Update auto-generated bindings
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 #ifndef LDK_C_BINDINGS_H
2 #define LDK_C_BINDINGS_H
3
4 /* Generated with cbindgen:0.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 a scalar value between zero and the secp256k1 curve order, in big endian.
472  */
473 typedef struct LDKBigEndianScalar {
474    /**
475     * The bytes of the scalar value.
476     */
477    uint8_t big_endian_bytes[32];
478 } LDKBigEndianScalar;
479
480 /**
481  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
482  * look up the corresponding function in rust-lightning's docs.
483  */
484 typedef struct LDKThirtyTwoBytes {
485    /**
486     * The thirty-two bytes
487     */
488    uint8_t data[32];
489 } LDKThirtyTwoBytes;
490
491 /**
492  * Represents an error returned from the bech32 library during validation of some bech32 data
493  */
494 typedef enum LDKBech32Error_Tag {
495    /**
496     * String does not contain the separator character
497     */
498    LDKBech32Error_MissingSeparator,
499    /**
500     * The checksum does not match the rest of the data
501     */
502    LDKBech32Error_InvalidChecksum,
503    /**
504     * The data or human-readable part is too long or too short
505     */
506    LDKBech32Error_InvalidLength,
507    /**
508     * Some part of the string contains an invalid character
509     */
510    LDKBech32Error_InvalidChar,
511    /**
512     * Some part of the data has an invalid value
513     */
514    LDKBech32Error_InvalidData,
515    /**
516     * The bit conversion failed due to a padding issue
517     */
518    LDKBech32Error_InvalidPadding,
519    /**
520     * The whole string must be of one case
521     */
522    LDKBech32Error_MixedCase,
523    /**
524     * Must be last for serialization purposes
525     */
526    LDKBech32Error_Sentinel,
527 } LDKBech32Error_Tag;
528
529 typedef struct LDKBech32Error {
530    LDKBech32Error_Tag tag;
531    union {
532       struct {
533          uint32_t invalid_char;
534       };
535       struct {
536          uint8_t invalid_data;
537       };
538    };
539 } LDKBech32Error;
540
541 /**
542  * A serialized transaction, in (pointer, length) form.
543  *
544  * This type optionally owns its own memory, and thus the semantics around access change based on
545  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
546  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
547  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
548  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
549  * you would be invalid.
550  *
551  * Note that, while it may change in the future, because transactions on the Rust side are stored
552  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
553  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
554  * `data_is_owned` either set or unset at your discretion.
555  */
556 typedef struct LDKTransaction {
557    /**
558     * The serialized transaction data.
559     *
560     * This is non-const for your convenience, an object passed to Rust is never written to.
561     */
562    uint8_t *data;
563    /**
564     * The length of the serialized transaction
565     */
566    uintptr_t datalen;
567    /**
568     * Whether the data pointed to by `data` should be freed or not.
569     */
570    bool data_is_owned;
571 } LDKTransaction;
572
573 /**
574  * A dynamically-allocated array of u8s of arbitrary size.
575  * This corresponds to std::vector in C++
576  */
577 typedef struct LDKCVec_u8Z {
578    /**
579     * The elements in the array.
580     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
581     */
582    uint8_t *data;
583    /**
584     * The number of elements pointed to by `data`.
585     */
586    uintptr_t datalen;
587 } LDKCVec_u8Z;
588
589 /**
590  * A transaction output including a scriptPubKey and value.
591  * This type *does* own its own memory, so must be free'd appropriately.
592  */
593 typedef struct LDKTxOut {
594    /**
595     * The script_pubkey in this output
596     */
597    struct LDKCVec_u8Z script_pubkey;
598    /**
599     * The value, in satoshis, of this output
600     */
601    uint64_t value;
602 } LDKTxOut;
603
604 /**
605  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
606  */
607 typedef struct LDKPublicKey {
608    /**
609     * The bytes of the public key
610     */
611    uint8_t compressed_form[33];
612 } LDKPublicKey;
613
614 /**
615  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
616  * This corresponds to std::vector in C++
617  */
618 typedef struct LDKCVec_PublicKeyZ {
619    /**
620     * The elements in the array.
621     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
622     */
623    struct LDKPublicKey *data;
624    /**
625     * The number of elements pointed to by `data`.
626     */
627    uintptr_t datalen;
628 } LDKCVec_PublicKeyZ;
629
630
631
632 /**
633  * Onion messages can be sent and received to blinded routes, which serve to hide the identity of
634  * the recipient.
635  */
636 typedef struct MUST_USE_STRUCT LDKBlindedRoute {
637    /**
638     * A pointer to the opaque Rust object.
639     * Nearly everywhere, inner must be non-null, however in places where
640     * the Rust equivalent takes an Option, it may be set to null to indicate None.
641     */
642    LDKnativeBlindedRoute *inner;
643    /**
644     * Indicates that this is the only struct which contains the same pointer.
645     * Rust functions which take ownership of an object provided via an argument require
646     * this to be true and invalidate the object pointed to by inner.
647     */
648    bool is_owned;
649 } LDKBlindedRoute;
650
651 /**
652  * The contents of CResult_BlindedRouteNoneZ
653  */
654 typedef union LDKCResult_BlindedRouteNoneZPtr {
655    /**
656     * A pointer to the contents in the success state.
657     * Reading from this pointer when `result_ok` is not set is undefined.
658     */
659    struct LDKBlindedRoute *result;
660    /**
661     * Note that this value is always NULL, as there are no contents in the Err variant
662     */
663    void *err;
664 } LDKCResult_BlindedRouteNoneZPtr;
665
666 /**
667  * A CResult_BlindedRouteNoneZ represents the result of a fallible operation,
668  * containing a crate::lightning::onion_message::blinded_route::BlindedRoute on success and a () on failure.
669  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
670  */
671 typedef struct LDKCResult_BlindedRouteNoneZ {
672    /**
673     * The contents of this CResult_BlindedRouteNoneZ, accessible via either
674     * `err` or `result` depending on the state of `result_ok`.
675     */
676    union LDKCResult_BlindedRouteNoneZPtr contents;
677    /**
678     * Whether this CResult_BlindedRouteNoneZ represents a success state.
679     */
680    bool result_ok;
681 } LDKCResult_BlindedRouteNoneZ;
682
683
684
685 /**
686  * An error in decoding a message or struct.
687  */
688 typedef struct MUST_USE_STRUCT LDKDecodeError {
689    /**
690     * A pointer to the opaque Rust object.
691     * Nearly everywhere, inner must be non-null, however in places where
692     * the Rust equivalent takes an Option, it may be set to null to indicate None.
693     */
694    LDKnativeDecodeError *inner;
695    /**
696     * Indicates that this is the only struct which contains the same pointer.
697     * Rust functions which take ownership of an object provided via an argument require
698     * this to be true and invalidate the object pointed to by inner.
699     */
700    bool is_owned;
701 } LDKDecodeError;
702
703 /**
704  * The contents of CResult_BlindedRouteDecodeErrorZ
705  */
706 typedef union LDKCResult_BlindedRouteDecodeErrorZPtr {
707    /**
708     * A pointer to the contents in the success state.
709     * Reading from this pointer when `result_ok` is not set is undefined.
710     */
711    struct LDKBlindedRoute *result;
712    /**
713     * A pointer to the contents in the error state.
714     * Reading from this pointer when `result_ok` is set is undefined.
715     */
716    struct LDKDecodeError *err;
717 } LDKCResult_BlindedRouteDecodeErrorZPtr;
718
719 /**
720  * A CResult_BlindedRouteDecodeErrorZ represents the result of a fallible operation,
721  * containing a crate::lightning::onion_message::blinded_route::BlindedRoute on success and a crate::lightning::ln::msgs::DecodeError on failure.
722  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
723  */
724 typedef struct LDKCResult_BlindedRouteDecodeErrorZ {
725    /**
726     * The contents of this CResult_BlindedRouteDecodeErrorZ, accessible via either
727     * `err` or `result` depending on the state of `result_ok`.
728     */
729    union LDKCResult_BlindedRouteDecodeErrorZPtr contents;
730    /**
731     * Whether this CResult_BlindedRouteDecodeErrorZ represents a success state.
732     */
733    bool result_ok;
734 } LDKCResult_BlindedRouteDecodeErrorZ;
735
736
737
738 /**
739  * Used to construct the blinded hops portion of a blinded route. These hops cannot be identified
740  * by outside observers and thus can be used to hide the identity of the recipient.
741  */
742 typedef struct MUST_USE_STRUCT LDKBlindedHop {
743    /**
744     * A pointer to the opaque Rust object.
745     * Nearly everywhere, inner must be non-null, however in places where
746     * the Rust equivalent takes an Option, it may be set to null to indicate None.
747     */
748    LDKnativeBlindedHop *inner;
749    /**
750     * Indicates that this is the only struct which contains the same pointer.
751     * Rust functions which take ownership of an object provided via an argument require
752     * this to be true and invalidate the object pointed to by inner.
753     */
754    bool is_owned;
755 } LDKBlindedHop;
756
757 /**
758  * The contents of CResult_BlindedHopDecodeErrorZ
759  */
760 typedef union LDKCResult_BlindedHopDecodeErrorZPtr {
761    /**
762     * A pointer to the contents in the success state.
763     * Reading from this pointer when `result_ok` is not set is undefined.
764     */
765    struct LDKBlindedHop *result;
766    /**
767     * A pointer to the contents in the error state.
768     * Reading from this pointer when `result_ok` is set is undefined.
769     */
770    struct LDKDecodeError *err;
771 } LDKCResult_BlindedHopDecodeErrorZPtr;
772
773 /**
774  * A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
775  * containing a crate::lightning::onion_message::blinded_route::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
776  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
777  */
778 typedef struct LDKCResult_BlindedHopDecodeErrorZ {
779    /**
780     * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
781     * `err` or `result` depending on the state of `result_ok`.
782     */
783    union LDKCResult_BlindedHopDecodeErrorZPtr contents;
784    /**
785     * Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
786     */
787    bool result_ok;
788 } LDKCResult_BlindedHopDecodeErrorZ;
789
790 /**
791  * The contents of CResult_NoneNoneZ
792  */
793 typedef union LDKCResult_NoneNoneZPtr {
794    /**
795     * Note that this value is always NULL, as there are no contents in the OK variant
796     */
797    void *result;
798    /**
799     * Note that this value is always NULL, as there are no contents in the Err variant
800     */
801    void *err;
802 } LDKCResult_NoneNoneZPtr;
803
804 /**
805  * A CResult_NoneNoneZ represents the result of a fallible operation,
806  * containing a () on success and a () on failure.
807  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
808  */
809 typedef struct LDKCResult_NoneNoneZ {
810    /**
811     * The contents of this CResult_NoneNoneZ, accessible via either
812     * `err` or `result` depending on the state of `result_ok`.
813     */
814    union LDKCResult_NoneNoneZPtr contents;
815    /**
816     * Whether this CResult_NoneNoneZ represents a success state.
817     */
818    bool result_ok;
819 } LDKCResult_NoneNoneZ;
820
821
822
823 /**
824  * Implements the per-commitment secret storage scheme from
825  * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
826  *
827  * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
828  * or so.
829  */
830 typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets {
831    /**
832     * A pointer to the opaque Rust object.
833     * Nearly everywhere, inner must be non-null, however in places where
834     * the Rust equivalent takes an Option, it may be set to null to indicate None.
835     */
836    LDKnativeCounterpartyCommitmentSecrets *inner;
837    /**
838     * Indicates that this is the only struct which contains the same pointer.
839     * Rust functions which take ownership of an object provided via an argument require
840     * this to be true and invalidate the object pointed to by inner.
841     */
842    bool is_owned;
843 } LDKCounterpartyCommitmentSecrets;
844
845 /**
846  * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
847  */
848 typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
849    /**
850     * A pointer to the contents in the success state.
851     * Reading from this pointer when `result_ok` is not set is undefined.
852     */
853    struct LDKCounterpartyCommitmentSecrets *result;
854    /**
855     * A pointer to the contents in the error state.
856     * Reading from this pointer when `result_ok` is set is undefined.
857     */
858    struct LDKDecodeError *err;
859 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr;
860
861 /**
862  * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
863  * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
864  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
865  */
866 typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ {
867    /**
868     * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
869     * `err` or `result` depending on the state of `result_ok`.
870     */
871    union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents;
872    /**
873     * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
874     */
875    bool result_ok;
876 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ;
877
878 /**
879  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
880  */
881 typedef struct LDKSecretKey {
882    /**
883     * The bytes of the secret key
884     */
885    uint8_t bytes[32];
886 } LDKSecretKey;
887
888 /**
889  * The contents of CResult_SecretKeyErrorZ
890  */
891 typedef union LDKCResult_SecretKeyErrorZPtr {
892    /**
893     * A pointer to the contents in the success state.
894     * Reading from this pointer when `result_ok` is not set is undefined.
895     */
896    struct LDKSecretKey *result;
897    /**
898     * A pointer to the contents in the error state.
899     * Reading from this pointer when `result_ok` is set is undefined.
900     */
901    enum LDKSecp256k1Error *err;
902 } LDKCResult_SecretKeyErrorZPtr;
903
904 /**
905  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
906  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
907  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
908  */
909 typedef struct LDKCResult_SecretKeyErrorZ {
910    /**
911     * The contents of this CResult_SecretKeyErrorZ, accessible via either
912     * `err` or `result` depending on the state of `result_ok`.
913     */
914    union LDKCResult_SecretKeyErrorZPtr contents;
915    /**
916     * Whether this CResult_SecretKeyErrorZ represents a success state.
917     */
918    bool result_ok;
919 } LDKCResult_SecretKeyErrorZ;
920
921 /**
922  * The contents of CResult_PublicKeyErrorZ
923  */
924 typedef union LDKCResult_PublicKeyErrorZPtr {
925    /**
926     * A pointer to the contents in the success state.
927     * Reading from this pointer when `result_ok` is not set is undefined.
928     */
929    struct LDKPublicKey *result;
930    /**
931     * A pointer to the contents in the error state.
932     * Reading from this pointer when `result_ok` is set is undefined.
933     */
934    enum LDKSecp256k1Error *err;
935 } LDKCResult_PublicKeyErrorZPtr;
936
937 /**
938  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
939  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
940  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
941  */
942 typedef struct LDKCResult_PublicKeyErrorZ {
943    /**
944     * The contents of this CResult_PublicKeyErrorZ, accessible via either
945     * `err` or `result` depending on the state of `result_ok`.
946     */
947    union LDKCResult_PublicKeyErrorZPtr contents;
948    /**
949     * Whether this CResult_PublicKeyErrorZ represents a success state.
950     */
951    bool result_ok;
952 } LDKCResult_PublicKeyErrorZ;
953
954
955
956 /**
957  * The set of public keys which are used in the creation of one commitment transaction.
958  * These are derived from the channel base keys and per-commitment data.
959  *
960  * A broadcaster key is provided from potential broadcaster of the computed transaction.
961  * A countersignatory key is coming from a protocol participant unable to broadcast the
962  * transaction.
963  *
964  * These keys are assumed to be good, either because the code derived them from
965  * channel basepoints via the new function, or they were obtained via
966  * CommitmentTransaction.trust().keys() because we trusted the source of the
967  * pre-calculated keys.
968  */
969 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
970    /**
971     * A pointer to the opaque Rust object.
972     * Nearly everywhere, inner must be non-null, however in places where
973     * the Rust equivalent takes an Option, it may be set to null to indicate None.
974     */
975    LDKnativeTxCreationKeys *inner;
976    /**
977     * Indicates that this is the only struct which contains the same pointer.
978     * Rust functions which take ownership of an object provided via an argument require
979     * this to be true and invalidate the object pointed to by inner.
980     */
981    bool is_owned;
982 } LDKTxCreationKeys;
983
984 /**
985  * The contents of CResult_TxCreationKeysDecodeErrorZ
986  */
987 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
988    /**
989     * A pointer to the contents in the success state.
990     * Reading from this pointer when `result_ok` is not set is undefined.
991     */
992    struct LDKTxCreationKeys *result;
993    /**
994     * A pointer to the contents in the error state.
995     * Reading from this pointer when `result_ok` is set is undefined.
996     */
997    struct LDKDecodeError *err;
998 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
999
1000 /**
1001  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
1002  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
1003  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1004  */
1005 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
1006    /**
1007     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
1008     * `err` or `result` depending on the state of `result_ok`.
1009     */
1010    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
1011    /**
1012     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
1013     */
1014    bool result_ok;
1015 } LDKCResult_TxCreationKeysDecodeErrorZ;
1016
1017
1018
1019 /**
1020  * One counterparty's public keys which do not change over the life of a channel.
1021  */
1022 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
1023    /**
1024     * A pointer to the opaque Rust object.
1025     * Nearly everywhere, inner must be non-null, however in places where
1026     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1027     */
1028    LDKnativeChannelPublicKeys *inner;
1029    /**
1030     * Indicates that this is the only struct which contains the same pointer.
1031     * Rust functions which take ownership of an object provided via an argument require
1032     * this to be true and invalidate the object pointed to by inner.
1033     */
1034    bool is_owned;
1035 } LDKChannelPublicKeys;
1036
1037 /**
1038  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
1039  */
1040 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
1041    /**
1042     * A pointer to the contents in the success state.
1043     * Reading from this pointer when `result_ok` is not set is undefined.
1044     */
1045    struct LDKChannelPublicKeys *result;
1046    /**
1047     * A pointer to the contents in the error state.
1048     * Reading from this pointer when `result_ok` is set is undefined.
1049     */
1050    struct LDKDecodeError *err;
1051 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
1052
1053 /**
1054  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
1055  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
1056  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1057  */
1058 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
1059    /**
1060     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
1061     * `err` or `result` depending on the state of `result_ok`.
1062     */
1063    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
1064    /**
1065     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
1066     */
1067    bool result_ok;
1068 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
1069
1070 /**
1071  * The contents of CResult_TxCreationKeysErrorZ
1072  */
1073 typedef union LDKCResult_TxCreationKeysErrorZPtr {
1074    /**
1075     * A pointer to the contents in the success state.
1076     * Reading from this pointer when `result_ok` is not set is undefined.
1077     */
1078    struct LDKTxCreationKeys *result;
1079    /**
1080     * A pointer to the contents in the error state.
1081     * Reading from this pointer when `result_ok` is set is undefined.
1082     */
1083    enum LDKSecp256k1Error *err;
1084 } LDKCResult_TxCreationKeysErrorZPtr;
1085
1086 /**
1087  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
1088  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
1089  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1090  */
1091 typedef struct LDKCResult_TxCreationKeysErrorZ {
1092    /**
1093     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
1094     * `err` or `result` depending on the state of `result_ok`.
1095     */
1096    union LDKCResult_TxCreationKeysErrorZPtr contents;
1097    /**
1098     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
1099     */
1100    bool result_ok;
1101 } LDKCResult_TxCreationKeysErrorZ;
1102
1103 /**
1104  * An enum which can either contain a u32 or not
1105  */
1106 typedef enum LDKCOption_u32Z_Tag {
1107    /**
1108     * When we're in this state, this COption_u32Z contains a u32
1109     */
1110    LDKCOption_u32Z_Some,
1111    /**
1112     * When we're in this state, this COption_u32Z contains nothing
1113     */
1114    LDKCOption_u32Z_None,
1115    /**
1116     * Must be last for serialization purposes
1117     */
1118    LDKCOption_u32Z_Sentinel,
1119 } LDKCOption_u32Z_Tag;
1120
1121 typedef struct LDKCOption_u32Z {
1122    LDKCOption_u32Z_Tag tag;
1123    union {
1124       struct {
1125          uint32_t some;
1126       };
1127    };
1128 } LDKCOption_u32Z;
1129
1130
1131
1132 /**
1133  * Information about an HTLC as it appears in a commitment transaction
1134  */
1135 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
1136    /**
1137     * A pointer to the opaque Rust object.
1138     * Nearly everywhere, inner must be non-null, however in places where
1139     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1140     */
1141    LDKnativeHTLCOutputInCommitment *inner;
1142    /**
1143     * Indicates that this is the only struct which contains the same pointer.
1144     * Rust functions which take ownership of an object provided via an argument require
1145     * this to be true and invalidate the object pointed to by inner.
1146     */
1147    bool is_owned;
1148 } LDKHTLCOutputInCommitment;
1149
1150 /**
1151  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
1152  */
1153 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1154    /**
1155     * A pointer to the contents in the success state.
1156     * Reading from this pointer when `result_ok` is not set is undefined.
1157     */
1158    struct LDKHTLCOutputInCommitment *result;
1159    /**
1160     * A pointer to the contents in the error state.
1161     * Reading from this pointer when `result_ok` is set is undefined.
1162     */
1163    struct LDKDecodeError *err;
1164 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
1165
1166 /**
1167  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
1168  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
1169  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1170  */
1171 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
1172    /**
1173     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
1174     * `err` or `result` depending on the state of `result_ok`.
1175     */
1176    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
1177    /**
1178     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
1179     */
1180    bool result_ok;
1181 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
1182
1183
1184
1185 /**
1186  * Late-bound per-channel counterparty data used to build transactions.
1187  */
1188 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
1189    /**
1190     * A pointer to the opaque Rust object.
1191     * Nearly everywhere, inner must be non-null, however in places where
1192     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1193     */
1194    LDKnativeCounterpartyChannelTransactionParameters *inner;
1195    /**
1196     * Indicates that this is the only struct which contains the same pointer.
1197     * Rust functions which take ownership of an object provided via an argument require
1198     * this to be true and invalidate the object pointed to by inner.
1199     */
1200    bool is_owned;
1201 } LDKCounterpartyChannelTransactionParameters;
1202
1203 /**
1204  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
1205  */
1206 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1207    /**
1208     * A pointer to the contents in the success state.
1209     * Reading from this pointer when `result_ok` is not set is undefined.
1210     */
1211    struct LDKCounterpartyChannelTransactionParameters *result;
1212    /**
1213     * A pointer to the contents in the error state.
1214     * Reading from this pointer when `result_ok` is set is undefined.
1215     */
1216    struct LDKDecodeError *err;
1217 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
1218
1219 /**
1220  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1221  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1222  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1223  */
1224 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1225    /**
1226     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
1227     * `err` or `result` depending on the state of `result_ok`.
1228     */
1229    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
1230    /**
1231     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
1232     */
1233    bool result_ok;
1234 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
1235
1236
1237
1238 /**
1239  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
1240  * The fields are organized by holder/counterparty.
1241  *
1242  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
1243  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
1244  */
1245 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
1246    /**
1247     * A pointer to the opaque Rust object.
1248     * Nearly everywhere, inner must be non-null, however in places where
1249     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1250     */
1251    LDKnativeChannelTransactionParameters *inner;
1252    /**
1253     * Indicates that this is the only struct which contains the same pointer.
1254     * Rust functions which take ownership of an object provided via an argument require
1255     * this to be true and invalidate the object pointed to by inner.
1256     */
1257    bool is_owned;
1258 } LDKChannelTransactionParameters;
1259
1260 /**
1261  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1262  */
1263 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
1264    /**
1265     * A pointer to the contents in the success state.
1266     * Reading from this pointer when `result_ok` is not set is undefined.
1267     */
1268    struct LDKChannelTransactionParameters *result;
1269    /**
1270     * A pointer to the contents in the error state.
1271     * Reading from this pointer when `result_ok` is set is undefined.
1272     */
1273    struct LDKDecodeError *err;
1274 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
1275
1276 /**
1277  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1278  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1279  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1280  */
1281 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
1282    /**
1283     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1284     * `err` or `result` depending on the state of `result_ok`.
1285     */
1286    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
1287    /**
1288     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1289     */
1290    bool result_ok;
1291 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
1292
1293 /**
1294  * Represents a secp256k1 signature serialized as two 32-byte numbers
1295  */
1296 typedef struct LDKSignature {
1297    /**
1298     * The bytes of the signature in "compact" form
1299     */
1300    uint8_t compact_form[64];
1301 } LDKSignature;
1302
1303 /**
1304  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1305  * This corresponds to std::vector in C++
1306  */
1307 typedef struct LDKCVec_SignatureZ {
1308    /**
1309     * The elements in the array.
1310     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1311     */
1312    struct LDKSignature *data;
1313    /**
1314     * The number of elements pointed to by `data`.
1315     */
1316    uintptr_t datalen;
1317 } LDKCVec_SignatureZ;
1318
1319
1320
1321 /**
1322  * Information needed to build and sign a holder's commitment transaction.
1323  *
1324  * The transaction is only signed once we are ready to broadcast.
1325  */
1326 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1327    /**
1328     * A pointer to the opaque Rust object.
1329     * Nearly everywhere, inner must be non-null, however in places where
1330     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1331     */
1332    LDKnativeHolderCommitmentTransaction *inner;
1333    /**
1334     * Indicates that this is the only struct which contains the same pointer.
1335     * Rust functions which take ownership of an object provided via an argument require
1336     * this to be true and invalidate the object pointed to by inner.
1337     */
1338    bool is_owned;
1339 } LDKHolderCommitmentTransaction;
1340
1341 /**
1342  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1343  */
1344 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
1345    /**
1346     * A pointer to the contents in the success state.
1347     * Reading from this pointer when `result_ok` is not set is undefined.
1348     */
1349    struct LDKHolderCommitmentTransaction *result;
1350    /**
1351     * A pointer to the contents in the error state.
1352     * Reading from this pointer when `result_ok` is set is undefined.
1353     */
1354    struct LDKDecodeError *err;
1355 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
1356
1357 /**
1358  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1359  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1360  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1361  */
1362 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
1363    /**
1364     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1365     * `err` or `result` depending on the state of `result_ok`.
1366     */
1367    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
1368    /**
1369     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1370     */
1371    bool result_ok;
1372 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
1373
1374
1375
1376 /**
1377  * A pre-built Bitcoin commitment transaction and its txid.
1378  */
1379 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1380    /**
1381     * A pointer to the opaque Rust object.
1382     * Nearly everywhere, inner must be non-null, however in places where
1383     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1384     */
1385    LDKnativeBuiltCommitmentTransaction *inner;
1386    /**
1387     * Indicates that this is the only struct which contains the same pointer.
1388     * Rust functions which take ownership of an object provided via an argument require
1389     * this to be true and invalidate the object pointed to by inner.
1390     */
1391    bool is_owned;
1392 } LDKBuiltCommitmentTransaction;
1393
1394 /**
1395  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1396  */
1397 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1398    /**
1399     * A pointer to the contents in the success state.
1400     * Reading from this pointer when `result_ok` is not set is undefined.
1401     */
1402    struct LDKBuiltCommitmentTransaction *result;
1403    /**
1404     * A pointer to the contents in the error state.
1405     * Reading from this pointer when `result_ok` is set is undefined.
1406     */
1407    struct LDKDecodeError *err;
1408 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1409
1410 /**
1411  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1412  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1413  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1414  */
1415 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1416    /**
1417     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1418     * `err` or `result` depending on the state of `result_ok`.
1419     */
1420    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1421    /**
1422     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1423     */
1424    bool result_ok;
1425 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1426
1427
1428
1429 /**
1430  * A wrapper on ClosingTransaction indicating that the built bitcoin
1431  * transaction is trusted.
1432  *
1433  * See trust() and verify() functions on CommitmentTransaction.
1434  *
1435  * This structure implements Deref.
1436  */
1437 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
1438    /**
1439     * A pointer to the opaque Rust object.
1440     * Nearly everywhere, inner must be non-null, however in places where
1441     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1442     */
1443    LDKnativeTrustedClosingTransaction *inner;
1444    /**
1445     * Indicates that this is the only struct which contains the same pointer.
1446     * Rust functions which take ownership of an object provided via an argument require
1447     * this to be true and invalidate the object pointed to by inner.
1448     */
1449    bool is_owned;
1450 } LDKTrustedClosingTransaction;
1451
1452 /**
1453  * The contents of CResult_TrustedClosingTransactionNoneZ
1454  */
1455 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
1456    /**
1457     * A pointer to the contents in the success state.
1458     * Reading from this pointer when `result_ok` is not set is undefined.
1459     */
1460    struct LDKTrustedClosingTransaction *result;
1461    /**
1462     * Note that this value is always NULL, as there are no contents in the Err variant
1463     */
1464    void *err;
1465 } LDKCResult_TrustedClosingTransactionNoneZPtr;
1466
1467 /**
1468  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1469  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1470  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1471  */
1472 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
1473    /**
1474     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1475     * `err` or `result` depending on the state of `result_ok`.
1476     */
1477    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
1478    /**
1479     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1480     */
1481    bool result_ok;
1482 } LDKCResult_TrustedClosingTransactionNoneZ;
1483
1484
1485
1486 /**
1487  * This class tracks the per-transaction information needed to build a commitment transaction and will
1488  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1489  * and for transactions we sign for the counterparty.
1490  *
1491  * This class can be used inside a signer implementation to generate a signature given the relevant
1492  * secret key.
1493  */
1494 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1495    /**
1496     * A pointer to the opaque Rust object.
1497     * Nearly everywhere, inner must be non-null, however in places where
1498     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1499     */
1500    LDKnativeCommitmentTransaction *inner;
1501    /**
1502     * Indicates that this is the only struct which contains the same pointer.
1503     * Rust functions which take ownership of an object provided via an argument require
1504     * this to be true and invalidate the object pointed to by inner.
1505     */
1506    bool is_owned;
1507 } LDKCommitmentTransaction;
1508
1509 /**
1510  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1511  */
1512 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1513    /**
1514     * A pointer to the contents in the success state.
1515     * Reading from this pointer when `result_ok` is not set is undefined.
1516     */
1517    struct LDKCommitmentTransaction *result;
1518    /**
1519     * A pointer to the contents in the error state.
1520     * Reading from this pointer when `result_ok` is set is undefined.
1521     */
1522    struct LDKDecodeError *err;
1523 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1524
1525 /**
1526  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1527  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1528  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1529  */
1530 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1531    /**
1532     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1533     * `err` or `result` depending on the state of `result_ok`.
1534     */
1535    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1536    /**
1537     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1538     */
1539    bool result_ok;
1540 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1541
1542
1543
1544 /**
1545  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1546  * transaction and the transaction creation keys) are trusted.
1547  *
1548  * See trust() and verify() functions on CommitmentTransaction.
1549  *
1550  * This structure implements Deref.
1551  */
1552 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1553    /**
1554     * A pointer to the opaque Rust object.
1555     * Nearly everywhere, inner must be non-null, however in places where
1556     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1557     */
1558    LDKnativeTrustedCommitmentTransaction *inner;
1559    /**
1560     * Indicates that this is the only struct which contains the same pointer.
1561     * Rust functions which take ownership of an object provided via an argument require
1562     * this to be true and invalidate the object pointed to by inner.
1563     */
1564    bool is_owned;
1565 } LDKTrustedCommitmentTransaction;
1566
1567 /**
1568  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1569  */
1570 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1571    /**
1572     * A pointer to the contents in the success state.
1573     * Reading from this pointer when `result_ok` is not set is undefined.
1574     */
1575    struct LDKTrustedCommitmentTransaction *result;
1576    /**
1577     * Note that this value is always NULL, as there are no contents in the Err variant
1578     */
1579    void *err;
1580 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1581
1582 /**
1583  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1584  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1585  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1586  */
1587 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1588    /**
1589     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1590     * `err` or `result` depending on the state of `result_ok`.
1591     */
1592    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1593    /**
1594     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1595     */
1596    bool result_ok;
1597 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1598
1599 /**
1600  * The contents of CResult_CVec_SignatureZNoneZ
1601  */
1602 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1603    /**
1604     * A pointer to the contents in the success state.
1605     * Reading from this pointer when `result_ok` is not set is undefined.
1606     */
1607    struct LDKCVec_SignatureZ *result;
1608    /**
1609     * Note that this value is always NULL, as there are no contents in the Err variant
1610     */
1611    void *err;
1612 } LDKCResult_CVec_SignatureZNoneZPtr;
1613
1614 /**
1615  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1616  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1617  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1618  */
1619 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1620    /**
1621     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1622     * `err` or `result` depending on the state of `result_ok`.
1623     */
1624    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1625    /**
1626     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1627     */
1628    bool result_ok;
1629 } LDKCResult_CVec_SignatureZNoneZ;
1630
1631
1632
1633 /**
1634  * A script pubkey for shutting down a channel as defined by [BOLT #2].
1635  *
1636  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
1637  */
1638 typedef struct MUST_USE_STRUCT LDKShutdownScript {
1639    /**
1640     * A pointer to the opaque Rust object.
1641     * Nearly everywhere, inner must be non-null, however in places where
1642     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1643     */
1644    LDKnativeShutdownScript *inner;
1645    /**
1646     * Indicates that this is the only struct which contains the same pointer.
1647     * Rust functions which take ownership of an object provided via an argument require
1648     * this to be true and invalidate the object pointed to by inner.
1649     */
1650    bool is_owned;
1651 } LDKShutdownScript;
1652
1653 /**
1654  * The contents of CResult_ShutdownScriptDecodeErrorZ
1655  */
1656 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
1657    /**
1658     * A pointer to the contents in the success state.
1659     * Reading from this pointer when `result_ok` is not set is undefined.
1660     */
1661    struct LDKShutdownScript *result;
1662    /**
1663     * A pointer to the contents in the error state.
1664     * Reading from this pointer when `result_ok` is set is undefined.
1665     */
1666    struct LDKDecodeError *err;
1667 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
1668
1669 /**
1670  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1671  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1672  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1673  */
1674 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
1675    /**
1676     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1677     * `err` or `result` depending on the state of `result_ok`.
1678     */
1679    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
1680    /**
1681     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1682     */
1683    bool result_ok;
1684 } LDKCResult_ShutdownScriptDecodeErrorZ;
1685
1686
1687
1688 /**
1689  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
1690  */
1691 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
1692    /**
1693     * A pointer to the opaque Rust object.
1694     * Nearly everywhere, inner must be non-null, however in places where
1695     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1696     */
1697    LDKnativeInvalidShutdownScript *inner;
1698    /**
1699     * Indicates that this is the only struct which contains the same pointer.
1700     * Rust functions which take ownership of an object provided via an argument require
1701     * this to be true and invalidate the object pointed to by inner.
1702     */
1703    bool is_owned;
1704 } LDKInvalidShutdownScript;
1705
1706 /**
1707  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1708  */
1709 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
1710    /**
1711     * A pointer to the contents in the success state.
1712     * Reading from this pointer when `result_ok` is not set is undefined.
1713     */
1714    struct LDKShutdownScript *result;
1715    /**
1716     * A pointer to the contents in the error state.
1717     * Reading from this pointer when `result_ok` is set is undefined.
1718     */
1719    struct LDKInvalidShutdownScript *err;
1720 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
1721
1722 /**
1723  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1724  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1725  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1726  */
1727 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
1728    /**
1729     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1730     * `err` or `result` depending on the state of `result_ok`.
1731     */
1732    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
1733    /**
1734     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1735     */
1736    bool result_ok;
1737 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
1738
1739
1740
1741 /**
1742  * Represents the compressed public key of a node
1743  */
1744 typedef struct MUST_USE_STRUCT LDKNodeId {
1745    /**
1746     * A pointer to the opaque Rust object.
1747     * Nearly everywhere, inner must be non-null, however in places where
1748     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1749     */
1750    LDKnativeNodeId *inner;
1751    /**
1752     * Indicates that this is the only struct which contains the same pointer.
1753     * Rust functions which take ownership of an object provided via an argument require
1754     * this to be true and invalidate the object pointed to by inner.
1755     */
1756    bool is_owned;
1757 } LDKNodeId;
1758
1759
1760
1761 /**
1762  * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`].
1763  */
1764 typedef struct MUST_USE_STRUCT LDKChannelUsage {
1765    /**
1766     * A pointer to the opaque Rust object.
1767     * Nearly everywhere, inner must be non-null, however in places where
1768     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1769     */
1770    LDKnativeChannelUsage *inner;
1771    /**
1772     * Indicates that this is the only struct which contains the same pointer.
1773     * Rust functions which take ownership of an object provided via an argument require
1774     * this to be true and invalidate the object pointed to by inner.
1775     */
1776    bool is_owned;
1777 } LDKChannelUsage;
1778
1779
1780
1781 /**
1782  * A hop in a route
1783  */
1784 typedef struct MUST_USE_STRUCT LDKRouteHop {
1785    /**
1786     * A pointer to the opaque Rust object.
1787     * Nearly everywhere, inner must be non-null, however in places where
1788     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1789     */
1790    LDKnativeRouteHop *inner;
1791    /**
1792     * Indicates that this is the only struct which contains the same pointer.
1793     * Rust functions which take ownership of an object provided via an argument require
1794     * this to be true and invalidate the object pointed to by inner.
1795     */
1796    bool is_owned;
1797 } LDKRouteHop;
1798
1799 /**
1800  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1801  * This corresponds to std::vector in C++
1802  */
1803 typedef struct LDKCVec_RouteHopZ {
1804    /**
1805     * The elements in the array.
1806     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1807     */
1808    struct LDKRouteHop *data;
1809    /**
1810     * The number of elements pointed to by `data`.
1811     */
1812    uintptr_t datalen;
1813 } LDKCVec_RouteHopZ;
1814
1815 /**
1816  * An interface used to score payment channels for path finding.
1817  *
1818  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
1819  */
1820 typedef struct LDKScore {
1821    /**
1822     * An opaque pointer which is passed to your function implementations as an argument.
1823     * This has no meaning in the LDK, and can be NULL or any other value.
1824     */
1825    void *this_arg;
1826    /**
1827     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
1828     * given channel in the direction from `source` to `target`.
1829     *
1830     * The channel's capacity (less any other MPP parts that are also being considered for use in
1831     * the same payment) is given by `capacity_msat`. It may be determined from various sources
1832     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
1833     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
1834     * Thus, implementations should be overflow-safe.
1835     */
1836    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);
1837    /**
1838     * Handles updating channel penalties after failing to route through a channel.
1839     */
1840    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
1841    /**
1842     * Handles updating channel penalties after successfully routing along a path.
1843     */
1844    void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
1845    /**
1846     * Handles updating channel penalties after a probe over the given path failed.
1847     */
1848    void (*probe_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
1849    /**
1850     * Handles updating channel penalties after a probe over the given path succeeded.
1851     */
1852    void (*probe_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
1853    /**
1854     * Serialize the object into a byte array
1855     */
1856    struct LDKCVec_u8Z (*write)(const void *this_arg);
1857    /**
1858     * Frees any resources associated with this object given its this_arg pointer.
1859     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
1860     */
1861    void (*free)(void *this_arg);
1862 } LDKScore;
1863
1864 /**
1865  * A scorer that is accessed under a lock.
1866  *
1867  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
1868  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
1869  * implementations. Internal locking would be detrimental to route finding performance and could
1870  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
1871  *
1872  * [`find_route`]: crate::routing::router::find_route
1873  */
1874 typedef struct LDKLockableScore {
1875    /**
1876     * An opaque pointer which is passed to your function implementations as an argument.
1877     * This has no meaning in the LDK, and can be NULL or any other value.
1878     */
1879    void *this_arg;
1880    /**
1881     * Returns the locked scorer.
1882     */
1883    struct LDKScore (*lock)(const void *this_arg);
1884    /**
1885     * Frees any resources associated with this object given its this_arg pointer.
1886     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
1887     */
1888    void (*free)(void *this_arg);
1889 } LDKLockableScore;
1890
1891 /**
1892  * Refers to a scorer that is accessible under lock and also writeable to disk
1893  *
1894  * We need this trait to be able to pass in a scorer to `lightning-background-processor` that will enable us to
1895  * use the Persister to persist it.
1896  */
1897 typedef struct LDKWriteableScore {
1898    /**
1899     * An opaque pointer which is passed to your function implementations as an argument.
1900     * This has no meaning in the LDK, and can be NULL or any other value.
1901     */
1902    void *this_arg;
1903    /**
1904     * Implementation of LockableScore for this object.
1905     */
1906    struct LDKLockableScore LockableScore;
1907    /**
1908     * Serialize the object into a byte array
1909     */
1910    struct LDKCVec_u8Z (*write)(const void *this_arg);
1911    /**
1912     * Frees any resources associated with this object given its this_arg pointer.
1913     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
1914     */
1915    void (*free)(void *this_arg);
1916 } LDKWriteableScore;
1917
1918 /**
1919  * An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
1920  */
1921 typedef enum LDKCOption_WriteableScoreZ_Tag {
1922    /**
1923     * When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
1924     */
1925    LDKCOption_WriteableScoreZ_Some,
1926    /**
1927     * When we're in this state, this COption_WriteableScoreZ contains nothing
1928     */
1929    LDKCOption_WriteableScoreZ_None,
1930    /**
1931     * Must be last for serialization purposes
1932     */
1933    LDKCOption_WriteableScoreZ_Sentinel,
1934 } LDKCOption_WriteableScoreZ_Tag;
1935
1936 typedef struct LDKCOption_WriteableScoreZ {
1937    LDKCOption_WriteableScoreZ_Tag tag;
1938    union {
1939       struct {
1940          struct LDKWriteableScore some;
1941       };
1942    };
1943 } LDKCOption_WriteableScoreZ;
1944
1945 /**
1946  * The contents of CResult_NoneErrorZ
1947  */
1948 typedef union LDKCResult_NoneErrorZPtr {
1949    /**
1950     * Note that this value is always NULL, as there are no contents in the OK variant
1951     */
1952    void *result;
1953    /**
1954     * A pointer to the contents in the error state.
1955     * Reading from this pointer when `result_ok` is set is undefined.
1956     */
1957    enum LDKIOError *err;
1958 } LDKCResult_NoneErrorZPtr;
1959
1960 /**
1961  * A CResult_NoneErrorZ represents the result of a fallible operation,
1962  * containing a () on success and a crate::c_types::IOError on failure.
1963  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1964  */
1965 typedef struct LDKCResult_NoneErrorZ {
1966    /**
1967     * The contents of this CResult_NoneErrorZ, accessible via either
1968     * `err` or `result` depending on the state of `result_ok`.
1969     */
1970    union LDKCResult_NoneErrorZPtr contents;
1971    /**
1972     * Whether this CResult_NoneErrorZ represents a success state.
1973     */
1974    bool result_ok;
1975 } LDKCResult_NoneErrorZ;
1976
1977 /**
1978  * The contents of CResult_RouteHopDecodeErrorZ
1979  */
1980 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1981    /**
1982     * A pointer to the contents in the success state.
1983     * Reading from this pointer when `result_ok` is not set is undefined.
1984     */
1985    struct LDKRouteHop *result;
1986    /**
1987     * A pointer to the contents in the error state.
1988     * Reading from this pointer when `result_ok` is set is undefined.
1989     */
1990    struct LDKDecodeError *err;
1991 } LDKCResult_RouteHopDecodeErrorZPtr;
1992
1993 /**
1994  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1995  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1996  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1997  */
1998 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1999    /**
2000     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
2001     * `err` or `result` depending on the state of `result_ok`.
2002     */
2003    union LDKCResult_RouteHopDecodeErrorZPtr contents;
2004    /**
2005     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
2006     */
2007    bool result_ok;
2008 } LDKCResult_RouteHopDecodeErrorZ;
2009
2010 /**
2011  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2012  * This corresponds to std::vector in C++
2013  */
2014 typedef struct LDKCVec_CVec_RouteHopZZ {
2015    /**
2016     * The elements in the array.
2017     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2018     */
2019    struct LDKCVec_RouteHopZ *data;
2020    /**
2021     * The number of elements pointed to by `data`.
2022     */
2023    uintptr_t datalen;
2024 } LDKCVec_CVec_RouteHopZZ;
2025
2026
2027
2028 /**
2029  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2030  * it can take multiple paths. Each path is composed of one or more hops through the network.
2031  */
2032 typedef struct MUST_USE_STRUCT LDKRoute {
2033    /**
2034     * A pointer to the opaque Rust object.
2035     * Nearly everywhere, inner must be non-null, however in places where
2036     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2037     */
2038    LDKnativeRoute *inner;
2039    /**
2040     * Indicates that this is the only struct which contains the same pointer.
2041     * Rust functions which take ownership of an object provided via an argument require
2042     * this to be true and invalidate the object pointed to by inner.
2043     */
2044    bool is_owned;
2045 } LDKRoute;
2046
2047 /**
2048  * The contents of CResult_RouteDecodeErrorZ
2049  */
2050 typedef union LDKCResult_RouteDecodeErrorZPtr {
2051    /**
2052     * A pointer to the contents in the success state.
2053     * Reading from this pointer when `result_ok` is not set is undefined.
2054     */
2055    struct LDKRoute *result;
2056    /**
2057     * A pointer to the contents in the error state.
2058     * Reading from this pointer when `result_ok` is set is undefined.
2059     */
2060    struct LDKDecodeError *err;
2061 } LDKCResult_RouteDecodeErrorZPtr;
2062
2063 /**
2064  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2065  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2066  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2067  */
2068 typedef struct LDKCResult_RouteDecodeErrorZ {
2069    /**
2070     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
2071     * `err` or `result` depending on the state of `result_ok`.
2072     */
2073    union LDKCResult_RouteDecodeErrorZPtr contents;
2074    /**
2075     * Whether this CResult_RouteDecodeErrorZ represents a success state.
2076     */
2077    bool result_ok;
2078 } LDKCResult_RouteDecodeErrorZ;
2079
2080
2081
2082 /**
2083  * Parameters needed to find a [`Route`].
2084  *
2085  * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
2086  * [`Event::PaymentPathFailed`] for retrying a failed payment path.
2087  *
2088  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
2089  */
2090 typedef struct MUST_USE_STRUCT LDKRouteParameters {
2091    /**
2092     * A pointer to the opaque Rust object.
2093     * Nearly everywhere, inner must be non-null, however in places where
2094     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2095     */
2096    LDKnativeRouteParameters *inner;
2097    /**
2098     * Indicates that this is the only struct which contains the same pointer.
2099     * Rust functions which take ownership of an object provided via an argument require
2100     * this to be true and invalidate the object pointed to by inner.
2101     */
2102    bool is_owned;
2103 } LDKRouteParameters;
2104
2105 /**
2106  * The contents of CResult_RouteParametersDecodeErrorZ
2107  */
2108 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
2109    /**
2110     * A pointer to the contents in the success state.
2111     * Reading from this pointer when `result_ok` is not set is undefined.
2112     */
2113    struct LDKRouteParameters *result;
2114    /**
2115     * A pointer to the contents in the error state.
2116     * Reading from this pointer when `result_ok` is set is undefined.
2117     */
2118    struct LDKDecodeError *err;
2119 } LDKCResult_RouteParametersDecodeErrorZPtr;
2120
2121 /**
2122  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2123  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2124  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2125  */
2126 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
2127    /**
2128     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2129     * `err` or `result` depending on the state of `result_ok`.
2130     */
2131    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
2132    /**
2133     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2134     */
2135    bool result_ok;
2136 } LDKCResult_RouteParametersDecodeErrorZ;
2137
2138
2139
2140 /**
2141  * A list of hops along a payment path terminating with a channel to the recipient.
2142  */
2143 typedef struct MUST_USE_STRUCT LDKRouteHint {
2144    /**
2145     * A pointer to the opaque Rust object.
2146     * Nearly everywhere, inner must be non-null, however in places where
2147     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2148     */
2149    LDKnativeRouteHint *inner;
2150    /**
2151     * Indicates that this is the only struct which contains the same pointer.
2152     * Rust functions which take ownership of an object provided via an argument require
2153     * this to be true and invalidate the object pointed to by inner.
2154     */
2155    bool is_owned;
2156 } LDKRouteHint;
2157
2158 /**
2159  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2160  * This corresponds to std::vector in C++
2161  */
2162 typedef struct LDKCVec_RouteHintZ {
2163    /**
2164     * The elements in the array.
2165     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2166     */
2167    struct LDKRouteHint *data;
2168    /**
2169     * The number of elements pointed to by `data`.
2170     */
2171    uintptr_t datalen;
2172 } LDKCVec_RouteHintZ;
2173
2174 /**
2175  * An enum which can either contain a u64 or not
2176  */
2177 typedef enum LDKCOption_u64Z_Tag {
2178    /**
2179     * When we're in this state, this COption_u64Z contains a u64
2180     */
2181    LDKCOption_u64Z_Some,
2182    /**
2183     * When we're in this state, this COption_u64Z contains nothing
2184     */
2185    LDKCOption_u64Z_None,
2186    /**
2187     * Must be last for serialization purposes
2188     */
2189    LDKCOption_u64Z_Sentinel,
2190 } LDKCOption_u64Z_Tag;
2191
2192 typedef struct LDKCOption_u64Z {
2193    LDKCOption_u64Z_Tag tag;
2194    union {
2195       struct {
2196          uint64_t some;
2197       };
2198    };
2199 } LDKCOption_u64Z;
2200
2201 /**
2202  * A dynamically-allocated array of u64s of arbitrary size.
2203  * This corresponds to std::vector in C++
2204  */
2205 typedef struct LDKCVec_u64Z {
2206    /**
2207     * The elements in the array.
2208     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2209     */
2210    uint64_t *data;
2211    /**
2212     * The number of elements pointed to by `data`.
2213     */
2214    uintptr_t datalen;
2215 } LDKCVec_u64Z;
2216
2217
2218
2219 /**
2220  * The recipient of a payment.
2221  */
2222 typedef struct MUST_USE_STRUCT LDKPaymentParameters {
2223    /**
2224     * A pointer to the opaque Rust object.
2225     * Nearly everywhere, inner must be non-null, however in places where
2226     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2227     */
2228    LDKnativePaymentParameters *inner;
2229    /**
2230     * Indicates that this is the only struct which contains the same pointer.
2231     * Rust functions which take ownership of an object provided via an argument require
2232     * this to be true and invalidate the object pointed to by inner.
2233     */
2234    bool is_owned;
2235 } LDKPaymentParameters;
2236
2237 /**
2238  * The contents of CResult_PaymentParametersDecodeErrorZ
2239  */
2240 typedef union LDKCResult_PaymentParametersDecodeErrorZPtr {
2241    /**
2242     * A pointer to the contents in the success state.
2243     * Reading from this pointer when `result_ok` is not set is undefined.
2244     */
2245    struct LDKPaymentParameters *result;
2246    /**
2247     * A pointer to the contents in the error state.
2248     * Reading from this pointer when `result_ok` is set is undefined.
2249     */
2250    struct LDKDecodeError *err;
2251 } LDKCResult_PaymentParametersDecodeErrorZPtr;
2252
2253 /**
2254  * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2255  * containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2256  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2257  */
2258 typedef struct LDKCResult_PaymentParametersDecodeErrorZ {
2259    /**
2260     * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2261     * `err` or `result` depending on the state of `result_ok`.
2262     */
2263    union LDKCResult_PaymentParametersDecodeErrorZPtr contents;
2264    /**
2265     * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2266     */
2267    bool result_ok;
2268 } LDKCResult_PaymentParametersDecodeErrorZ;
2269
2270
2271
2272 /**
2273  * A channel descriptor for a hop along a payment path.
2274  */
2275 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
2276    /**
2277     * A pointer to the opaque Rust object.
2278     * Nearly everywhere, inner must be non-null, however in places where
2279     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2280     */
2281    LDKnativeRouteHintHop *inner;
2282    /**
2283     * Indicates that this is the only struct which contains the same pointer.
2284     * Rust functions which take ownership of an object provided via an argument require
2285     * this to be true and invalidate the object pointed to by inner.
2286     */
2287    bool is_owned;
2288 } LDKRouteHintHop;
2289
2290 /**
2291  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2292  * This corresponds to std::vector in C++
2293  */
2294 typedef struct LDKCVec_RouteHintHopZ {
2295    /**
2296     * The elements in the array.
2297     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2298     */
2299    struct LDKRouteHintHop *data;
2300    /**
2301     * The number of elements pointed to by `data`.
2302     */
2303    uintptr_t datalen;
2304 } LDKCVec_RouteHintHopZ;
2305
2306 /**
2307  * The contents of CResult_RouteHintDecodeErrorZ
2308  */
2309 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
2310    /**
2311     * A pointer to the contents in the success state.
2312     * Reading from this pointer when `result_ok` is not set is undefined.
2313     */
2314    struct LDKRouteHint *result;
2315    /**
2316     * A pointer to the contents in the error state.
2317     * Reading from this pointer when `result_ok` is set is undefined.
2318     */
2319    struct LDKDecodeError *err;
2320 } LDKCResult_RouteHintDecodeErrorZPtr;
2321
2322 /**
2323  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2324  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2325  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2326  */
2327 typedef struct LDKCResult_RouteHintDecodeErrorZ {
2328    /**
2329     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2330     * `err` or `result` depending on the state of `result_ok`.
2331     */
2332    union LDKCResult_RouteHintDecodeErrorZPtr contents;
2333    /**
2334     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2335     */
2336    bool result_ok;
2337 } LDKCResult_RouteHintDecodeErrorZ;
2338
2339 /**
2340  * The contents of CResult_RouteHintHopDecodeErrorZ
2341  */
2342 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
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 LDKRouteHintHop *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_RouteHintHopDecodeErrorZPtr;
2354
2355 /**
2356  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2357  * containing a crate::lightning::routing::router::RouteHintHop 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_RouteHintHopDecodeErrorZ {
2361    /**
2362     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2363     * `err` or `result` depending on the state of `result_ok`.
2364     */
2365    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
2366    /**
2367     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2368     */
2369    bool result_ok;
2370 } LDKCResult_RouteHintHopDecodeErrorZ;
2371
2372
2373
2374 /**
2375  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2376  */
2377 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2378    /**
2379     * A pointer to the opaque Rust object.
2380     * Nearly everywhere, inner must be non-null, however in places where
2381     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2382     */
2383    LDKnativeChannelDetails *inner;
2384    /**
2385     * Indicates that this is the only struct which contains the same pointer.
2386     * Rust functions which take ownership of an object provided via an argument require
2387     * this to be true and invalidate the object pointed to by inner.
2388     */
2389    bool is_owned;
2390 } LDKChannelDetails;
2391
2392 /**
2393  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2394  * This corresponds to std::vector in C++
2395  */
2396 typedef struct LDKCVec_ChannelDetailsZ {
2397    /**
2398     * The elements in the array.
2399     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2400     */
2401    struct LDKChannelDetails *data;
2402    /**
2403     * The number of elements pointed to by `data`.
2404     */
2405    uintptr_t datalen;
2406 } LDKCVec_ChannelDetailsZ;
2407
2408
2409
2410 /**
2411  * An Err type for failure to process messages.
2412  */
2413 typedef struct MUST_USE_STRUCT LDKLightningError {
2414    /**
2415     * A pointer to the opaque Rust object.
2416     * Nearly everywhere, inner must be non-null, however in places where
2417     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2418     */
2419    LDKnativeLightningError *inner;
2420    /**
2421     * Indicates that this is the only struct which contains the same pointer.
2422     * Rust functions which take ownership of an object provided via an argument require
2423     * this to be true and invalidate the object pointed to by inner.
2424     */
2425    bool is_owned;
2426 } LDKLightningError;
2427
2428 /**
2429  * The contents of CResult_RouteLightningErrorZ
2430  */
2431 typedef union LDKCResult_RouteLightningErrorZPtr {
2432    /**
2433     * A pointer to the contents in the success state.
2434     * Reading from this pointer when `result_ok` is not set is undefined.
2435     */
2436    struct LDKRoute *result;
2437    /**
2438     * A pointer to the contents in the error state.
2439     * Reading from this pointer when `result_ok` is set is undefined.
2440     */
2441    struct LDKLightningError *err;
2442 } LDKCResult_RouteLightningErrorZPtr;
2443
2444 /**
2445  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2446  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2447  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2448  */
2449 typedef struct LDKCResult_RouteLightningErrorZ {
2450    /**
2451     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2452     * `err` or `result` depending on the state of `result_ok`.
2453     */
2454    union LDKCResult_RouteLightningErrorZPtr contents;
2455    /**
2456     * Whether this CResult_RouteLightningErrorZ represents a success state.
2457     */
2458    bool result_ok;
2459 } LDKCResult_RouteLightningErrorZ;
2460
2461 /**
2462  * Some information provided on receipt of payment depends on whether the payment received is a
2463  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
2464  */
2465 typedef enum LDKPaymentPurpose_Tag {
2466    /**
2467     * Information for receiving a payment that we generated an invoice for.
2468     */
2469    LDKPaymentPurpose_InvoicePayment,
2470    /**
2471     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
2472     * (the payee) providing a preimage.
2473     */
2474    LDKPaymentPurpose_SpontaneousPayment,
2475    /**
2476     * Must be last for serialization purposes
2477     */
2478    LDKPaymentPurpose_Sentinel,
2479 } LDKPaymentPurpose_Tag;
2480
2481 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
2482    /**
2483     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2484     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2485     * [`ChannelManager::claim_funds`].
2486     *
2487     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2488     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2489     *
2490     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2491     */
2492    struct LDKThirtyTwoBytes payment_preimage;
2493    /**
2494     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2495     * number of deanonymization attacks during the routing process.
2496     * It is provided here for your reference, however its accuracy is enforced directly by
2497     * [`ChannelManager`] using the values you previously provided to
2498     * [`ChannelManager::create_inbound_payment`] or
2499     * [`ChannelManager::create_inbound_payment_for_hash`].
2500     *
2501     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2502     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2503     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2504     */
2505    struct LDKThirtyTwoBytes payment_secret;
2506 } LDKPaymentPurpose_LDKInvoicePayment_Body;
2507
2508 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
2509    LDKPaymentPurpose_Tag tag;
2510    union {
2511       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
2512       struct {
2513          struct LDKThirtyTwoBytes spontaneous_payment;
2514       };
2515    };
2516 } LDKPaymentPurpose;
2517
2518 /**
2519  * The contents of CResult_PaymentPurposeDecodeErrorZ
2520  */
2521 typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr {
2522    /**
2523     * A pointer to the contents in the success state.
2524     * Reading from this pointer when `result_ok` is not set is undefined.
2525     */
2526    struct LDKPaymentPurpose *result;
2527    /**
2528     * A pointer to the contents in the error state.
2529     * Reading from this pointer when `result_ok` is set is undefined.
2530     */
2531    struct LDKDecodeError *err;
2532 } LDKCResult_PaymentPurposeDecodeErrorZPtr;
2533
2534 /**
2535  * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2536  * containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2537  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2538  */
2539 typedef struct LDKCResult_PaymentPurposeDecodeErrorZ {
2540    /**
2541     * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2542     * `err` or `result` depending on the state of `result_ok`.
2543     */
2544    union LDKCResult_PaymentPurposeDecodeErrorZPtr contents;
2545    /**
2546     * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2547     */
2548    bool result_ok;
2549 } LDKCResult_PaymentPurposeDecodeErrorZ;
2550
2551 /**
2552  * The reason the channel was closed. See individual variants more details.
2553  */
2554 typedef enum LDKClosureReason_Tag {
2555    /**
2556     * Closure generated from receiving a peer error message.
2557     *
2558     * Our counterparty may have broadcasted their latest commitment state, and we have
2559     * as well.
2560     */
2561    LDKClosureReason_CounterpartyForceClosed,
2562    /**
2563     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
2564     *
2565     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
2566     */
2567    LDKClosureReason_HolderForceClosed,
2568    /**
2569     * The channel was closed after negotiating a cooperative close and we've now broadcasted
2570     * the cooperative close transaction. Note the shutdown may have been initiated by us.
2571     */
2572    LDKClosureReason_CooperativeClosure,
2573    /**
2574     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
2575     * commitment transaction came from our counterparty, but it may also have come from
2576     * a copy of our own `ChannelMonitor`.
2577     */
2578    LDKClosureReason_CommitmentTxConfirmed,
2579    /**
2580     * The funding transaction failed to confirm in a timely manner on an inbound channel.
2581     */
2582    LDKClosureReason_FundingTimedOut,
2583    /**
2584     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
2585     */
2586    LDKClosureReason_ProcessingError,
2587    /**
2588     * The peer disconnected prior to funding completing. In this case the spec mandates that we
2589     * forget the channel entirely - we can attempt again if the peer reconnects.
2590     *
2591     * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
2592     * peer because of mutual incompatibility between us and our channel counterparty.
2593     */
2594    LDKClosureReason_DisconnectedPeer,
2595    /**
2596     * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
2597     * the ChannelManager deserialized.
2598     */
2599    LDKClosureReason_OutdatedChannelManager,
2600    /**
2601     * Must be last for serialization purposes
2602     */
2603    LDKClosureReason_Sentinel,
2604 } LDKClosureReason_Tag;
2605
2606 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
2607    /**
2608     * The error which the peer sent us.
2609     *
2610     * The string should be sanitized before it is used (e.g emitted to logs
2611     * or printed to stdout). Otherwise, a well crafted error message may exploit
2612     * a security vulnerability in the terminal emulator or the logging subsystem.
2613     */
2614    struct LDKStr peer_msg;
2615 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
2616
2617 typedef struct LDKClosureReason_LDKProcessingError_Body {
2618    /**
2619     * A developer-readable error message which we generated.
2620     */
2621    struct LDKStr err;
2622 } LDKClosureReason_LDKProcessingError_Body;
2623
2624 typedef struct MUST_USE_STRUCT LDKClosureReason {
2625    LDKClosureReason_Tag tag;
2626    union {
2627       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
2628       LDKClosureReason_LDKProcessingError_Body processing_error;
2629    };
2630 } LDKClosureReason;
2631
2632 /**
2633  * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2634  */
2635 typedef enum LDKCOption_ClosureReasonZ_Tag {
2636    /**
2637     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2638     */
2639    LDKCOption_ClosureReasonZ_Some,
2640    /**
2641     * When we're in this state, this COption_ClosureReasonZ contains nothing
2642     */
2643    LDKCOption_ClosureReasonZ_None,
2644    /**
2645     * Must be last for serialization purposes
2646     */
2647    LDKCOption_ClosureReasonZ_Sentinel,
2648 } LDKCOption_ClosureReasonZ_Tag;
2649
2650 typedef struct LDKCOption_ClosureReasonZ {
2651    LDKCOption_ClosureReasonZ_Tag tag;
2652    union {
2653       struct {
2654          struct LDKClosureReason some;
2655       };
2656    };
2657 } LDKCOption_ClosureReasonZ;
2658
2659 /**
2660  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
2661  */
2662 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
2663    /**
2664     * A pointer to the contents in the success state.
2665     * Reading from this pointer when `result_ok` is not set is undefined.
2666     */
2667    struct LDKCOption_ClosureReasonZ *result;
2668    /**
2669     * A pointer to the contents in the error state.
2670     * Reading from this pointer when `result_ok` is set is undefined.
2671     */
2672    struct LDKDecodeError *err;
2673 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
2674
2675 /**
2676  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
2677  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2678  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2679  */
2680 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
2681    /**
2682     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
2683     * `err` or `result` depending on the state of `result_ok`.
2684     */
2685    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
2686    /**
2687     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
2688     */
2689    bool result_ok;
2690 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
2691
2692 /**
2693  * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
2694  */
2695 typedef enum LDKHTLCDestination_Tag {
2696    /**
2697     * We tried forwarding to a channel but failed to do so. An example of such an instance is when
2698     * there is insufficient capacity in our outbound channel.
2699     */
2700    LDKHTLCDestination_NextHopChannel,
2701    /**
2702     * Scenario where we are unsure of the next node to forward the HTLC to.
2703     */
2704    LDKHTLCDestination_UnknownNextHop,
2705    /**
2706     * Failure scenario where an HTLC may have been forwarded to be intended for us,
2707     * but is invalid for some reason, so we reject it.
2708     *
2709     * Some of the reasons may include:
2710     * * HTLC Timeouts
2711     * * Expected MPP amount to claim does not equal HTLC total
2712     * * Claimable amount does not match expected amount
2713     */
2714    LDKHTLCDestination_FailedPayment,
2715    /**
2716     * Must be last for serialization purposes
2717     */
2718    LDKHTLCDestination_Sentinel,
2719 } LDKHTLCDestination_Tag;
2720
2721 typedef struct LDKHTLCDestination_LDKNextHopChannel_Body {
2722    /**
2723     * The `node_id` of the next node. For backwards compatibility, this field is
2724     * marked as optional, versions prior to 0.0.110 may not always be able to provide
2725     * counterparty node information.
2726     *
2727     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2728     */
2729    struct LDKPublicKey node_id;
2730    /**
2731     * The outgoing `channel_id` between us and the next node.
2732     */
2733    struct LDKThirtyTwoBytes channel_id;
2734 } LDKHTLCDestination_LDKNextHopChannel_Body;
2735
2736 typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body {
2737    /**
2738     * Short channel id we are requesting to forward an HTLC to.
2739     */
2740    uint64_t requested_forward_scid;
2741 } LDKHTLCDestination_LDKUnknownNextHop_Body;
2742
2743 typedef struct LDKHTLCDestination_LDKFailedPayment_Body {
2744    /**
2745     * The payment hash of the payment we attempted to process.
2746     */
2747    struct LDKThirtyTwoBytes payment_hash;
2748 } LDKHTLCDestination_LDKFailedPayment_Body;
2749
2750 typedef struct MUST_USE_STRUCT LDKHTLCDestination {
2751    LDKHTLCDestination_Tag tag;
2752    union {
2753       LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel;
2754       LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop;
2755       LDKHTLCDestination_LDKFailedPayment_Body failed_payment;
2756    };
2757 } LDKHTLCDestination;
2758
2759 /**
2760  * An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
2761  */
2762 typedef enum LDKCOption_HTLCDestinationZ_Tag {
2763    /**
2764     * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination
2765     */
2766    LDKCOption_HTLCDestinationZ_Some,
2767    /**
2768     * When we're in this state, this COption_HTLCDestinationZ contains nothing
2769     */
2770    LDKCOption_HTLCDestinationZ_None,
2771    /**
2772     * Must be last for serialization purposes
2773     */
2774    LDKCOption_HTLCDestinationZ_Sentinel,
2775 } LDKCOption_HTLCDestinationZ_Tag;
2776
2777 typedef struct LDKCOption_HTLCDestinationZ {
2778    LDKCOption_HTLCDestinationZ_Tag tag;
2779    union {
2780       struct {
2781          struct LDKHTLCDestination some;
2782       };
2783    };
2784 } LDKCOption_HTLCDestinationZ;
2785
2786 /**
2787  * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
2788  */
2789 typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr {
2790    /**
2791     * A pointer to the contents in the success state.
2792     * Reading from this pointer when `result_ok` is not set is undefined.
2793     */
2794    struct LDKCOption_HTLCDestinationZ *result;
2795    /**
2796     * A pointer to the contents in the error state.
2797     * Reading from this pointer when `result_ok` is set is undefined.
2798     */
2799    struct LDKDecodeError *err;
2800 } LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr;
2801
2802 /**
2803  * A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
2804  * containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2805  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2806  */
2807 typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ {
2808    /**
2809     * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
2810     * `err` or `result` depending on the state of `result_ok`.
2811     */
2812    union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents;
2813    /**
2814     * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
2815     */
2816    bool result_ok;
2817 } LDKCResult_COption_HTLCDestinationZDecodeErrorZ;
2818
2819
2820
2821 /**
2822  * A channel_update message to be sent or received from a peer
2823  */
2824 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2825    /**
2826     * A pointer to the opaque Rust object.
2827     * Nearly everywhere, inner must be non-null, however in places where
2828     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2829     */
2830    LDKnativeChannelUpdate *inner;
2831    /**
2832     * Indicates that this is the only struct which contains the same pointer.
2833     * Rust functions which take ownership of an object provided via an argument require
2834     * this to be true and invalidate the object pointed to by inner.
2835     */
2836    bool is_owned;
2837 } LDKChannelUpdate;
2838
2839 /**
2840  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
2841  * return packet by a node along the route. See [BOLT #4] for details.
2842  *
2843  * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
2844  */
2845 typedef enum LDKNetworkUpdate_Tag {
2846    /**
2847     * An error indicating a `channel_update` messages should be applied via
2848     * [`NetworkGraph::update_channel`].
2849     */
2850    LDKNetworkUpdate_ChannelUpdateMessage,
2851    /**
2852     * An error indicating that a channel failed to route a payment, which should be applied via
2853     * [`NetworkGraph::channel_failed`].
2854     */
2855    LDKNetworkUpdate_ChannelFailure,
2856    /**
2857     * An error indicating that a node failed to route a payment, which should be applied via
2858     * [`NetworkGraph::node_failed`].
2859     */
2860    LDKNetworkUpdate_NodeFailure,
2861    /**
2862     * Must be last for serialization purposes
2863     */
2864    LDKNetworkUpdate_Sentinel,
2865 } LDKNetworkUpdate_Tag;
2866
2867 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
2868    /**
2869     * The update to apply via [`NetworkGraph::update_channel`].
2870     */
2871    struct LDKChannelUpdate msg;
2872 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
2873
2874 typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
2875    /**
2876     * The short channel id of the closed channel.
2877     */
2878    uint64_t short_channel_id;
2879    /**
2880     * Whether the channel should be permanently removed or temporarily disabled until a new
2881     * `channel_update` message is received.
2882     */
2883    bool is_permanent;
2884 } LDKNetworkUpdate_LDKChannelFailure_Body;
2885
2886 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
2887    /**
2888     * The node id of the failed node.
2889     */
2890    struct LDKPublicKey node_id;
2891    /**
2892     * Whether the node should be permanently removed from consideration or can be restored
2893     * when a new `channel_update` message is received.
2894     */
2895    bool is_permanent;
2896 } LDKNetworkUpdate_LDKNodeFailure_Body;
2897
2898 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
2899    LDKNetworkUpdate_Tag tag;
2900    union {
2901       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2902       LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
2903       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
2904    };
2905 } LDKNetworkUpdate;
2906
2907 /**
2908  * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
2909  */
2910 typedef enum LDKCOption_NetworkUpdateZ_Tag {
2911    /**
2912     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
2913     */
2914    LDKCOption_NetworkUpdateZ_Some,
2915    /**
2916     * When we're in this state, this COption_NetworkUpdateZ contains nothing
2917     */
2918    LDKCOption_NetworkUpdateZ_None,
2919    /**
2920     * Must be last for serialization purposes
2921     */
2922    LDKCOption_NetworkUpdateZ_Sentinel,
2923 } LDKCOption_NetworkUpdateZ_Tag;
2924
2925 typedef struct LDKCOption_NetworkUpdateZ {
2926    LDKCOption_NetworkUpdateZ_Tag tag;
2927    union {
2928       struct {
2929          struct LDKNetworkUpdate some;
2930       };
2931    };
2932 } LDKCOption_NetworkUpdateZ;
2933
2934
2935
2936 /**
2937  * A reference to a transaction output.
2938  *
2939  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
2940  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
2941  */
2942 typedef struct MUST_USE_STRUCT LDKOutPoint {
2943    /**
2944     * A pointer to the opaque Rust object.
2945     * Nearly everywhere, inner must be non-null, however in places where
2946     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2947     */
2948    LDKnativeOutPoint *inner;
2949    /**
2950     * Indicates that this is the only struct which contains the same pointer.
2951     * Rust functions which take ownership of an object provided via an argument require
2952     * this to be true and invalidate the object pointed to by inner.
2953     */
2954    bool is_owned;
2955 } LDKOutPoint;
2956
2957
2958
2959 /**
2960  * Information about a spendable output to a P2WSH script. See
2961  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2962  */
2963 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2964    /**
2965     * A pointer to the opaque Rust object.
2966     * Nearly everywhere, inner must be non-null, however in places where
2967     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2968     */
2969    LDKnativeDelayedPaymentOutputDescriptor *inner;
2970    /**
2971     * Indicates that this is the only struct which contains the same pointer.
2972     * Rust functions which take ownership of an object provided via an argument require
2973     * this to be true and invalidate the object pointed to by inner.
2974     */
2975    bool is_owned;
2976 } LDKDelayedPaymentOutputDescriptor;
2977
2978
2979
2980 /**
2981  * Information about a spendable output to our \"payment key\". See
2982  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2983  */
2984 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2985    /**
2986     * A pointer to the opaque Rust object.
2987     * Nearly everywhere, inner must be non-null, however in places where
2988     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2989     */
2990    LDKnativeStaticPaymentOutputDescriptor *inner;
2991    /**
2992     * Indicates that this is the only struct which contains the same pointer.
2993     * Rust functions which take ownership of an object provided via an argument require
2994     * this to be true and invalidate the object pointed to by inner.
2995     */
2996    bool is_owned;
2997 } LDKStaticPaymentOutputDescriptor;
2998
2999 /**
3000  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
3001  * claim at any point in the future) an event is generated which you must track and be able to
3002  * spend on-chain. The information needed to do this is provided in this enum, including the
3003  * outpoint describing which txid and output index is available, the full output which exists at
3004  * that txid/index, and any keys or other information required to sign.
3005  */
3006 typedef enum LDKSpendableOutputDescriptor_Tag {
3007    /**
3008     * An output to a script which was provided via KeysInterface directly, either from
3009     * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know
3010     * how to spend it. No secret keys are provided as rust-lightning was never given any key.
3011     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
3012     * on-chain using the payment preimage or after it has timed out.
3013     */
3014    LDKSpendableOutputDescriptor_StaticOutput,
3015    /**
3016     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
3017     *
3018     * The witness in the spending input should be:
3019     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
3020     *
3021     * Note that the nSequence field in the spending input must be set to to_self_delay
3022     * (which means the transaction is not broadcastable until at least to_self_delay
3023     * blocks after the outpoint confirms).
3024     *
3025     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
3026     * it is an output from an old state which we broadcast (which should never happen).
3027     *
3028     * To derive the delayed_payment key which is used to sign for this input, you must pass the
3029     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
3030     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
3031     * chan_utils::derive_private_key. The public key can be generated without the secret key
3032     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
3033     * Sign::pubkeys().
3034     *
3035     * To derive the revocation_pubkey provided here (which is used in the witness
3036     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
3037     * call to Sign::ready_channel) and the provided per_commitment point
3038     * to chan_utils::derive_public_revocation_key.
3039     *
3040     * The witness script which is hashed and included in the output script_pubkey may be
3041     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
3042     * (derived as above), and the to_self_delay contained here to
3043     * chan_utils::get_revokeable_redeemscript.
3044     */
3045    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
3046    /**
3047     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
3048     * corresponds to the public key in Sign::pubkeys().payment_point).
3049     * The witness in the spending input, is, thus, simply:
3050     * <BIP 143 signature> <payment key>
3051     *
3052     * These are generally the result of our counterparty having broadcast the current state,
3053     * allowing us to claim the non-HTLC-encumbered outputs immediately.
3054     */
3055    LDKSpendableOutputDescriptor_StaticPaymentOutput,
3056    /**
3057     * Must be last for serialization purposes
3058     */
3059    LDKSpendableOutputDescriptor_Sentinel,
3060 } LDKSpendableOutputDescriptor_Tag;
3061
3062 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
3063    /**
3064     * The outpoint which is spendable
3065     */
3066    struct LDKOutPoint outpoint;
3067    /**
3068     * The output which is referenced by the given outpoint.
3069     */
3070    struct LDKTxOut output;
3071 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
3072
3073 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
3074    LDKSpendableOutputDescriptor_Tag tag;
3075    union {
3076       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
3077       struct {
3078          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
3079       };
3080       struct {
3081          struct LDKStaticPaymentOutputDescriptor static_payment_output;
3082       };
3083    };
3084 } LDKSpendableOutputDescriptor;
3085
3086 /**
3087  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3088  * This corresponds to std::vector in C++
3089  */
3090 typedef struct LDKCVec_SpendableOutputDescriptorZ {
3091    /**
3092     * The elements in the array.
3093     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3094     */
3095    struct LDKSpendableOutputDescriptor *data;
3096    /**
3097     * The number of elements pointed to by `data`.
3098     */
3099    uintptr_t datalen;
3100 } LDKCVec_SpendableOutputDescriptorZ;
3101
3102
3103
3104 /**
3105  * Features used within the channel_type field in an OpenChannel message.
3106  *
3107  * A channel is always of some known \"type\", describing the transaction formats used and the exact
3108  * semantics of our interaction with our peer.
3109  *
3110  * Note that because a channel is a specific type which is proposed by the opener and accepted by
3111  * the counterparty, only required features are allowed here.
3112  *
3113  * This is serialized differently from other feature types - it is not prefixed by a length, and
3114  * thus must only appear inside a TLV where its length is known in advance.
3115  */
3116 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
3117    /**
3118     * A pointer to the opaque Rust object.
3119     * Nearly everywhere, inner must be non-null, however in places where
3120     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3121     */
3122    LDKnativeChannelTypeFeatures *inner;
3123    /**
3124     * Indicates that this is the only struct which contains the same pointer.
3125     * Rust functions which take ownership of an object provided via an argument require
3126     * this to be true and invalidate the object pointed to by inner.
3127     */
3128    bool is_owned;
3129 } LDKChannelTypeFeatures;
3130
3131 /**
3132  * An Event which you should probably take some action in response to.
3133  *
3134  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
3135  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
3136  * written as it makes no sense to respond to it after reconnecting to peers).
3137  */
3138 typedef enum LDKEvent_Tag {
3139    /**
3140     * Used to indicate that the client should generate a funding transaction with the given
3141     * parameters and then call [`ChannelManager::funding_transaction_generated`].
3142     * Generated in [`ChannelManager`] message handling.
3143     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
3144     * counterparty can steal your funds!
3145     *
3146     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3147     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
3148     */
3149    LDKEvent_FundingGenerationReady,
3150    /**
3151     * Indicates we've received (an offer of) money! Just gotta dig out that payment preimage and
3152     * feed it to [`ChannelManager::claim_funds`] to get it....
3153     *
3154     * Note that if the preimage is not known, you should call
3155     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
3156     * network congestion.
3157     * If you fail to call either [`ChannelManager::claim_funds`] or
3158     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
3159     * automatically failed.
3160     *
3161     * # Note
3162     * LDK will not stop an inbound payment from being paid multiple times, so multiple
3163     * `PaymentReceived` events may be generated for the same payment.
3164     *
3165     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
3166     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
3167     */
3168    LDKEvent_PaymentReceived,
3169    /**
3170     * Indicates a payment has been claimed and we've received money!
3171     *
3172     * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
3173     * to an [`Event::PaymentReceived`]. However, if we previously crashed during a
3174     * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
3175     * [`Event::PaymentReceived`] event.
3176     *
3177     * # Note
3178     * LDK will not stop an inbound payment from being paid multiple times, so multiple
3179     * `PaymentReceived` events may be generated for the same payment. If you then call
3180     * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentReceived`] you may get
3181     * multiple `PaymentClaimed` events.
3182     *
3183     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
3184     */
3185    LDKEvent_PaymentClaimed,
3186    /**
3187     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
3188     * and we got back the payment preimage for it).
3189     *
3190     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
3191     * event. In this situation, you SHOULD treat this payment as having succeeded.
3192     */
3193    LDKEvent_PaymentSent,
3194    /**
3195     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
3196     * provide failure information for each MPP part in the payment.
3197     *
3198     * This event is provided once there are no further pending HTLCs for the payment and the
3199     * payment is no longer retryable, either due to a several-block timeout or because
3200     * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
3201     *
3202     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3203     */
3204    LDKEvent_PaymentFailed,
3205    /**
3206     * Indicates that a path for an outbound payment was successful.
3207     *
3208     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
3209     * [`Event::PaymentSent`] for obtaining the payment preimage.
3210     */
3211    LDKEvent_PaymentPathSuccessful,
3212    /**
3213     * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
3214     * something. You may wish to retry with a different route.
3215     *
3216     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
3217     * [`Event::PaymentFailed`] and [`all_paths_failed`].
3218     *
3219     * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
3220     */
3221    LDKEvent_PaymentPathFailed,
3222    /**
3223     * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
3224     */
3225    LDKEvent_ProbeSuccessful,
3226    /**
3227     * Indicates that a probe payment we sent failed at an intermediary node on the path.
3228     */
3229    LDKEvent_ProbeFailed,
3230    /**
3231     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
3232     * a time in the future.
3233     *
3234     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
3235     */
3236    LDKEvent_PendingHTLCsForwardable,
3237    /**
3238     * Used to indicate that an output which you should know how to spend was confirmed on chain
3239     * and is now spendable.
3240     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
3241     * counterparty spending them due to some kind of timeout. Thus, you need to store them
3242     * somewhere and spend them when you create on-chain transactions.
3243     */
3244    LDKEvent_SpendableOutputs,
3245    /**
3246     * This event is generated when a payment has been successfully forwarded through us and a
3247     * forwarding fee earned.
3248     */
3249    LDKEvent_PaymentForwarded,
3250    /**
3251     * Used to indicate that a previously opened channel with the given `channel_id` is in the
3252     * process of closure.
3253     */
3254    LDKEvent_ChannelClosed,
3255    /**
3256     * Used to indicate to the user that they can abandon the funding transaction and recycle the
3257     * inputs for another purpose.
3258     */
3259    LDKEvent_DiscardFunding,
3260    /**
3261     * Indicates a request to open a new channel by a peer.
3262     *
3263     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
3264     * request, call [`ChannelManager::force_close_without_broadcasting_txn`].
3265     *
3266     * The event is only triggered when a new open channel request is received and the
3267     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
3268     *
3269     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3270     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
3271     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
3272     */
3273    LDKEvent_OpenChannelRequest,
3274    /**
3275     * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
3276     * forward it.
3277     *
3278     * Some scenarios where this event may be sent include:
3279     * * Insufficient capacity in the outbound channel
3280     * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
3281     * * When an unknown SCID is requested for forwarding a payment.
3282     * * Claiming an amount for an MPP payment that exceeds the HTLC total
3283     * * The HTLC has timed out
3284     *
3285     * This event, however, does not get generated if an HTLC fails to meet the forwarding
3286     * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
3287     */
3288    LDKEvent_HTLCHandlingFailed,
3289    /**
3290     * Must be last for serialization purposes
3291     */
3292    LDKEvent_Sentinel,
3293 } LDKEvent_Tag;
3294
3295 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
3296    /**
3297     * The random channel_id we picked which you'll need to pass into
3298     * [`ChannelManager::funding_transaction_generated`].
3299     *
3300     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
3301     */
3302    struct LDKThirtyTwoBytes temporary_channel_id;
3303    /**
3304     * The counterparty's node_id, which you'll need to pass back into
3305     * [`ChannelManager::funding_transaction_generated`].
3306     *
3307     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
3308     */
3309    struct LDKPublicKey counterparty_node_id;
3310    /**
3311     * The value, in satoshis, that the output should have.
3312     */
3313    uint64_t channel_value_satoshis;
3314    /**
3315     * The script which should be used in the transaction output.
3316     */
3317    struct LDKCVec_u8Z output_script;
3318    /**
3319     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
3320     * an inbound channel.
3321     *
3322     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3323     */
3324    uint64_t user_channel_id;
3325 } LDKEvent_LDKFundingGenerationReady_Body;
3326
3327 typedef struct LDKEvent_LDKPaymentReceived_Body {
3328    /**
3329     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
3330     * not stop you from registering duplicate payment hashes for inbound payments.
3331     */
3332    struct LDKThirtyTwoBytes payment_hash;
3333    /**
3334     * The value, in thousandths of a satoshi, that this payment is for.
3335     */
3336    uint64_t amount_msat;
3337    /**
3338     * Information for claiming this received payment, based on whether the purpose of the
3339     * payment is to pay an invoice or to send a spontaneous payment.
3340     */
3341    struct LDKPaymentPurpose purpose;
3342 } LDKEvent_LDKPaymentReceived_Body;
3343
3344 typedef struct LDKEvent_LDKPaymentClaimed_Body {
3345    /**
3346     * The payment hash of the claimed payment. Note that LDK will not stop you from
3347     * registering duplicate payment hashes for inbound payments.
3348     */
3349    struct LDKThirtyTwoBytes payment_hash;
3350    /**
3351     * The value, in thousandths of a satoshi, that this payment is for.
3352     */
3353    uint64_t amount_msat;
3354    /**
3355     * The purpose of this claimed payment, i.e. whether the payment was for an invoice or a
3356     * spontaneous payment.
3357     */
3358    struct LDKPaymentPurpose purpose;
3359 } LDKEvent_LDKPaymentClaimed_Body;
3360
3361 typedef struct LDKEvent_LDKPaymentSent_Body {
3362    /**
3363     * The id returned by [`ChannelManager::send_payment`] and used with
3364     * [`ChannelManager::retry_payment`].
3365     *
3366     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3367     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3368     *
3369     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3370     */
3371    struct LDKThirtyTwoBytes payment_id;
3372    /**
3373     * The preimage to the hash given to ChannelManager::send_payment.
3374     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
3375     * store it somehow!
3376     */
3377    struct LDKThirtyTwoBytes payment_preimage;
3378    /**
3379     * The hash that was given to [`ChannelManager::send_payment`].
3380     *
3381     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3382     */
3383    struct LDKThirtyTwoBytes payment_hash;
3384    /**
3385     * The total fee which was spent at intermediate hops in this payment, across all paths.
3386     *
3387     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
3388     * overpayment to the recipient node.
3389     *
3390     * If the recipient or an intermediate node misbehaves and gives us free money, this may
3391     * overstate the amount paid, though this is unlikely.
3392     *
3393     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
3394     */
3395    struct LDKCOption_u64Z fee_paid_msat;
3396 } LDKEvent_LDKPaymentSent_Body;
3397
3398 typedef struct LDKEvent_LDKPaymentFailed_Body {
3399    /**
3400     * The id returned by [`ChannelManager::send_payment`] and used with
3401     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3402     *
3403     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3404     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3405     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3406     */
3407    struct LDKThirtyTwoBytes payment_id;
3408    /**
3409     * The hash that was given to [`ChannelManager::send_payment`].
3410     *
3411     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3412     */
3413    struct LDKThirtyTwoBytes payment_hash;
3414 } LDKEvent_LDKPaymentFailed_Body;
3415
3416 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
3417    /**
3418     * The id returned by [`ChannelManager::send_payment`] and used with
3419     * [`ChannelManager::retry_payment`].
3420     *
3421     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3422     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3423     */
3424    struct LDKThirtyTwoBytes payment_id;
3425    /**
3426     * The hash that was given to [`ChannelManager::send_payment`].
3427     *
3428     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3429     *
3430     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3431     */
3432    struct LDKThirtyTwoBytes payment_hash;
3433    /**
3434     * The payment path that was successful.
3435     *
3436     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
3437     */
3438    struct LDKCVec_RouteHopZ path;
3439 } LDKEvent_LDKPaymentPathSuccessful_Body;
3440
3441 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
3442    /**
3443     * The id returned by [`ChannelManager::send_payment`] and used with
3444     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3445     *
3446     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3447     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3448     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3449     *
3450     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3451     */
3452    struct LDKThirtyTwoBytes payment_id;
3453    /**
3454     * The hash that was given to [`ChannelManager::send_payment`].
3455     *
3456     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3457     */
3458    struct LDKThirtyTwoBytes payment_hash;
3459    /**
3460     * Indicates the payment was rejected for some reason by the recipient. This implies that
3461     * the payment has failed, not just the route in question. If this is not set, you may
3462     * retry the payment via a different route.
3463     */
3464    bool payment_failed_permanently;
3465    /**
3466     * Any failure information conveyed via the Onion return packet by a node along the failed
3467     * payment route.
3468     *
3469     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
3470     * account the update.
3471     *
3472     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
3473     */
3474    struct LDKCOption_NetworkUpdateZ network_update;
3475    /**
3476     * For both single-path and multi-path payments, this is set if all paths of the payment have
3477     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
3478     * larger MPP payment were still in flight when this event was generated.
3479     *
3480     * Note that if you are retrying individual MPP parts, using this value to determine if a
3481     * payment has fully failed is race-y. Because multiple failures can happen prior to events
3482     * being processed, you may retry in response to a first failure, with a second failure
3483     * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
3484     * you will see `all_paths_failed` set even though the retry of the first failure still
3485     * has an associated in-flight HTLC. See (1) for an example of such a failure.
3486     *
3487     * If you wish to retry individual MPP parts and learn when a payment has failed, you must
3488     * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
3489     *
3490     * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
3491     *
3492     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3493     */
3494    bool all_paths_failed;
3495    /**
3496     * The payment path that failed.
3497     */
3498    struct LDKCVec_RouteHopZ path;
3499    /**
3500     * The channel responsible for the failed payment path.
3501     *
3502     * Note that for route hints or for the first hop in a path this may be an SCID alias and
3503     * may not refer to a channel in the public network graph. These aliases may also collide
3504     * with channels in the public network graph.
3505     *
3506     * If this is `Some`, then the corresponding channel should be avoided when the payment is
3507     * retried. May be `None` for older [`Event`] serializations.
3508     */
3509    struct LDKCOption_u64Z short_channel_id;
3510    /**
3511     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
3512     *
3513     * See [`find_route`] for details.
3514     *
3515     * [`Route`]: crate::routing::router::Route
3516     * [`find_route`]: crate::routing::router::find_route
3517     *
3518     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3519     */
3520    struct LDKRouteParameters retry;
3521 } LDKEvent_LDKPaymentPathFailed_Body;
3522
3523 typedef struct LDKEvent_LDKProbeSuccessful_Body {
3524    /**
3525     * The id returned by [`ChannelManager::send_probe`].
3526     *
3527     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3528     */
3529    struct LDKThirtyTwoBytes payment_id;
3530    /**
3531     * The hash generated by [`ChannelManager::send_probe`].
3532     *
3533     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3534     */
3535    struct LDKThirtyTwoBytes payment_hash;
3536    /**
3537     * The payment path that was successful.
3538     */
3539    struct LDKCVec_RouteHopZ path;
3540 } LDKEvent_LDKProbeSuccessful_Body;
3541
3542 typedef struct LDKEvent_LDKProbeFailed_Body {
3543    /**
3544     * The id returned by [`ChannelManager::send_probe`].
3545     *
3546     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3547     */
3548    struct LDKThirtyTwoBytes payment_id;
3549    /**
3550     * The hash generated by [`ChannelManager::send_probe`].
3551     *
3552     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3553     */
3554    struct LDKThirtyTwoBytes payment_hash;
3555    /**
3556     * The payment path that failed.
3557     */
3558    struct LDKCVec_RouteHopZ path;
3559    /**
3560     * The channel responsible for the failed probe.
3561     *
3562     * Note that for route hints or for the first hop in a path this may be an SCID alias and
3563     * may not refer to a channel in the public network graph. These aliases may also collide
3564     * with channels in the public network graph.
3565     */
3566    struct LDKCOption_u64Z short_channel_id;
3567 } LDKEvent_LDKProbeFailed_Body;
3568
3569 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
3570    /**
3571     * The minimum amount of time that should be waited prior to calling
3572     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
3573     * you should wait a random amount of time in roughly the range (now + time_forwardable,
3574     * now + 5*time_forwardable).
3575     */
3576    uint64_t time_forwardable;
3577 } LDKEvent_LDKPendingHTLCsForwardable_Body;
3578
3579 typedef struct LDKEvent_LDKSpendableOutputs_Body {
3580    /**
3581     * The outputs which you should store as spendable by you.
3582     */
3583    struct LDKCVec_SpendableOutputDescriptorZ outputs;
3584 } LDKEvent_LDKSpendableOutputs_Body;
3585
3586 typedef struct LDKEvent_LDKPaymentForwarded_Body {
3587    /**
3588     * The incoming channel between the previous node and us. This is only `None` for events
3589     * generated or serialized by versions prior to 0.0.107.
3590     *
3591     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3592     */
3593    struct LDKThirtyTwoBytes prev_channel_id;
3594    /**
3595     * The outgoing channel between the next node and us. This is only `None` for events
3596     * generated or serialized by versions prior to 0.0.107.
3597     *
3598     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3599     */
3600    struct LDKThirtyTwoBytes next_channel_id;
3601    /**
3602     * The fee, in milli-satoshis, which was earned as a result of the payment.
3603     *
3604     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
3605     * was pending, the amount the next hop claimed will have been rounded down to the nearest
3606     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
3607     * claimed the full value in millisatoshis from the source. In this case,
3608     * `claim_from_onchain_tx` will be set.
3609     *
3610     * If the channel which sent us the payment has been force-closed, we will claim the funds
3611     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
3612     * fees which we will spend and will instead set this to `None`. It is possible duplicate
3613     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
3614     * `None`.
3615     */
3616    struct LDKCOption_u64Z fee_earned_msat;
3617    /**
3618     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
3619     * transaction.
3620     */
3621    bool claim_from_onchain_tx;
3622 } LDKEvent_LDKPaymentForwarded_Body;
3623
3624 typedef struct LDKEvent_LDKChannelClosed_Body {
3625    /**
3626     * The channel_id of the channel which has been closed. Note that on-chain transactions
3627     * resolving the channel are likely still awaiting confirmation.
3628     */
3629    struct LDKThirtyTwoBytes channel_id;
3630    /**
3631     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
3632     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
3633     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
3634     * `user_channel_id` will be 0 for an inbound channel.
3635     * This will always be zero for objects serialized with LDK versions prior to 0.0.102.
3636     *
3637     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3638     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3639     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
3640     */
3641    uint64_t user_channel_id;
3642    /**
3643     * The reason the channel was closed.
3644     */
3645    struct LDKClosureReason reason;
3646 } LDKEvent_LDKChannelClosed_Body;
3647
3648 typedef struct LDKEvent_LDKDiscardFunding_Body {
3649    /**
3650     * The channel_id of the channel which has been closed.
3651     */
3652    struct LDKThirtyTwoBytes channel_id;
3653    /**
3654     * The full transaction received from the user
3655     */
3656    struct LDKTransaction transaction;
3657 } LDKEvent_LDKDiscardFunding_Body;
3658
3659 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
3660    /**
3661     * The temporary channel ID of the channel requested to be opened.
3662     *
3663     * When responding to the request, the `temporary_channel_id` should be passed
3664     * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
3665     * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
3666     *
3667     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3668     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
3669     */
3670    struct LDKThirtyTwoBytes temporary_channel_id;
3671    /**
3672     * The node_id of the counterparty requesting to open the channel.
3673     *
3674     * When responding to the request, the `counterparty_node_id` should be passed
3675     * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
3676     * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
3677     * request.
3678     *
3679     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3680     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
3681     */
3682    struct LDKPublicKey counterparty_node_id;
3683    /**
3684     * The channel value of the requested channel.
3685     */
3686    uint64_t funding_satoshis;
3687    /**
3688     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
3689     */
3690    uint64_t push_msat;
3691    /**
3692     * The features that this channel will operate with. If you reject the channel, a
3693     * well-behaved counterparty may automatically re-attempt the channel with a new set of
3694     * feature flags.
3695     *
3696     * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
3697     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3698     * 0.0.106.
3699     *
3700     * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
3701     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3702     * 0.0.107. Channels setting this type also need to get manually accepted via
3703     * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
3704     * or will be rejected otherwise.
3705     *
3706     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3707     */
3708    struct LDKChannelTypeFeatures channel_type;
3709 } LDKEvent_LDKOpenChannelRequest_Body;
3710
3711 typedef struct LDKEvent_LDKHTLCHandlingFailed_Body {
3712    /**
3713     * The channel over which the HTLC was received.
3714     */
3715    struct LDKThirtyTwoBytes prev_channel_id;
3716    /**
3717     * Destination of the HTLC that failed to be processed.
3718     */
3719    struct LDKHTLCDestination failed_next_destination;
3720 } LDKEvent_LDKHTLCHandlingFailed_Body;
3721
3722 typedef struct MUST_USE_STRUCT LDKEvent {
3723    LDKEvent_Tag tag;
3724    union {
3725       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
3726       LDKEvent_LDKPaymentReceived_Body payment_received;
3727       LDKEvent_LDKPaymentClaimed_Body payment_claimed;
3728       LDKEvent_LDKPaymentSent_Body payment_sent;
3729       LDKEvent_LDKPaymentFailed_Body payment_failed;
3730       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
3731       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
3732       LDKEvent_LDKProbeSuccessful_Body probe_successful;
3733       LDKEvent_LDKProbeFailed_Body probe_failed;
3734       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
3735       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
3736       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
3737       LDKEvent_LDKChannelClosed_Body channel_closed;
3738       LDKEvent_LDKDiscardFunding_Body discard_funding;
3739       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
3740       LDKEvent_LDKHTLCHandlingFailed_Body htlc_handling_failed;
3741    };
3742 } LDKEvent;
3743
3744 /**
3745  * An enum which can either contain a crate::lightning::util::events::Event or not
3746  */
3747 typedef enum LDKCOption_EventZ_Tag {
3748    /**
3749     * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3750     */
3751    LDKCOption_EventZ_Some,
3752    /**
3753     * When we're in this state, this COption_EventZ contains nothing
3754     */
3755    LDKCOption_EventZ_None,
3756    /**
3757     * Must be last for serialization purposes
3758     */
3759    LDKCOption_EventZ_Sentinel,
3760 } LDKCOption_EventZ_Tag;
3761
3762 typedef struct LDKCOption_EventZ {
3763    LDKCOption_EventZ_Tag tag;
3764    union {
3765       struct {
3766          struct LDKEvent some;
3767       };
3768    };
3769 } LDKCOption_EventZ;
3770
3771 /**
3772  * The contents of CResult_COption_EventZDecodeErrorZ
3773  */
3774 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
3775    /**
3776     * A pointer to the contents in the success state.
3777     * Reading from this pointer when `result_ok` is not set is undefined.
3778     */
3779    struct LDKCOption_EventZ *result;
3780    /**
3781     * A pointer to the contents in the error state.
3782     * Reading from this pointer when `result_ok` is set is undefined.
3783     */
3784    struct LDKDecodeError *err;
3785 } LDKCResult_COption_EventZDecodeErrorZPtr;
3786
3787 /**
3788  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3789  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3790  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3791  */
3792 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
3793    /**
3794     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3795     * `err` or `result` depending on the state of `result_ok`.
3796     */
3797    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
3798    /**
3799     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3800     */
3801    bool result_ok;
3802 } LDKCResult_COption_EventZDecodeErrorZ;
3803
3804
3805
3806 /**
3807  * An accept_channel message to be sent or received from a peer
3808  */
3809 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3810    /**
3811     * A pointer to the opaque Rust object.
3812     * Nearly everywhere, inner must be non-null, however in places where
3813     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3814     */
3815    LDKnativeAcceptChannel *inner;
3816    /**
3817     * Indicates that this is the only struct which contains the same pointer.
3818     * Rust functions which take ownership of an object provided via an argument require
3819     * this to be true and invalidate the object pointed to by inner.
3820     */
3821    bool is_owned;
3822 } LDKAcceptChannel;
3823
3824
3825
3826 /**
3827  * An open_channel message to be sent or received from a peer
3828  */
3829 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3830    /**
3831     * A pointer to the opaque Rust object.
3832     * Nearly everywhere, inner must be non-null, however in places where
3833     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3834     */
3835    LDKnativeOpenChannel *inner;
3836    /**
3837     * Indicates that this is the only struct which contains the same pointer.
3838     * Rust functions which take ownership of an object provided via an argument require
3839     * this to be true and invalidate the object pointed to by inner.
3840     */
3841    bool is_owned;
3842 } LDKOpenChannel;
3843
3844
3845
3846 /**
3847  * A funding_created message to be sent or received from a peer
3848  */
3849 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3850    /**
3851     * A pointer to the opaque Rust object.
3852     * Nearly everywhere, inner must be non-null, however in places where
3853     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3854     */
3855    LDKnativeFundingCreated *inner;
3856    /**
3857     * Indicates that this is the only struct which contains the same pointer.
3858     * Rust functions which take ownership of an object provided via an argument require
3859     * this to be true and invalidate the object pointed to by inner.
3860     */
3861    bool is_owned;
3862 } LDKFundingCreated;
3863
3864
3865
3866 /**
3867  * A funding_signed message to be sent or received from a peer
3868  */
3869 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3870    /**
3871     * A pointer to the opaque Rust object.
3872     * Nearly everywhere, inner must be non-null, however in places where
3873     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3874     */
3875    LDKnativeFundingSigned *inner;
3876    /**
3877     * Indicates that this is the only struct which contains the same pointer.
3878     * Rust functions which take ownership of an object provided via an argument require
3879     * this to be true and invalidate the object pointed to by inner.
3880     */
3881    bool is_owned;
3882 } LDKFundingSigned;
3883
3884
3885
3886 /**
3887  * A channel_ready message to be sent or received from a peer
3888  */
3889 typedef struct MUST_USE_STRUCT LDKChannelReady {
3890    /**
3891     * A pointer to the opaque Rust object.
3892     * Nearly everywhere, inner must be non-null, however in places where
3893     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3894     */
3895    LDKnativeChannelReady *inner;
3896    /**
3897     * Indicates that this is the only struct which contains the same pointer.
3898     * Rust functions which take ownership of an object provided via an argument require
3899     * this to be true and invalidate the object pointed to by inner.
3900     */
3901    bool is_owned;
3902 } LDKChannelReady;
3903
3904
3905
3906 /**
3907  * An announcement_signatures message to be sent or received from a peer
3908  */
3909 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3910    /**
3911     * A pointer to the opaque Rust object.
3912     * Nearly everywhere, inner must be non-null, however in places where
3913     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3914     */
3915    LDKnativeAnnouncementSignatures *inner;
3916    /**
3917     * Indicates that this is the only struct which contains the same pointer.
3918     * Rust functions which take ownership of an object provided via an argument require
3919     * this to be true and invalidate the object pointed to by inner.
3920     */
3921    bool is_owned;
3922 } LDKAnnouncementSignatures;
3923
3924
3925
3926 /**
3927  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3928  * transaction updates if they were pending.
3929  */
3930 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3931    /**
3932     * A pointer to the opaque Rust object.
3933     * Nearly everywhere, inner must be non-null, however in places where
3934     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3935     */
3936    LDKnativeCommitmentUpdate *inner;
3937    /**
3938     * Indicates that this is the only struct which contains the same pointer.
3939     * Rust functions which take ownership of an object provided via an argument require
3940     * this to be true and invalidate the object pointed to by inner.
3941     */
3942    bool is_owned;
3943 } LDKCommitmentUpdate;
3944
3945
3946
3947 /**
3948  * A revoke_and_ack message to be sent or received from a peer
3949  */
3950 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3951    /**
3952     * A pointer to the opaque Rust object.
3953     * Nearly everywhere, inner must be non-null, however in places where
3954     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3955     */
3956    LDKnativeRevokeAndACK *inner;
3957    /**
3958     * Indicates that this is the only struct which contains the same pointer.
3959     * Rust functions which take ownership of an object provided via an argument require
3960     * this to be true and invalidate the object pointed to by inner.
3961     */
3962    bool is_owned;
3963 } LDKRevokeAndACK;
3964
3965
3966
3967 /**
3968  * A closing_signed message to be sent or received from a peer
3969  */
3970 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3971    /**
3972     * A pointer to the opaque Rust object.
3973     * Nearly everywhere, inner must be non-null, however in places where
3974     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3975     */
3976    LDKnativeClosingSigned *inner;
3977    /**
3978     * Indicates that this is the only struct which contains the same pointer.
3979     * Rust functions which take ownership of an object provided via an argument require
3980     * this to be true and invalidate the object pointed to by inner.
3981     */
3982    bool is_owned;
3983 } LDKClosingSigned;
3984
3985
3986
3987 /**
3988  * A shutdown message to be sent or received from a peer
3989  */
3990 typedef struct MUST_USE_STRUCT LDKShutdown {
3991    /**
3992     * A pointer to the opaque Rust object.
3993     * Nearly everywhere, inner must be non-null, however in places where
3994     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3995     */
3996    LDKnativeShutdown *inner;
3997    /**
3998     * Indicates that this is the only struct which contains the same pointer.
3999     * Rust functions which take ownership of an object provided via an argument require
4000     * this to be true and invalidate the object pointed to by inner.
4001     */
4002    bool is_owned;
4003 } LDKShutdown;
4004
4005
4006
4007 /**
4008  * A channel_reestablish message to be sent or received from a peer
4009  */
4010 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
4011    /**
4012     * A pointer to the opaque Rust object.
4013     * Nearly everywhere, inner must be non-null, however in places where
4014     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4015     */
4016    LDKnativeChannelReestablish *inner;
4017    /**
4018     * Indicates that this is the only struct which contains the same pointer.
4019     * Rust functions which take ownership of an object provided via an argument require
4020     * this to be true and invalidate the object pointed to by inner.
4021     */
4022    bool is_owned;
4023 } LDKChannelReestablish;
4024
4025
4026
4027 /**
4028  * A channel_announcement message to be sent or received from a peer
4029  */
4030 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
4031    /**
4032     * A pointer to the opaque Rust object.
4033     * Nearly everywhere, inner must be non-null, however in places where
4034     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4035     */
4036    LDKnativeChannelAnnouncement *inner;
4037    /**
4038     * Indicates that this is the only struct which contains the same pointer.
4039     * Rust functions which take ownership of an object provided via an argument require
4040     * this to be true and invalidate the object pointed to by inner.
4041     */
4042    bool is_owned;
4043 } LDKChannelAnnouncement;
4044
4045
4046
4047 /**
4048  * An error message to be sent or received from a peer
4049  */
4050 typedef struct MUST_USE_STRUCT LDKErrorMessage {
4051    /**
4052     * A pointer to the opaque Rust object.
4053     * Nearly everywhere, inner must be non-null, however in places where
4054     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4055     */
4056    LDKnativeErrorMessage *inner;
4057    /**
4058     * Indicates that this is the only struct which contains the same pointer.
4059     * Rust functions which take ownership of an object provided via an argument require
4060     * this to be true and invalidate the object pointed to by inner.
4061     */
4062    bool is_owned;
4063 } LDKErrorMessage;
4064
4065
4066
4067 /**
4068  * A warning message to be sent or received from a peer
4069  */
4070 typedef struct MUST_USE_STRUCT LDKWarningMessage {
4071    /**
4072     * A pointer to the opaque Rust object.
4073     * Nearly everywhere, inner must be non-null, however in places where
4074     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4075     */
4076    LDKnativeWarningMessage *inner;
4077    /**
4078     * Indicates that this is the only struct which contains the same pointer.
4079     * Rust functions which take ownership of an object provided via an argument require
4080     * this to be true and invalidate the object pointed to by inner.
4081     */
4082    bool is_owned;
4083 } LDKWarningMessage;
4084
4085 /**
4086  * Used to put an error message in a LightningError
4087  */
4088 typedef enum LDKErrorAction_Tag {
4089    /**
4090     * The peer took some action which made us think they were useless. Disconnect them.
4091     */
4092    LDKErrorAction_DisconnectPeer,
4093    /**
4094     * The peer did something harmless that we weren't able to process, just log and ignore
4095     */
4096    LDKErrorAction_IgnoreError,
4097    /**
4098     * The peer did something harmless that we weren't able to meaningfully process.
4099     * If the error is logged, log it at the given level.
4100     */
4101    LDKErrorAction_IgnoreAndLog,
4102    /**
4103     * The peer provided us with a gossip message which we'd already seen. In most cases this
4104     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
4105     * our own channel announcements.
4106     */
4107    LDKErrorAction_IgnoreDuplicateGossip,
4108    /**
4109     * The peer did something incorrect. Tell them.
4110     */
4111    LDKErrorAction_SendErrorMessage,
4112    /**
4113     * The peer did something incorrect. Tell them without closing any channels.
4114     */
4115    LDKErrorAction_SendWarningMessage,
4116    /**
4117     * Must be last for serialization purposes
4118     */
4119    LDKErrorAction_Sentinel,
4120 } LDKErrorAction_Tag;
4121
4122 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
4123    /**
4124     * An error message which we should make an effort to send before we disconnect.
4125     *
4126     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
4127     */
4128    struct LDKErrorMessage msg;
4129 } LDKErrorAction_LDKDisconnectPeer_Body;
4130
4131 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
4132    /**
4133     * The message to send.
4134     */
4135    struct LDKErrorMessage msg;
4136 } LDKErrorAction_LDKSendErrorMessage_Body;
4137
4138 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
4139    /**
4140     * The message to send.
4141     */
4142    struct LDKWarningMessage msg;
4143    /**
4144     * The peer may have done something harmless that we weren't able to meaningfully process,
4145     * though we should still tell them about it.
4146     * If this event is logged, log it at the given level.
4147     */
4148    enum LDKLevel log_level;
4149 } LDKErrorAction_LDKSendWarningMessage_Body;
4150
4151 typedef struct MUST_USE_STRUCT LDKErrorAction {
4152    LDKErrorAction_Tag tag;
4153    union {
4154       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
4155       struct {
4156          enum LDKLevel ignore_and_log;
4157       };
4158       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
4159       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
4160    };
4161 } LDKErrorAction;
4162
4163
4164
4165 /**
4166  * A query_channel_range message is used to query a peer for channel
4167  * UTXOs in a range of blocks. The recipient of a query makes a best
4168  * effort to reply to the query using one or more reply_channel_range
4169  * messages.
4170  */
4171 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
4172    /**
4173     * A pointer to the opaque Rust object.
4174     * Nearly everywhere, inner must be non-null, however in places where
4175     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4176     */
4177    LDKnativeQueryChannelRange *inner;
4178    /**
4179     * Indicates that this is the only struct which contains the same pointer.
4180     * Rust functions which take ownership of an object provided via an argument require
4181     * this to be true and invalidate the object pointed to by inner.
4182     */
4183    bool is_owned;
4184 } LDKQueryChannelRange;
4185
4186
4187
4188 /**
4189  * A query_short_channel_ids message is used to query a peer for
4190  * routing gossip messages related to one or more short_channel_ids.
4191  * The query recipient will reply with the latest, if available,
4192  * channel_announcement, channel_update and node_announcement messages
4193  * it maintains for the requested short_channel_ids followed by a
4194  * reply_short_channel_ids_end message. The short_channel_ids sent in
4195  * this query are encoded. We only support encoding_type=0 uncompressed
4196  * serialization and do not support encoding_type=1 zlib serialization.
4197  */
4198 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
4199    /**
4200     * A pointer to the opaque Rust object.
4201     * Nearly everywhere, inner must be non-null, however in places where
4202     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4203     */
4204    LDKnativeQueryShortChannelIds *inner;
4205    /**
4206     * Indicates that this is the only struct which contains the same pointer.
4207     * Rust functions which take ownership of an object provided via an argument require
4208     * this to be true and invalidate the object pointed to by inner.
4209     */
4210    bool is_owned;
4211 } LDKQueryShortChannelIds;
4212
4213
4214
4215 /**
4216  * A reply_channel_range message is a reply to a query_channel_range
4217  * message. Multiple reply_channel_range messages can be sent in reply
4218  * to a single query_channel_range message. The query recipient makes a
4219  * best effort to respond based on their local network view which may
4220  * not be a perfect view of the network. The short_channel_ids in the
4221  * reply are encoded. We only support encoding_type=0 uncompressed
4222  * serialization and do not support encoding_type=1 zlib serialization.
4223  */
4224 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
4225    /**
4226     * A pointer to the opaque Rust object.
4227     * Nearly everywhere, inner must be non-null, however in places where
4228     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4229     */
4230    LDKnativeReplyChannelRange *inner;
4231    /**
4232     * Indicates that this is the only struct which contains the same pointer.
4233     * Rust functions which take ownership of an object provided via an argument require
4234     * this to be true and invalidate the object pointed to by inner.
4235     */
4236    bool is_owned;
4237 } LDKReplyChannelRange;
4238
4239
4240
4241 /**
4242  * A gossip_timestamp_filter message is used by a node to request
4243  * gossip relay for messages in the requested time range when the
4244  * gossip_queries feature has been negotiated.
4245  */
4246 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
4247    /**
4248     * A pointer to the opaque Rust object.
4249     * Nearly everywhere, inner must be non-null, however in places where
4250     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4251     */
4252    LDKnativeGossipTimestampFilter *inner;
4253    /**
4254     * Indicates that this is the only struct which contains the same pointer.
4255     * Rust functions which take ownership of an object provided via an argument require
4256     * this to be true and invalidate the object pointed to by inner.
4257     */
4258    bool is_owned;
4259 } LDKGossipTimestampFilter;
4260
4261 /**
4262  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
4263  * broadcast to most peers).
4264  * These events are handled by PeerManager::process_events if you are using a PeerManager.
4265  */
4266 typedef enum LDKMessageSendEvent_Tag {
4267    /**
4268     * Used to indicate that we've accepted a channel open and should send the accept_channel
4269     * message provided to the given peer.
4270     */
4271    LDKMessageSendEvent_SendAcceptChannel,
4272    /**
4273     * Used to indicate that we've initiated a channel open and should send the open_channel
4274     * message provided to the given peer.
4275     */
4276    LDKMessageSendEvent_SendOpenChannel,
4277    /**
4278     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
4279     */
4280    LDKMessageSendEvent_SendFundingCreated,
4281    /**
4282     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
4283     */
4284    LDKMessageSendEvent_SendFundingSigned,
4285    /**
4286     * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
4287     */
4288    LDKMessageSendEvent_SendChannelReady,
4289    /**
4290     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
4291     */
4292    LDKMessageSendEvent_SendAnnouncementSignatures,
4293    /**
4294     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
4295     * message should be sent to the peer with the given node_id.
4296     */
4297    LDKMessageSendEvent_UpdateHTLCs,
4298    /**
4299     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
4300     */
4301    LDKMessageSendEvent_SendRevokeAndACK,
4302    /**
4303     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
4304     */
4305    LDKMessageSendEvent_SendClosingSigned,
4306    /**
4307     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
4308     */
4309    LDKMessageSendEvent_SendShutdown,
4310    /**
4311     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
4312     */
4313    LDKMessageSendEvent_SendChannelReestablish,
4314    /**
4315     * Used to send a channel_announcement and channel_update to a specific peer, likely on
4316     * initial connection to ensure our peers know about our channels.
4317     */
4318    LDKMessageSendEvent_SendChannelAnnouncement,
4319    /**
4320     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
4321     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
4322     *
4323     * Note that after doing so, you very likely (unless you did so very recently) want to
4324     * broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This
4325     * ensures that any nodes which see our channel_announcement also have a relevant
4326     * node_announcement, including relevant feature flags which may be important for routing
4327     * through or to us.
4328     *
4329     * [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement
4330     */
4331    LDKMessageSendEvent_BroadcastChannelAnnouncement,
4332    /**
4333     * Used to indicate that a channel_update should be broadcast to all peers.
4334     */
4335    LDKMessageSendEvent_BroadcastChannelUpdate,
4336    /**
4337     * Used to indicate that a channel_update should be sent to a single peer.
4338     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
4339     * private channel and we shouldn't be informing all of our peers of channel parameters.
4340     */
4341    LDKMessageSendEvent_SendChannelUpdate,
4342    /**
4343     * Broadcast an error downstream to be handled
4344     */
4345    LDKMessageSendEvent_HandleError,
4346    /**
4347     * Query a peer for channels with funding transaction UTXOs in a block range.
4348     */
4349    LDKMessageSendEvent_SendChannelRangeQuery,
4350    /**
4351     * Request routing gossip messages from a peer for a list of channels identified by
4352     * their short_channel_ids.
4353     */
4354    LDKMessageSendEvent_SendShortIdsQuery,
4355    /**
4356     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
4357     * emitted during processing of the query.
4358     */
4359    LDKMessageSendEvent_SendReplyChannelRange,
4360    /**
4361     * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
4362     * enable receiving gossip messages from the peer.
4363     */
4364    LDKMessageSendEvent_SendGossipTimestampFilter,
4365    /**
4366     * Must be last for serialization purposes
4367     */
4368    LDKMessageSendEvent_Sentinel,
4369 } LDKMessageSendEvent_Tag;
4370
4371 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
4372    /**
4373     * The node_id of the node which should receive this message
4374     */
4375    struct LDKPublicKey node_id;
4376    /**
4377     * The message which should be sent.
4378     */
4379    struct LDKAcceptChannel msg;
4380 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
4381
4382 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
4383    /**
4384     * The node_id of the node which should receive this message
4385     */
4386    struct LDKPublicKey node_id;
4387    /**
4388     * The message which should be sent.
4389     */
4390    struct LDKOpenChannel msg;
4391 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
4392
4393 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
4394    /**
4395     * The node_id of the node which should receive this message
4396     */
4397    struct LDKPublicKey node_id;
4398    /**
4399     * The message which should be sent.
4400     */
4401    struct LDKFundingCreated msg;
4402 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
4403
4404 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
4405    /**
4406     * The node_id of the node which should receive this message
4407     */
4408    struct LDKPublicKey node_id;
4409    /**
4410     * The message which should be sent.
4411     */
4412    struct LDKFundingSigned msg;
4413 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
4414
4415 typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body {
4416    /**
4417     * The node_id of the node which should receive these message(s)
4418     */
4419    struct LDKPublicKey node_id;
4420    /**
4421     * The channel_ready message which should be sent.
4422     */
4423    struct LDKChannelReady msg;
4424 } LDKMessageSendEvent_LDKSendChannelReady_Body;
4425
4426 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
4427    /**
4428     * The node_id of the node which should receive these message(s)
4429     */
4430    struct LDKPublicKey node_id;
4431    /**
4432     * The announcement_signatures message which should be sent.
4433     */
4434    struct LDKAnnouncementSignatures msg;
4435 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
4436
4437 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
4438    /**
4439     * The node_id of the node which should receive these message(s)
4440     */
4441    struct LDKPublicKey node_id;
4442    /**
4443     * The update messages which should be sent. ALL messages in the struct should be sent!
4444     */
4445    struct LDKCommitmentUpdate updates;
4446 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
4447
4448 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
4449    /**
4450     * The node_id of the node which should receive this message
4451     */
4452    struct LDKPublicKey node_id;
4453    /**
4454     * The message which should be sent.
4455     */
4456    struct LDKRevokeAndACK msg;
4457 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
4458
4459 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
4460    /**
4461     * The node_id of the node which should receive this message
4462     */
4463    struct LDKPublicKey node_id;
4464    /**
4465     * The message which should be sent.
4466     */
4467    struct LDKClosingSigned msg;
4468 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
4469
4470 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
4471    /**
4472     * The node_id of the node which should receive this message
4473     */
4474    struct LDKPublicKey node_id;
4475    /**
4476     * The message which should be sent.
4477     */
4478    struct LDKShutdown msg;
4479 } LDKMessageSendEvent_LDKSendShutdown_Body;
4480
4481 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
4482    /**
4483     * The node_id of the node which should receive this message
4484     */
4485    struct LDKPublicKey node_id;
4486    /**
4487     * The message which should be sent.
4488     */
4489    struct LDKChannelReestablish msg;
4490 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
4491
4492 typedef struct LDKMessageSendEvent_LDKSendChannelAnnouncement_Body {
4493    /**
4494     * The node_id of the node which should receive this message
4495     */
4496    struct LDKPublicKey node_id;
4497    /**
4498     * The channel_announcement which should be sent.
4499     */
4500    struct LDKChannelAnnouncement msg;
4501    /**
4502     * The followup channel_update which should be sent.
4503     */
4504    struct LDKChannelUpdate update_msg;
4505 } LDKMessageSendEvent_LDKSendChannelAnnouncement_Body;
4506
4507 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
4508    /**
4509     * The channel_announcement which should be sent.
4510     */
4511    struct LDKChannelAnnouncement msg;
4512    /**
4513     * The followup channel_update which should be sent.
4514     */
4515    struct LDKChannelUpdate update_msg;
4516 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
4517
4518 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
4519    /**
4520     * The channel_update which should be sent.
4521     */
4522    struct LDKChannelUpdate msg;
4523 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
4524
4525 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
4526    /**
4527     * The node_id of the node which should receive this message
4528     */
4529    struct LDKPublicKey node_id;
4530    /**
4531     * The channel_update which should be sent.
4532     */
4533    struct LDKChannelUpdate msg;
4534 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
4535
4536 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
4537    /**
4538     * The node_id of the node which should receive this message
4539     */
4540    struct LDKPublicKey node_id;
4541    /**
4542     * The action which should be taken.
4543     */
4544    struct LDKErrorAction action;
4545 } LDKMessageSendEvent_LDKHandleError_Body;
4546
4547 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
4548    /**
4549     * The node_id of this message recipient
4550     */
4551    struct LDKPublicKey node_id;
4552    /**
4553     * The query_channel_range which should be sent.
4554     */
4555    struct LDKQueryChannelRange msg;
4556 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4557
4558 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4559    /**
4560     * The node_id of this message recipient
4561     */
4562    struct LDKPublicKey node_id;
4563    /**
4564     * The query_short_channel_ids which should be sent.
4565     */
4566    struct LDKQueryShortChannelIds msg;
4567 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4568
4569 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4570    /**
4571     * The node_id of this message recipient
4572     */
4573    struct LDKPublicKey node_id;
4574    /**
4575     * The reply_channel_range which should be sent.
4576     */
4577    struct LDKReplyChannelRange msg;
4578 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4579
4580 typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
4581    /**
4582     * The node_id of this message recipient
4583     */
4584    struct LDKPublicKey node_id;
4585    /**
4586     * The gossip_timestamp_filter which should be sent.
4587     */
4588    struct LDKGossipTimestampFilter msg;
4589 } LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
4590
4591 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4592    LDKMessageSendEvent_Tag tag;
4593    union {
4594       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4595       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4596       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4597       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4598       LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready;
4599       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4600       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4601       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4602       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4603       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4604       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4605       LDKMessageSendEvent_LDKSendChannelAnnouncement_Body send_channel_announcement;
4606       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4607       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4608       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
4609       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4610       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4611       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4612       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4613       LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
4614    };
4615 } LDKMessageSendEvent;
4616
4617 /**
4618  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4619  * This corresponds to std::vector in C++
4620  */
4621 typedef struct LDKCVec_MessageSendEventZ {
4622    /**
4623     * The elements in the array.
4624     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4625     */
4626    struct LDKMessageSendEvent *data;
4627    /**
4628     * The number of elements pointed to by `data`.
4629     */
4630    uintptr_t datalen;
4631 } LDKCVec_MessageSendEventZ;
4632
4633 /**
4634  * The contents of CResult_TxOutAccessErrorZ
4635  */
4636 typedef union LDKCResult_TxOutAccessErrorZPtr {
4637    /**
4638     * A pointer to the contents in the success state.
4639     * Reading from this pointer when `result_ok` is not set is undefined.
4640     */
4641    struct LDKTxOut *result;
4642    /**
4643     * A pointer to the contents in the error state.
4644     * Reading from this pointer when `result_ok` is set is undefined.
4645     */
4646    enum LDKAccessError *err;
4647 } LDKCResult_TxOutAccessErrorZPtr;
4648
4649 /**
4650  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4651  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4652  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4653  */
4654 typedef struct LDKCResult_TxOutAccessErrorZ {
4655    /**
4656     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
4657     * `err` or `result` depending on the state of `result_ok`.
4658     */
4659    union LDKCResult_TxOutAccessErrorZPtr contents;
4660    /**
4661     * Whether this CResult_TxOutAccessErrorZ represents a success state.
4662     */
4663    bool result_ok;
4664 } LDKCResult_TxOutAccessErrorZ;
4665
4666 /**
4667  * A tuple of 2 elements. See the individual fields for the types contained.
4668  */
4669 typedef struct LDKC2Tuple_usizeTransactionZ {
4670    /**
4671     * The element at position 0
4672     */
4673    uintptr_t a;
4674    /**
4675     * The element at position 1
4676     */
4677    struct LDKTransaction b;
4678 } LDKC2Tuple_usizeTransactionZ;
4679
4680 /**
4681  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
4682  * This corresponds to std::vector in C++
4683  */
4684 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
4685    /**
4686     * The elements in the array.
4687     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4688     */
4689    struct LDKC2Tuple_usizeTransactionZ *data;
4690    /**
4691     * The number of elements pointed to by `data`.
4692     */
4693    uintptr_t datalen;
4694 } LDKCVec_C2Tuple_usizeTransactionZZ;
4695
4696 /**
4697  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4698  * This corresponds to std::vector in C++
4699  */
4700 typedef struct LDKCVec_TxidZ {
4701    /**
4702     * The elements in the array.
4703     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4704     */
4705    struct LDKThirtyTwoBytes *data;
4706    /**
4707     * The number of elements pointed to by `data`.
4708     */
4709    uintptr_t datalen;
4710 } LDKCVec_TxidZ;
4711
4712 /**
4713  * The contents of CResult_NoneChannelMonitorUpdateErrZ
4714  */
4715 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
4716    /**
4717     * Note that this value is always NULL, as there are no contents in the OK variant
4718     */
4719    void *result;
4720    /**
4721     * A pointer to the contents in the error state.
4722     * Reading from this pointer when `result_ok` is set is undefined.
4723     */
4724    enum LDKChannelMonitorUpdateErr *err;
4725 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
4726
4727 /**
4728  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
4729  * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
4730  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4731  */
4732 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
4733    /**
4734     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
4735     * `err` or `result` depending on the state of `result_ok`.
4736     */
4737    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
4738    /**
4739     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
4740     */
4741    bool result_ok;
4742 } LDKCResult_NoneChannelMonitorUpdateErrZ;
4743
4744
4745
4746 /**
4747  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
4748  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
4749  * preimage claim backward will lead to loss of funds.
4750  */
4751 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
4752    /**
4753     * A pointer to the opaque Rust object.
4754     * Nearly everywhere, inner must be non-null, however in places where
4755     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4756     */
4757    LDKnativeHTLCUpdate *inner;
4758    /**
4759     * Indicates that this is the only struct which contains the same pointer.
4760     * Rust functions which take ownership of an object provided via an argument require
4761     * this to be true and invalidate the object pointed to by inner.
4762     */
4763    bool is_owned;
4764 } LDKHTLCUpdate;
4765
4766 /**
4767  * An event to be processed by the ChannelManager.
4768  */
4769 typedef enum LDKMonitorEvent_Tag {
4770    /**
4771     * A monitor event containing an HTLCUpdate.
4772     */
4773    LDKMonitorEvent_HTLCEvent,
4774    /**
4775     * A monitor event that the Channel's commitment transaction was confirmed.
4776     */
4777    LDKMonitorEvent_CommitmentTxConfirmed,
4778    /**
4779     * Indicates a [`ChannelMonitor`] update has completed. See
4780     * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
4781     *
4782     * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
4783     */
4784    LDKMonitorEvent_UpdateCompleted,
4785    /**
4786     * Indicates a [`ChannelMonitor`] update has failed. See
4787     * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
4788     *
4789     * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
4790     */
4791    LDKMonitorEvent_UpdateFailed,
4792    /**
4793     * Must be last for serialization purposes
4794     */
4795    LDKMonitorEvent_Sentinel,
4796 } LDKMonitorEvent_Tag;
4797
4798 typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
4799    /**
4800     * The funding outpoint of the [`ChannelMonitor`] that was updated
4801     */
4802    struct LDKOutPoint funding_txo;
4803    /**
4804     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
4805     * [`ChannelMonitor::get_latest_update_id`].
4806     *
4807     * Note that this should only be set to a given update's ID if all previous updates for the
4808     * same [`ChannelMonitor`] have been applied and persisted.
4809     */
4810    uint64_t monitor_update_id;
4811 } LDKMonitorEvent_LDKUpdateCompleted_Body;
4812
4813 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
4814    LDKMonitorEvent_Tag tag;
4815    union {
4816       struct {
4817          struct LDKHTLCUpdate htlc_event;
4818       };
4819       struct {
4820          struct LDKOutPoint commitment_tx_confirmed;
4821       };
4822       LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
4823       struct {
4824          struct LDKOutPoint update_failed;
4825       };
4826    };
4827 } LDKMonitorEvent;
4828
4829 /**
4830  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4831  * This corresponds to std::vector in C++
4832  */
4833 typedef struct LDKCVec_MonitorEventZ {
4834    /**
4835     * The elements in the array.
4836     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4837     */
4838    struct LDKMonitorEvent *data;
4839    /**
4840     * The number of elements pointed to by `data`.
4841     */
4842    uintptr_t datalen;
4843 } LDKCVec_MonitorEventZ;
4844
4845 /**
4846  * A tuple of 3 elements. See the individual fields for the types contained.
4847  */
4848 typedef struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4849    /**
4850     * The element at position 0
4851     */
4852    struct LDKOutPoint a;
4853    /**
4854     * The element at position 1
4855     */
4856    struct LDKCVec_MonitorEventZ b;
4857    /**
4858     * The element at position 2
4859     */
4860    struct LDKPublicKey c;
4861 } LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ;
4862
4863 /**
4864  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
4865  * This corresponds to std::vector in C++
4866  */
4867 typedef struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4868    /**
4869     * The elements in the array.
4870     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4871     */
4872    struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *data;
4873    /**
4874     * The number of elements pointed to by `data`.
4875     */
4876    uintptr_t datalen;
4877 } LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ;
4878
4879
4880
4881 /**
4882  * [`Score`] implementation that uses a fixed penalty.
4883  */
4884 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
4885    /**
4886     * A pointer to the opaque Rust object.
4887     * Nearly everywhere, inner must be non-null, however in places where
4888     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4889     */
4890    LDKnativeFixedPenaltyScorer *inner;
4891    /**
4892     * Indicates that this is the only struct which contains the same pointer.
4893     * Rust functions which take ownership of an object provided via an argument require
4894     * this to be true and invalidate the object pointed to by inner.
4895     */
4896    bool is_owned;
4897 } LDKFixedPenaltyScorer;
4898
4899 /**
4900  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4901  */
4902 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
4903    /**
4904     * A pointer to the contents in the success state.
4905     * Reading from this pointer when `result_ok` is not set is undefined.
4906     */
4907    struct LDKFixedPenaltyScorer *result;
4908    /**
4909     * A pointer to the contents in the error state.
4910     * Reading from this pointer when `result_ok` is set is undefined.
4911     */
4912    struct LDKDecodeError *err;
4913 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
4914
4915 /**
4916  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4917  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4918  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4919  */
4920 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
4921    /**
4922     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4923     * `err` or `result` depending on the state of `result_ok`.
4924     */
4925    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
4926    /**
4927     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4928     */
4929    bool result_ok;
4930 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
4931
4932 /**
4933  * A tuple of 2 elements. See the individual fields for the types contained.
4934  */
4935 typedef struct LDKC2Tuple_u64u64Z {
4936    /**
4937     * The element at position 0
4938     */
4939    uint64_t a;
4940    /**
4941     * The element at position 1
4942     */
4943    uint64_t b;
4944 } LDKC2Tuple_u64u64Z;
4945
4946 /**
4947  * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4948  */
4949 typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag {
4950    /**
4951     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4952     */
4953    LDKCOption_C2Tuple_u64u64ZZ_Some,
4954    /**
4955     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4956     */
4957    LDKCOption_C2Tuple_u64u64ZZ_None,
4958    /**
4959     * Must be last for serialization purposes
4960     */
4961    LDKCOption_C2Tuple_u64u64ZZ_Sentinel,
4962 } LDKCOption_C2Tuple_u64u64ZZ_Tag;
4963
4964 typedef struct LDKCOption_C2Tuple_u64u64ZZ {
4965    LDKCOption_C2Tuple_u64u64ZZ_Tag tag;
4966    union {
4967       struct {
4968          struct LDKC2Tuple_u64u64Z some;
4969       };
4970    };
4971 } LDKCOption_C2Tuple_u64u64ZZ;
4972
4973 /**
4974  * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4975  * This corresponds to std::vector in C++
4976  */
4977 typedef struct LDKCVec_NodeIdZ {
4978    /**
4979     * The elements in the array.
4980     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4981     */
4982    struct LDKNodeId *data;
4983    /**
4984     * The number of elements pointed to by `data`.
4985     */
4986    uintptr_t datalen;
4987 } LDKCVec_NodeIdZ;
4988
4989
4990
4991 /**
4992  * A Record, unit of logging output with Metadata to enable filtering
4993  * Module_path, file, line to inform on log's source
4994  */
4995 typedef struct MUST_USE_STRUCT LDKRecord {
4996    /**
4997     * A pointer to the opaque Rust object.
4998     * Nearly everywhere, inner must be non-null, however in places where
4999     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5000     */
5001    LDKnativeRecord *inner;
5002    /**
5003     * Indicates that this is the only struct which contains the same pointer.
5004     * Rust functions which take ownership of an object provided via an argument require
5005     * this to be true and invalidate the object pointed to by inner.
5006     */
5007    bool is_owned;
5008 } LDKRecord;
5009
5010 /**
5011  * A trait encapsulating the operations required of a logger
5012  */
5013 typedef struct LDKLogger {
5014    /**
5015     * An opaque pointer which is passed to your function implementations as an argument.
5016     * This has no meaning in the LDK, and can be NULL or any other value.
5017     */
5018    void *this_arg;
5019    /**
5020     * Logs the `Record`
5021     */
5022    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
5023    /**
5024     * Frees any resources associated with this object given its this_arg pointer.
5025     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5026     */
5027    void (*free)(void *this_arg);
5028 } LDKLogger;
5029
5030
5031
5032 /**
5033  * Represents the network as nodes and channels between them
5034  */
5035 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
5036    /**
5037     * A pointer to the opaque Rust object.
5038     * Nearly everywhere, inner must be non-null, however in places where
5039     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5040     */
5041    LDKnativeNetworkGraph *inner;
5042    /**
5043     * Indicates that this is the only struct which contains the same pointer.
5044     * Rust functions which take ownership of an object provided via an argument require
5045     * this to be true and invalidate the object pointed to by inner.
5046     */
5047    bool is_owned;
5048 } LDKNetworkGraph;
5049
5050
5051
5052 /**
5053  * [`Score`] implementation using channel success probability distributions.
5054  *
5055  * Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
5056  * and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability
5057  * distributions are defined based on knowledge learned from successful and unsuccessful attempts.
5058  * Then the negative `log10` of the success probability is used to determine the cost of routing a
5059  * specific HTLC amount through a channel.
5060  *
5061  * Knowledge about channel liquidity balances takes the form of upper and lower bounds on the
5062  * possible liquidity. Certainty of the bounds is decreased over time using a decay function. See
5063  * [`ProbabilisticScoringParameters`] for details.
5064  *
5065  * Since the scorer aims to learn the current channel liquidity balances, it works best for nodes
5066  * with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment
5067  * volume are more likely to experience failed payment paths, which would need to be retried.
5068  *
5069  * # Note
5070  *
5071  * Mixing the `no-std` feature between serialization and deserialization results in undefined
5072  * behavior.
5073  *
5074  * [1]: https://arxiv.org/abs/2107.05322
5075  */
5076 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
5077    /**
5078     * A pointer to the opaque Rust object.
5079     * Nearly everywhere, inner must be non-null, however in places where
5080     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5081     */
5082    LDKnativeProbabilisticScorer *inner;
5083    /**
5084     * Indicates that this is the only struct which contains the same pointer.
5085     * Rust functions which take ownership of an object provided via an argument require
5086     * this to be true and invalidate the object pointed to by inner.
5087     */
5088    bool is_owned;
5089 } LDKProbabilisticScorer;
5090
5091 /**
5092  * The contents of CResult_ProbabilisticScorerDecodeErrorZ
5093  */
5094 typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
5095    /**
5096     * A pointer to the contents in the success state.
5097     * Reading from this pointer when `result_ok` is not set is undefined.
5098     */
5099    struct LDKProbabilisticScorer *result;
5100    /**
5101     * A pointer to the contents in the error state.
5102     * Reading from this pointer when `result_ok` is set is undefined.
5103     */
5104    struct LDKDecodeError *err;
5105 } LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
5106
5107 /**
5108  * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
5109  * containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5110  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5111  */
5112 typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ {
5113    /**
5114     * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
5115     * `err` or `result` depending on the state of `result_ok`.
5116     */
5117    union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
5118    /**
5119     * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
5120     */
5121    bool result_ok;
5122 } LDKCResult_ProbabilisticScorerDecodeErrorZ;
5123
5124
5125
5126 /**
5127  * Features used within an `init` message.
5128  */
5129 typedef struct MUST_USE_STRUCT LDKInitFeatures {
5130    /**
5131     * A pointer to the opaque Rust object.
5132     * Nearly everywhere, inner must be non-null, however in places where
5133     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5134     */
5135    LDKnativeInitFeatures *inner;
5136    /**
5137     * Indicates that this is the only struct which contains the same pointer.
5138     * Rust functions which take ownership of an object provided via an argument require
5139     * this to be true and invalidate the object pointed to by inner.
5140     */
5141    bool is_owned;
5142 } LDKInitFeatures;
5143
5144 /**
5145  * The contents of CResult_InitFeaturesDecodeErrorZ
5146  */
5147 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
5148    /**
5149     * A pointer to the contents in the success state.
5150     * Reading from this pointer when `result_ok` is not set is undefined.
5151     */
5152    struct LDKInitFeatures *result;
5153    /**
5154     * A pointer to the contents in the error state.
5155     * Reading from this pointer when `result_ok` is set is undefined.
5156     */
5157    struct LDKDecodeError *err;
5158 } LDKCResult_InitFeaturesDecodeErrorZPtr;
5159
5160 /**
5161  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5162  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5163  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5164  */
5165 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
5166    /**
5167     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5168     * `err` or `result` depending on the state of `result_ok`.
5169     */
5170    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
5171    /**
5172     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5173     */
5174    bool result_ok;
5175 } LDKCResult_InitFeaturesDecodeErrorZ;
5176
5177
5178
5179 /**
5180  * Features used within a `channel_announcement` message.
5181  */
5182 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
5183    /**
5184     * A pointer to the opaque Rust object.
5185     * Nearly everywhere, inner must be non-null, however in places where
5186     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5187     */
5188    LDKnativeChannelFeatures *inner;
5189    /**
5190     * Indicates that this is the only struct which contains the same pointer.
5191     * Rust functions which take ownership of an object provided via an argument require
5192     * this to be true and invalidate the object pointed to by inner.
5193     */
5194    bool is_owned;
5195 } LDKChannelFeatures;
5196
5197 /**
5198  * The contents of CResult_ChannelFeaturesDecodeErrorZ
5199  */
5200 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
5201    /**
5202     * A pointer to the contents in the success state.
5203     * Reading from this pointer when `result_ok` is not set is undefined.
5204     */
5205    struct LDKChannelFeatures *result;
5206    /**
5207     * A pointer to the contents in the error state.
5208     * Reading from this pointer when `result_ok` is set is undefined.
5209     */
5210    struct LDKDecodeError *err;
5211 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
5212
5213 /**
5214  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5215  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5216  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5217  */
5218 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
5219    /**
5220     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5221     * `err` or `result` depending on the state of `result_ok`.
5222     */
5223    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
5224    /**
5225     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5226     */
5227    bool result_ok;
5228 } LDKCResult_ChannelFeaturesDecodeErrorZ;
5229
5230
5231
5232 /**
5233  * Features used within a `node_announcement` message.
5234  */
5235 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
5236    /**
5237     * A pointer to the opaque Rust object.
5238     * Nearly everywhere, inner must be non-null, however in places where
5239     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5240     */
5241    LDKnativeNodeFeatures *inner;
5242    /**
5243     * Indicates that this is the only struct which contains the same pointer.
5244     * Rust functions which take ownership of an object provided via an argument require
5245     * this to be true and invalidate the object pointed to by inner.
5246     */
5247    bool is_owned;
5248 } LDKNodeFeatures;
5249
5250 /**
5251  * The contents of CResult_NodeFeaturesDecodeErrorZ
5252  */
5253 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
5254    /**
5255     * A pointer to the contents in the success state.
5256     * Reading from this pointer when `result_ok` is not set is undefined.
5257     */
5258    struct LDKNodeFeatures *result;
5259    /**
5260     * A pointer to the contents in the error state.
5261     * Reading from this pointer when `result_ok` is set is undefined.
5262     */
5263    struct LDKDecodeError *err;
5264 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
5265
5266 /**
5267  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5268  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5269  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5270  */
5271 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
5272    /**
5273     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5274     * `err` or `result` depending on the state of `result_ok`.
5275     */
5276    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
5277    /**
5278     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5279     */
5280    bool result_ok;
5281 } LDKCResult_NodeFeaturesDecodeErrorZ;
5282
5283
5284
5285 /**
5286  * Features used within an invoice.
5287  */
5288 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
5289    /**
5290     * A pointer to the opaque Rust object.
5291     * Nearly everywhere, inner must be non-null, however in places where
5292     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5293     */
5294    LDKnativeInvoiceFeatures *inner;
5295    /**
5296     * Indicates that this is the only struct which contains the same pointer.
5297     * Rust functions which take ownership of an object provided via an argument require
5298     * this to be true and invalidate the object pointed to by inner.
5299     */
5300    bool is_owned;
5301 } LDKInvoiceFeatures;
5302
5303 /**
5304  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
5305  */
5306 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
5307    /**
5308     * A pointer to the contents in the success state.
5309     * Reading from this pointer when `result_ok` is not set is undefined.
5310     */
5311    struct LDKInvoiceFeatures *result;
5312    /**
5313     * A pointer to the contents in the error state.
5314     * Reading from this pointer when `result_ok` is set is undefined.
5315     */
5316    struct LDKDecodeError *err;
5317 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
5318
5319 /**
5320  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5321  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5322  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5323  */
5324 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
5325    /**
5326     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5327     * `err` or `result` depending on the state of `result_ok`.
5328     */
5329    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
5330    /**
5331     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5332     */
5333    bool result_ok;
5334 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
5335
5336 /**
5337  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
5338  */
5339 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
5340    /**
5341     * A pointer to the contents in the success state.
5342     * Reading from this pointer when `result_ok` is not set is undefined.
5343     */
5344    struct LDKChannelTypeFeatures *result;
5345    /**
5346     * A pointer to the contents in the error state.
5347     * Reading from this pointer when `result_ok` is set is undefined.
5348     */
5349    struct LDKDecodeError *err;
5350 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
5351
5352 /**
5353  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
5354  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5355  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5356  */
5357 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
5358    /**
5359     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
5360     * `err` or `result` depending on the state of `result_ok`.
5361     */
5362    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
5363    /**
5364     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
5365     */
5366    bool result_ok;
5367 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
5368
5369 /**
5370  * The contents of CResult_NodeIdDecodeErrorZ
5371  */
5372 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
5373    /**
5374     * A pointer to the contents in the success state.
5375     * Reading from this pointer when `result_ok` is not set is undefined.
5376     */
5377    struct LDKNodeId *result;
5378    /**
5379     * A pointer to the contents in the error state.
5380     * Reading from this pointer when `result_ok` is set is undefined.
5381     */
5382    struct LDKDecodeError *err;
5383 } LDKCResult_NodeIdDecodeErrorZPtr;
5384
5385 /**
5386  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5387  * containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5388  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5389  */
5390 typedef struct LDKCResult_NodeIdDecodeErrorZ {
5391    /**
5392     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5393     * `err` or `result` depending on the state of `result_ok`.
5394     */
5395    union LDKCResult_NodeIdDecodeErrorZPtr contents;
5396    /**
5397     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5398     */
5399    bool result_ok;
5400 } LDKCResult_NodeIdDecodeErrorZ;
5401
5402 /**
5403  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
5404  */
5405 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
5406    /**
5407     * A pointer to the contents in the success state.
5408     * Reading from this pointer when `result_ok` is not set is undefined.
5409     */
5410    struct LDKCOption_NetworkUpdateZ *result;
5411    /**
5412     * A pointer to the contents in the error state.
5413     * Reading from this pointer when `result_ok` is set is undefined.
5414     */
5415    struct LDKDecodeError *err;
5416 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
5417
5418 /**
5419  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
5420  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5421  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5422  */
5423 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
5424    /**
5425     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
5426     * `err` or `result` depending on the state of `result_ok`.
5427     */
5428    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
5429    /**
5430     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
5431     */
5432    bool result_ok;
5433 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
5434
5435 /**
5436  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
5437  * UTXOs.
5438  */
5439 typedef struct LDKAccess {
5440    /**
5441     * An opaque pointer which is passed to your function implementations as an argument.
5442     * This has no meaning in the LDK, and can be NULL or any other value.
5443     */
5444    void *this_arg;
5445    /**
5446     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
5447     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
5448     * is unknown.
5449     *
5450     * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
5451     */
5452    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
5453    /**
5454     * Frees any resources associated with this object given its this_arg pointer.
5455     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5456     */
5457    void (*free)(void *this_arg);
5458 } LDKAccess;
5459
5460 /**
5461  * An enum which can either contain a crate::lightning::chain::Access or not
5462  */
5463 typedef enum LDKCOption_AccessZ_Tag {
5464    /**
5465     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
5466     */
5467    LDKCOption_AccessZ_Some,
5468    /**
5469     * When we're in this state, this COption_AccessZ contains nothing
5470     */
5471    LDKCOption_AccessZ_None,
5472    /**
5473     * Must be last for serialization purposes
5474     */
5475    LDKCOption_AccessZ_Sentinel,
5476 } LDKCOption_AccessZ_Tag;
5477
5478 typedef struct LDKCOption_AccessZ {
5479    LDKCOption_AccessZ_Tag tag;
5480    union {
5481       struct {
5482          struct LDKAccess some;
5483       };
5484    };
5485 } LDKCOption_AccessZ;
5486
5487 /**
5488  * The contents of CResult_boolLightningErrorZ
5489  */
5490 typedef union LDKCResult_boolLightningErrorZPtr {
5491    /**
5492     * A pointer to the contents in the success state.
5493     * Reading from this pointer when `result_ok` is not set is undefined.
5494     */
5495    bool *result;
5496    /**
5497     * A pointer to the contents in the error state.
5498     * Reading from this pointer when `result_ok` is set is undefined.
5499     */
5500    struct LDKLightningError *err;
5501 } LDKCResult_boolLightningErrorZPtr;
5502
5503 /**
5504  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
5505  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5506  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5507  */
5508 typedef struct LDKCResult_boolLightningErrorZ {
5509    /**
5510     * The contents of this CResult_boolLightningErrorZ, accessible via either
5511     * `err` or `result` depending on the state of `result_ok`.
5512     */
5513    union LDKCResult_boolLightningErrorZPtr contents;
5514    /**
5515     * Whether this CResult_boolLightningErrorZ represents a success state.
5516     */
5517    bool result_ok;
5518 } LDKCResult_boolLightningErrorZ;
5519
5520 /**
5521  * A tuple of 3 elements. See the individual fields for the types contained.
5522  */
5523 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5524    /**
5525     * The element at position 0
5526     */
5527    struct LDKChannelAnnouncement a;
5528    /**
5529     * The element at position 1
5530     */
5531    struct LDKChannelUpdate b;
5532    /**
5533     * The element at position 2
5534     */
5535    struct LDKChannelUpdate c;
5536 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
5537
5538 /**
5539  * An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
5540  */
5541 typedef enum LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag {
5542    /**
5543     * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5544     */
5545    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some,
5546    /**
5547     * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
5548     */
5549    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None,
5550    /**
5551     * Must be last for serialization purposes
5552     */
5553    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Sentinel,
5554 } LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag;
5555
5556 typedef struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5557    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag tag;
5558    union {
5559       struct {
5560          struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ some;
5561       };
5562    };
5563 } LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
5564
5565 /**
5566  * The contents of CResult_NoneLightningErrorZ
5567  */
5568 typedef union LDKCResult_NoneLightningErrorZPtr {
5569    /**
5570     * Note that this value is always NULL, as there are no contents in the OK variant
5571     */
5572    void *result;
5573    /**
5574     * A pointer to the contents in the error state.
5575     * Reading from this pointer when `result_ok` is set is undefined.
5576     */
5577    struct LDKLightningError *err;
5578 } LDKCResult_NoneLightningErrorZPtr;
5579
5580 /**
5581  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5582  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5583  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5584  */
5585 typedef struct LDKCResult_NoneLightningErrorZ {
5586    /**
5587     * The contents of this CResult_NoneLightningErrorZ, accessible via either
5588     * `err` or `result` depending on the state of `result_ok`.
5589     */
5590    union LDKCResult_NoneLightningErrorZPtr contents;
5591    /**
5592     * Whether this CResult_NoneLightningErrorZ represents a success state.
5593     */
5594    bool result_ok;
5595 } LDKCResult_NoneLightningErrorZ;
5596
5597
5598
5599 /**
5600  * Details about one direction of a channel as received within a [`ChannelUpdate`].
5601  */
5602 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
5603    /**
5604     * A pointer to the opaque Rust object.
5605     * Nearly everywhere, inner must be non-null, however in places where
5606     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5607     */
5608    LDKnativeChannelUpdateInfo *inner;
5609    /**
5610     * Indicates that this is the only struct which contains the same pointer.
5611     * Rust functions which take ownership of an object provided via an argument require
5612     * this to be true and invalidate the object pointed to by inner.
5613     */
5614    bool is_owned;
5615 } LDKChannelUpdateInfo;
5616
5617 /**
5618  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5619  */
5620 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
5621    /**
5622     * A pointer to the contents in the success state.
5623     * Reading from this pointer when `result_ok` is not set is undefined.
5624     */
5625    struct LDKChannelUpdateInfo *result;
5626    /**
5627     * A pointer to the contents in the error state.
5628     * Reading from this pointer when `result_ok` is set is undefined.
5629     */
5630    struct LDKDecodeError *err;
5631 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
5632
5633 /**
5634  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5635  * containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5636  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5637  */
5638 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
5639    /**
5640     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5641     * `err` or `result` depending on the state of `result_ok`.
5642     */
5643    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
5644    /**
5645     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5646     */
5647    bool result_ok;
5648 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
5649
5650
5651
5652 /**
5653  * Details about a channel (both directions).
5654  * Received within a channel announcement.
5655  */
5656 typedef struct MUST_USE_STRUCT LDKChannelInfo {
5657    /**
5658     * A pointer to the opaque Rust object.
5659     * Nearly everywhere, inner must be non-null, however in places where
5660     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5661     */
5662    LDKnativeChannelInfo *inner;
5663    /**
5664     * Indicates that this is the only struct which contains the same pointer.
5665     * Rust functions which take ownership of an object provided via an argument require
5666     * this to be true and invalidate the object pointed to by inner.
5667     */
5668    bool is_owned;
5669 } LDKChannelInfo;
5670
5671 /**
5672  * The contents of CResult_ChannelInfoDecodeErrorZ
5673  */
5674 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
5675    /**
5676     * A pointer to the contents in the success state.
5677     * Reading from this pointer when `result_ok` is not set is undefined.
5678     */
5679    struct LDKChannelInfo *result;
5680    /**
5681     * A pointer to the contents in the error state.
5682     * Reading from this pointer when `result_ok` is set is undefined.
5683     */
5684    struct LDKDecodeError *err;
5685 } LDKCResult_ChannelInfoDecodeErrorZPtr;
5686
5687 /**
5688  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5689  * containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5690  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5691  */
5692 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
5693    /**
5694     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5695     * `err` or `result` depending on the state of `result_ok`.
5696     */
5697    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
5698    /**
5699     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5700     */
5701    bool result_ok;
5702 } LDKCResult_ChannelInfoDecodeErrorZ;
5703
5704
5705
5706 /**
5707  * Fees for routing via a given channel or a node
5708  */
5709 typedef struct MUST_USE_STRUCT LDKRoutingFees {
5710    /**
5711     * A pointer to the opaque Rust object.
5712     * Nearly everywhere, inner must be non-null, however in places where
5713     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5714     */
5715    LDKnativeRoutingFees *inner;
5716    /**
5717     * Indicates that this is the only struct which contains the same pointer.
5718     * Rust functions which take ownership of an object provided via an argument require
5719     * this to be true and invalidate the object pointed to by inner.
5720     */
5721    bool is_owned;
5722 } LDKRoutingFees;
5723
5724 /**
5725  * The contents of CResult_RoutingFeesDecodeErrorZ
5726  */
5727 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
5728    /**
5729     * A pointer to the contents in the success state.
5730     * Reading from this pointer when `result_ok` is not set is undefined.
5731     */
5732    struct LDKRoutingFees *result;
5733    /**
5734     * A pointer to the contents in the error state.
5735     * Reading from this pointer when `result_ok` is set is undefined.
5736     */
5737    struct LDKDecodeError *err;
5738 } LDKCResult_RoutingFeesDecodeErrorZPtr;
5739
5740 /**
5741  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5742  * containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5743  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5744  */
5745 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
5746    /**
5747     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5748     * `err` or `result` depending on the state of `result_ok`.
5749     */
5750    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
5751    /**
5752     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5753     */
5754    bool result_ok;
5755 } LDKCResult_RoutingFeesDecodeErrorZ;
5756
5757 /**
5758  * A 4-byte byte array.
5759  */
5760 typedef struct LDKFourBytes {
5761    /**
5762     * The four bytes
5763     */
5764    uint8_t data[4];
5765 } LDKFourBytes;
5766
5767 /**
5768  * A 16-byte byte array.
5769  */
5770 typedef struct LDKSixteenBytes {
5771    /**
5772     * The sixteen bytes
5773     */
5774    uint8_t data[16];
5775 } LDKSixteenBytes;
5776
5777 /**
5778  * A 12-byte byte array.
5779  */
5780 typedef struct LDKTwelveBytes {
5781    /**
5782     * The twelve bytes
5783     */
5784    uint8_t data[12];
5785 } LDKTwelveBytes;
5786
5787
5788
5789 /**
5790  * Represents a hostname for serialization purposes.
5791  * Only the character set and length will be validated.
5792  * The character set consists of ASCII alphanumeric characters, hyphens, and periods.
5793  * Its length is guaranteed to be representable by a single byte.
5794  * This serialization is used by BOLT 7 hostnames.
5795  */
5796 typedef struct MUST_USE_STRUCT LDKHostname {
5797    /**
5798     * A pointer to the opaque Rust object.
5799     * Nearly everywhere, inner must be non-null, however in places where
5800     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5801     */
5802    LDKnativeHostname *inner;
5803    /**
5804     * Indicates that this is the only struct which contains the same pointer.
5805     * Rust functions which take ownership of an object provided via an argument require
5806     * this to be true and invalidate the object pointed to by inner.
5807     */
5808    bool is_owned;
5809 } LDKHostname;
5810
5811 /**
5812  * An address which can be used to connect to a remote peer
5813  */
5814 typedef enum LDKNetAddress_Tag {
5815    /**
5816     * An IPv4 address/port on which the peer is listening.
5817     */
5818    LDKNetAddress_IPv4,
5819    /**
5820     * An IPv6 address/port on which the peer is listening.
5821     */
5822    LDKNetAddress_IPv6,
5823    /**
5824     * An old-style Tor onion address/port on which the peer is listening.
5825     *
5826     * This field is deprecated and the Tor network generally no longer supports V2 Onion
5827     * addresses. Thus, the details are not parsed here.
5828     */
5829    LDKNetAddress_OnionV2,
5830    /**
5831     * A new-style Tor onion address/port on which the peer is listening.
5832     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
5833     * wrap as base32 and append \".onion\".
5834     */
5835    LDKNetAddress_OnionV3,
5836    /**
5837     * A hostname/port on which the peer is listening.
5838     */
5839    LDKNetAddress_Hostname,
5840    /**
5841     * Must be last for serialization purposes
5842     */
5843    LDKNetAddress_Sentinel,
5844 } LDKNetAddress_Tag;
5845
5846 typedef struct LDKNetAddress_LDKIPv4_Body {
5847    /**
5848     * The 4-byte IPv4 address
5849     */
5850    struct LDKFourBytes addr;
5851    /**
5852     * The port on which the node is listening
5853     */
5854    uint16_t port;
5855 } LDKNetAddress_LDKIPv4_Body;
5856
5857 typedef struct LDKNetAddress_LDKIPv6_Body {
5858    /**
5859     * The 16-byte IPv6 address
5860     */
5861    struct LDKSixteenBytes addr;
5862    /**
5863     * The port on which the node is listening
5864     */
5865    uint16_t port;
5866 } LDKNetAddress_LDKIPv6_Body;
5867
5868 typedef struct LDKNetAddress_LDKOnionV3_Body {
5869    /**
5870     * The ed25519 long-term public key of the peer
5871     */
5872    struct LDKThirtyTwoBytes ed25519_pubkey;
5873    /**
5874     * The checksum of the pubkey and version, as included in the onion address
5875     */
5876    uint16_t checksum;
5877    /**
5878     * The version byte, as defined by the Tor Onion v3 spec.
5879     */
5880    uint8_t version;
5881    /**
5882     * The port on which the node is listening
5883     */
5884    uint16_t port;
5885 } LDKNetAddress_LDKOnionV3_Body;
5886
5887 typedef struct LDKNetAddress_LDKHostname_Body {
5888    /**
5889     * The hostname on which the node is listening.
5890     */
5891    struct LDKHostname hostname;
5892    /**
5893     * The port on which the node is listening.
5894     */
5895    uint16_t port;
5896 } LDKNetAddress_LDKHostname_Body;
5897
5898 typedef struct MUST_USE_STRUCT LDKNetAddress {
5899    LDKNetAddress_Tag tag;
5900    union {
5901       LDKNetAddress_LDKIPv4_Body i_pv4;
5902       LDKNetAddress_LDKIPv6_Body i_pv6;
5903       struct {
5904          struct LDKTwelveBytes onion_v2;
5905       };
5906       LDKNetAddress_LDKOnionV3_Body onion_v3;
5907       LDKNetAddress_LDKHostname_Body hostname;
5908    };
5909 } LDKNetAddress;
5910
5911 /**
5912  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5913  * This corresponds to std::vector in C++
5914  */
5915 typedef struct LDKCVec_NetAddressZ {
5916    /**
5917     * The elements in the array.
5918     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5919     */
5920    struct LDKNetAddress *data;
5921    /**
5922     * The number of elements pointed to by `data`.
5923     */
5924    uintptr_t datalen;
5925 } LDKCVec_NetAddressZ;
5926
5927
5928
5929 /**
5930  * Information received in the latest node_announcement from this node.
5931  */
5932 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
5933    /**
5934     * A pointer to the opaque Rust object.
5935     * Nearly everywhere, inner must be non-null, however in places where
5936     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5937     */
5938    LDKnativeNodeAnnouncementInfo *inner;
5939    /**
5940     * Indicates that this is the only struct which contains the same pointer.
5941     * Rust functions which take ownership of an object provided via an argument require
5942     * this to be true and invalidate the object pointed to by inner.
5943     */
5944    bool is_owned;
5945 } LDKNodeAnnouncementInfo;
5946
5947 /**
5948  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5949  */
5950 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
5951    /**
5952     * A pointer to the contents in the success state.
5953     * Reading from this pointer when `result_ok` is not set is undefined.
5954     */
5955    struct LDKNodeAnnouncementInfo *result;
5956    /**
5957     * A pointer to the contents in the error state.
5958     * Reading from this pointer when `result_ok` is set is undefined.
5959     */
5960    struct LDKDecodeError *err;
5961 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
5962
5963 /**
5964  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5965  * containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5966  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5967  */
5968 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
5969    /**
5970     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5971     * `err` or `result` depending on the state of `result_ok`.
5972     */
5973    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
5974    /**
5975     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5976     */
5977    bool result_ok;
5978 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
5979
5980
5981
5982 /**
5983  * A user-defined name for a node, which may be used when displaying the node in a graph.
5984  *
5985  * Since node aliases are provided by third parties, they are a potential avenue for injection
5986  * attacks. Care must be taken when processing.
5987  */
5988 typedef struct MUST_USE_STRUCT LDKNodeAlias {
5989    /**
5990     * A pointer to the opaque Rust object.
5991     * Nearly everywhere, inner must be non-null, however in places where
5992     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5993     */
5994    LDKnativeNodeAlias *inner;
5995    /**
5996     * Indicates that this is the only struct which contains the same pointer.
5997     * Rust functions which take ownership of an object provided via an argument require
5998     * this to be true and invalidate the object pointed to by inner.
5999     */
6000    bool is_owned;
6001 } LDKNodeAlias;
6002
6003 /**
6004  * The contents of CResult_NodeAliasDecodeErrorZ
6005  */
6006 typedef union LDKCResult_NodeAliasDecodeErrorZPtr {
6007    /**
6008     * A pointer to the contents in the success state.
6009     * Reading from this pointer when `result_ok` is not set is undefined.
6010     */
6011    struct LDKNodeAlias *result;
6012    /**
6013     * A pointer to the contents in the error state.
6014     * Reading from this pointer when `result_ok` is set is undefined.
6015     */
6016    struct LDKDecodeError *err;
6017 } LDKCResult_NodeAliasDecodeErrorZPtr;
6018
6019 /**
6020  * A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
6021  * containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
6022  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6023  */
6024 typedef struct LDKCResult_NodeAliasDecodeErrorZ {
6025    /**
6026     * The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
6027     * `err` or `result` depending on the state of `result_ok`.
6028     */
6029    union LDKCResult_NodeAliasDecodeErrorZPtr contents;
6030    /**
6031     * Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
6032     */
6033    bool result_ok;
6034 } LDKCResult_NodeAliasDecodeErrorZ;
6035
6036
6037
6038 /**
6039  * Details about a node in the network, known from the network announcement.
6040  */
6041 typedef struct MUST_USE_STRUCT LDKNodeInfo {
6042    /**
6043     * A pointer to the opaque Rust object.
6044     * Nearly everywhere, inner must be non-null, however in places where
6045     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6046     */
6047    LDKnativeNodeInfo *inner;
6048    /**
6049     * Indicates that this is the only struct which contains the same pointer.
6050     * Rust functions which take ownership of an object provided via an argument require
6051     * this to be true and invalidate the object pointed to by inner.
6052     */
6053    bool is_owned;
6054 } LDKNodeInfo;
6055
6056 /**
6057  * The contents of CResult_NodeInfoDecodeErrorZ
6058  */
6059 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
6060    /**
6061     * A pointer to the contents in the success state.
6062     * Reading from this pointer when `result_ok` is not set is undefined.
6063     */
6064    struct LDKNodeInfo *result;
6065    /**
6066     * A pointer to the contents in the error state.
6067     * Reading from this pointer when `result_ok` is set is undefined.
6068     */
6069    struct LDKDecodeError *err;
6070 } LDKCResult_NodeInfoDecodeErrorZPtr;
6071
6072 /**
6073  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6074  * containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6075  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6076  */
6077 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
6078    /**
6079     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6080     * `err` or `result` depending on the state of `result_ok`.
6081     */
6082    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
6083    /**
6084     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6085     */
6086    bool result_ok;
6087 } LDKCResult_NodeInfoDecodeErrorZ;
6088
6089 /**
6090  * The contents of CResult_NetworkGraphDecodeErrorZ
6091  */
6092 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
6093    /**
6094     * A pointer to the contents in the success state.
6095     * Reading from this pointer when `result_ok` is not set is undefined.
6096     */
6097    struct LDKNetworkGraph *result;
6098    /**
6099     * A pointer to the contents in the error state.
6100     * Reading from this pointer when `result_ok` is set is undefined.
6101     */
6102    struct LDKDecodeError *err;
6103 } LDKCResult_NetworkGraphDecodeErrorZPtr;
6104
6105 /**
6106  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6107  * containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6108  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6109  */
6110 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
6111    /**
6112     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6113     * `err` or `result` depending on the state of `result_ok`.
6114     */
6115    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
6116    /**
6117     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6118     */
6119    bool result_ok;
6120 } LDKCResult_NetworkGraphDecodeErrorZ;
6121
6122 /**
6123  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
6124  */
6125 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
6126    /**
6127     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
6128     */
6129    LDKCOption_CVec_NetAddressZZ_Some,
6130    /**
6131     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
6132     */
6133    LDKCOption_CVec_NetAddressZZ_None,
6134    /**
6135     * Must be last for serialization purposes
6136     */
6137    LDKCOption_CVec_NetAddressZZ_Sentinel,
6138 } LDKCOption_CVec_NetAddressZZ_Tag;
6139
6140 typedef struct LDKCOption_CVec_NetAddressZZ {
6141    LDKCOption_CVec_NetAddressZZ_Tag tag;
6142    union {
6143       struct {
6144          struct LDKCVec_NetAddressZ some;
6145       };
6146    };
6147 } LDKCOption_CVec_NetAddressZZ;
6148
6149 /**
6150  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6151  */
6152 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6153    /**
6154     * A pointer to the contents in the success state.
6155     * Reading from this pointer when `result_ok` is not set is undefined.
6156     */
6157    struct LDKDelayedPaymentOutputDescriptor *result;
6158    /**
6159     * A pointer to the contents in the error state.
6160     * Reading from this pointer when `result_ok` is set is undefined.
6161     */
6162    struct LDKDecodeError *err;
6163 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
6164
6165 /**
6166  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6167  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6168  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6169  */
6170 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6171    /**
6172     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
6173     * `err` or `result` depending on the state of `result_ok`.
6174     */
6175    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
6176    /**
6177     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
6178     */
6179    bool result_ok;
6180 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
6181
6182 /**
6183  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6184  */
6185 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6186    /**
6187     * A pointer to the contents in the success state.
6188     * Reading from this pointer when `result_ok` is not set is undefined.
6189     */
6190    struct LDKStaticPaymentOutputDescriptor *result;
6191    /**
6192     * A pointer to the contents in the error state.
6193     * Reading from this pointer when `result_ok` is set is undefined.
6194     */
6195    struct LDKDecodeError *err;
6196 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
6197
6198 /**
6199  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6200  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6201  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6202  */
6203 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6204    /**
6205     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6206     * `err` or `result` depending on the state of `result_ok`.
6207     */
6208    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
6209    /**
6210     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6211     */
6212    bool result_ok;
6213 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
6214
6215 /**
6216  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6217  */
6218 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
6219    /**
6220     * A pointer to the contents in the success state.
6221     * Reading from this pointer when `result_ok` is not set is undefined.
6222     */
6223    struct LDKSpendableOutputDescriptor *result;
6224    /**
6225     * A pointer to the contents in the error state.
6226     * Reading from this pointer when `result_ok` is set is undefined.
6227     */
6228    struct LDKDecodeError *err;
6229 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
6230
6231 /**
6232  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6233  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6234  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6235  */
6236 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
6237    /**
6238     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6239     * `err` or `result` depending on the state of `result_ok`.
6240     */
6241    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
6242    /**
6243     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6244     */
6245    bool result_ok;
6246 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
6247
6248 /**
6249  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6250  * This corresponds to std::vector in C++
6251  */
6252 typedef struct LDKCVec_PaymentPreimageZ {
6253    /**
6254     * The elements in the array.
6255     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6256     */
6257    struct LDKThirtyTwoBytes *data;
6258    /**
6259     * The number of elements pointed to by `data`.
6260     */
6261    uintptr_t datalen;
6262 } LDKCVec_PaymentPreimageZ;
6263
6264 /**
6265  * A tuple of 2 elements. See the individual fields for the types contained.
6266  */
6267 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
6268    /**
6269     * The element at position 0
6270     */
6271    struct LDKSignature a;
6272    /**
6273     * The element at position 1
6274     */
6275    struct LDKCVec_SignatureZ b;
6276 } LDKC2Tuple_SignatureCVec_SignatureZZ;
6277
6278 /**
6279  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6280  */
6281 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6282    /**
6283     * A pointer to the contents in the success state.
6284     * Reading from this pointer when `result_ok` is not set is undefined.
6285     */
6286    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
6287    /**
6288     * Note that this value is always NULL, as there are no contents in the Err variant
6289     */
6290    void *err;
6291 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
6292
6293 /**
6294  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6295  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6296  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6297  */
6298 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6299    /**
6300     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6301     * `err` or `result` depending on the state of `result_ok`.
6302     */
6303    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
6304    /**
6305     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6306     */
6307    bool result_ok;
6308 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
6309
6310 /**
6311  * The contents of CResult_SignatureNoneZ
6312  */
6313 typedef union LDKCResult_SignatureNoneZPtr {
6314    /**
6315     * A pointer to the contents in the success state.
6316     * Reading from this pointer when `result_ok` is not set is undefined.
6317     */
6318    struct LDKSignature *result;
6319    /**
6320     * Note that this value is always NULL, as there are no contents in the Err variant
6321     */
6322    void *err;
6323 } LDKCResult_SignatureNoneZPtr;
6324
6325 /**
6326  * A CResult_SignatureNoneZ represents the result of a fallible operation,
6327  * containing a crate::c_types::Signature on success and a () on failure.
6328  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6329  */
6330 typedef struct LDKCResult_SignatureNoneZ {
6331    /**
6332     * The contents of this CResult_SignatureNoneZ, accessible via either
6333     * `err` or `result` depending on the state of `result_ok`.
6334     */
6335    union LDKCResult_SignatureNoneZPtr contents;
6336    /**
6337     * Whether this CResult_SignatureNoneZ represents a success state.
6338     */
6339    bool result_ok;
6340 } LDKCResult_SignatureNoneZ;
6341
6342 /**
6343  * A tuple of 2 elements. See the individual fields for the types contained.
6344  */
6345 typedef struct LDKC2Tuple_SignatureSignatureZ {
6346    /**
6347     * The element at position 0
6348     */
6349    struct LDKSignature a;
6350    /**
6351     * The element at position 1
6352     */
6353    struct LDKSignature b;
6354 } LDKC2Tuple_SignatureSignatureZ;
6355
6356 /**
6357  * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6358  */
6359 typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr {
6360    /**
6361     * A pointer to the contents in the success state.
6362     * Reading from this pointer when `result_ok` is not set is undefined.
6363     */
6364    struct LDKC2Tuple_SignatureSignatureZ *result;
6365    /**
6366     * Note that this value is always NULL, as there are no contents in the Err variant
6367     */
6368    void *err;
6369 } LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr;
6370
6371 /**
6372  * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6373  * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6374  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6375  */
6376 typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ {
6377    /**
6378     * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6379     * `err` or `result` depending on the state of `result_ok`.
6380     */
6381    union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents;
6382    /**
6383     * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6384     */
6385    bool result_ok;
6386 } LDKCResult_C2Tuple_SignatureSignatureZNoneZ;
6387
6388 /**
6389  * The contents of CResult_SecretKeyNoneZ
6390  */
6391 typedef union LDKCResult_SecretKeyNoneZPtr {
6392    /**
6393     * A pointer to the contents in the success state.
6394     * Reading from this pointer when `result_ok` is not set is undefined.
6395     */
6396    struct LDKSecretKey *result;
6397    /**
6398     * Note that this value is always NULL, as there are no contents in the Err variant
6399     */
6400    void *err;
6401 } LDKCResult_SecretKeyNoneZPtr;
6402
6403 /**
6404  * A CResult_SecretKeyNoneZ represents the result of a fallible operation,
6405  * containing a crate::c_types::SecretKey on success and a () on failure.
6406  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6407  */
6408 typedef struct LDKCResult_SecretKeyNoneZ {
6409    /**
6410     * The contents of this CResult_SecretKeyNoneZ, accessible via either
6411     * `err` or `result` depending on the state of `result_ok`.
6412     */
6413    union LDKCResult_SecretKeyNoneZPtr contents;
6414    /**
6415     * Whether this CResult_SecretKeyNoneZ represents a success state.
6416     */
6417    bool result_ok;
6418 } LDKCResult_SecretKeyNoneZ;
6419
6420 /**
6421  * An enum which can either contain a crate::c_types::BigEndianScalar or not
6422  */
6423 typedef enum LDKCOption_ScalarZ_Tag {
6424    /**
6425     * When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
6426     */
6427    LDKCOption_ScalarZ_Some,
6428    /**
6429     * When we're in this state, this COption_ScalarZ contains nothing
6430     */
6431    LDKCOption_ScalarZ_None,
6432    /**
6433     * Must be last for serialization purposes
6434     */
6435    LDKCOption_ScalarZ_Sentinel,
6436 } LDKCOption_ScalarZ_Tag;
6437
6438 typedef struct LDKCOption_ScalarZ {
6439    LDKCOption_ScalarZ_Tag tag;
6440    union {
6441       struct {
6442          struct LDKBigEndianScalar some;
6443       };
6444    };
6445 } LDKCOption_ScalarZ;
6446
6447 /**
6448  * The contents of CResult_SharedSecretNoneZ
6449  */
6450 typedef union LDKCResult_SharedSecretNoneZPtr {
6451    /**
6452     * A pointer to the contents in the success state.
6453     * Reading from this pointer when `result_ok` is not set is undefined.
6454     */
6455    struct LDKThirtyTwoBytes *result;
6456    /**
6457     * Note that this value is always NULL, as there are no contents in the Err variant
6458     */
6459    void *err;
6460 } LDKCResult_SharedSecretNoneZPtr;
6461
6462 /**
6463  * A CResult_SharedSecretNoneZ represents the result of a fallible operation,
6464  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6465  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6466  */
6467 typedef struct LDKCResult_SharedSecretNoneZ {
6468    /**
6469     * The contents of this CResult_SharedSecretNoneZ, accessible via either
6470     * `err` or `result` depending on the state of `result_ok`.
6471     */
6472    union LDKCResult_SharedSecretNoneZPtr contents;
6473    /**
6474     * Whether this CResult_SharedSecretNoneZ represents a success state.
6475     */
6476    bool result_ok;
6477 } LDKCResult_SharedSecretNoneZ;
6478
6479
6480
6481 /**
6482  * This class tracks the per-transaction information needed to build a closing transaction and will
6483  * actually build it and sign.
6484  *
6485  * This class can be used inside a signer implementation to generate a signature given the relevant
6486  * secret key.
6487  */
6488 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
6489    /**
6490     * A pointer to the opaque Rust object.
6491     * Nearly everywhere, inner must be non-null, however in places where
6492     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6493     */
6494    LDKnativeClosingTransaction *inner;
6495    /**
6496     * Indicates that this is the only struct which contains the same pointer.
6497     * Rust functions which take ownership of an object provided via an argument require
6498     * this to be true and invalidate the object pointed to by inner.
6499     */
6500    bool is_owned;
6501 } LDKClosingTransaction;
6502
6503
6504
6505 /**
6506  * The unsigned part of a channel_announcement
6507  */
6508 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
6509    /**
6510     * A pointer to the opaque Rust object.
6511     * Nearly everywhere, inner must be non-null, however in places where
6512     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6513     */
6514    LDKnativeUnsignedChannelAnnouncement *inner;
6515    /**
6516     * Indicates that this is the only struct which contains the same pointer.
6517     * Rust functions which take ownership of an object provided via an argument require
6518     * this to be true and invalidate the object pointed to by inner.
6519     */
6520    bool is_owned;
6521 } LDKUnsignedChannelAnnouncement;
6522
6523 /**
6524  * A trait to sign lightning channel transactions as described in BOLT 3.
6525  *
6526  * Signing services could be implemented on a hardware wallet. In this case,
6527  * the current Sign would be a front-end on top of a communication
6528  * channel connected to your secure device and lightning key material wouldn't
6529  * reside on a hot server. Nevertheless, a this deployment would still need
6530  * to trust the ChannelManager to avoid loss of funds as this latest component
6531  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
6532  *
6533  * A more secure iteration would be to use hashlock (or payment points) to pair
6534  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
6535  * at the price of more state and computation on the hardware wallet side. In the future,
6536  * we are looking forward to design such interface.
6537  *
6538  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
6539  * to act, as liveness and breach reply correctness are always going to be hard requirements
6540  * of LN security model, orthogonal of key management issues.
6541  */
6542 typedef struct LDKBaseSign {
6543    /**
6544     * An opaque pointer which is passed to your function implementations as an argument.
6545     * This has no meaning in the LDK, and can be NULL or any other value.
6546     */
6547    void *this_arg;
6548    /**
6549     * Gets the per-commitment point for a specific commitment number
6550     *
6551     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
6552     */
6553    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
6554    /**
6555     * Gets the commitment secret for a specific commitment number as part of the revocation process
6556     *
6557     * An external signer implementation should error here if the commitment was already signed
6558     * and should refuse to sign it in the future.
6559     *
6560     * May be called more than once for the same index.
6561     *
6562     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
6563     */
6564    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
6565    /**
6566     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
6567     *
6568     * This is required in order for the signer to make sure that releasing a commitment
6569     * secret won't leave us without a broadcastable holder transaction.
6570     * Policy checks should be implemented in this function, including checking the amount
6571     * sent to us and checking the HTLCs.
6572     *
6573     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
6574     * A validating signer should ensure that an HTLC output is removed only when the matching
6575     * preimage is provided, or when the value to holder is restored.
6576     *
6577     * NOTE: all the relevant preimages will be provided, but there may also be additional
6578     * irrelevant or duplicate preimages.
6579     */
6580    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
6581    /**
6582     * Gets the holder's channel public keys and basepoints
6583     */
6584    struct LDKChannelPublicKeys pubkeys;
6585    /**
6586     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
6587     * Note that this takes a pointer to this object, not the this_ptr like other methods do
6588     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
6589     */
6590    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
6591    /**
6592     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
6593     * some SpendableOutputDescriptor types. This should be sufficient to identify this
6594     * Sign object uniquely and lookup or re-derive its keys.
6595     */
6596    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
6597    /**
6598     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
6599     *
6600     * Note that if signing fails or is rejected, the channel will be force-closed.
6601     *
6602     * Policy checks should be implemented in this function, including checking the amount
6603     * sent to us and checking the HTLCs.
6604     *
6605     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
6606     * A validating signer should ensure that an HTLC output is removed only when the matching
6607     * preimage is provided, or when the value to holder is restored.
6608     *
6609     * NOTE: all the relevant preimages will be provided, but there may also be additional
6610     * irrelevant or duplicate preimages.
6611     */
6612    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
6613    /**
6614     * Validate the counterparty's revocation.
6615     *
6616     * This is required in order for the signer to make sure that the state has moved
6617     * forward and it is safe to sign the next counterparty commitment.
6618     */
6619    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
6620    /**
6621     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
6622     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
6623     * latest commitment_tx when we initiate a force-close.
6624     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
6625     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
6626     * the latest.
6627     * This may be called multiple times for the same transaction.
6628     *
6629     * An external signer implementation should check that the commitment has not been revoked.
6630     *
6631     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
6632     */
6633    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
6634    /**
6635     * Create a signature for the given input in a transaction spending an HTLC transaction output
6636     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
6637     *
6638     * A justice transaction may claim multiple outputs at the same time if timelocks are
6639     * similar, but only a signature for the input at index `input` should be signed for here.
6640     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
6641     * to an upcoming timelock expiration.
6642     *
6643     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6644     *
6645     * per_commitment_key is revocation secret which was provided by our counterparty when they
6646     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
6647     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
6648     * so).
6649     */
6650    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]);
6651    /**
6652     * Create a signature for the given input in a transaction spending a commitment transaction
6653     * HTLC output when our counterparty broadcasts an old state.
6654     *
6655     * A justice transaction may claim multiple outputs at the same time if timelocks are
6656     * similar, but only a signature for the input at index `input` should be signed for here.
6657     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
6658     * to an upcoming timelock expiration.
6659     *
6660     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6661     *
6662     * per_commitment_key is revocation secret which was provided by our counterparty when they
6663     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
6664     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
6665     * so).
6666     *
6667     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
6668     * (which is committed to in the BIP 143 signatures).
6669     */
6670    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);
6671    /**
6672     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
6673     * transaction, either offered or received.
6674     *
6675     * Such a transaction may claim multiples offered outputs at same time if we know the
6676     * preimage for each when we create it, but only the input at index `input` should be
6677     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
6678     * needed with regards to an upcoming timelock expiration.
6679     *
6680     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
6681     * outputs.
6682     *
6683     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6684     *
6685     * Per_commitment_point is the dynamic point corresponding to the channel state
6686     * detected onchain. It has been generated by our counterparty and is used to derive
6687     * channel state keys, which are then included in the witness script and committed to in the
6688     * BIP 143 signature.
6689     */
6690    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);
6691    /**
6692     * Create a signature for a (proposed) closing transaction.
6693     *
6694     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
6695     * chosen to forgo their output as dust.
6696     */
6697    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
6698    /**
6699     * Signs a channel announcement message with our funding key and our node secret key (aka
6700     * node_id or network_key), proving it comes from one of the channel participants.
6701     *
6702     * The first returned signature should be from our node secret key, the second from our
6703     * funding key.
6704     *
6705     * Note that if this fails or is rejected, the channel will not be publicly announced and
6706     * our counterparty may (though likely will not) close the channel on us for violating the
6707     * protocol.
6708     */
6709    struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
6710    /**
6711     * Set the counterparty static channel data, including basepoints,
6712     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
6713     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
6714     * they MUST NOT be allowed to change to different values once set.
6715     *
6716     * channel_parameters.is_populated() MUST be true.
6717     *
6718     * We bind holder_selected_contest_delay late here for API convenience.
6719     *
6720     * Will be called before any signatures are applied.
6721     */
6722    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
6723    /**
6724     * Frees any resources associated with this object given its this_arg pointer.
6725     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6726     */
6727    void (*free)(void *this_arg);
6728 } LDKBaseSign;
6729
6730 /**
6731  * A cloneable signer.
6732  *
6733  * Although we require signers to be cloneable, it may be useful for developers to be able to use
6734  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
6735  * which implies Sized, into this derived trait.
6736  */
6737 typedef struct LDKSign {
6738    /**
6739     * An opaque pointer which is passed to your function implementations as an argument.
6740     * This has no meaning in the LDK, and can be NULL or any other value.
6741     */
6742    void *this_arg;
6743    /**
6744     * Implementation of BaseSign for this object.
6745     */
6746    struct LDKBaseSign BaseSign;
6747    /**
6748     * Serialize the object into a byte array
6749     */
6750    struct LDKCVec_u8Z (*write)(const void *this_arg);
6751    /**
6752     * Called, if set, after this Sign has been cloned into a duplicate object.
6753     * The new Sign is provided, and should be mutated as needed to perform a
6754     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
6755     */
6756    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
6757    /**
6758     * Frees any resources associated with this object given its this_arg pointer.
6759     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6760     */
6761    void (*free)(void *this_arg);
6762 } LDKSign;
6763
6764 /**
6765  * The contents of CResult_SignDecodeErrorZ
6766  */
6767 typedef union LDKCResult_SignDecodeErrorZPtr {
6768    /**
6769     * A pointer to the contents in the success state.
6770     * Reading from this pointer when `result_ok` is not set is undefined.
6771     */
6772    struct LDKSign *result;
6773    /**
6774     * A pointer to the contents in the error state.
6775     * Reading from this pointer when `result_ok` is set is undefined.
6776     */
6777    struct LDKDecodeError *err;
6778 } LDKCResult_SignDecodeErrorZPtr;
6779
6780 /**
6781  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6782  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6783  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6784  */
6785 typedef struct LDKCResult_SignDecodeErrorZ {
6786    /**
6787     * The contents of this CResult_SignDecodeErrorZ, accessible via either
6788     * `err` or `result` depending on the state of `result_ok`.
6789     */
6790    union LDKCResult_SignDecodeErrorZPtr contents;
6791    /**
6792     * Whether this CResult_SignDecodeErrorZ represents a success state.
6793     */
6794    bool result_ok;
6795 } LDKCResult_SignDecodeErrorZ;
6796
6797 /**
6798  * Integer in the range `0..32`
6799  */
6800 typedef struct LDKu5 {
6801    uint8_t _0;
6802 } LDKu5;
6803
6804 /**
6805  * A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
6806  * This corresponds to std::vector in C++
6807  */
6808 typedef struct LDKCVec_u5Z {
6809    /**
6810     * The elements in the array.
6811     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6812     */
6813    struct LDKu5 *data;
6814    /**
6815     * The number of elements pointed to by `data`.
6816     */
6817    uintptr_t datalen;
6818 } LDKCVec_u5Z;
6819
6820 /**
6821  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
6822  * allows recovering the exact public key which created the signature given the message.
6823  */
6824 typedef struct LDKRecoverableSignature {
6825    /**
6826     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
6827     * recovery.
6828     */
6829    uint8_t serialized_form[68];
6830 } LDKRecoverableSignature;
6831
6832 /**
6833  * The contents of CResult_RecoverableSignatureNoneZ
6834  */
6835 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
6836    /**
6837     * A pointer to the contents in the success state.
6838     * Reading from this pointer when `result_ok` is not set is undefined.
6839     */
6840    struct LDKRecoverableSignature *result;
6841    /**
6842     * Note that this value is always NULL, as there are no contents in the Err variant
6843     */
6844    void *err;
6845 } LDKCResult_RecoverableSignatureNoneZPtr;
6846
6847 /**
6848  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6849  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
6850  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6851  */
6852 typedef struct LDKCResult_RecoverableSignatureNoneZ {
6853    /**
6854     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6855     * `err` or `result` depending on the state of `result_ok`.
6856     */
6857    union LDKCResult_RecoverableSignatureNoneZPtr contents;
6858    /**
6859     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6860     */
6861    bool result_ok;
6862 } LDKCResult_RecoverableSignatureNoneZ;
6863
6864 /**
6865  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6866  * This corresponds to std::vector in C++
6867  */
6868 typedef struct LDKCVec_CVec_u8ZZ {
6869    /**
6870     * The elements in the array.
6871     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6872     */
6873    struct LDKCVec_u8Z *data;
6874    /**
6875     * The number of elements pointed to by `data`.
6876     */
6877    uintptr_t datalen;
6878 } LDKCVec_CVec_u8ZZ;
6879
6880 /**
6881  * The contents of CResult_CVec_CVec_u8ZZNoneZ
6882  */
6883 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
6884    /**
6885     * A pointer to the contents in the success state.
6886     * Reading from this pointer when `result_ok` is not set is undefined.
6887     */
6888    struct LDKCVec_CVec_u8ZZ *result;
6889    /**
6890     * Note that this value is always NULL, as there are no contents in the Err variant
6891     */
6892    void *err;
6893 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
6894
6895 /**
6896  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6897  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6898  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6899  */
6900 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
6901    /**
6902     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6903     * `err` or `result` depending on the state of `result_ok`.
6904     */
6905    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
6906    /**
6907     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6908     */
6909    bool result_ok;
6910 } LDKCResult_CVec_CVec_u8ZZNoneZ;
6911
6912
6913
6914 /**
6915  * A simple implementation of Sign that just keeps the private keys in memory.
6916  *
6917  * This implementation performs no policy checks and is insufficient by itself as
6918  * a secure external signer.
6919  */
6920 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
6921    /**
6922     * A pointer to the opaque Rust object.
6923     * Nearly everywhere, inner must be non-null, however in places where
6924     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6925     */
6926    LDKnativeInMemorySigner *inner;
6927    /**
6928     * Indicates that this is the only struct which contains the same pointer.
6929     * Rust functions which take ownership of an object provided via an argument require
6930     * this to be true and invalidate the object pointed to by inner.
6931     */
6932    bool is_owned;
6933 } LDKInMemorySigner;
6934
6935 /**
6936  * The contents of CResult_InMemorySignerDecodeErrorZ
6937  */
6938 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
6939    /**
6940     * A pointer to the contents in the success state.
6941     * Reading from this pointer when `result_ok` is not set is undefined.
6942     */
6943    struct LDKInMemorySigner *result;
6944    /**
6945     * A pointer to the contents in the error state.
6946     * Reading from this pointer when `result_ok` is set is undefined.
6947     */
6948    struct LDKDecodeError *err;
6949 } LDKCResult_InMemorySignerDecodeErrorZPtr;
6950
6951 /**
6952  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
6953  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
6954  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6955  */
6956 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
6957    /**
6958     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
6959     * `err` or `result` depending on the state of `result_ok`.
6960     */
6961    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
6962    /**
6963     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
6964     */
6965    bool result_ok;
6966 } LDKCResult_InMemorySignerDecodeErrorZ;
6967
6968 /**
6969  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
6970  * This corresponds to std::vector in C++
6971  */
6972 typedef struct LDKCVec_TxOutZ {
6973    /**
6974     * The elements in the array.
6975     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6976     */
6977    struct LDKTxOut *data;
6978    /**
6979     * The number of elements pointed to by `data`.
6980     */
6981    uintptr_t datalen;
6982 } LDKCVec_TxOutZ;
6983
6984 /**
6985  * The contents of CResult_TransactionNoneZ
6986  */
6987 typedef union LDKCResult_TransactionNoneZPtr {
6988    /**
6989     * A pointer to the contents in the success state.
6990     * Reading from this pointer when `result_ok` is not set is undefined.
6991     */
6992    struct LDKTransaction *result;
6993    /**
6994     * Note that this value is always NULL, as there are no contents in the Err variant
6995     */
6996    void *err;
6997 } LDKCResult_TransactionNoneZPtr;
6998
6999 /**
7000  * A CResult_TransactionNoneZ represents the result of a fallible operation,
7001  * containing a crate::c_types::Transaction on success and a () on failure.
7002  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7003  */
7004 typedef struct LDKCResult_TransactionNoneZ {
7005    /**
7006     * The contents of this CResult_TransactionNoneZ, accessible via either
7007     * `err` or `result` depending on the state of `result_ok`.
7008     */
7009    union LDKCResult_TransactionNoneZPtr contents;
7010    /**
7011     * Whether this CResult_TransactionNoneZ represents a success state.
7012     */
7013    bool result_ok;
7014 } LDKCResult_TransactionNoneZ;
7015
7016
7017
7018 /**
7019  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
7020  * on-chain transactions to ensure no loss of funds occurs.
7021  *
7022  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
7023  * information and are actively monitoring the chain.
7024  *
7025  * Pending Events or updated HTLCs which have not yet been read out by
7026  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
7027  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
7028  * gotten are fully handled before re-serializing the new state.
7029  *
7030  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
7031  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
7032  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
7033  * returned block hash and the the current chain and then reconnecting blocks to get to the
7034  * best chain) upon deserializing the object!
7035  */
7036 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
7037    /**
7038     * A pointer to the opaque Rust object.
7039     * Nearly everywhere, inner must be non-null, however in places where
7040     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7041     */
7042    LDKnativeChannelMonitor *inner;
7043    /**
7044     * Indicates that this is the only struct which contains the same pointer.
7045     * Rust functions which take ownership of an object provided via an argument require
7046     * this to be true and invalidate the object pointed to by inner.
7047     */
7048    bool is_owned;
7049 } LDKChannelMonitor;
7050
7051 /**
7052  * A tuple of 2 elements. See the individual fields for the types contained.
7053  */
7054 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
7055    /**
7056     * The element at position 0
7057     */
7058    struct LDKThirtyTwoBytes a;
7059    /**
7060     * The element at position 1
7061     */
7062    struct LDKChannelMonitor b;
7063 } LDKC2Tuple_BlockHashChannelMonitorZ;
7064
7065 /**
7066  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7067  * This corresponds to std::vector in C++
7068  */
7069 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
7070    /**
7071     * The elements in the array.
7072     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7073     */
7074    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
7075    /**
7076     * The number of elements pointed to by `data`.
7077     */
7078    uintptr_t datalen;
7079 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
7080
7081 /**
7082  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7083  */
7084 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7085    /**
7086     * A pointer to the contents in the success state.
7087     * Reading from this pointer when `result_ok` is not set is undefined.
7088     */
7089    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
7090    /**
7091     * A pointer to the contents in the error state.
7092     * Reading from this pointer when `result_ok` is set is undefined.
7093     */
7094    enum LDKIOError *err;
7095 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
7096
7097 /**
7098  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7099  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7100  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7101  */
7102 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7103    /**
7104     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7105     * `err` or `result` depending on the state of `result_ok`.
7106     */
7107    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
7108    /**
7109     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7110     */
7111    bool result_ok;
7112 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
7113
7114 /**
7115  * An enum which can either contain a u16 or not
7116  */
7117 typedef enum LDKCOption_u16Z_Tag {
7118    /**
7119     * When we're in this state, this COption_u16Z contains a u16
7120     */
7121    LDKCOption_u16Z_Some,
7122    /**
7123     * When we're in this state, this COption_u16Z contains nothing
7124     */
7125    LDKCOption_u16Z_None,
7126    /**
7127     * Must be last for serialization purposes
7128     */
7129    LDKCOption_u16Z_Sentinel,
7130 } LDKCOption_u16Z_Tag;
7131
7132 typedef struct LDKCOption_u16Z {
7133    LDKCOption_u16Z_Tag tag;
7134    union {
7135       struct {
7136          uint16_t some;
7137       };
7138    };
7139 } LDKCOption_u16Z;
7140
7141 /**
7142  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
7143  * too-high values)
7144  */
7145 typedef enum LDKAPIError_Tag {
7146    /**
7147     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
7148     * are documented, but generally indicates some precondition of a function was violated.
7149     */
7150    LDKAPIError_APIMisuseError,
7151    /**
7152     * Due to a high feerate, we were unable to complete the request.
7153     * For example, this may be returned if the feerate implies we cannot open a channel at the
7154     * requested value, but opening a larger channel would succeed.
7155     */
7156    LDKAPIError_FeeRateTooHigh,
7157    /**
7158     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
7159     * too-many-hops, etc).
7160     */
7161    LDKAPIError_RouteError,
7162    /**
7163     * We were unable to complete the request as the Channel required to do so is unable to
7164     * complete the request (or was not found). This can take many forms, including disconnected
7165     * peer, channel at capacity, channel shutting down, etc.
7166     */
7167    LDKAPIError_ChannelUnavailable,
7168    /**
7169     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
7170     * attempted action to fail.
7171     */
7172    LDKAPIError_MonitorUpdateFailed,
7173    /**
7174     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
7175     * with the channel counterparty as negotiated in [`InitFeatures`].
7176     *
7177     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
7178     * a channel or cooperatively close one with this peer (and will have to force-close instead).
7179     *
7180     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
7181     * [`InitFeatures`]: crate::ln::features::InitFeatures
7182     */
7183    LDKAPIError_IncompatibleShutdownScript,
7184    /**
7185     * Must be last for serialization purposes
7186     */
7187    LDKAPIError_Sentinel,
7188 } LDKAPIError_Tag;
7189
7190 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
7191    /**
7192     * A human-readable error message
7193     */
7194    struct LDKStr err;
7195 } LDKAPIError_LDKAPIMisuseError_Body;
7196
7197 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
7198    /**
7199     * A human-readable error message
7200     */
7201    struct LDKStr err;
7202    /**
7203     * The feerate which was too high.
7204     */
7205    uint32_t feerate;
7206 } LDKAPIError_LDKFeeRateTooHigh_Body;
7207
7208 typedef struct LDKAPIError_LDKRouteError_Body {
7209    /**
7210     * A human-readable error message
7211     */
7212    struct LDKStr err;
7213 } LDKAPIError_LDKRouteError_Body;
7214
7215 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
7216    /**
7217     * A human-readable error message
7218     */
7219    struct LDKStr err;
7220 } LDKAPIError_LDKChannelUnavailable_Body;
7221
7222 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
7223    /**
7224     * The incompatible shutdown script.
7225     */
7226    struct LDKShutdownScript script;
7227 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
7228
7229 typedef struct MUST_USE_STRUCT LDKAPIError {
7230    LDKAPIError_Tag tag;
7231    union {
7232       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
7233       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
7234       LDKAPIError_LDKRouteError_Body route_error;
7235       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
7236       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
7237    };
7238 } LDKAPIError;
7239
7240 /**
7241  * The contents of CResult_NoneAPIErrorZ
7242  */
7243 typedef union LDKCResult_NoneAPIErrorZPtr {
7244    /**
7245     * Note that this value is always NULL, as there are no contents in the OK variant
7246     */
7247    void *result;
7248    /**
7249     * A pointer to the contents in the error state.
7250     * Reading from this pointer when `result_ok` is set is undefined.
7251     */
7252    struct LDKAPIError *err;
7253 } LDKCResult_NoneAPIErrorZPtr;
7254
7255 /**
7256  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7257  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
7258  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7259  */
7260 typedef struct LDKCResult_NoneAPIErrorZ {
7261    /**
7262     * The contents of this CResult_NoneAPIErrorZ, accessible via either
7263     * `err` or `result` depending on the state of `result_ok`.
7264     */
7265    union LDKCResult_NoneAPIErrorZPtr contents;
7266    /**
7267     * Whether this CResult_NoneAPIErrorZ represents a success state.
7268     */
7269    bool result_ok;
7270 } LDKCResult_NoneAPIErrorZ;
7271
7272 /**
7273  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7274  * This corresponds to std::vector in C++
7275  */
7276 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
7277    /**
7278     * The elements in the array.
7279     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7280     */
7281    struct LDKCResult_NoneAPIErrorZ *data;
7282    /**
7283     * The number of elements pointed to by `data`.
7284     */
7285    uintptr_t datalen;
7286 } LDKCVec_CResult_NoneAPIErrorZZ;
7287
7288 /**
7289  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7290  * This corresponds to std::vector in C++
7291  */
7292 typedef struct LDKCVec_APIErrorZ {
7293    /**
7294     * The elements in the array.
7295     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7296     */
7297    struct LDKAPIError *data;
7298    /**
7299     * The number of elements pointed to by `data`.
7300     */
7301    uintptr_t datalen;
7302 } LDKCVec_APIErrorZ;
7303
7304 /**
7305  * The contents of CResult__u832APIErrorZ
7306  */
7307 typedef union LDKCResult__u832APIErrorZPtr {
7308    /**
7309     * A pointer to the contents in the success state.
7310     * Reading from this pointer when `result_ok` is not set is undefined.
7311     */
7312    struct LDKThirtyTwoBytes *result;
7313    /**
7314     * A pointer to the contents in the error state.
7315     * Reading from this pointer when `result_ok` is set is undefined.
7316     */
7317    struct LDKAPIError *err;
7318 } LDKCResult__u832APIErrorZPtr;
7319
7320 /**
7321  * A CResult__u832APIErrorZ represents the result of a fallible operation,
7322  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7323  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7324  */
7325 typedef struct LDKCResult__u832APIErrorZ {
7326    /**
7327     * The contents of this CResult__u832APIErrorZ, accessible via either
7328     * `err` or `result` depending on the state of `result_ok`.
7329     */
7330    union LDKCResult__u832APIErrorZPtr contents;
7331    /**
7332     * Whether this CResult__u832APIErrorZ represents a success state.
7333     */
7334    bool result_ok;
7335 } LDKCResult__u832APIErrorZ;
7336
7337 /**
7338  * If a payment fails to send, it can be in one of several states. This enum is returned as the
7339  * Err() type describing which state the payment is in, see the description of individual enum
7340  * states for more.
7341  */
7342 typedef enum LDKPaymentSendFailure_Tag {
7343    /**
7344     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
7345     * send the payment at all. No channel state has been changed or messages sent to peers, and
7346     * once you've changed the parameter at error, you can freely retry the payment in full.
7347     */
7348    LDKPaymentSendFailure_ParameterError,
7349    /**
7350     * A parameter in a single path which was passed to send_payment was invalid, preventing us
7351     * from attempting to send the payment at all. No channel state has been changed or messages
7352     * sent to peers, and once you've changed the parameter at error, you can freely retry the
7353     * payment in full.
7354     *
7355     * The results here are ordered the same as the paths in the route object which was passed to
7356     * send_payment.
7357     */
7358    LDKPaymentSendFailure_PathParameterError,
7359    /**
7360     * All paths which were attempted failed to send, with no channel state change taking place.
7361     * You can freely retry the payment in full (though you probably want to do so over different
7362     * paths than the ones selected).
7363     */
7364    LDKPaymentSendFailure_AllFailedRetrySafe,
7365    /**
7366     * Some paths which were attempted failed to send, though possibly not all. At least some
7367     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
7368     * in over-/re-payment.
7369     *
7370     * The results here are ordered the same as the paths in the route object which was passed to
7371     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
7372     * retried (though there is currently no API with which to do so).
7373     *
7374     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
7375     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
7376     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
7377     * with the latest update_id.
7378     */
7379    LDKPaymentSendFailure_PartialFailure,
7380    /**
7381     * Must be last for serialization purposes
7382     */
7383    LDKPaymentSendFailure_Sentinel,
7384 } LDKPaymentSendFailure_Tag;
7385
7386 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
7387    /**
7388     * The errors themselves, in the same order as the route hops.
7389     */
7390    struct LDKCVec_CResult_NoneAPIErrorZZ results;
7391    /**
7392     * If some paths failed without irrevocably committing to the new HTLC(s), this will
7393     * contain a [`RouteParameters`] object which can be used to calculate a new route that
7394     * will pay all remaining unpaid balance.
7395     *
7396     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
7397     */
7398    struct LDKRouteParameters failed_paths_retry;
7399    /**
7400     * The payment id for the payment, which is now at least partially pending.
7401     */
7402    struct LDKThirtyTwoBytes payment_id;
7403 } LDKPaymentSendFailure_LDKPartialFailure_Body;
7404
7405 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
7406    LDKPaymentSendFailure_Tag tag;
7407    union {
7408       struct {
7409          struct LDKAPIError parameter_error;
7410       };
7411       struct {
7412          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
7413       };
7414       struct {
7415          struct LDKCVec_APIErrorZ all_failed_retry_safe;
7416       };
7417       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
7418    };
7419 } LDKPaymentSendFailure;
7420
7421 /**
7422  * The contents of CResult_PaymentIdPaymentSendFailureZ
7423  */
7424 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
7425    /**
7426     * A pointer to the contents in the success state.
7427     * Reading from this pointer when `result_ok` is not set is undefined.
7428     */
7429    struct LDKThirtyTwoBytes *result;
7430    /**
7431     * A pointer to the contents in the error state.
7432     * Reading from this pointer when `result_ok` is set is undefined.
7433     */
7434    struct LDKPaymentSendFailure *err;
7435 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
7436
7437 /**
7438  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
7439  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7440  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7441  */
7442 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
7443    /**
7444     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
7445     * `err` or `result` depending on the state of `result_ok`.
7446     */
7447    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
7448    /**
7449     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
7450     */
7451    bool result_ok;
7452 } LDKCResult_PaymentIdPaymentSendFailureZ;
7453
7454 /**
7455  * The contents of CResult_NonePaymentSendFailureZ
7456  */
7457 typedef union LDKCResult_NonePaymentSendFailureZPtr {
7458    /**
7459     * Note that this value is always NULL, as there are no contents in the OK variant
7460     */
7461    void *result;
7462    /**
7463     * A pointer to the contents in the error state.
7464     * Reading from this pointer when `result_ok` is set is undefined.
7465     */
7466    struct LDKPaymentSendFailure *err;
7467 } LDKCResult_NonePaymentSendFailureZPtr;
7468
7469 /**
7470  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7471  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7472  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7473  */
7474 typedef struct LDKCResult_NonePaymentSendFailureZ {
7475    /**
7476     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7477     * `err` or `result` depending on the state of `result_ok`.
7478     */
7479    union LDKCResult_NonePaymentSendFailureZPtr contents;
7480    /**
7481     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
7482     */
7483    bool result_ok;
7484 } LDKCResult_NonePaymentSendFailureZ;
7485
7486 /**
7487  * A tuple of 2 elements. See the individual fields for the types contained.
7488  */
7489 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
7490    /**
7491     * The element at position 0
7492     */
7493    struct LDKThirtyTwoBytes a;
7494    /**
7495     * The element at position 1
7496     */
7497    struct LDKThirtyTwoBytes b;
7498 } LDKC2Tuple_PaymentHashPaymentIdZ;
7499
7500 /**
7501  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
7502  */
7503 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7504    /**
7505     * A pointer to the contents in the success state.
7506     * Reading from this pointer when `result_ok` is not set is undefined.
7507     */
7508    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
7509    /**
7510     * A pointer to the contents in the error state.
7511     * Reading from this pointer when `result_ok` is set is undefined.
7512     */
7513    struct LDKPaymentSendFailure *err;
7514 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
7515
7516 /**
7517  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
7518  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7519  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7520  */
7521 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7522    /**
7523     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
7524     * `err` or `result` depending on the state of `result_ok`.
7525     */
7526    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
7527    /**
7528     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
7529     */
7530    bool result_ok;
7531 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
7532
7533 /**
7534  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
7535  * This corresponds to std::vector in C++
7536  */
7537 typedef struct LDKCVec_ThirtyTwoBytesZ {
7538    /**
7539     * The elements in the array.
7540     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7541     */
7542    struct LDKThirtyTwoBytes *data;
7543    /**
7544     * The number of elements pointed to by `data`.
7545     */
7546    uintptr_t datalen;
7547 } LDKCVec_ThirtyTwoBytesZ;
7548
7549 /**
7550  * A tuple of 2 elements. See the individual fields for the types contained.
7551  */
7552 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
7553    /**
7554     * The element at position 0
7555     */
7556    struct LDKThirtyTwoBytes a;
7557    /**
7558     * The element at position 1
7559     */
7560    struct LDKThirtyTwoBytes b;
7561 } LDKC2Tuple_PaymentHashPaymentSecretZ;
7562
7563 /**
7564  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
7565  */
7566 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
7567    /**
7568     * A pointer to the contents in the success state.
7569     * Reading from this pointer when `result_ok` is not set is undefined.
7570     */
7571    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
7572    /**
7573     * Note that this value is always NULL, as there are no contents in the Err variant
7574     */
7575    void *err;
7576 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
7577
7578 /**
7579  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
7580  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
7581  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7582  */
7583 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
7584    /**
7585     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
7586     * `err` or `result` depending on the state of `result_ok`.
7587     */
7588    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
7589    /**
7590     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
7591     */
7592    bool result_ok;
7593 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
7594
7595 /**
7596  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
7597  */
7598 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
7599    /**
7600     * A pointer to the contents in the success state.
7601     * Reading from this pointer when `result_ok` is not set is undefined.
7602     */
7603    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
7604    /**
7605     * A pointer to the contents in the error state.
7606     * Reading from this pointer when `result_ok` is set is undefined.
7607     */
7608    struct LDKAPIError *err;
7609 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
7610
7611 /**
7612  * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
7613  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
7614  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7615  */
7616 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
7617    /**
7618     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
7619     * `err` or `result` depending on the state of `result_ok`.
7620     */
7621    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
7622    /**
7623     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
7624     */
7625    bool result_ok;
7626 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
7627
7628 /**
7629  * The contents of CResult_PaymentSecretNoneZ
7630  */
7631 typedef union LDKCResult_PaymentSecretNoneZPtr {
7632    /**
7633     * A pointer to the contents in the success state.
7634     * Reading from this pointer when `result_ok` is not set is undefined.
7635     */
7636    struct LDKThirtyTwoBytes *result;
7637    /**
7638     * Note that this value is always NULL, as there are no contents in the Err variant
7639     */
7640    void *err;
7641 } LDKCResult_PaymentSecretNoneZPtr;
7642
7643 /**
7644  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
7645  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7646  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7647  */
7648 typedef struct LDKCResult_PaymentSecretNoneZ {
7649    /**
7650     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
7651     * `err` or `result` depending on the state of `result_ok`.
7652     */
7653    union LDKCResult_PaymentSecretNoneZPtr contents;
7654    /**
7655     * Whether this CResult_PaymentSecretNoneZ represents a success state.
7656     */
7657    bool result_ok;
7658 } LDKCResult_PaymentSecretNoneZ;
7659
7660 /**
7661  * The contents of CResult_PaymentSecretAPIErrorZ
7662  */
7663 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
7664    /**
7665     * A pointer to the contents in the success state.
7666     * Reading from this pointer when `result_ok` is not set is undefined.
7667     */
7668    struct LDKThirtyTwoBytes *result;
7669    /**
7670     * A pointer to the contents in the error state.
7671     * Reading from this pointer when `result_ok` is set is undefined.
7672     */
7673    struct LDKAPIError *err;
7674 } LDKCResult_PaymentSecretAPIErrorZPtr;
7675
7676 /**
7677  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7678  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7679  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7680  */
7681 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
7682    /**
7683     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7684     * `err` or `result` depending on the state of `result_ok`.
7685     */
7686    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
7687    /**
7688     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7689     */
7690    bool result_ok;
7691 } LDKCResult_PaymentSecretAPIErrorZ;
7692
7693 /**
7694  * The contents of CResult_PaymentPreimageAPIErrorZ
7695  */
7696 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
7697    /**
7698     * A pointer to the contents in the success state.
7699     * Reading from this pointer when `result_ok` is not set is undefined.
7700     */
7701    struct LDKThirtyTwoBytes *result;
7702    /**
7703     * A pointer to the contents in the error state.
7704     * Reading from this pointer when `result_ok` is set is undefined.
7705     */
7706    struct LDKAPIError *err;
7707 } LDKCResult_PaymentPreimageAPIErrorZPtr;
7708
7709 /**
7710  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7711  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7712  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7713  */
7714 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
7715    /**
7716     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7717     * `err` or `result` depending on the state of `result_ok`.
7718     */
7719    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
7720    /**
7721     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7722     */
7723    bool result_ok;
7724 } LDKCResult_PaymentPreimageAPIErrorZ;
7725
7726
7727
7728 /**
7729  * Information needed for constructing an invoice route hint for this channel.
7730  */
7731 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
7732    /**
7733     * A pointer to the opaque Rust object.
7734     * Nearly everywhere, inner must be non-null, however in places where
7735     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7736     */
7737    LDKnativeCounterpartyForwardingInfo *inner;
7738    /**
7739     * Indicates that this is the only struct which contains the same pointer.
7740     * Rust functions which take ownership of an object provided via an argument require
7741     * this to be true and invalidate the object pointed to by inner.
7742     */
7743    bool is_owned;
7744 } LDKCounterpartyForwardingInfo;
7745
7746 /**
7747  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7748  */
7749 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7750    /**
7751     * A pointer to the contents in the success state.
7752     * Reading from this pointer when `result_ok` is not set is undefined.
7753     */
7754    struct LDKCounterpartyForwardingInfo *result;
7755    /**
7756     * A pointer to the contents in the error state.
7757     * Reading from this pointer when `result_ok` is set is undefined.
7758     */
7759    struct LDKDecodeError *err;
7760 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
7761
7762 /**
7763  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7764  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7765  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7766  */
7767 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
7768    /**
7769     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7770     * `err` or `result` depending on the state of `result_ok`.
7771     */
7772    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
7773    /**
7774     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7775     */
7776    bool result_ok;
7777 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
7778
7779
7780
7781 /**
7782  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
7783  * to better separate parameters.
7784  */
7785 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
7786    /**
7787     * A pointer to the opaque Rust object.
7788     * Nearly everywhere, inner must be non-null, however in places where
7789     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7790     */
7791    LDKnativeChannelCounterparty *inner;
7792    /**
7793     * Indicates that this is the only struct which contains the same pointer.
7794     * Rust functions which take ownership of an object provided via an argument require
7795     * this to be true and invalidate the object pointed to by inner.
7796     */
7797    bool is_owned;
7798 } LDKChannelCounterparty;
7799
7800 /**
7801  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
7802  */
7803 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
7804    /**
7805     * A pointer to the contents in the success state.
7806     * Reading from this pointer when `result_ok` is not set is undefined.
7807     */
7808    struct LDKChannelCounterparty *result;
7809    /**
7810     * A pointer to the contents in the error state.
7811     * Reading from this pointer when `result_ok` is set is undefined.
7812     */
7813    struct LDKDecodeError *err;
7814 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
7815
7816 /**
7817  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7818  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7819  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7820  */
7821 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
7822    /**
7823     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7824     * `err` or `result` depending on the state of `result_ok`.
7825     */
7826    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
7827    /**
7828     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7829     */
7830    bool result_ok;
7831 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
7832
7833 /**
7834  * The contents of CResult_ChannelDetailsDecodeErrorZ
7835  */
7836 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
7837    /**
7838     * A pointer to the contents in the success state.
7839     * Reading from this pointer when `result_ok` is not set is undefined.
7840     */
7841    struct LDKChannelDetails *result;
7842    /**
7843     * A pointer to the contents in the error state.
7844     * Reading from this pointer when `result_ok` is set is undefined.
7845     */
7846    struct LDKDecodeError *err;
7847 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
7848
7849 /**
7850  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7851  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7852  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7853  */
7854 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
7855    /**
7856     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7857     * `err` or `result` depending on the state of `result_ok`.
7858     */
7859    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
7860    /**
7861     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7862     */
7863    bool result_ok;
7864 } LDKCResult_ChannelDetailsDecodeErrorZ;
7865
7866
7867
7868 /**
7869  * Route hints used in constructing invoices for [phantom node payents].
7870  *
7871  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
7872  */
7873 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
7874    /**
7875     * A pointer to the opaque Rust object.
7876     * Nearly everywhere, inner must be non-null, however in places where
7877     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7878     */
7879    LDKnativePhantomRouteHints *inner;
7880    /**
7881     * Indicates that this is the only struct which contains the same pointer.
7882     * Rust functions which take ownership of an object provided via an argument require
7883     * this to be true and invalidate the object pointed to by inner.
7884     */
7885    bool is_owned;
7886 } LDKPhantomRouteHints;
7887
7888 /**
7889  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
7890  */
7891 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
7892    /**
7893     * A pointer to the contents in the success state.
7894     * Reading from this pointer when `result_ok` is not set is undefined.
7895     */
7896    struct LDKPhantomRouteHints *result;
7897    /**
7898     * A pointer to the contents in the error state.
7899     * Reading from this pointer when `result_ok` is set is undefined.
7900     */
7901    struct LDKDecodeError *err;
7902 } LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
7903
7904 /**
7905  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7906  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7907  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7908  */
7909 typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
7910    /**
7911     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7912     * `err` or `result` depending on the state of `result_ok`.
7913     */
7914    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
7915    /**
7916     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7917     */
7918    bool result_ok;
7919 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
7920
7921 /**
7922  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7923  * This corresponds to std::vector in C++
7924  */
7925 typedef struct LDKCVec_ChannelMonitorZ {
7926    /**
7927     * The elements in the array.
7928     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7929     */
7930    struct LDKChannelMonitor *data;
7931    /**
7932     * The number of elements pointed to by `data`.
7933     */
7934    uintptr_t datalen;
7935 } LDKCVec_ChannelMonitorZ;
7936
7937
7938
7939 /**
7940  * An update generated by the underlying channel itself which contains some new information the
7941  * [`ChannelMonitor`] should be made aware of.
7942  *
7943  * Because this represents only a small number of updates to the underlying state, it is generally
7944  * much smaller than a full [`ChannelMonitor`]. However, for large single commitment transaction
7945  * updates (e.g. ones during which there are hundreds of HTLCs pending on the commitment
7946  * transaction), a single update may reach upwards of 1 MiB in serialized size.
7947  */
7948 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
7949    /**
7950     * A pointer to the opaque Rust object.
7951     * Nearly everywhere, inner must be non-null, however in places where
7952     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7953     */
7954    LDKnativeChannelMonitorUpdate *inner;
7955    /**
7956     * Indicates that this is the only struct which contains the same pointer.
7957     * Rust functions which take ownership of an object provided via an argument require
7958     * this to be true and invalidate the object pointed to by inner.
7959     */
7960    bool is_owned;
7961 } LDKChannelMonitorUpdate;
7962
7963 /**
7964  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
7965  * blocks are connected and disconnected.
7966  *
7967  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
7968  * responsible for maintaining a set of monitors such that they can be updated accordingly as
7969  * channel state changes and HTLCs are resolved. See method documentation for specific
7970  * requirements.
7971  *
7972  * Implementations **must** ensure that updates are successfully applied and persisted upon method
7973  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
7974  * without taking any further action such as persisting the current state.
7975  *
7976  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
7977  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
7978  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
7979  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
7980  * multiple instances.
7981  *
7982  * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
7983  */
7984 typedef struct LDKWatch {
7985    /**
7986     * An opaque pointer which is passed to your function implementations as an argument.
7987     * This has no meaning in the LDK, and can be NULL or any other value.
7988     */
7989    void *this_arg;
7990    /**
7991     * Watches a channel identified by `funding_txo` using `monitor`.
7992     *
7993     * Implementations are responsible for watching the chain for the funding transaction along
7994     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
7995     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
7996     *
7997     * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
7998     * the given `funding_txo` has previously been registered via `watch_channel`.
7999     *
8000     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
8001     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
8002     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
8003     */
8004    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
8005    /**
8006     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
8007     *
8008     * Implementations must call [`update_monitor`] with the given update. See
8009     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
8010     *
8011     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
8012     */
8013    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
8014    /**
8015     * Returns any monitor events since the last call. Subsequent calls must only return new
8016     * events.
8017     *
8018     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
8019     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
8020     * to disk.
8021     *
8022     * For details on asynchronous [`ChannelMonitor`] updating and returning
8023     * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
8024     */
8025    struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ (*release_pending_monitor_events)(const void *this_arg);
8026    /**
8027     * Frees any resources associated with this object given its this_arg pointer.
8028     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8029     */
8030    void (*free)(void *this_arg);
8031 } LDKWatch;
8032
8033 /**
8034  * An interface to send a transaction to the Bitcoin network.
8035  */
8036 typedef struct LDKBroadcasterInterface {
8037    /**
8038     * An opaque pointer which is passed to your function implementations as an argument.
8039     * This has no meaning in the LDK, and can be NULL or any other value.
8040     */
8041    void *this_arg;
8042    /**
8043     * Sends a transaction out to (hopefully) be mined.
8044     */
8045    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
8046    /**
8047     * Frees any resources associated with this object given its this_arg pointer.
8048     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8049     */
8050    void (*free)(void *this_arg);
8051 } LDKBroadcasterInterface;
8052
8053 /**
8054  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
8055  * own the memory pointed to by data.
8056  */
8057 typedef struct LDKu8slice {
8058    /**
8059     * A pointer to the byte buffer
8060     */
8061    const uint8_t *data;
8062    /**
8063     * The number of bytes pointed to by `data`.
8064     */
8065    uintptr_t datalen;
8066 } LDKu8slice;
8067
8068 /**
8069  * A trait to describe an object which can get user secrets and key material.
8070  */
8071 typedef struct LDKKeysInterface {
8072    /**
8073     * An opaque pointer which is passed to your function implementations as an argument.
8074     * This has no meaning in the LDK, and can be NULL or any other value.
8075     */
8076    void *this_arg;
8077    /**
8078     * Get node secret key based on the provided [`Recipient`].
8079     *
8080     * The node_id/network_key is the public key that corresponds to this secret key.
8081     *
8082     * This method must return the same value each time it is called with a given `Recipient`
8083     * parameter.
8084     */
8085    struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
8086    /**
8087     * Gets the ECDH shared secret of our [`node secret`] and `other_key`, multiplying by `tweak` if
8088     * one is provided. Note that this tweak can be applied to `other_key` instead of our node
8089     * secret, though this is less efficient.
8090     *
8091     * [`node secret`]: Self::get_node_secret
8092     */
8093    struct LDKCResult_SharedSecretNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak);
8094    /**
8095     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
8096     *
8097     * This method should return a different value each time it is called, to avoid linking
8098     * on-chain funds across channels as controlled to the same user.
8099     */
8100    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
8101    /**
8102     * Get a script pubkey which we will send funds to when closing a channel.
8103     *
8104     * This method should return a different value each time it is called, to avoid linking
8105     * on-chain funds across channels as controlled to the same user.
8106     */
8107    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
8108    /**
8109     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
8110     * restarted with some stale data!
8111     *
8112     * This method must return a different value each time it is called.
8113     */
8114    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
8115    /**
8116     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
8117     * onion packets and for temporary channel IDs. There is no requirement that these be
8118     * persisted anywhere, though they must be unique across restarts.
8119     *
8120     * This method must return a different value each time it is called.
8121     */
8122    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
8123    /**
8124     * Reads a `Signer` for this `KeysInterface` from the given input stream.
8125     * This is only called during deserialization of other objects which contain
8126     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
8127     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
8128     * contain no versioning scheme. You may wish to include your own version prefix and ensure
8129     * you've read all of the provided bytes to ensure no corruption occurred.
8130     */
8131    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
8132    /**
8133     * Sign an invoice.
8134     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
8135     * this trait to parse the invoice and make sure they're signing what they expect, rather than
8136     * blindly signing the hash.
8137     * The hrp is ascii bytes, while the invoice data is base32.
8138     *
8139     * The secret key used to sign the invoice is dependent on the [`Recipient`].
8140     */
8141    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
8142    /**
8143     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
8144     *
8145     * If the implementor of this trait supports [phantom node payments], then every node that is
8146     * intended to be included in the phantom invoice route hints must return the same value from
8147     * this method.
8148     *
8149     * This method must return the same value each time it is called.
8150     *
8151     * [phantom node payments]: PhantomKeysManager
8152     */
8153    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
8154    /**
8155     * Frees any resources associated with this object given its this_arg pointer.
8156     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8157     */
8158    void (*free)(void *this_arg);
8159 } LDKKeysInterface;
8160
8161 /**
8162  * A trait which should be implemented to provide feerate information on a number of time
8163  * horizons.
8164  *
8165  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
8166  * called from inside the library in response to chain events, P2P events, or timer events).
8167  */
8168 typedef struct LDKFeeEstimator {
8169    /**
8170     * An opaque pointer which is passed to your function implementations as an argument.
8171     * This has no meaning in the LDK, and can be NULL or any other value.
8172     */
8173    void *this_arg;
8174    /**
8175     * Gets estimated satoshis of fee required per 1000 Weight-Units.
8176     *
8177     * LDK will wrap this method and ensure that the value returned is no smaller than 253
8178     * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte).
8179     *
8180     * The following unit conversions can be used to convert to sats/KW:
8181     *  * satoshis-per-byte * 250
8182     *  * satoshis-per-kbyte / 4
8183     */
8184    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
8185    /**
8186     * Frees any resources associated with this object given its this_arg pointer.
8187     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8188     */
8189    void (*free)(void *this_arg);
8190 } LDKFeeEstimator;
8191
8192
8193
8194 /**
8195  * Manager which keeps track of a number of channels and sends messages to the appropriate
8196  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
8197  *
8198  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
8199  * to individual Channels.
8200  *
8201  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
8202  * all peers during write/read (though does not modify this instance, only the instance being
8203  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
8204  * called funding_transaction_generated for outbound channels).
8205  *
8206  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
8207  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
8208  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
8209  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
8210  * the serialization process). If the deserialized version is out-of-date compared to the
8211  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
8212  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
8213  *
8214  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
8215  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
8216  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
8217  * block_connected() to step towards your best block) upon deserialization before using the
8218  * object!
8219  *
8220  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
8221  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
8222  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
8223  * offline for a full minute. In order to track this, you must call
8224  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
8225  *
8226  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
8227  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
8228  * essentially you should default to using a SimpleRefChannelManager, and use a
8229  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
8230  * you're using lightning-net-tokio.
8231  */
8232 typedef struct MUST_USE_STRUCT LDKChannelManager {
8233    /**
8234     * A pointer to the opaque Rust object.
8235     * Nearly everywhere, inner must be non-null, however in places where
8236     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8237     */
8238    LDKnativeChannelManager *inner;
8239    /**
8240     * Indicates that this is the only struct which contains the same pointer.
8241     * Rust functions which take ownership of an object provided via an argument require
8242     * this to be true and invalidate the object pointed to by inner.
8243     */
8244    bool is_owned;
8245 } LDKChannelManager;
8246
8247 /**
8248  * A tuple of 2 elements. See the individual fields for the types contained.
8249  */
8250 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
8251    /**
8252     * The element at position 0
8253     */
8254    struct LDKThirtyTwoBytes a;
8255    /**
8256     * The element at position 1
8257     */
8258    struct LDKChannelManager b;
8259 } LDKC2Tuple_BlockHashChannelManagerZ;
8260
8261 /**
8262  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
8263  */
8264 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
8265    /**
8266     * A pointer to the contents in the success state.
8267     * Reading from this pointer when `result_ok` is not set is undefined.
8268     */
8269    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
8270    /**
8271     * A pointer to the contents in the error state.
8272     * Reading from this pointer when `result_ok` is set is undefined.
8273     */
8274    struct LDKDecodeError *err;
8275 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
8276
8277 /**
8278  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
8279  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8280  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8281  */
8282 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8283    /**
8284     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
8285     * `err` or `result` depending on the state of `result_ok`.
8286     */
8287    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
8288    /**
8289     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
8290     */
8291    bool result_ok;
8292 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
8293
8294
8295
8296 /**
8297  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
8298  * with our counterparty.
8299  */
8300 typedef struct MUST_USE_STRUCT LDKChannelConfig {
8301    /**
8302     * A pointer to the opaque Rust object.
8303     * Nearly everywhere, inner must be non-null, however in places where
8304     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8305     */
8306    LDKnativeChannelConfig *inner;
8307    /**
8308     * Indicates that this is the only struct which contains the same pointer.
8309     * Rust functions which take ownership of an object provided via an argument require
8310     * this to be true and invalidate the object pointed to by inner.
8311     */
8312    bool is_owned;
8313 } LDKChannelConfig;
8314
8315 /**
8316  * The contents of CResult_ChannelConfigDecodeErrorZ
8317  */
8318 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
8319    /**
8320     * A pointer to the contents in the success state.
8321     * Reading from this pointer when `result_ok` is not set is undefined.
8322     */
8323    struct LDKChannelConfig *result;
8324    /**
8325     * A pointer to the contents in the error state.
8326     * Reading from this pointer when `result_ok` is set is undefined.
8327     */
8328    struct LDKDecodeError *err;
8329 } LDKCResult_ChannelConfigDecodeErrorZPtr;
8330
8331 /**
8332  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
8333  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
8334  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8335  */
8336 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
8337    /**
8338     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
8339     * `err` or `result` depending on the state of `result_ok`.
8340     */
8341    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
8342    /**
8343     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
8344     */
8345    bool result_ok;
8346 } LDKCResult_ChannelConfigDecodeErrorZ;
8347
8348 /**
8349  * The contents of CResult_OutPointDecodeErrorZ
8350  */
8351 typedef union LDKCResult_OutPointDecodeErrorZPtr {
8352    /**
8353     * A pointer to the contents in the success state.
8354     * Reading from this pointer when `result_ok` is not set is undefined.
8355     */
8356    struct LDKOutPoint *result;
8357    /**
8358     * A pointer to the contents in the error state.
8359     * Reading from this pointer when `result_ok` is set is undefined.
8360     */
8361    struct LDKDecodeError *err;
8362 } LDKCResult_OutPointDecodeErrorZPtr;
8363
8364 /**
8365  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
8366  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
8367  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8368  */
8369 typedef struct LDKCResult_OutPointDecodeErrorZ {
8370    /**
8371     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
8372     * `err` or `result` depending on the state of `result_ok`.
8373     */
8374    union LDKCResult_OutPointDecodeErrorZPtr contents;
8375    /**
8376     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
8377     */
8378    bool result_ok;
8379 } LDKCResult_OutPointDecodeErrorZ;
8380
8381 /**
8382  * Defines a type identifier for sending messages over the wire.
8383  *
8384  * Messages implementing this trait specify a type and must be [`Writeable`].
8385  */
8386 typedef struct LDKType {
8387    /**
8388     * An opaque pointer which is passed to your function implementations as an argument.
8389     * This has no meaning in the LDK, and can be NULL or any other value.
8390     */
8391    void *this_arg;
8392    /**
8393     * Returns the type identifying the message payload.
8394     */
8395    uint16_t (*type_id)(const void *this_arg);
8396    /**
8397     * Return a human-readable "debug" string describing this object
8398     */
8399    struct LDKStr (*debug_str)(const void *this_arg);
8400    /**
8401     * Serialize the object into a byte array
8402     */
8403    struct LDKCVec_u8Z (*write)(const void *this_arg);
8404    /**
8405     * Frees any resources associated with this object given its this_arg pointer.
8406     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8407     */
8408    void (*free)(void *this_arg);
8409 } LDKType;
8410
8411 /**
8412  * An enum which can either contain a crate::lightning::ln::wire::Type or not
8413  */
8414 typedef enum LDKCOption_TypeZ_Tag {
8415    /**
8416     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
8417     */
8418    LDKCOption_TypeZ_Some,
8419    /**
8420     * When we're in this state, this COption_TypeZ contains nothing
8421     */
8422    LDKCOption_TypeZ_None,
8423    /**
8424     * Must be last for serialization purposes
8425     */
8426    LDKCOption_TypeZ_Sentinel,
8427 } LDKCOption_TypeZ_Tag;
8428
8429 typedef struct LDKCOption_TypeZ {
8430    LDKCOption_TypeZ_Tag tag;
8431    union {
8432       struct {
8433          struct LDKType some;
8434       };
8435    };
8436 } LDKCOption_TypeZ;
8437
8438 /**
8439  * The contents of CResult_COption_TypeZDecodeErrorZ
8440  */
8441 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
8442    /**
8443     * A pointer to the contents in the success state.
8444     * Reading from this pointer when `result_ok` is not set is undefined.
8445     */
8446    struct LDKCOption_TypeZ *result;
8447    /**
8448     * A pointer to the contents in the error state.
8449     * Reading from this pointer when `result_ok` is set is undefined.
8450     */
8451    struct LDKDecodeError *err;
8452 } LDKCResult_COption_TypeZDecodeErrorZPtr;
8453
8454 /**
8455  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
8456  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8457  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8458  */
8459 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
8460    /**
8461     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
8462     * `err` or `result` depending on the state of `result_ok`.
8463     */
8464    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
8465    /**
8466     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
8467     */
8468    bool result_ok;
8469 } LDKCResult_COption_TypeZDecodeErrorZ;
8470
8471 /**
8472  * An error that may occur when making a payment.
8473  */
8474 typedef enum LDKPaymentError_Tag {
8475    /**
8476     * An error resulting from the provided [`Invoice`] or payment hash.
8477     */
8478    LDKPaymentError_Invoice,
8479    /**
8480     * An error occurring when finding a route.
8481     */
8482    LDKPaymentError_Routing,
8483    /**
8484     * An error occurring when sending a payment.
8485     */
8486    LDKPaymentError_Sending,
8487    /**
8488     * Must be last for serialization purposes
8489     */
8490    LDKPaymentError_Sentinel,
8491 } LDKPaymentError_Tag;
8492
8493 typedef struct MUST_USE_STRUCT LDKPaymentError {
8494    LDKPaymentError_Tag tag;
8495    union {
8496       struct {
8497          struct LDKStr invoice;
8498       };
8499       struct {
8500          struct LDKLightningError routing;
8501       };
8502       struct {
8503          struct LDKPaymentSendFailure sending;
8504       };
8505    };
8506 } LDKPaymentError;
8507
8508 /**
8509  * The contents of CResult_PaymentIdPaymentErrorZ
8510  */
8511 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
8512    /**
8513     * A pointer to the contents in the success state.
8514     * Reading from this pointer when `result_ok` is not set is undefined.
8515     */
8516    struct LDKThirtyTwoBytes *result;
8517    /**
8518     * A pointer to the contents in the error state.
8519     * Reading from this pointer when `result_ok` is set is undefined.
8520     */
8521    struct LDKPaymentError *err;
8522 } LDKCResult_PaymentIdPaymentErrorZPtr;
8523
8524 /**
8525  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
8526  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
8527  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8528  */
8529 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
8530    /**
8531     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
8532     * `err` or `result` depending on the state of `result_ok`.
8533     */
8534    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
8535    /**
8536     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
8537     */
8538    bool result_ok;
8539 } LDKCResult_PaymentIdPaymentErrorZ;
8540
8541
8542
8543 /**
8544  * A map with liquidity value (in msat) keyed by a short channel id and the direction the HTLC
8545  * is traveling in. The direction boolean is determined by checking if the HTLC source's public
8546  * key is less than its destination. See [`InFlightHtlcs::used_liquidity_msat`] for more
8547  * details.
8548  */
8549 typedef struct MUST_USE_STRUCT LDKInFlightHtlcs {
8550    /**
8551     * A pointer to the opaque Rust object.
8552     * Nearly everywhere, inner must be non-null, however in places where
8553     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8554     */
8555    LDKnativeInFlightHtlcs *inner;
8556    /**
8557     * Indicates that this is the only struct which contains the same pointer.
8558     * Rust functions which take ownership of an object provided via an argument require
8559     * this to be true and invalidate the object pointed to by inner.
8560     */
8561    bool is_owned;
8562 } LDKInFlightHtlcs;
8563
8564 /**
8565  * The contents of CResult_InFlightHtlcsDecodeErrorZ
8566  */
8567 typedef union LDKCResult_InFlightHtlcsDecodeErrorZPtr {
8568    /**
8569     * A pointer to the contents in the success state.
8570     * Reading from this pointer when `result_ok` is not set is undefined.
8571     */
8572    struct LDKInFlightHtlcs *result;
8573    /**
8574     * A pointer to the contents in the error state.
8575     * Reading from this pointer when `result_ok` is set is undefined.
8576     */
8577    struct LDKDecodeError *err;
8578 } LDKCResult_InFlightHtlcsDecodeErrorZPtr;
8579
8580 /**
8581  * A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
8582  * containing a crate::lightning_invoice::payment::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
8583  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8584  */
8585 typedef struct LDKCResult_InFlightHtlcsDecodeErrorZ {
8586    /**
8587     * The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
8588     * `err` or `result` depending on the state of `result_ok`.
8589     */
8590    union LDKCResult_InFlightHtlcsDecodeErrorZPtr contents;
8591    /**
8592     * Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
8593     */
8594    bool result_ok;
8595 } LDKCResult_InFlightHtlcsDecodeErrorZ;
8596
8597 /**
8598  * Sub-errors which don't have specific information in them use this type.
8599  */
8600 typedef struct LDKError {
8601    /**
8602     * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
8603     */
8604    uint8_t _dummy;
8605 } LDKError;
8606
8607 /**
8608  * Errors that indicate what is wrong with the invoice. They have some granularity for debug
8609  * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
8610  */
8611 typedef enum LDKParseError_Tag {
8612    LDKParseError_Bech32Error,
8613    LDKParseError_ParseAmountError,
8614    LDKParseError_MalformedSignature,
8615    LDKParseError_BadPrefix,
8616    LDKParseError_UnknownCurrency,
8617    LDKParseError_UnknownSiPrefix,
8618    LDKParseError_MalformedHRP,
8619    LDKParseError_TooShortDataPart,
8620    LDKParseError_UnexpectedEndOfTaggedFields,
8621    LDKParseError_DescriptionDecodeError,
8622    LDKParseError_PaddingError,
8623    LDKParseError_IntegerOverflowError,
8624    LDKParseError_InvalidSegWitProgramLength,
8625    LDKParseError_InvalidPubKeyHashLength,
8626    LDKParseError_InvalidScriptHashLength,
8627    LDKParseError_InvalidRecoveryId,
8628    LDKParseError_InvalidSliceLength,
8629    /**
8630     * Not an error, but used internally to signal that a part of the invoice should be ignored
8631     * according to BOLT11
8632     */
8633    LDKParseError_Skip,
8634    /**
8635     * Must be last for serialization purposes
8636     */
8637    LDKParseError_Sentinel,
8638 } LDKParseError_Tag;
8639
8640 typedef struct MUST_USE_STRUCT LDKParseError {
8641    LDKParseError_Tag tag;
8642    union {
8643       struct {
8644          struct LDKBech32Error bech32_error;
8645       };
8646       struct {
8647          struct LDKError parse_amount_error;
8648       };
8649       struct {
8650          enum LDKSecp256k1Error malformed_signature;
8651       };
8652       struct {
8653          struct LDKError description_decode_error;
8654       };
8655       struct {
8656          struct LDKStr invalid_slice_length;
8657       };
8658    };
8659 } LDKParseError;
8660
8661 /**
8662  * The contents of CResult_SiPrefixParseErrorZ
8663  */
8664 typedef union LDKCResult_SiPrefixParseErrorZPtr {
8665    /**
8666     * A pointer to the contents in the success state.
8667     * Reading from this pointer when `result_ok` is not set is undefined.
8668     */
8669    enum LDKSiPrefix *result;
8670    /**
8671     * A pointer to the contents in the error state.
8672     * Reading from this pointer when `result_ok` is set is undefined.
8673     */
8674    struct LDKParseError *err;
8675 } LDKCResult_SiPrefixParseErrorZPtr;
8676
8677 /**
8678  * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
8679  * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
8680  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8681  */
8682 typedef struct LDKCResult_SiPrefixParseErrorZ {
8683    /**
8684     * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
8685     * `err` or `result` depending on the state of `result_ok`.
8686     */
8687    union LDKCResult_SiPrefixParseErrorZPtr contents;
8688    /**
8689     * Whether this CResult_SiPrefixParseErrorZ represents a success state.
8690     */
8691    bool result_ok;
8692 } LDKCResult_SiPrefixParseErrorZ;
8693
8694
8695
8696 /**
8697  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
8698  *
8699  * There are three ways to construct an `Invoice`:
8700  *  1. using `InvoiceBuilder`
8701  *  2. using `Invoice::from_signed(SignedRawInvoice)`
8702  *  3. using `str::parse::<Invoice>(&str)`
8703  */
8704 typedef struct MUST_USE_STRUCT LDKInvoice {
8705    /**
8706     * A pointer to the opaque Rust object.
8707     * Nearly everywhere, inner must be non-null, however in places where
8708     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8709     */
8710    LDKnativeInvoice *inner;
8711    /**
8712     * Indicates that this is the only struct which contains the same pointer.
8713     * Rust functions which take ownership of an object provided via an argument require
8714     * this to be true and invalidate the object pointed to by inner.
8715     */
8716    bool is_owned;
8717 } LDKInvoice;
8718
8719 /**
8720  * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
8721  * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
8722  * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
8723  */
8724 typedef enum LDKParseOrSemanticError_Tag {
8725    /**
8726     * The invoice couldn't be decoded
8727     */
8728    LDKParseOrSemanticError_ParseError,
8729    /**
8730     * The invoice could be decoded but violates the BOLT11 standard
8731     */
8732    LDKParseOrSemanticError_SemanticError,
8733    /**
8734     * Must be last for serialization purposes
8735     */
8736    LDKParseOrSemanticError_Sentinel,
8737 } LDKParseOrSemanticError_Tag;
8738
8739 typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
8740    LDKParseOrSemanticError_Tag tag;
8741    union {
8742       struct {
8743          struct LDKParseError parse_error;
8744       };
8745       struct {
8746          enum LDKSemanticError semantic_error;
8747       };
8748    };
8749 } LDKParseOrSemanticError;
8750
8751 /**
8752  * The contents of CResult_InvoiceParseOrSemanticErrorZ
8753  */
8754 typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
8755    /**
8756     * A pointer to the contents in the success state.
8757     * Reading from this pointer when `result_ok` is not set is undefined.
8758     */
8759    struct LDKInvoice *result;
8760    /**
8761     * A pointer to the contents in the error state.
8762     * Reading from this pointer when `result_ok` is set is undefined.
8763     */
8764    struct LDKParseOrSemanticError *err;
8765 } LDKCResult_InvoiceParseOrSemanticErrorZPtr;
8766
8767 /**
8768  * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
8769  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
8770  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8771  */
8772 typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
8773    /**
8774     * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
8775     * `err` or `result` depending on the state of `result_ok`.
8776     */
8777    union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
8778    /**
8779     * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
8780     */
8781    bool result_ok;
8782 } LDKCResult_InvoiceParseOrSemanticErrorZ;
8783
8784
8785
8786 /**
8787  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
8788  * invalid.
8789  *
8790  * # Invariants
8791  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
8792  */
8793 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
8794    /**
8795     * A pointer to the opaque Rust object.
8796     * Nearly everywhere, inner must be non-null, however in places where
8797     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8798     */
8799    LDKnativeSignedRawInvoice *inner;
8800    /**
8801     * Indicates that this is the only struct which contains the same pointer.
8802     * Rust functions which take ownership of an object provided via an argument require
8803     * this to be true and invalidate the object pointed to by inner.
8804     */
8805    bool is_owned;
8806 } LDKSignedRawInvoice;
8807
8808 /**
8809  * The contents of CResult_SignedRawInvoiceParseErrorZ
8810  */
8811 typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
8812    /**
8813     * A pointer to the contents in the success state.
8814     * Reading from this pointer when `result_ok` is not set is undefined.
8815     */
8816    struct LDKSignedRawInvoice *result;
8817    /**
8818     * A pointer to the contents in the error state.
8819     * Reading from this pointer when `result_ok` is set is undefined.
8820     */
8821    struct LDKParseError *err;
8822 } LDKCResult_SignedRawInvoiceParseErrorZPtr;
8823
8824 /**
8825  * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
8826  * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
8827  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8828  */
8829 typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
8830    /**
8831     * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
8832     * `err` or `result` depending on the state of `result_ok`.
8833     */
8834    union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
8835    /**
8836     * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
8837     */
8838    bool result_ok;
8839 } LDKCResult_SignedRawInvoiceParseErrorZ;
8840
8841
8842
8843 /**
8844  * Represents an syntactically correct Invoice for a payment on the lightning network,
8845  * but without the signature information.
8846  * De- and encoding should not lead to information loss but may lead to different hashes.
8847  *
8848  * For methods without docs see the corresponding methods in `Invoice`.
8849  */
8850 typedef struct MUST_USE_STRUCT LDKRawInvoice {
8851    /**
8852     * A pointer to the opaque Rust object.
8853     * Nearly everywhere, inner must be non-null, however in places where
8854     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8855     */
8856    LDKnativeRawInvoice *inner;
8857    /**
8858     * Indicates that this is the only struct which contains the same pointer.
8859     * Rust functions which take ownership of an object provided via an argument require
8860     * this to be true and invalidate the object pointed to by inner.
8861     */
8862    bool is_owned;
8863 } LDKRawInvoice;
8864
8865
8866
8867 /**
8868  * Recoverable signature
8869  */
8870 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
8871    /**
8872     * A pointer to the opaque Rust object.
8873     * Nearly everywhere, inner must be non-null, however in places where
8874     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8875     */
8876    LDKnativeInvoiceSignature *inner;
8877    /**
8878     * Indicates that this is the only struct which contains the same pointer.
8879     * Rust functions which take ownership of an object provided via an argument require
8880     * this to be true and invalidate the object pointed to by inner.
8881     */
8882    bool is_owned;
8883 } LDKInvoiceSignature;
8884
8885 /**
8886  * A tuple of 3 elements. See the individual fields for the types contained.
8887  */
8888 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
8889    /**
8890     * The element at position 0
8891     */
8892    struct LDKRawInvoice a;
8893    /**
8894     * The element at position 1
8895     */
8896    struct LDKThirtyTwoBytes b;
8897    /**
8898     * The element at position 2
8899     */
8900    struct LDKInvoiceSignature c;
8901 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
8902
8903
8904
8905 /**
8906  * Payee public key
8907  */
8908 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
8909    /**
8910     * A pointer to the opaque Rust object.
8911     * Nearly everywhere, inner must be non-null, however in places where
8912     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8913     */
8914    LDKnativePayeePubKey *inner;
8915    /**
8916     * Indicates that this is the only struct which contains the same pointer.
8917     * Rust functions which take ownership of an object provided via an argument require
8918     * this to be true and invalidate the object pointed to by inner.
8919     */
8920    bool is_owned;
8921 } LDKPayeePubKey;
8922
8923 /**
8924  * The contents of CResult_PayeePubKeyErrorZ
8925  */
8926 typedef union LDKCResult_PayeePubKeyErrorZPtr {
8927    /**
8928     * A pointer to the contents in the success state.
8929     * Reading from this pointer when `result_ok` is not set is undefined.
8930     */
8931    struct LDKPayeePubKey *result;
8932    /**
8933     * A pointer to the contents in the error state.
8934     * Reading from this pointer when `result_ok` is set is undefined.
8935     */
8936    enum LDKSecp256k1Error *err;
8937 } LDKCResult_PayeePubKeyErrorZPtr;
8938
8939 /**
8940  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8941  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8942  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8943  */
8944 typedef struct LDKCResult_PayeePubKeyErrorZ {
8945    /**
8946     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8947     * `err` or `result` depending on the state of `result_ok`.
8948     */
8949    union LDKCResult_PayeePubKeyErrorZPtr contents;
8950    /**
8951     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
8952     */
8953    bool result_ok;
8954 } LDKCResult_PayeePubKeyErrorZ;
8955
8956
8957
8958 /**
8959  * Private routing information
8960  *
8961  * # Invariants
8962  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
8963  *
8964  */
8965 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
8966    /**
8967     * A pointer to the opaque Rust object.
8968     * Nearly everywhere, inner must be non-null, however in places where
8969     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8970     */
8971    LDKnativePrivateRoute *inner;
8972    /**
8973     * Indicates that this is the only struct which contains the same pointer.
8974     * Rust functions which take ownership of an object provided via an argument require
8975     * this to be true and invalidate the object pointed to by inner.
8976     */
8977    bool is_owned;
8978 } LDKPrivateRoute;
8979
8980 /**
8981  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8982  * This corresponds to std::vector in C++
8983  */
8984 typedef struct LDKCVec_PrivateRouteZ {
8985    /**
8986     * The elements in the array.
8987     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8988     */
8989    struct LDKPrivateRoute *data;
8990    /**
8991     * The number of elements pointed to by `data`.
8992     */
8993    uintptr_t datalen;
8994 } LDKCVec_PrivateRouteZ;
8995
8996
8997
8998 /**
8999  * A timestamp that refers to a date after 1 January 1970.
9000  *
9001  * # Invariants
9002  *
9003  * The Unix timestamp representing the stored time has to be positive and no greater than
9004  * [`MAX_TIMESTAMP`].
9005  */
9006 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
9007    /**
9008     * A pointer to the opaque Rust object.
9009     * Nearly everywhere, inner must be non-null, however in places where
9010     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9011     */
9012    LDKnativePositiveTimestamp *inner;
9013    /**
9014     * Indicates that this is the only struct which contains the same pointer.
9015     * Rust functions which take ownership of an object provided via an argument require
9016     * this to be true and invalidate the object pointed to by inner.
9017     */
9018    bool is_owned;
9019 } LDKPositiveTimestamp;
9020
9021 /**
9022  * The contents of CResult_PositiveTimestampCreationErrorZ
9023  */
9024 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
9025    /**
9026     * A pointer to the contents in the success state.
9027     * Reading from this pointer when `result_ok` is not set is undefined.
9028     */
9029    struct LDKPositiveTimestamp *result;
9030    /**
9031     * A pointer to the contents in the error state.
9032     * Reading from this pointer when `result_ok` is set is undefined.
9033     */
9034    enum LDKCreationError *err;
9035 } LDKCResult_PositiveTimestampCreationErrorZPtr;
9036
9037 /**
9038  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
9039  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
9040  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9041  */
9042 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
9043    /**
9044     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
9045     * `err` or `result` depending on the state of `result_ok`.
9046     */
9047    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
9048    /**
9049     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
9050     */
9051    bool result_ok;
9052 } LDKCResult_PositiveTimestampCreationErrorZ;
9053
9054 /**
9055  * The contents of CResult_NoneSemanticErrorZ
9056  */
9057 typedef union LDKCResult_NoneSemanticErrorZPtr {
9058    /**
9059     * Note that this value is always NULL, as there are no contents in the OK variant
9060     */
9061    void *result;
9062    /**
9063     * A pointer to the contents in the error state.
9064     * Reading from this pointer when `result_ok` is set is undefined.
9065     */
9066    enum LDKSemanticError *err;
9067 } LDKCResult_NoneSemanticErrorZPtr;
9068
9069 /**
9070  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
9071  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
9072  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9073  */
9074 typedef struct LDKCResult_NoneSemanticErrorZ {
9075    /**
9076     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
9077     * `err` or `result` depending on the state of `result_ok`.
9078     */
9079    union LDKCResult_NoneSemanticErrorZPtr contents;
9080    /**
9081     * Whether this CResult_NoneSemanticErrorZ represents a success state.
9082     */
9083    bool result_ok;
9084 } LDKCResult_NoneSemanticErrorZ;
9085
9086 /**
9087  * The contents of CResult_InvoiceSemanticErrorZ
9088  */
9089 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
9090    /**
9091     * A pointer to the contents in the success state.
9092     * Reading from this pointer when `result_ok` is not set is undefined.
9093     */
9094    struct LDKInvoice *result;
9095    /**
9096     * A pointer to the contents in the error state.
9097     * Reading from this pointer when `result_ok` is set is undefined.
9098     */
9099    enum LDKSemanticError *err;
9100 } LDKCResult_InvoiceSemanticErrorZPtr;
9101
9102 /**
9103  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
9104  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
9105  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9106  */
9107 typedef struct LDKCResult_InvoiceSemanticErrorZ {
9108    /**
9109     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
9110     * `err` or `result` depending on the state of `result_ok`.
9111     */
9112    union LDKCResult_InvoiceSemanticErrorZPtr contents;
9113    /**
9114     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
9115     */
9116    bool result_ok;
9117 } LDKCResult_InvoiceSemanticErrorZ;
9118
9119
9120
9121 /**
9122  * Description string
9123  *
9124  * # Invariants
9125  * The description can be at most 639 __bytes__ long
9126  */
9127 typedef struct MUST_USE_STRUCT LDKDescription {
9128    /**
9129     * A pointer to the opaque Rust object.
9130     * Nearly everywhere, inner must be non-null, however in places where
9131     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9132     */
9133    LDKnativeDescription *inner;
9134    /**
9135     * Indicates that this is the only struct which contains the same pointer.
9136     * Rust functions which take ownership of an object provided via an argument require
9137     * this to be true and invalidate the object pointed to by inner.
9138     */
9139    bool is_owned;
9140 } LDKDescription;
9141
9142 /**
9143  * The contents of CResult_DescriptionCreationErrorZ
9144  */
9145 typedef union LDKCResult_DescriptionCreationErrorZPtr {
9146    /**
9147     * A pointer to the contents in the success state.
9148     * Reading from this pointer when `result_ok` is not set is undefined.
9149     */
9150    struct LDKDescription *result;
9151    /**
9152     * A pointer to the contents in the error state.
9153     * Reading from this pointer when `result_ok` is set is undefined.
9154     */
9155    enum LDKCreationError *err;
9156 } LDKCResult_DescriptionCreationErrorZPtr;
9157
9158 /**
9159  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
9160  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
9161  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9162  */
9163 typedef struct LDKCResult_DescriptionCreationErrorZ {
9164    /**
9165     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
9166     * `err` or `result` depending on the state of `result_ok`.
9167     */
9168    union LDKCResult_DescriptionCreationErrorZPtr contents;
9169    /**
9170     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
9171     */
9172    bool result_ok;
9173 } LDKCResult_DescriptionCreationErrorZ;
9174
9175 /**
9176  * The contents of CResult_PrivateRouteCreationErrorZ
9177  */
9178 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
9179    /**
9180     * A pointer to the contents in the success state.
9181     * Reading from this pointer when `result_ok` is not set is undefined.
9182     */
9183    struct LDKPrivateRoute *result;
9184    /**
9185     * A pointer to the contents in the error state.
9186     * Reading from this pointer when `result_ok` is set is undefined.
9187     */
9188    enum LDKCreationError *err;
9189 } LDKCResult_PrivateRouteCreationErrorZPtr;
9190
9191 /**
9192  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
9193  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
9194  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9195  */
9196 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
9197    /**
9198     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
9199     * `err` or `result` depending on the state of `result_ok`.
9200     */
9201    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
9202    /**
9203     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
9204     */
9205    bool result_ok;
9206 } LDKCResult_PrivateRouteCreationErrorZ;
9207
9208 /**
9209  * The contents of CResult_StringErrorZ
9210  */
9211 typedef union LDKCResult_StringErrorZPtr {
9212    /**
9213     * A pointer to the contents in the success state.
9214     * Reading from this pointer when `result_ok` is not set is undefined.
9215     */
9216    struct LDKStr *result;
9217    /**
9218     * A pointer to the contents in the error state.
9219     * Reading from this pointer when `result_ok` is set is undefined.
9220     */
9221    enum LDKSecp256k1Error *err;
9222 } LDKCResult_StringErrorZPtr;
9223
9224 /**
9225  * A CResult_StringErrorZ represents the result of a fallible operation,
9226  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
9227  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9228  */
9229 typedef struct LDKCResult_StringErrorZ {
9230    /**
9231     * The contents of this CResult_StringErrorZ, accessible via either
9232     * `err` or `result` depending on the state of `result_ok`.
9233     */
9234    union LDKCResult_StringErrorZPtr contents;
9235    /**
9236     * Whether this CResult_StringErrorZ represents a success state.
9237     */
9238    bool result_ok;
9239 } LDKCResult_StringErrorZ;
9240
9241 /**
9242  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9243  */
9244 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
9245    /**
9246     * A pointer to the contents in the success state.
9247     * Reading from this pointer when `result_ok` is not set is undefined.
9248     */
9249    struct LDKChannelMonitorUpdate *result;
9250    /**
9251     * A pointer to the contents in the error state.
9252     * Reading from this pointer when `result_ok` is set is undefined.
9253     */
9254    struct LDKDecodeError *err;
9255 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
9256
9257 /**
9258  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9259  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9260  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9261  */
9262 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
9263    /**
9264     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9265     * `err` or `result` depending on the state of `result_ok`.
9266     */
9267    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
9268    /**
9269     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9270     */
9271    bool result_ok;
9272 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
9273
9274 /**
9275  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9276  */
9277 typedef enum LDKCOption_MonitorEventZ_Tag {
9278    /**
9279     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9280     */
9281    LDKCOption_MonitorEventZ_Some,
9282    /**
9283     * When we're in this state, this COption_MonitorEventZ contains nothing
9284     */
9285    LDKCOption_MonitorEventZ_None,
9286    /**
9287     * Must be last for serialization purposes
9288     */
9289    LDKCOption_MonitorEventZ_Sentinel,
9290 } LDKCOption_MonitorEventZ_Tag;
9291
9292 typedef struct LDKCOption_MonitorEventZ {
9293    LDKCOption_MonitorEventZ_Tag tag;
9294    union {
9295       struct {
9296          struct LDKMonitorEvent some;
9297       };
9298    };
9299 } LDKCOption_MonitorEventZ;
9300
9301 /**
9302  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
9303  */
9304 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
9305    /**
9306     * A pointer to the contents in the success state.
9307     * Reading from this pointer when `result_ok` is not set is undefined.
9308     */
9309    struct LDKCOption_MonitorEventZ *result;
9310    /**
9311     * A pointer to the contents in the error state.
9312     * Reading from this pointer when `result_ok` is set is undefined.
9313     */
9314    struct LDKDecodeError *err;
9315 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
9316
9317 /**
9318  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9319  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9320  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9321  */
9322 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
9323    /**
9324     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9325     * `err` or `result` depending on the state of `result_ok`.
9326     */
9327    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
9328    /**
9329     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9330     */
9331    bool result_ok;
9332 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
9333
9334 /**
9335  * The contents of CResult_HTLCUpdateDecodeErrorZ
9336  */
9337 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
9338    /**
9339     * A pointer to the contents in the success state.
9340     * Reading from this pointer when `result_ok` is not set is undefined.
9341     */
9342    struct LDKHTLCUpdate *result;
9343    /**
9344     * A pointer to the contents in the error state.
9345     * Reading from this pointer when `result_ok` is set is undefined.
9346     */
9347    struct LDKDecodeError *err;
9348 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
9349
9350 /**
9351  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9352  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9353  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9354  */
9355 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
9356    /**
9357     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9358     * `err` or `result` depending on the state of `result_ok`.
9359     */
9360    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
9361    /**
9362     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9363     */
9364    bool result_ok;
9365 } LDKCResult_HTLCUpdateDecodeErrorZ;
9366
9367 /**
9368  * A tuple of 2 elements. See the individual fields for the types contained.
9369  */
9370 typedef struct LDKC2Tuple_OutPointScriptZ {
9371    /**
9372     * The element at position 0
9373     */
9374    struct LDKOutPoint a;
9375    /**
9376     * The element at position 1
9377     */
9378    struct LDKCVec_u8Z b;
9379 } LDKC2Tuple_OutPointScriptZ;
9380
9381 /**
9382  * A tuple of 2 elements. See the individual fields for the types contained.
9383  */
9384 typedef struct LDKC2Tuple_u32ScriptZ {
9385    /**
9386     * The element at position 0
9387     */
9388    uint32_t a;
9389    /**
9390     * The element at position 1
9391     */
9392    struct LDKCVec_u8Z b;
9393 } LDKC2Tuple_u32ScriptZ;
9394
9395 /**
9396  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9397  * This corresponds to std::vector in C++
9398  */
9399 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
9400    /**
9401     * The elements in the array.
9402     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9403     */
9404    struct LDKC2Tuple_u32ScriptZ *data;
9405    /**
9406     * The number of elements pointed to by `data`.
9407     */
9408    uintptr_t datalen;
9409 } LDKCVec_C2Tuple_u32ScriptZZ;
9410
9411 /**
9412  * A tuple of 2 elements. See the individual fields for the types contained.
9413  */
9414 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9415    /**
9416     * The element at position 0
9417     */
9418    struct LDKThirtyTwoBytes a;
9419    /**
9420     * The element at position 1
9421     */
9422    struct LDKCVec_C2Tuple_u32ScriptZZ b;
9423 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
9424
9425 /**
9426  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9427  * This corresponds to std::vector in C++
9428  */
9429 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9430    /**
9431     * The elements in the array.
9432     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9433     */
9434    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
9435    /**
9436     * The number of elements pointed to by `data`.
9437     */
9438    uintptr_t datalen;
9439 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
9440
9441 /**
9442  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9443  * This corresponds to std::vector in C++
9444  */
9445 typedef struct LDKCVec_EventZ {
9446    /**
9447     * The elements in the array.
9448     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9449     */
9450    struct LDKEvent *data;
9451    /**
9452     * The number of elements pointed to by `data`.
9453     */
9454    uintptr_t datalen;
9455 } LDKCVec_EventZ;
9456
9457 /**
9458  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9459  * This corresponds to std::vector in C++
9460  */
9461 typedef struct LDKCVec_TransactionZ {
9462    /**
9463     * The elements in the array.
9464     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9465     */
9466    struct LDKTransaction *data;
9467    /**
9468     * The number of elements pointed to by `data`.
9469     */
9470    uintptr_t datalen;
9471 } LDKCVec_TransactionZ;
9472
9473 /**
9474  * A tuple of 2 elements. See the individual fields for the types contained.
9475  */
9476 typedef struct LDKC2Tuple_u32TxOutZ {
9477    /**
9478     * The element at position 0
9479     */
9480    uint32_t a;
9481    /**
9482     * The element at position 1
9483     */
9484    struct LDKTxOut b;
9485 } LDKC2Tuple_u32TxOutZ;
9486
9487 /**
9488  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9489  * This corresponds to std::vector in C++
9490  */
9491 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
9492    /**
9493     * The elements in the array.
9494     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9495     */
9496    struct LDKC2Tuple_u32TxOutZ *data;
9497    /**
9498     * The number of elements pointed to by `data`.
9499     */
9500    uintptr_t datalen;
9501 } LDKCVec_C2Tuple_u32TxOutZZ;
9502
9503 /**
9504  * A tuple of 2 elements. See the individual fields for the types contained.
9505  */
9506 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9507    /**
9508     * The element at position 0
9509     */
9510    struct LDKThirtyTwoBytes a;
9511    /**
9512     * The element at position 1
9513     */
9514    struct LDKCVec_C2Tuple_u32TxOutZZ b;
9515 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
9516
9517 /**
9518  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9519  * This corresponds to std::vector in C++
9520  */
9521 typedef struct LDKCVec_TransactionOutputsZ {
9522    /**
9523     * The elements in the array.
9524     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9525     */
9526    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
9527    /**
9528     * The number of elements pointed to by `data`.
9529     */
9530    uintptr_t datalen;
9531 } LDKCVec_TransactionOutputsZ;
9532
9533 /**
9534  * Details about the balance(s) available for spending once the channel appears on chain.
9535  *
9536  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
9537  * be provided.
9538  */
9539 typedef enum LDKBalance_Tag {
9540    /**
9541     * The channel is not yet closed (or the commitment or closing transaction has not yet
9542     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
9543     * force-closed now.
9544     */
9545    LDKBalance_ClaimableOnChannelClose,
9546    /**
9547     * The channel has been closed, and the given balance is ours but awaiting confirmations until
9548     * we consider it spendable.
9549     */
9550    LDKBalance_ClaimableAwaitingConfirmations,
9551    /**
9552     * The channel has been closed, and the given balance should be ours but awaiting spending
9553     * transaction confirmation. If the spending transaction does not confirm in time, it is
9554     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
9555     *
9556     * Once the spending transaction confirms, before it has reached enough confirmations to be
9557     * considered safe from chain reorganizations, the balance will instead be provided via
9558     * [`Balance::ClaimableAwaitingConfirmations`].
9559     */
9560    LDKBalance_ContentiousClaimable,
9561    /**
9562     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
9563     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
9564     * likely to be claimed by our counterparty before we do.
9565     */
9566    LDKBalance_MaybeTimeoutClaimableHTLC,
9567    /**
9568     * HTLCs which we received from our counterparty which are claimable with a preimage which we
9569     * do not currently have. This will only be claimable if we receive the preimage from the node
9570     * to which we forwarded this HTLC before the timeout.
9571     */
9572    LDKBalance_MaybePreimageClaimableHTLC,
9573    /**
9574     * The channel has been closed, and our counterparty broadcasted a revoked commitment
9575     * transaction.
9576     *
9577     * Thus, we're able to claim all outputs in the commitment transaction, one of which has the
9578     * following amount.
9579     */
9580    LDKBalance_CounterpartyRevokedOutputClaimable,
9581    /**
9582     * Must be last for serialization purposes
9583     */
9584    LDKBalance_Sentinel,
9585 } LDKBalance_Tag;
9586
9587 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
9588    /**
9589     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
9590     * required to do so.
9591     */
9592    uint64_t claimable_amount_satoshis;
9593 } LDKBalance_LDKClaimableOnChannelClose_Body;
9594
9595 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
9596    /**
9597     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
9598     * were spent in broadcasting the transaction.
9599     */
9600    uint64_t claimable_amount_satoshis;
9601    /**
9602     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
9603     * amount.
9604     */
9605    uint32_t confirmation_height;
9606 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
9607
9608 typedef struct LDKBalance_LDKContentiousClaimable_Body {
9609    /**
9610     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
9611     * required to do so.
9612     */
9613    uint64_t claimable_amount_satoshis;
9614    /**
9615     * The height at which the counterparty may be able to claim the balance if we have not
9616     * done so.
9617     */
9618    uint32_t timeout_height;
9619 } LDKBalance_LDKContentiousClaimable_Body;
9620
9621 typedef struct LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body {
9622    /**
9623     * The amount potentially available to claim, in satoshis, excluding the on-chain fees
9624     * which will be required to do so.
9625     */
9626    uint64_t claimable_amount_satoshis;
9627    /**
9628     * The height at which we will be able to claim the balance if our counterparty has not
9629     * done so.
9630     */
9631    uint32_t claimable_height;
9632 } LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body;
9633
9634 typedef struct LDKBalance_LDKMaybePreimageClaimableHTLC_Body {
9635    /**
9636     * The amount potentially available to claim, in satoshis, excluding the on-chain fees
9637     * which will be required to do so.
9638     */
9639    uint64_t claimable_amount_satoshis;
9640    /**
9641     * The height at which our counterparty will be able to claim the balance if we have not
9642     * yet received the preimage and claimed it ourselves.
9643     */
9644    uint32_t expiry_height;
9645 } LDKBalance_LDKMaybePreimageClaimableHTLC_Body;
9646
9647 typedef struct LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body {
9648    /**
9649     * The amount, in satoshis, of the output which we can claim.
9650     *
9651     * Note that for outputs from HTLC balances this may be excluding some on-chain fees that
9652     * were already spent.
9653     */
9654    uint64_t claimable_amount_satoshis;
9655 } LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body;
9656
9657 typedef struct MUST_USE_STRUCT LDKBalance {
9658    LDKBalance_Tag tag;
9659    union {
9660       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
9661       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
9662       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
9663       LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body maybe_timeout_claimable_htlc;
9664       LDKBalance_LDKMaybePreimageClaimableHTLC_Body maybe_preimage_claimable_htlc;
9665       LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body counterparty_revoked_output_claimable;
9666    };
9667 } LDKBalance;
9668
9669 /**
9670  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9671  * This corresponds to std::vector in C++
9672  */
9673 typedef struct LDKCVec_BalanceZ {
9674    /**
9675     * The elements in the array.
9676     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9677     */
9678    struct LDKBalance *data;
9679    /**
9680     * The number of elements pointed to by `data`.
9681     */
9682    uintptr_t datalen;
9683 } LDKCVec_BalanceZ;
9684
9685 /**
9686  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9687  */
9688 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9689    /**
9690     * A pointer to the contents in the success state.
9691     * Reading from this pointer when `result_ok` is not set is undefined.
9692     */
9693    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
9694    /**
9695     * A pointer to the contents in the error state.
9696     * Reading from this pointer when `result_ok` is set is undefined.
9697     */
9698    struct LDKDecodeError *err;
9699 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
9700
9701 /**
9702  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9703  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9704  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9705  */
9706 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9707    /**
9708     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9709     * `err` or `result` depending on the state of `result_ok`.
9710     */
9711    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
9712    /**
9713     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9714     */
9715    bool result_ok;
9716 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
9717
9718 /**
9719  * A tuple of 2 elements. See the individual fields for the types contained.
9720  */
9721 typedef struct LDKC2Tuple_PublicKeyTypeZ {
9722    /**
9723     * The element at position 0
9724     */
9725    struct LDKPublicKey a;
9726    /**
9727     * The element at position 1
9728     */
9729    struct LDKType b;
9730 } LDKC2Tuple_PublicKeyTypeZ;
9731
9732 /**
9733  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
9734  * This corresponds to std::vector in C++
9735  */
9736 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
9737    /**
9738     * The elements in the array.
9739     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9740     */
9741    struct LDKC2Tuple_PublicKeyTypeZ *data;
9742    /**
9743     * The number of elements pointed to by `data`.
9744     */
9745    uintptr_t datalen;
9746 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
9747
9748 /**
9749  * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
9750  */
9751 typedef enum LDKCOption_NetAddressZ_Tag {
9752    /**
9753     * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
9754     */
9755    LDKCOption_NetAddressZ_Some,
9756    /**
9757     * When we're in this state, this COption_NetAddressZ contains nothing
9758     */
9759    LDKCOption_NetAddressZ_None,
9760    /**
9761     * Must be last for serialization purposes
9762     */
9763    LDKCOption_NetAddressZ_Sentinel,
9764 } LDKCOption_NetAddressZ_Tag;
9765
9766 typedef struct LDKCOption_NetAddressZ {
9767    LDKCOption_NetAddressZ_Tag tag;
9768    union {
9769       struct {
9770          struct LDKNetAddress some;
9771       };
9772    };
9773 } LDKCOption_NetAddressZ;
9774
9775
9776
9777 /**
9778  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
9779  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
9780  * descriptor.
9781  */
9782 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
9783    /**
9784     * A pointer to the opaque Rust object.
9785     * Nearly everywhere, inner must be non-null, however in places where
9786     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9787     */
9788    LDKnativePeerHandleError *inner;
9789    /**
9790     * Indicates that this is the only struct which contains the same pointer.
9791     * Rust functions which take ownership of an object provided via an argument require
9792     * this to be true and invalidate the object pointed to by inner.
9793     */
9794    bool is_owned;
9795 } LDKPeerHandleError;
9796
9797 /**
9798  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
9799  */
9800 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
9801    /**
9802     * A pointer to the contents in the success state.
9803     * Reading from this pointer when `result_ok` is not set is undefined.
9804     */
9805    struct LDKCVec_u8Z *result;
9806    /**
9807     * A pointer to the contents in the error state.
9808     * Reading from this pointer when `result_ok` is set is undefined.
9809     */
9810    struct LDKPeerHandleError *err;
9811 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
9812
9813 /**
9814  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
9815  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9816  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9817  */
9818 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
9819    /**
9820     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
9821     * `err` or `result` depending on the state of `result_ok`.
9822     */
9823    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
9824    /**
9825     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
9826     */
9827    bool result_ok;
9828 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
9829
9830 /**
9831  * The contents of CResult_NonePeerHandleErrorZ
9832  */
9833 typedef union LDKCResult_NonePeerHandleErrorZPtr {
9834    /**
9835     * Note that this value is always NULL, as there are no contents in the OK variant
9836     */
9837    void *result;
9838    /**
9839     * A pointer to the contents in the error state.
9840     * Reading from this pointer when `result_ok` is set is undefined.
9841     */
9842    struct LDKPeerHandleError *err;
9843 } LDKCResult_NonePeerHandleErrorZPtr;
9844
9845 /**
9846  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
9847  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9848  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9849  */
9850 typedef struct LDKCResult_NonePeerHandleErrorZ {
9851    /**
9852     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
9853     * `err` or `result` depending on the state of `result_ok`.
9854     */
9855    union LDKCResult_NonePeerHandleErrorZPtr contents;
9856    /**
9857     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
9858     */
9859    bool result_ok;
9860 } LDKCResult_NonePeerHandleErrorZ;
9861
9862 /**
9863  * The contents of CResult_boolPeerHandleErrorZ
9864  */
9865 typedef union LDKCResult_boolPeerHandleErrorZPtr {
9866    /**
9867     * A pointer to the contents in the success state.
9868     * Reading from this pointer when `result_ok` is not set is undefined.
9869     */
9870    bool *result;
9871    /**
9872     * A pointer to the contents in the error state.
9873     * Reading from this pointer when `result_ok` is set is undefined.
9874     */
9875    struct LDKPeerHandleError *err;
9876 } LDKCResult_boolPeerHandleErrorZPtr;
9877
9878 /**
9879  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
9880  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9881  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9882  */
9883 typedef struct LDKCResult_boolPeerHandleErrorZ {
9884    /**
9885     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
9886     * `err` or `result` depending on the state of `result_ok`.
9887     */
9888    union LDKCResult_boolPeerHandleErrorZPtr contents;
9889    /**
9890     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
9891     */
9892    bool result_ok;
9893 } LDKCResult_boolPeerHandleErrorZ;
9894
9895 /**
9896  * Errors that may occur when [sending an onion message].
9897  *
9898  * [sending an onion message]: OnionMessenger::send_onion_message
9899  */
9900 typedef enum LDKSendError_Tag {
9901    /**
9902     * Errored computing onion message packet keys.
9903     */
9904    LDKSendError_Secp256k1,
9905    /**
9906     * Because implementations such as Eclair will drop onion messages where the message packet
9907     * exceeds 32834 bytes, we refuse to send messages where the packet exceeds this size.
9908     */
9909    LDKSendError_TooBigPacket,
9910    /**
9911     * The provided [`Destination`] was an invalid [`BlindedRoute`], due to having fewer than two
9912     * blinded hops.
9913     */
9914    LDKSendError_TooFewBlindedHops,
9915    /**
9916     * Our next-hop peer was offline or does not support onion message forwarding.
9917     */
9918    LDKSendError_InvalidFirstHop,
9919    /**
9920     * Our next-hop peer's buffer was full or our total outbound buffer was full.
9921     */
9922    LDKSendError_BufferFull,
9923    /**
9924     * Must be last for serialization purposes
9925     */
9926    LDKSendError_Sentinel,
9927 } LDKSendError_Tag;
9928
9929 typedef struct MUST_USE_STRUCT LDKSendError {
9930    LDKSendError_Tag tag;
9931    union {
9932       struct {
9933          enum LDKSecp256k1Error secp256k1;
9934       };
9935    };
9936 } LDKSendError;
9937
9938 /**
9939  * The contents of CResult_NoneSendErrorZ
9940  */
9941 typedef union LDKCResult_NoneSendErrorZPtr {
9942    /**
9943     * Note that this value is always NULL, as there are no contents in the OK variant
9944     */
9945    void *result;
9946    /**
9947     * A pointer to the contents in the error state.
9948     * Reading from this pointer when `result_ok` is set is undefined.
9949     */
9950    struct LDKSendError *err;
9951 } LDKCResult_NoneSendErrorZPtr;
9952
9953 /**
9954  * A CResult_NoneSendErrorZ represents the result of a fallible operation,
9955  * containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
9956  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9957  */
9958 typedef struct LDKCResult_NoneSendErrorZ {
9959    /**
9960     * The contents of this CResult_NoneSendErrorZ, accessible via either
9961     * `err` or `result` depending on the state of `result_ok`.
9962     */
9963    union LDKCResult_NoneSendErrorZPtr contents;
9964    /**
9965     * Whether this CResult_NoneSendErrorZ represents a success state.
9966     */
9967    bool result_ok;
9968 } LDKCResult_NoneSendErrorZ;
9969
9970 /**
9971  * All-encompassing standard error type that processing can return
9972  */
9973 typedef enum LDKGraphSyncError_Tag {
9974    /**
9975     * Error trying to read the update data, typically due to an erroneous data length indication
9976     * that is greater than the actual amount of data provided
9977     */
9978    LDKGraphSyncError_DecodeError,
9979    /**
9980     * Error applying the patch to the network graph, usually the result of updates that are too
9981     * old or missing prerequisite data to the application of updates out of order
9982     */
9983    LDKGraphSyncError_LightningError,
9984    /**
9985     * Must be last for serialization purposes
9986     */
9987    LDKGraphSyncError_Sentinel,
9988 } LDKGraphSyncError_Tag;
9989
9990 typedef struct MUST_USE_STRUCT LDKGraphSyncError {
9991    LDKGraphSyncError_Tag tag;
9992    union {
9993       struct {
9994          struct LDKDecodeError decode_error;
9995       };
9996       struct {
9997          struct LDKLightningError lightning_error;
9998       };
9999    };
10000 } LDKGraphSyncError;
10001
10002 /**
10003  * The contents of CResult_u32GraphSyncErrorZ
10004  */
10005 typedef union LDKCResult_u32GraphSyncErrorZPtr {
10006    /**
10007     * A pointer to the contents in the success state.
10008     * Reading from this pointer when `result_ok` is not set is undefined.
10009     */
10010    uint32_t *result;
10011    /**
10012     * A pointer to the contents in the error state.
10013     * Reading from this pointer when `result_ok` is set is undefined.
10014     */
10015    struct LDKGraphSyncError *err;
10016 } LDKCResult_u32GraphSyncErrorZPtr;
10017
10018 /**
10019  * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
10020  * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
10021  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10022  */
10023 typedef struct LDKCResult_u32GraphSyncErrorZ {
10024    /**
10025     * The contents of this CResult_u32GraphSyncErrorZ, accessible via either
10026     * `err` or `result` depending on the state of `result_ok`.
10027     */
10028    union LDKCResult_u32GraphSyncErrorZPtr contents;
10029    /**
10030     * Whether this CResult_u32GraphSyncErrorZ represents a success state.
10031     */
10032    bool result_ok;
10033 } LDKCResult_u32GraphSyncErrorZ;
10034
10035 /**
10036  * The contents of CResult_NetAddressDecodeErrorZ
10037  */
10038 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
10039    /**
10040     * A pointer to the contents in the success state.
10041     * Reading from this pointer when `result_ok` is not set is undefined.
10042     */
10043    struct LDKNetAddress *result;
10044    /**
10045     * A pointer to the contents in the error state.
10046     * Reading from this pointer when `result_ok` is set is undefined.
10047     */
10048    struct LDKDecodeError *err;
10049 } LDKCResult_NetAddressDecodeErrorZPtr;
10050
10051 /**
10052  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
10053  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
10054  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10055  */
10056 typedef struct LDKCResult_NetAddressDecodeErrorZ {
10057    /**
10058     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
10059     * `err` or `result` depending on the state of `result_ok`.
10060     */
10061    union LDKCResult_NetAddressDecodeErrorZPtr contents;
10062    /**
10063     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
10064     */
10065    bool result_ok;
10066 } LDKCResult_NetAddressDecodeErrorZ;
10067
10068
10069
10070 /**
10071  * An update_add_htlc message to be sent or received from a peer
10072  */
10073 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
10074    /**
10075     * A pointer to the opaque Rust object.
10076     * Nearly everywhere, inner must be non-null, however in places where
10077     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10078     */
10079    LDKnativeUpdateAddHTLC *inner;
10080    /**
10081     * Indicates that this is the only struct which contains the same pointer.
10082     * Rust functions which take ownership of an object provided via an argument require
10083     * this to be true and invalidate the object pointed to by inner.
10084     */
10085    bool is_owned;
10086 } LDKUpdateAddHTLC;
10087
10088 /**
10089  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
10090  * This corresponds to std::vector in C++
10091  */
10092 typedef struct LDKCVec_UpdateAddHTLCZ {
10093    /**
10094     * The elements in the array.
10095     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10096     */
10097    struct LDKUpdateAddHTLC *data;
10098    /**
10099     * The number of elements pointed to by `data`.
10100     */
10101    uintptr_t datalen;
10102 } LDKCVec_UpdateAddHTLCZ;
10103
10104
10105
10106 /**
10107  * An update_fulfill_htlc message to be sent or received from a peer
10108  */
10109 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
10110    /**
10111     * A pointer to the opaque Rust object.
10112     * Nearly everywhere, inner must be non-null, however in places where
10113     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10114     */
10115    LDKnativeUpdateFulfillHTLC *inner;
10116    /**
10117     * Indicates that this is the only struct which contains the same pointer.
10118     * Rust functions which take ownership of an object provided via an argument require
10119     * this to be true and invalidate the object pointed to by inner.
10120     */
10121    bool is_owned;
10122 } LDKUpdateFulfillHTLC;
10123
10124 /**
10125  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
10126  * This corresponds to std::vector in C++
10127  */
10128 typedef struct LDKCVec_UpdateFulfillHTLCZ {
10129    /**
10130     * The elements in the array.
10131     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10132     */
10133    struct LDKUpdateFulfillHTLC *data;
10134    /**
10135     * The number of elements pointed to by `data`.
10136     */
10137    uintptr_t datalen;
10138 } LDKCVec_UpdateFulfillHTLCZ;
10139
10140
10141
10142 /**
10143  * An update_fail_htlc message to be sent or received from a peer
10144  */
10145 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
10146    /**
10147     * A pointer to the opaque Rust object.
10148     * Nearly everywhere, inner must be non-null, however in places where
10149     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10150     */
10151    LDKnativeUpdateFailHTLC *inner;
10152    /**
10153     * Indicates that this is the only struct which contains the same pointer.
10154     * Rust functions which take ownership of an object provided via an argument require
10155     * this to be true and invalidate the object pointed to by inner.
10156     */
10157    bool is_owned;
10158 } LDKUpdateFailHTLC;
10159
10160 /**
10161  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
10162  * This corresponds to std::vector in C++
10163  */
10164 typedef struct LDKCVec_UpdateFailHTLCZ {
10165    /**
10166     * The elements in the array.
10167     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10168     */
10169    struct LDKUpdateFailHTLC *data;
10170    /**
10171     * The number of elements pointed to by `data`.
10172     */
10173    uintptr_t datalen;
10174 } LDKCVec_UpdateFailHTLCZ;
10175
10176
10177
10178 /**
10179  * An update_fail_malformed_htlc message to be sent or received from a peer
10180  */
10181 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
10182    /**
10183     * A pointer to the opaque Rust object.
10184     * Nearly everywhere, inner must be non-null, however in places where
10185     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10186     */
10187    LDKnativeUpdateFailMalformedHTLC *inner;
10188    /**
10189     * Indicates that this is the only struct which contains the same pointer.
10190     * Rust functions which take ownership of an object provided via an argument require
10191     * this to be true and invalidate the object pointed to by inner.
10192     */
10193    bool is_owned;
10194 } LDKUpdateFailMalformedHTLC;
10195
10196 /**
10197  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
10198  * This corresponds to std::vector in C++
10199  */
10200 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
10201    /**
10202     * The elements in the array.
10203     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10204     */
10205    struct LDKUpdateFailMalformedHTLC *data;
10206    /**
10207     * The number of elements pointed to by `data`.
10208     */
10209    uintptr_t datalen;
10210 } LDKCVec_UpdateFailMalformedHTLCZ;
10211
10212 /**
10213  * The contents of CResult_AcceptChannelDecodeErrorZ
10214  */
10215 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
10216    /**
10217     * A pointer to the contents in the success state.
10218     * Reading from this pointer when `result_ok` is not set is undefined.
10219     */
10220    struct LDKAcceptChannel *result;
10221    /**
10222     * A pointer to the contents in the error state.
10223     * Reading from this pointer when `result_ok` is set is undefined.
10224     */
10225    struct LDKDecodeError *err;
10226 } LDKCResult_AcceptChannelDecodeErrorZPtr;
10227
10228 /**
10229  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
10230  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
10231  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10232  */
10233 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
10234    /**
10235     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
10236     * `err` or `result` depending on the state of `result_ok`.
10237     */
10238    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
10239    /**
10240     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
10241     */
10242    bool result_ok;
10243 } LDKCResult_AcceptChannelDecodeErrorZ;
10244
10245 /**
10246  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
10247  */
10248 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
10249    /**
10250     * A pointer to the contents in the success state.
10251     * Reading from this pointer when `result_ok` is not set is undefined.
10252     */
10253    struct LDKAnnouncementSignatures *result;
10254    /**
10255     * A pointer to the contents in the error state.
10256     * Reading from this pointer when `result_ok` is set is undefined.
10257     */
10258    struct LDKDecodeError *err;
10259 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
10260
10261 /**
10262  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
10263  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
10264  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10265  */
10266 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
10267    /**
10268     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
10269     * `err` or `result` depending on the state of `result_ok`.
10270     */
10271    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
10272    /**
10273     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
10274     */
10275    bool result_ok;
10276 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
10277
10278 /**
10279  * The contents of CResult_ChannelReestablishDecodeErrorZ
10280  */
10281 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
10282    /**
10283     * A pointer to the contents in the success state.
10284     * Reading from this pointer when `result_ok` is not set is undefined.
10285     */
10286    struct LDKChannelReestablish *result;
10287    /**
10288     * A pointer to the contents in the error state.
10289     * Reading from this pointer when `result_ok` is set is undefined.
10290     */
10291    struct LDKDecodeError *err;
10292 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
10293
10294 /**
10295  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
10296  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
10297  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10298  */
10299 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
10300    /**
10301     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
10302     * `err` or `result` depending on the state of `result_ok`.
10303     */
10304    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
10305    /**
10306     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
10307     */
10308    bool result_ok;
10309 } LDKCResult_ChannelReestablishDecodeErrorZ;
10310
10311 /**
10312  * The contents of CResult_ClosingSignedDecodeErrorZ
10313  */
10314 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
10315    /**
10316     * A pointer to the contents in the success state.
10317     * Reading from this pointer when `result_ok` is not set is undefined.
10318     */
10319    struct LDKClosingSigned *result;
10320    /**
10321     * A pointer to the contents in the error state.
10322     * Reading from this pointer when `result_ok` is set is undefined.
10323     */
10324    struct LDKDecodeError *err;
10325 } LDKCResult_ClosingSignedDecodeErrorZPtr;
10326
10327 /**
10328  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
10329  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10330  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10331  */
10332 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
10333    /**
10334     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
10335     * `err` or `result` depending on the state of `result_ok`.
10336     */
10337    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
10338    /**
10339     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
10340     */
10341    bool result_ok;
10342 } LDKCResult_ClosingSignedDecodeErrorZ;
10343
10344
10345
10346 /**
10347  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
10348  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
10349  * to use.
10350  */
10351 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
10352    /**
10353     * A pointer to the opaque Rust object.
10354     * Nearly everywhere, inner must be non-null, however in places where
10355     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10356     */
10357    LDKnativeClosingSignedFeeRange *inner;
10358    /**
10359     * Indicates that this is the only struct which contains the same pointer.
10360     * Rust functions which take ownership of an object provided via an argument require
10361     * this to be true and invalidate the object pointed to by inner.
10362     */
10363    bool is_owned;
10364 } LDKClosingSignedFeeRange;
10365
10366 /**
10367  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
10368  */
10369 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
10370    /**
10371     * A pointer to the contents in the success state.
10372     * Reading from this pointer when `result_ok` is not set is undefined.
10373     */
10374    struct LDKClosingSignedFeeRange *result;
10375    /**
10376     * A pointer to the contents in the error state.
10377     * Reading from this pointer when `result_ok` is set is undefined.
10378     */
10379    struct LDKDecodeError *err;
10380 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
10381
10382 /**
10383  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
10384  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10385  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10386  */
10387 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
10388    /**
10389     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
10390     * `err` or `result` depending on the state of `result_ok`.
10391     */
10392    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
10393    /**
10394     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
10395     */
10396    bool result_ok;
10397 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
10398
10399
10400
10401 /**
10402  * A commitment_signed message to be sent or received from a peer
10403  */
10404 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
10405    /**
10406     * A pointer to the opaque Rust object.
10407     * Nearly everywhere, inner must be non-null, however in places where
10408     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10409     */
10410    LDKnativeCommitmentSigned *inner;
10411    /**
10412     * Indicates that this is the only struct which contains the same pointer.
10413     * Rust functions which take ownership of an object provided via an argument require
10414     * this to be true and invalidate the object pointed to by inner.
10415     */
10416    bool is_owned;
10417 } LDKCommitmentSigned;
10418
10419 /**
10420  * The contents of CResult_CommitmentSignedDecodeErrorZ
10421  */
10422 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
10423    /**
10424     * A pointer to the contents in the success state.
10425     * Reading from this pointer when `result_ok` is not set is undefined.
10426     */
10427    struct LDKCommitmentSigned *result;
10428    /**
10429     * A pointer to the contents in the error state.
10430     * Reading from this pointer when `result_ok` is set is undefined.
10431     */
10432    struct LDKDecodeError *err;
10433 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
10434
10435 /**
10436  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
10437  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10438  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10439  */
10440 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
10441    /**
10442     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
10443     * `err` or `result` depending on the state of `result_ok`.
10444     */
10445    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
10446    /**
10447     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
10448     */
10449    bool result_ok;
10450 } LDKCResult_CommitmentSignedDecodeErrorZ;
10451
10452 /**
10453  * The contents of CResult_FundingCreatedDecodeErrorZ
10454  */
10455 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
10456    /**
10457     * A pointer to the contents in the success state.
10458     * Reading from this pointer when `result_ok` is not set is undefined.
10459     */
10460    struct LDKFundingCreated *result;
10461    /**
10462     * A pointer to the contents in the error state.
10463     * Reading from this pointer when `result_ok` is set is undefined.
10464     */
10465    struct LDKDecodeError *err;
10466 } LDKCResult_FundingCreatedDecodeErrorZPtr;
10467
10468 /**
10469  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
10470  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
10471  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10472  */
10473 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
10474    /**
10475     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
10476     * `err` or `result` depending on the state of `result_ok`.
10477     */
10478    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
10479    /**
10480     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
10481     */
10482    bool result_ok;
10483 } LDKCResult_FundingCreatedDecodeErrorZ;
10484
10485 /**
10486  * The contents of CResult_FundingSignedDecodeErrorZ
10487  */
10488 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
10489    /**
10490     * A pointer to the contents in the success state.
10491     * Reading from this pointer when `result_ok` is not set is undefined.
10492     */
10493    struct LDKFundingSigned *result;
10494    /**
10495     * A pointer to the contents in the error state.
10496     * Reading from this pointer when `result_ok` is set is undefined.
10497     */
10498    struct LDKDecodeError *err;
10499 } LDKCResult_FundingSignedDecodeErrorZPtr;
10500
10501 /**
10502  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
10503  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10504  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10505  */
10506 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
10507    /**
10508     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
10509     * `err` or `result` depending on the state of `result_ok`.
10510     */
10511    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
10512    /**
10513     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
10514     */
10515    bool result_ok;
10516 } LDKCResult_FundingSignedDecodeErrorZ;
10517
10518 /**
10519  * The contents of CResult_ChannelReadyDecodeErrorZ
10520  */
10521 typedef union LDKCResult_ChannelReadyDecodeErrorZPtr {
10522    /**
10523     * A pointer to the contents in the success state.
10524     * Reading from this pointer when `result_ok` is not set is undefined.
10525     */
10526    struct LDKChannelReady *result;
10527    /**
10528     * A pointer to the contents in the error state.
10529     * Reading from this pointer when `result_ok` is set is undefined.
10530     */
10531    struct LDKDecodeError *err;
10532 } LDKCResult_ChannelReadyDecodeErrorZPtr;
10533
10534 /**
10535  * A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
10536  * containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
10537  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10538  */
10539 typedef struct LDKCResult_ChannelReadyDecodeErrorZ {
10540    /**
10541     * The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
10542     * `err` or `result` depending on the state of `result_ok`.
10543     */
10544    union LDKCResult_ChannelReadyDecodeErrorZPtr contents;
10545    /**
10546     * Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
10547     */
10548    bool result_ok;
10549 } LDKCResult_ChannelReadyDecodeErrorZ;
10550
10551
10552
10553 /**
10554  * An init message to be sent or received from a peer
10555  */
10556 typedef struct MUST_USE_STRUCT LDKInit {
10557    /**
10558     * A pointer to the opaque Rust object.
10559     * Nearly everywhere, inner must be non-null, however in places where
10560     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10561     */
10562    LDKnativeInit *inner;
10563    /**
10564     * Indicates that this is the only struct which contains the same pointer.
10565     * Rust functions which take ownership of an object provided via an argument require
10566     * this to be true and invalidate the object pointed to by inner.
10567     */
10568    bool is_owned;
10569 } LDKInit;
10570
10571 /**
10572  * The contents of CResult_InitDecodeErrorZ
10573  */
10574 typedef union LDKCResult_InitDecodeErrorZPtr {
10575    /**
10576     * A pointer to the contents in the success state.
10577     * Reading from this pointer when `result_ok` is not set is undefined.
10578     */
10579    struct LDKInit *result;
10580    /**
10581     * A pointer to the contents in the error state.
10582     * Reading from this pointer when `result_ok` is set is undefined.
10583     */
10584    struct LDKDecodeError *err;
10585 } LDKCResult_InitDecodeErrorZPtr;
10586
10587 /**
10588  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
10589  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
10590  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10591  */
10592 typedef struct LDKCResult_InitDecodeErrorZ {
10593    /**
10594     * The contents of this CResult_InitDecodeErrorZ, accessible via either
10595     * `err` or `result` depending on the state of `result_ok`.
10596     */
10597    union LDKCResult_InitDecodeErrorZPtr contents;
10598    /**
10599     * Whether this CResult_InitDecodeErrorZ represents a success state.
10600     */
10601    bool result_ok;
10602 } LDKCResult_InitDecodeErrorZ;
10603
10604 /**
10605  * The contents of CResult_OpenChannelDecodeErrorZ
10606  */
10607 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
10608    /**
10609     * A pointer to the contents in the success state.
10610     * Reading from this pointer when `result_ok` is not set is undefined.
10611     */
10612    struct LDKOpenChannel *result;
10613    /**
10614     * A pointer to the contents in the error state.
10615     * Reading from this pointer when `result_ok` is set is undefined.
10616     */
10617    struct LDKDecodeError *err;
10618 } LDKCResult_OpenChannelDecodeErrorZPtr;
10619
10620 /**
10621  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
10622  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
10623  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10624  */
10625 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
10626    /**
10627     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
10628     * `err` or `result` depending on the state of `result_ok`.
10629     */
10630    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
10631    /**
10632     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
10633     */
10634    bool result_ok;
10635 } LDKCResult_OpenChannelDecodeErrorZ;
10636
10637 /**
10638  * The contents of CResult_RevokeAndACKDecodeErrorZ
10639  */
10640 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
10641    /**
10642     * A pointer to the contents in the success state.
10643     * Reading from this pointer when `result_ok` is not set is undefined.
10644     */
10645    struct LDKRevokeAndACK *result;
10646    /**
10647     * A pointer to the contents in the error state.
10648     * Reading from this pointer when `result_ok` is set is undefined.
10649     */
10650    struct LDKDecodeError *err;
10651 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
10652
10653 /**
10654  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
10655  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
10656  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10657  */
10658 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
10659    /**
10660     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
10661     * `err` or `result` depending on the state of `result_ok`.
10662     */
10663    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
10664    /**
10665     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
10666     */
10667    bool result_ok;
10668 } LDKCResult_RevokeAndACKDecodeErrorZ;
10669
10670 /**
10671  * The contents of CResult_ShutdownDecodeErrorZ
10672  */
10673 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
10674    /**
10675     * A pointer to the contents in the success state.
10676     * Reading from this pointer when `result_ok` is not set is undefined.
10677     */
10678    struct LDKShutdown *result;
10679    /**
10680     * A pointer to the contents in the error state.
10681     * Reading from this pointer when `result_ok` is set is undefined.
10682     */
10683    struct LDKDecodeError *err;
10684 } LDKCResult_ShutdownDecodeErrorZPtr;
10685
10686 /**
10687  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
10688  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
10689  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10690  */
10691 typedef struct LDKCResult_ShutdownDecodeErrorZ {
10692    /**
10693     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
10694     * `err` or `result` depending on the state of `result_ok`.
10695     */
10696    union LDKCResult_ShutdownDecodeErrorZPtr contents;
10697    /**
10698     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
10699     */
10700    bool result_ok;
10701 } LDKCResult_ShutdownDecodeErrorZ;
10702
10703 /**
10704  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
10705  */
10706 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
10707    /**
10708     * A pointer to the contents in the success state.
10709     * Reading from this pointer when `result_ok` is not set is undefined.
10710     */
10711    struct LDKUpdateFailHTLC *result;
10712    /**
10713     * A pointer to the contents in the error state.
10714     * Reading from this pointer when `result_ok` is set is undefined.
10715     */
10716    struct LDKDecodeError *err;
10717 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
10718
10719 /**
10720  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
10721  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10722  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10723  */
10724 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
10725    /**
10726     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
10727     * `err` or `result` depending on the state of `result_ok`.
10728     */
10729    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
10730    /**
10731     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
10732     */
10733    bool result_ok;
10734 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
10735
10736 /**
10737  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
10738  */
10739 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10740    /**
10741     * A pointer to the contents in the success state.
10742     * Reading from this pointer when `result_ok` is not set is undefined.
10743     */
10744    struct LDKUpdateFailMalformedHTLC *result;
10745    /**
10746     * A pointer to the contents in the error state.
10747     * Reading from this pointer when `result_ok` is set is undefined.
10748     */
10749    struct LDKDecodeError *err;
10750 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
10751
10752 /**
10753  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
10754  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10755  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10756  */
10757 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
10758    /**
10759     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
10760     * `err` or `result` depending on the state of `result_ok`.
10761     */
10762    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
10763    /**
10764     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
10765     */
10766    bool result_ok;
10767 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
10768
10769
10770
10771 /**
10772  * An update_fee message to be sent or received from a peer
10773  */
10774 typedef struct MUST_USE_STRUCT LDKUpdateFee {
10775    /**
10776     * A pointer to the opaque Rust object.
10777     * Nearly everywhere, inner must be non-null, however in places where
10778     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10779     */
10780    LDKnativeUpdateFee *inner;
10781    /**
10782     * Indicates that this is the only struct which contains the same pointer.
10783     * Rust functions which take ownership of an object provided via an argument require
10784     * this to be true and invalidate the object pointed to by inner.
10785     */
10786    bool is_owned;
10787 } LDKUpdateFee;
10788
10789 /**
10790  * The contents of CResult_UpdateFeeDecodeErrorZ
10791  */
10792 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
10793    /**
10794     * A pointer to the contents in the success state.
10795     * Reading from this pointer when `result_ok` is not set is undefined.
10796     */
10797    struct LDKUpdateFee *result;
10798    /**
10799     * A pointer to the contents in the error state.
10800     * Reading from this pointer when `result_ok` is set is undefined.
10801     */
10802    struct LDKDecodeError *err;
10803 } LDKCResult_UpdateFeeDecodeErrorZPtr;
10804
10805 /**
10806  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
10807  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
10808  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10809  */
10810 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
10811    /**
10812     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
10813     * `err` or `result` depending on the state of `result_ok`.
10814     */
10815    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
10816    /**
10817     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
10818     */
10819    bool result_ok;
10820 } LDKCResult_UpdateFeeDecodeErrorZ;
10821
10822 /**
10823  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
10824  */
10825 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
10826    /**
10827     * A pointer to the contents in the success state.
10828     * Reading from this pointer when `result_ok` is not set is undefined.
10829     */
10830    struct LDKUpdateFulfillHTLC *result;
10831    /**
10832     * A pointer to the contents in the error state.
10833     * Reading from this pointer when `result_ok` is set is undefined.
10834     */
10835    struct LDKDecodeError *err;
10836 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
10837
10838 /**
10839  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
10840  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10841  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10842  */
10843 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
10844    /**
10845     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
10846     * `err` or `result` depending on the state of `result_ok`.
10847     */
10848    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
10849    /**
10850     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
10851     */
10852    bool result_ok;
10853 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
10854
10855 /**
10856  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
10857  */
10858 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
10859    /**
10860     * A pointer to the contents in the success state.
10861     * Reading from this pointer when `result_ok` is not set is undefined.
10862     */
10863    struct LDKUpdateAddHTLC *result;
10864    /**
10865     * A pointer to the contents in the error state.
10866     * Reading from this pointer when `result_ok` is set is undefined.
10867     */
10868    struct LDKDecodeError *err;
10869 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
10870
10871 /**
10872  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
10873  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10874  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10875  */
10876 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
10877    /**
10878     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
10879     * `err` or `result` depending on the state of `result_ok`.
10880     */
10881    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
10882    /**
10883     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
10884     */
10885    bool result_ok;
10886 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
10887
10888
10889
10890 /**
10891  * An onion message to be sent or received from a peer
10892  */
10893 typedef struct MUST_USE_STRUCT LDKOnionMessage {
10894    /**
10895     * A pointer to the opaque Rust object.
10896     * Nearly everywhere, inner must be non-null, however in places where
10897     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10898     */
10899    LDKnativeOnionMessage *inner;
10900    /**
10901     * Indicates that this is the only struct which contains the same pointer.
10902     * Rust functions which take ownership of an object provided via an argument require
10903     * this to be true and invalidate the object pointed to by inner.
10904     */
10905    bool is_owned;
10906 } LDKOnionMessage;
10907
10908 /**
10909  * The contents of CResult_OnionMessageDecodeErrorZ
10910  */
10911 typedef union LDKCResult_OnionMessageDecodeErrorZPtr {
10912    /**
10913     * A pointer to the contents in the success state.
10914     * Reading from this pointer when `result_ok` is not set is undefined.
10915     */
10916    struct LDKOnionMessage *result;
10917    /**
10918     * A pointer to the contents in the error state.
10919     * Reading from this pointer when `result_ok` is set is undefined.
10920     */
10921    struct LDKDecodeError *err;
10922 } LDKCResult_OnionMessageDecodeErrorZPtr;
10923
10924 /**
10925  * A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
10926  * containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10927  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10928  */
10929 typedef struct LDKCResult_OnionMessageDecodeErrorZ {
10930    /**
10931     * The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
10932     * `err` or `result` depending on the state of `result_ok`.
10933     */
10934    union LDKCResult_OnionMessageDecodeErrorZPtr contents;
10935    /**
10936     * Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
10937     */
10938    bool result_ok;
10939 } LDKCResult_OnionMessageDecodeErrorZ;
10940
10941
10942
10943 /**
10944  * A ping message to be sent or received from a peer
10945  */
10946 typedef struct MUST_USE_STRUCT LDKPing {
10947    /**
10948     * A pointer to the opaque Rust object.
10949     * Nearly everywhere, inner must be non-null, however in places where
10950     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10951     */
10952    LDKnativePing *inner;
10953    /**
10954     * Indicates that this is the only struct which contains the same pointer.
10955     * Rust functions which take ownership of an object provided via an argument require
10956     * this to be true and invalidate the object pointed to by inner.
10957     */
10958    bool is_owned;
10959 } LDKPing;
10960
10961 /**
10962  * The contents of CResult_PingDecodeErrorZ
10963  */
10964 typedef union LDKCResult_PingDecodeErrorZPtr {
10965    /**
10966     * A pointer to the contents in the success state.
10967     * Reading from this pointer when `result_ok` is not set is undefined.
10968     */
10969    struct LDKPing *result;
10970    /**
10971     * A pointer to the contents in the error state.
10972     * Reading from this pointer when `result_ok` is set is undefined.
10973     */
10974    struct LDKDecodeError *err;
10975 } LDKCResult_PingDecodeErrorZPtr;
10976
10977 /**
10978  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
10979  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
10980  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10981  */
10982 typedef struct LDKCResult_PingDecodeErrorZ {
10983    /**
10984     * The contents of this CResult_PingDecodeErrorZ, accessible via either
10985     * `err` or `result` depending on the state of `result_ok`.
10986     */
10987    union LDKCResult_PingDecodeErrorZPtr contents;
10988    /**
10989     * Whether this CResult_PingDecodeErrorZ represents a success state.
10990     */
10991    bool result_ok;
10992 } LDKCResult_PingDecodeErrorZ;
10993
10994
10995
10996 /**
10997  * A pong message to be sent or received from a peer
10998  */
10999 typedef struct MUST_USE_STRUCT LDKPong {
11000    /**
11001     * A pointer to the opaque Rust object.
11002     * Nearly everywhere, inner must be non-null, however in places where
11003     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11004     */
11005    LDKnativePong *inner;
11006    /**
11007     * Indicates that this is the only struct which contains the same pointer.
11008     * Rust functions which take ownership of an object provided via an argument require
11009     * this to be true and invalidate the object pointed to by inner.
11010     */
11011    bool is_owned;
11012 } LDKPong;
11013
11014 /**
11015  * The contents of CResult_PongDecodeErrorZ
11016  */
11017 typedef union LDKCResult_PongDecodeErrorZPtr {
11018    /**
11019     * A pointer to the contents in the success state.
11020     * Reading from this pointer when `result_ok` is not set is undefined.
11021     */
11022    struct LDKPong *result;
11023    /**
11024     * A pointer to the contents in the error state.
11025     * Reading from this pointer when `result_ok` is set is undefined.
11026     */
11027    struct LDKDecodeError *err;
11028 } LDKCResult_PongDecodeErrorZPtr;
11029
11030 /**
11031  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
11032  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
11033  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11034  */
11035 typedef struct LDKCResult_PongDecodeErrorZ {
11036    /**
11037     * The contents of this CResult_PongDecodeErrorZ, accessible via either
11038     * `err` or `result` depending on the state of `result_ok`.
11039     */
11040    union LDKCResult_PongDecodeErrorZPtr contents;
11041    /**
11042     * Whether this CResult_PongDecodeErrorZ represents a success state.
11043     */
11044    bool result_ok;
11045 } LDKCResult_PongDecodeErrorZ;
11046
11047 /**
11048  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
11049  */
11050 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11051    /**
11052     * A pointer to the contents in the success state.
11053     * Reading from this pointer when `result_ok` is not set is undefined.
11054     */
11055    struct LDKUnsignedChannelAnnouncement *result;
11056    /**
11057     * A pointer to the contents in the error state.
11058     * Reading from this pointer when `result_ok` is set is undefined.
11059     */
11060    struct LDKDecodeError *err;
11061 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
11062
11063 /**
11064  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11065  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11066  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11067  */
11068 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
11069    /**
11070     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
11071     * `err` or `result` depending on the state of `result_ok`.
11072     */
11073    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
11074    /**
11075     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
11076     */
11077    bool result_ok;
11078 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
11079
11080 /**
11081  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
11082  */
11083 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
11084    /**
11085     * A pointer to the contents in the success state.
11086     * Reading from this pointer when `result_ok` is not set is undefined.
11087     */
11088    struct LDKChannelAnnouncement *result;
11089    /**
11090     * A pointer to the contents in the error state.
11091     * Reading from this pointer when `result_ok` is set is undefined.
11092     */
11093    struct LDKDecodeError *err;
11094 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
11095
11096 /**
11097  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11098  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11099  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11100  */
11101 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
11102    /**
11103     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
11104     * `err` or `result` depending on the state of `result_ok`.
11105     */
11106    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
11107    /**
11108     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
11109     */
11110    bool result_ok;
11111 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
11112
11113
11114
11115 /**
11116  * The unsigned part of a channel_update
11117  */
11118 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
11119    /**
11120     * A pointer to the opaque Rust object.
11121     * Nearly everywhere, inner must be non-null, however in places where
11122     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11123     */
11124    LDKnativeUnsignedChannelUpdate *inner;
11125    /**
11126     * Indicates that this is the only struct which contains the same pointer.
11127     * Rust functions which take ownership of an object provided via an argument require
11128     * this to be true and invalidate the object pointed to by inner.
11129     */
11130    bool is_owned;
11131 } LDKUnsignedChannelUpdate;
11132
11133 /**
11134  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
11135  */
11136 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
11137    /**
11138     * A pointer to the contents in the success state.
11139     * Reading from this pointer when `result_ok` is not set is undefined.
11140     */
11141    struct LDKUnsignedChannelUpdate *result;
11142    /**
11143     * A pointer to the contents in the error state.
11144     * Reading from this pointer when `result_ok` is set is undefined.
11145     */
11146    struct LDKDecodeError *err;
11147 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
11148
11149 /**
11150  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11151  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11152  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11153  */
11154 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
11155    /**
11156     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
11157     * `err` or `result` depending on the state of `result_ok`.
11158     */
11159    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
11160    /**
11161     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
11162     */
11163    bool result_ok;
11164 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
11165
11166 /**
11167  * The contents of CResult_ChannelUpdateDecodeErrorZ
11168  */
11169 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
11170    /**
11171     * A pointer to the contents in the success state.
11172     * Reading from this pointer when `result_ok` is not set is undefined.
11173     */
11174    struct LDKChannelUpdate *result;
11175    /**
11176     * A pointer to the contents in the error state.
11177     * Reading from this pointer when `result_ok` is set is undefined.
11178     */
11179    struct LDKDecodeError *err;
11180 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
11181
11182 /**
11183  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11184  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11185  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11186  */
11187 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
11188    /**
11189     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
11190     * `err` or `result` depending on the state of `result_ok`.
11191     */
11192    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
11193    /**
11194     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
11195     */
11196    bool result_ok;
11197 } LDKCResult_ChannelUpdateDecodeErrorZ;
11198
11199 /**
11200  * The contents of CResult_ErrorMessageDecodeErrorZ
11201  */
11202 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
11203    /**
11204     * A pointer to the contents in the success state.
11205     * Reading from this pointer when `result_ok` is not set is undefined.
11206     */
11207    struct LDKErrorMessage *result;
11208    /**
11209     * A pointer to the contents in the error state.
11210     * Reading from this pointer when `result_ok` is set is undefined.
11211     */
11212    struct LDKDecodeError *err;
11213 } LDKCResult_ErrorMessageDecodeErrorZPtr;
11214
11215 /**
11216  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
11217  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11218  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11219  */
11220 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
11221    /**
11222     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
11223     * `err` or `result` depending on the state of `result_ok`.
11224     */
11225    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
11226    /**
11227     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
11228     */
11229    bool result_ok;
11230 } LDKCResult_ErrorMessageDecodeErrorZ;
11231
11232 /**
11233  * The contents of CResult_WarningMessageDecodeErrorZ
11234  */
11235 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
11236    /**
11237     * A pointer to the contents in the success state.
11238     * Reading from this pointer when `result_ok` is not set is undefined.
11239     */
11240    struct LDKWarningMessage *result;
11241    /**
11242     * A pointer to the contents in the error state.
11243     * Reading from this pointer when `result_ok` is set is undefined.
11244     */
11245    struct LDKDecodeError *err;
11246 } LDKCResult_WarningMessageDecodeErrorZPtr;
11247
11248 /**
11249  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
11250  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11251  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11252  */
11253 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
11254    /**
11255     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
11256     * `err` or `result` depending on the state of `result_ok`.
11257     */
11258    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
11259    /**
11260     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
11261     */
11262    bool result_ok;
11263 } LDKCResult_WarningMessageDecodeErrorZ;
11264
11265
11266
11267 /**
11268  * The unsigned part of a node_announcement
11269  */
11270 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
11271    /**
11272     * A pointer to the opaque Rust object.
11273     * Nearly everywhere, inner must be non-null, however in places where
11274     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11275     */
11276    LDKnativeUnsignedNodeAnnouncement *inner;
11277    /**
11278     * Indicates that this is the only struct which contains the same pointer.
11279     * Rust functions which take ownership of an object provided via an argument require
11280     * this to be true and invalidate the object pointed to by inner.
11281     */
11282    bool is_owned;
11283 } LDKUnsignedNodeAnnouncement;
11284
11285 /**
11286  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
11287  */
11288 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11289    /**
11290     * A pointer to the contents in the success state.
11291     * Reading from this pointer when `result_ok` is not set is undefined.
11292     */
11293    struct LDKUnsignedNodeAnnouncement *result;
11294    /**
11295     * A pointer to the contents in the error state.
11296     * Reading from this pointer when `result_ok` is set is undefined.
11297     */
11298    struct LDKDecodeError *err;
11299 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
11300
11301 /**
11302  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11303  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11304  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11305  */
11306 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
11307    /**
11308     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
11309     * `err` or `result` depending on the state of `result_ok`.
11310     */
11311    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
11312    /**
11313     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
11314     */
11315    bool result_ok;
11316 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
11317
11318
11319
11320 /**
11321  * A node_announcement message to be sent or received from a peer
11322  */
11323 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
11324    /**
11325     * A pointer to the opaque Rust object.
11326     * Nearly everywhere, inner must be non-null, however in places where
11327     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11328     */
11329    LDKnativeNodeAnnouncement *inner;
11330    /**
11331     * Indicates that this is the only struct which contains the same pointer.
11332     * Rust functions which take ownership of an object provided via an argument require
11333     * this to be true and invalidate the object pointed to by inner.
11334     */
11335    bool is_owned;
11336 } LDKNodeAnnouncement;
11337
11338 /**
11339  * The contents of CResult_NodeAnnouncementDecodeErrorZ
11340  */
11341 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
11342    /**
11343     * A pointer to the contents in the success state.
11344     * Reading from this pointer when `result_ok` is not set is undefined.
11345     */
11346    struct LDKNodeAnnouncement *result;
11347    /**
11348     * A pointer to the contents in the error state.
11349     * Reading from this pointer when `result_ok` is set is undefined.
11350     */
11351    struct LDKDecodeError *err;
11352 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
11353
11354 /**
11355  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11356  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11357  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11358  */
11359 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
11360    /**
11361     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
11362     * `err` or `result` depending on the state of `result_ok`.
11363     */
11364    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
11365    /**
11366     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
11367     */
11368    bool result_ok;
11369 } LDKCResult_NodeAnnouncementDecodeErrorZ;
11370
11371 /**
11372  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
11373  */
11374 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
11375    /**
11376     * A pointer to the contents in the success state.
11377     * Reading from this pointer when `result_ok` is not set is undefined.
11378     */
11379    struct LDKQueryShortChannelIds *result;
11380    /**
11381     * A pointer to the contents in the error state.
11382     * Reading from this pointer when `result_ok` is set is undefined.
11383     */
11384    struct LDKDecodeError *err;
11385 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
11386
11387 /**
11388  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
11389  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
11390  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11391  */
11392 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
11393    /**
11394     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
11395     * `err` or `result` depending on the state of `result_ok`.
11396     */
11397    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
11398    /**
11399     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
11400     */
11401    bool result_ok;
11402 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
11403
11404
11405
11406 /**
11407  * A reply_short_channel_ids_end message is sent as a reply to a
11408  * query_short_channel_ids message. The query recipient makes a best
11409  * effort to respond based on their local network view which may not be
11410  * a perfect view of the network.
11411  */
11412 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
11413    /**
11414     * A pointer to the opaque Rust object.
11415     * Nearly everywhere, inner must be non-null, however in places where
11416     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11417     */
11418    LDKnativeReplyShortChannelIdsEnd *inner;
11419    /**
11420     * Indicates that this is the only struct which contains the same pointer.
11421     * Rust functions which take ownership of an object provided via an argument require
11422     * this to be true and invalidate the object pointed to by inner.
11423     */
11424    bool is_owned;
11425 } LDKReplyShortChannelIdsEnd;
11426
11427 /**
11428  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
11429  */
11430 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11431    /**
11432     * A pointer to the contents in the success state.
11433     * Reading from this pointer when `result_ok` is not set is undefined.
11434     */
11435    struct LDKReplyShortChannelIdsEnd *result;
11436    /**
11437     * A pointer to the contents in the error state.
11438     * Reading from this pointer when `result_ok` is set is undefined.
11439     */
11440    struct LDKDecodeError *err;
11441 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
11442
11443 /**
11444  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
11445  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
11446  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11447  */
11448 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
11449    /**
11450     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
11451     * `err` or `result` depending on the state of `result_ok`.
11452     */
11453    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
11454    /**
11455     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
11456     */
11457    bool result_ok;
11458 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
11459
11460 /**
11461  * The contents of CResult_QueryChannelRangeDecodeErrorZ
11462  */
11463 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
11464    /**
11465     * A pointer to the contents in the success state.
11466     * Reading from this pointer when `result_ok` is not set is undefined.
11467     */
11468    struct LDKQueryChannelRange *result;
11469    /**
11470     * A pointer to the contents in the error state.
11471     * Reading from this pointer when `result_ok` is set is undefined.
11472     */
11473    struct LDKDecodeError *err;
11474 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
11475
11476 /**
11477  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
11478  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11479  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11480  */
11481 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
11482    /**
11483     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
11484     * `err` or `result` depending on the state of `result_ok`.
11485     */
11486    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
11487    /**
11488     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
11489     */
11490    bool result_ok;
11491 } LDKCResult_QueryChannelRangeDecodeErrorZ;
11492
11493 /**
11494  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
11495  */
11496 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
11497    /**
11498     * A pointer to the contents in the success state.
11499     * Reading from this pointer when `result_ok` is not set is undefined.
11500     */
11501    struct LDKReplyChannelRange *result;
11502    /**
11503     * A pointer to the contents in the error state.
11504     * Reading from this pointer when `result_ok` is set is undefined.
11505     */
11506    struct LDKDecodeError *err;
11507 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
11508
11509 /**
11510  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
11511  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11512  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11513  */
11514 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
11515    /**
11516     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
11517     * `err` or `result` depending on the state of `result_ok`.
11518     */
11519    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
11520    /**
11521     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
11522     */
11523    bool result_ok;
11524 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
11525
11526 /**
11527  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
11528  */
11529 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
11530    /**
11531     * A pointer to the contents in the success state.
11532     * Reading from this pointer when `result_ok` is not set is undefined.
11533     */
11534    struct LDKGossipTimestampFilter *result;
11535    /**
11536     * A pointer to the contents in the error state.
11537     * Reading from this pointer when `result_ok` is set is undefined.
11538     */
11539    struct LDKDecodeError *err;
11540 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
11541
11542 /**
11543  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
11544  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
11545  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11546  */
11547 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
11548    /**
11549     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
11550     * `err` or `result` depending on the state of `result_ok`.
11551     */
11552    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
11553    /**
11554     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
11555     */
11556    bool result_ok;
11557 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
11558
11559 /**
11560  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
11561  * This corresponds to std::vector in C++
11562  */
11563 typedef struct LDKCVec_PhantomRouteHintsZ {
11564    /**
11565     * The elements in the array.
11566     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11567     */
11568    struct LDKPhantomRouteHints *data;
11569    /**
11570     * The number of elements pointed to by `data`.
11571     */
11572    uintptr_t datalen;
11573 } LDKCVec_PhantomRouteHintsZ;
11574
11575 /**
11576  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
11577  * may occur.
11578  */
11579 typedef enum LDKSignOrCreationError_Tag {
11580    /**
11581     * An error occurred during signing
11582     */
11583    LDKSignOrCreationError_SignError,
11584    /**
11585     * An error occurred while building the transaction
11586     */
11587    LDKSignOrCreationError_CreationError,
11588    /**
11589     * Must be last for serialization purposes
11590     */
11591    LDKSignOrCreationError_Sentinel,
11592 } LDKSignOrCreationError_Tag;
11593
11594 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
11595    LDKSignOrCreationError_Tag tag;
11596    union {
11597       struct {
11598          enum LDKCreationError creation_error;
11599       };
11600    };
11601 } LDKSignOrCreationError;
11602
11603 /**
11604  * The contents of CResult_InvoiceSignOrCreationErrorZ
11605  */
11606 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
11607    /**
11608     * A pointer to the contents in the success state.
11609     * Reading from this pointer when `result_ok` is not set is undefined.
11610     */
11611    struct LDKInvoice *result;
11612    /**
11613     * A pointer to the contents in the error state.
11614     * Reading from this pointer when `result_ok` is set is undefined.
11615     */
11616    struct LDKSignOrCreationError *err;
11617 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
11618
11619 /**
11620  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
11621  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
11622  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11623  */
11624 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
11625    /**
11626     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
11627     * `err` or `result` depending on the state of `result_ok`.
11628     */
11629    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
11630    /**
11631     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
11632     */
11633    bool result_ok;
11634 } LDKCResult_InvoiceSignOrCreationErrorZ;
11635
11636
11637
11638 /**
11639  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
11640  *
11641  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
11642  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
11643  * [`Confirm::transactions_confirmed`].
11644  *
11645  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
11646  * may have been spent there. See [`Filter::register_output`] for details.
11647  *
11648  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
11649  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
11650  */
11651 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
11652    /**
11653     * A pointer to the opaque Rust object.
11654     * Nearly everywhere, inner must be non-null, however in places where
11655     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11656     */
11657    LDKnativeWatchedOutput *inner;
11658    /**
11659     * Indicates that this is the only struct which contains the same pointer.
11660     * Rust functions which take ownership of an object provided via an argument require
11661     * this to be true and invalidate the object pointed to by inner.
11662     */
11663    bool is_owned;
11664 } LDKWatchedOutput;
11665
11666 /**
11667  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
11668  * channels.
11669  *
11670  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
11671  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
11672  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
11673  * receiving full blocks from a chain source, any further filtering is unnecessary.
11674  *
11675  * After an output has been registered, subsequent block retrievals from the chain source must not
11676  * exclude any transactions matching the new criteria nor any in-block descendants of such
11677  * transactions.
11678  *
11679  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
11680  * should not block on I/O. Implementations should instead queue the newly monitored data to be
11681  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
11682  * invocation that has called the `Filter` must return [`TemporaryFailure`].
11683  *
11684  * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
11685  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
11686  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
11687  */
11688 typedef struct LDKFilter {
11689    /**
11690     * An opaque pointer which is passed to your function implementations as an argument.
11691     * This has no meaning in the LDK, and can be NULL or any other value.
11692     */
11693    void *this_arg;
11694    /**
11695     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
11696     * a spending condition.
11697     */
11698    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
11699    /**
11700     * Registers interest in spends of a transaction output.
11701     *
11702     * Note that this method might be called during processing of a new block. You therefore need
11703     * to ensure that also dependent output spents within an already connected block are correctly
11704     * handled, e.g., by re-scanning the block in question whenever new outputs have been
11705     * registered mid-processing.
11706     */
11707    void (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
11708    /**
11709     * Frees any resources associated with this object given its this_arg pointer.
11710     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11711     */
11712    void (*free)(void *this_arg);
11713 } LDKFilter;
11714
11715 /**
11716  * An enum which can either contain a crate::lightning::chain::Filter or not
11717  */
11718 typedef enum LDKCOption_FilterZ_Tag {
11719    /**
11720     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
11721     */
11722    LDKCOption_FilterZ_Some,
11723    /**
11724     * When we're in this state, this COption_FilterZ contains nothing
11725     */
11726    LDKCOption_FilterZ_None,
11727    /**
11728     * Must be last for serialization purposes
11729     */
11730    LDKCOption_FilterZ_Sentinel,
11731 } LDKCOption_FilterZ_Tag;
11732
11733 typedef struct LDKCOption_FilterZ {
11734    LDKCOption_FilterZ_Tag tag;
11735    union {
11736       struct {
11737          struct LDKFilter some;
11738       };
11739    };
11740 } LDKCOption_FilterZ;
11741
11742
11743
11744 /**
11745  * A read-only reference to a current ChannelMonitor.
11746  *
11747  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
11748  * released.
11749  */
11750 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
11751    /**
11752     * A pointer to the opaque Rust object.
11753     * Nearly everywhere, inner must be non-null, however in places where
11754     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11755     */
11756    LDKnativeLockedChannelMonitor *inner;
11757    /**
11758     * Indicates that this is the only struct which contains the same pointer.
11759     * Rust functions which take ownership of an object provided via an argument require
11760     * this to be true and invalidate the object pointed to by inner.
11761     */
11762    bool is_owned;
11763 } LDKLockedChannelMonitor;
11764
11765 /**
11766  * The contents of CResult_LockedChannelMonitorNoneZ
11767  */
11768 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
11769    /**
11770     * A pointer to the contents in the success state.
11771     * Reading from this pointer when `result_ok` is not set is undefined.
11772     */
11773    struct LDKLockedChannelMonitor *result;
11774    /**
11775     * Note that this value is always NULL, as there are no contents in the Err variant
11776     */
11777    void *err;
11778 } LDKCResult_LockedChannelMonitorNoneZPtr;
11779
11780 /**
11781  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
11782  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
11783  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11784  */
11785 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
11786    /**
11787     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
11788     * `err` or `result` depending on the state of `result_ok`.
11789     */
11790    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
11791    /**
11792     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
11793     */
11794    bool result_ok;
11795 } LDKCResult_LockedChannelMonitorNoneZ;
11796
11797 /**
11798  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
11799  * This corresponds to std::vector in C++
11800  */
11801 typedef struct LDKCVec_OutPointZ {
11802    /**
11803     * The elements in the array.
11804     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11805     */
11806    struct LDKOutPoint *data;
11807    /**
11808     * The number of elements pointed to by `data`.
11809     */
11810    uintptr_t datalen;
11811 } LDKCVec_OutPointZ;
11812
11813 /**
11814  * A trait indicating an object may generate message send events
11815  */
11816 typedef struct LDKMessageSendEventsProvider {
11817    /**
11818     * An opaque pointer which is passed to your function implementations as an argument.
11819     * This has no meaning in the LDK, and can be NULL or any other value.
11820     */
11821    void *this_arg;
11822    /**
11823     * Gets the list of pending events which were generated by previous actions, clearing the list
11824     * in the process.
11825     */
11826    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
11827    /**
11828     * Frees any resources associated with this object given its this_arg pointer.
11829     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11830     */
11831    void (*free)(void *this_arg);
11832 } LDKMessageSendEventsProvider;
11833
11834 /**
11835  * A trait indicating an object may generate onion messages to send
11836  */
11837 typedef struct LDKOnionMessageProvider {
11838    /**
11839     * An opaque pointer which is passed to your function implementations as an argument.
11840     * This has no meaning in the LDK, and can be NULL or any other value.
11841     */
11842    void *this_arg;
11843    /**
11844     * Gets the next pending onion message for the peer with the given node id.
11845     *
11846     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
11847     */
11848    struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id);
11849    /**
11850     * Frees any resources associated with this object given its this_arg pointer.
11851     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11852     */
11853    void (*free)(void *this_arg);
11854 } LDKOnionMessageProvider;
11855
11856 /**
11857  * A trait implemented for objects handling events from [`EventsProvider`].
11858  */
11859 typedef struct LDKEventHandler {
11860    /**
11861     * An opaque pointer which is passed to your function implementations as an argument.
11862     * This has no meaning in the LDK, and can be NULL or any other value.
11863     */
11864    void *this_arg;
11865    /**
11866     * Handles the given [`Event`].
11867     *
11868     * See [`EventsProvider`] for details that must be considered when implementing this method.
11869     */
11870    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
11871    /**
11872     * Frees any resources associated with this object given its this_arg pointer.
11873     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11874     */
11875    void (*free)(void *this_arg);
11876 } LDKEventHandler;
11877
11878 /**
11879  * A trait indicating an object may generate events.
11880  *
11881  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
11882  *
11883  * # Requirements
11884  *
11885  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
11886  * event since the last invocation.
11887  *
11888  * In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s
11889  * and replay any unhandled events on startup. An [`Event`] is considered handled when
11890  * [`process_pending_events`] returns, thus handlers MUST fully handle [`Event`]s and persist any
11891  * relevant changes to disk *before* returning.
11892  *
11893  * Further, because an application may crash between an [`Event`] being handled and the
11894  * implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in
11895  * effect, [`Event`]s may be replayed.
11896  *
11897  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
11898  * consult the provider's documentation on the implication of processing events and how a handler
11899  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
11900  * [`ChainMonitor::process_pending_events`]).
11901  *
11902  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
11903  * own type(s).
11904  *
11905  * [`process_pending_events`]: Self::process_pending_events
11906  * [`handle_event`]: EventHandler::handle_event
11907  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
11908  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
11909  */
11910 typedef struct LDKEventsProvider {
11911    /**
11912     * An opaque pointer which is passed to your function implementations as an argument.
11913     * This has no meaning in the LDK, and can be NULL or any other value.
11914     */
11915    void *this_arg;
11916    /**
11917     * Processes any events generated since the last call using the given event handler.
11918     *
11919     * See the trait-level documentation for requirements.
11920     */
11921    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
11922    /**
11923     * Frees any resources associated with this object given its this_arg pointer.
11924     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11925     */
11926    void (*free)(void *this_arg);
11927 } LDKEventsProvider;
11928
11929
11930
11931 /**
11932  * Lightning TLV uses a custom variable-length integer called BigSize. It is similar to Bitcoin's
11933  * variable-length integers except that it is serialized in big-endian instead of little-endian.
11934  *
11935  * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
11936  * encoded in several different ways, which we must check for at deserialization-time. Thus, if
11937  * you're looking for an example of a variable-length integer to use for your own project, move
11938  * along, this is a rather poor design.
11939  */
11940 typedef struct MUST_USE_STRUCT LDKBigSize {
11941    /**
11942     * A pointer to the opaque Rust object.
11943     * Nearly everywhere, inner must be non-null, however in places where
11944     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11945     */
11946    LDKnativeBigSize *inner;
11947    /**
11948     * Indicates that this is the only struct which contains the same pointer.
11949     * Rust functions which take ownership of an object provided via an argument require
11950     * this to be true and invalidate the object pointed to by inner.
11951     */
11952    bool is_owned;
11953 } LDKBigSize;
11954
11955 /**
11956  * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk.
11957  */
11958 typedef struct LDKPersister {
11959    /**
11960     * An opaque pointer which is passed to your function implementations as an argument.
11961     * This has no meaning in the LDK, and can be NULL or any other value.
11962     */
11963    void *this_arg;
11964    /**
11965     * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
11966     */
11967    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
11968    /**
11969     * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
11970     */
11971    struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
11972    /**
11973     * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed.
11974     */
11975    struct LDKCResult_NoneErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer);
11976    /**
11977     * Frees any resources associated with this object given its this_arg pointer.
11978     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11979     */
11980    void (*free)(void *this_arg);
11981 } LDKPersister;
11982
11983 /**
11984  * A callback which is called when a [`Future`] completes.
11985  *
11986  * Note that this MUST NOT call back into LDK directly, it must instead schedule actions to be
11987  * taken later. Rust users should use the [`std::future::Future`] implementation for [`Future`]
11988  * instead.
11989  *
11990  * Note that the [`std::future::Future`] implementation may only work for runtimes which schedule
11991  * futures when they receive a wake, rather than immediately executing them.
11992  */
11993 typedef struct LDKFutureCallback {
11994    /**
11995     * An opaque pointer which is passed to your function implementations as an argument.
11996     * This has no meaning in the LDK, and can be NULL or any other value.
11997     */
11998    void *this_arg;
11999    /**
12000     * The method which is called.
12001     */
12002    void (*call)(const void *this_arg);
12003    /**
12004     * Frees any resources associated with this object given its this_arg pointer.
12005     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12006     */
12007    void (*free)(void *this_arg);
12008 } LDKFutureCallback;
12009
12010
12011
12012 /**
12013  * A simple future which can complete once, and calls some callback(s) when it does so.
12014  */
12015 typedef struct MUST_USE_STRUCT LDKFuture {
12016    /**
12017     * A pointer to the opaque Rust object.
12018     * Nearly everywhere, inner must be non-null, however in places where
12019     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12020     */
12021    LDKnativeFuture *inner;
12022    /**
12023     * Indicates that this is the only struct which contains the same pointer.
12024     * Rust functions which take ownership of an object provided via an argument require
12025     * this to be true and invalidate the object pointed to by inner.
12026     */
12027    bool is_owned;
12028 } LDKFuture;
12029
12030
12031
12032 /**
12033  * Configuration we set when applicable.
12034  *
12035  * Default::default() provides sane defaults.
12036  */
12037 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
12038    /**
12039     * A pointer to the opaque Rust object.
12040     * Nearly everywhere, inner must be non-null, however in places where
12041     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12042     */
12043    LDKnativeChannelHandshakeConfig *inner;
12044    /**
12045     * Indicates that this is the only struct which contains the same pointer.
12046     * Rust functions which take ownership of an object provided via an argument require
12047     * this to be true and invalidate the object pointed to by inner.
12048     */
12049    bool is_owned;
12050 } LDKChannelHandshakeConfig;
12051
12052
12053
12054 /**
12055  * Optional channel limits which are applied during channel creation.
12056  *
12057  * These limits are only applied to our counterparty's limits, not our own.
12058  *
12059  * Use 0/<type>::max_value() as appropriate to skip checking.
12060  *
12061  * Provides sane defaults for most configurations.
12062  *
12063  * Most additional limits are disabled except those with which specify a default in individual
12064  * field documentation. Note that this may result in barely-usable channels, but since they
12065  * are applied mostly only to incoming channels that's not much of a problem.
12066  */
12067 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
12068    /**
12069     * A pointer to the opaque Rust object.
12070     * Nearly everywhere, inner must be non-null, however in places where
12071     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12072     */
12073    LDKnativeChannelHandshakeLimits *inner;
12074    /**
12075     * Indicates that this is the only struct which contains the same pointer.
12076     * Rust functions which take ownership of an object provided via an argument require
12077     * this to be true and invalidate the object pointed to by inner.
12078     */
12079    bool is_owned;
12080 } LDKChannelHandshakeLimits;
12081
12082
12083
12084 /**
12085  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
12086  *
12087  * Default::default() provides sane defaults for most configurations
12088  * (but currently with 0 relay fees!)
12089  */
12090 typedef struct MUST_USE_STRUCT LDKUserConfig {
12091    /**
12092     * A pointer to the opaque Rust object.
12093     * Nearly everywhere, inner must be non-null, however in places where
12094     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12095     */
12096    LDKnativeUserConfig *inner;
12097    /**
12098     * Indicates that this is the only struct which contains the same pointer.
12099     * Rust functions which take ownership of an object provided via an argument require
12100     * this to be true and invalidate the object pointed to by inner.
12101     */
12102    bool is_owned;
12103 } LDKUserConfig;
12104
12105
12106
12107 /**
12108  * The best known block as identified by its hash and height.
12109  */
12110 typedef struct MUST_USE_STRUCT LDKBestBlock {
12111    /**
12112     * A pointer to the opaque Rust object.
12113     * Nearly everywhere, inner must be non-null, however in places where
12114     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12115     */
12116    LDKnativeBestBlock *inner;
12117    /**
12118     * Indicates that this is the only struct which contains the same pointer.
12119     * Rust functions which take ownership of an object provided via an argument require
12120     * this to be true and invalidate the object pointed to by inner.
12121     */
12122    bool is_owned;
12123 } LDKBestBlock;
12124
12125 /**
12126  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
12127  * chain.
12128  *
12129  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
12130  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
12131  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
12132  * when needed.
12133  *
12134  * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the
12135  * entire header chain and only blocks with matching transaction data using BIP 157 filters or
12136  * other similar filtering.
12137  */
12138 typedef struct LDKListen {
12139    /**
12140     * An opaque pointer which is passed to your function implementations as an argument.
12141     * This has no meaning in the LDK, and can be NULL or any other value.
12142     */
12143    void *this_arg;
12144    /**
12145     * Notifies the listener that a block was added at the given height, with the transaction data
12146     * possibly filtered.
12147     */
12148    void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
12149    /**
12150     * Notifies the listener that a block was added at the given height.
12151     */
12152    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
12153    /**
12154     * Notifies the listener that a block was removed at the given height.
12155     */
12156    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
12157    /**
12158     * Frees any resources associated with this object given its this_arg pointer.
12159     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12160     */
12161    void (*free)(void *this_arg);
12162 } LDKListen;
12163
12164 /**
12165  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
12166  * unconfirmed during a chain reorganization.
12167  *
12168  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
12169  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
12170  * related to registered transactions and outputs. Upon notification, it would pass along the
12171  * matching transactions using this interface.
12172  *
12173  * # Use
12174  *
12175  * The intended use is as follows:
12176  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
12177  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
12178  *   that has been reorganized out of the chain.
12179  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
12180  *
12181  * # Order
12182  *
12183  * Clients must call these methods in chain order. Specifically:
12184  * - Transactions confirmed in a block must be given before transactions confirmed in a later
12185  *   block.
12186  * - Dependent transactions within the same block must be given in topological order, possibly in
12187  *   separate calls.
12188  * - Unconfirmed transactions must be given after the original confirmations and before any
12189  *   reconfirmation.
12190  *
12191  * See individual method documentation for further details.
12192  *
12193  * [`transactions_confirmed`]: Self::transactions_confirmed
12194  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
12195  * [`best_block_updated`]: Self::best_block_updated
12196  * [`get_relevant_txids`]: Self::get_relevant_txids
12197  */
12198 typedef struct LDKConfirm {
12199    /**
12200     * An opaque pointer which is passed to your function implementations as an argument.
12201     * This has no meaning in the LDK, and can be NULL or any other value.
12202     */
12203    void *this_arg;
12204    /**
12205     * Processes transactions confirmed in a block with a given header and height.
12206     *
12207     * Should be called for any transactions registered by [`Filter::register_tx`] or any
12208     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
12209     * appearing in the same block do not need to be included in the same call; instead, multiple
12210     * calls with additional transactions may be made so long as they are made in [chain order].
12211     *
12212     * May be called before or after [`best_block_updated`] for the corresponding block. However,
12213     * in the event of a chain reorganization, it must not be called with a `header` that is no
12214     * longer in the chain as of the last call to [`best_block_updated`].
12215     *
12216     * [chain order]: Confirm#order
12217     * [`best_block_updated`]: Self::best_block_updated
12218     */
12219    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
12220    /**
12221     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
12222     *
12223     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
12224     * reorganized out of the best chain. Once called, the given transaction will not be returned
12225     * by [`get_relevant_txids`], unless it has been reconfirmed via [`transactions_confirmed`].
12226     *
12227     * [`get_relevant_txids`]: Self::get_relevant_txids
12228     * [`transactions_confirmed`]: Self::transactions_confirmed
12229     */
12230    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
12231    /**
12232     * Processes an update to the best header connected at the given height.
12233     *
12234     * Should be called when a new header is available but may be skipped for intermediary blocks
12235     * if they become available at the same time.
12236     */
12237    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
12238    /**
12239     * Returns transactions that should be monitored for reorganization out of the chain.
12240     *
12241     * Will include any transactions passed to [`transactions_confirmed`] that have insufficient
12242     * confirmations to be safe from a chain reorganization. Will not include any transactions
12243     * passed to [`transaction_unconfirmed`], unless later reconfirmed.
12244     *
12245     * May be called to determine the subset of transactions that must still be monitored for
12246     * reorganization. Will be idempotent between calls but may change as a result of calls to the
12247     * other interface methods. Thus, this is useful to determine which transactions may need to be
12248     * given to [`transaction_unconfirmed`].
12249     *
12250     * [`transactions_confirmed`]: Self::transactions_confirmed
12251     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
12252     */
12253    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
12254    /**
12255     * Frees any resources associated with this object given its this_arg pointer.
12256     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12257     */
12258    void (*free)(void *this_arg);
12259 } LDKConfirm;
12260
12261
12262
12263 /**
12264  * An opaque identifier describing a specific [`Persist`] method call.
12265  */
12266 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
12267    /**
12268     * A pointer to the opaque Rust object.
12269     * Nearly everywhere, inner must be non-null, however in places where
12270     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12271     */
12272    LDKnativeMonitorUpdateId *inner;
12273    /**
12274     * Indicates that this is the only struct which contains the same pointer.
12275     * Rust functions which take ownership of an object provided via an argument require
12276     * this to be true and invalidate the object pointed to by inner.
12277     */
12278    bool is_owned;
12279 } LDKMonitorUpdateId;
12280
12281 /**
12282  * `Persist` defines behavior for persisting channel monitors: this could mean
12283  * writing once to disk, and/or uploading to one or more backup services.
12284  *
12285  * Each method can return three possible values:
12286  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
12287  *    implementation should return `Ok(())`, indicating normal channel operation should continue.
12288  *  * If persistence happens asynchronously, implementations should first ensure the
12289  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
12290  *    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
12291  *    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
12292  *    called with the corresponding [`MonitorUpdateId`].
12293  *
12294  *    Note that unlike the direct [`chain::Watch`] interface,
12295  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
12296  *
12297  *  * If persistence fails for some reason, implementations should return
12298  *    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
12299  *    closed without broadcasting the latest state. See
12300  *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
12301  */
12302 typedef struct LDKPersist {
12303    /**
12304     * An opaque pointer which is passed to your function implementations as an argument.
12305     * This has no meaning in the LDK, and can be NULL or any other value.
12306     */
12307    void *this_arg;
12308    /**
12309     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
12310     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
12311     *
12312     * The data can be stored any way you want, but the identifier provided by LDK is the
12313     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
12314     * and the stored channel data). Note that you **must** persist every new monitor to disk.
12315     *
12316     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
12317     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
12318     *
12319     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
12320     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
12321     *
12322     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
12323     * [`Writeable::write`]: crate::util::ser::Writeable::write
12324     */
12325    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
12326    /**
12327     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
12328     * update.
12329     *
12330     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
12331     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
12332     * details.
12333     *
12334     * During blockchain synchronization operations, this may be called with no
12335     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
12336     * Note that after the full [`ChannelMonitor`] is persisted any previous
12337     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
12338     * applied to the persisted [`ChannelMonitor`] as they were already applied.
12339     *
12340     * If an implementer chooses to persist the updates only, they need to make
12341     * sure that all the updates are applied to the `ChannelMonitors` *before*
12342     * the set of channel monitors is given to the `ChannelManager`
12343     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
12344     * applying a monitor update to a monitor. If full `ChannelMonitors` are
12345     * persisted, then there is no need to persist individual updates.
12346     *
12347     * Note that there could be a performance tradeoff between persisting complete
12348     * channel monitors on every update vs. persisting only updates and applying
12349     * them in batches. The size of each monitor grows `O(number of state updates)`
12350     * whereas updates are small and `O(1)`.
12351     *
12352     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
12353     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
12354     *
12355     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
12356     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
12357     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
12358     *
12359     * [`Writeable::write`]: crate::util::ser::Writeable::write
12360     *
12361     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
12362     */
12363    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);
12364    /**
12365     * Frees any resources associated with this object given its this_arg pointer.
12366     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12367     */
12368    void (*free)(void *this_arg);
12369 } LDKPersist;
12370
12371
12372
12373 /**
12374  * An implementation of [`chain::Watch`] for monitoring channels.
12375  *
12376  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
12377  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
12378  * or used independently to monitor channels remotely. See the [module-level documentation] for
12379  * details.
12380  *
12381  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
12382  * [module-level documentation]: crate::chain::chainmonitor
12383  */
12384 typedef struct MUST_USE_STRUCT LDKChainMonitor {
12385    /**
12386     * A pointer to the opaque Rust object.
12387     * Nearly everywhere, inner must be non-null, however in places where
12388     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12389     */
12390    LDKnativeChainMonitor *inner;
12391    /**
12392     * Indicates that this is the only struct which contains the same pointer.
12393     * Rust functions which take ownership of an object provided via an argument require
12394     * this to be true and invalidate the object pointed to by inner.
12395     */
12396    bool is_owned;
12397 } LDKChainMonitor;
12398
12399
12400
12401 /**
12402  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
12403  * and derives keys from that.
12404  *
12405  * Your node_id is seed/0'
12406  * ChannelMonitor closes may use seed/1'
12407  * Cooperative closes may use seed/2'
12408  * The two close keys may be needed to claim on-chain funds!
12409  *
12410  * This struct cannot be used for nodes that wish to support receiving phantom payments;
12411  * [`PhantomKeysManager`] must be used instead.
12412  *
12413  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
12414  * previously issued invoices and attempts to pay previous invoices will fail.
12415  */
12416 typedef struct MUST_USE_STRUCT LDKKeysManager {
12417    /**
12418     * A pointer to the opaque Rust object.
12419     * Nearly everywhere, inner must be non-null, however in places where
12420     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12421     */
12422    LDKnativeKeysManager *inner;
12423    /**
12424     * Indicates that this is the only struct which contains the same pointer.
12425     * Rust functions which take ownership of an object provided via an argument require
12426     * this to be true and invalidate the object pointed to by inner.
12427     */
12428    bool is_owned;
12429 } LDKKeysManager;
12430
12431
12432
12433 /**
12434  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
12435  * payments.
12436  *
12437  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
12438  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
12439  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
12440  * itself without ever needing to forward to this fake node.
12441  *
12442  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
12443  * provide some fault tolerance, because payers will automatically retry paying other provided
12444  * nodes in the case that one node goes down.
12445  *
12446  * Note that multi-path payments are not supported in phantom invoices for security reasons.
12447  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
12448  * invoices and attempts to pay previous invoices will fail.
12449  */
12450 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
12451    /**
12452     * A pointer to the opaque Rust object.
12453     * Nearly everywhere, inner must be non-null, however in places where
12454     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12455     */
12456    LDKnativePhantomKeysManager *inner;
12457    /**
12458     * Indicates that this is the only struct which contains the same pointer.
12459     * Rust functions which take ownership of an object provided via an argument require
12460     * this to be true and invalidate the object pointed to by inner.
12461     */
12462    bool is_owned;
12463 } LDKPhantomKeysManager;
12464
12465
12466
12467 /**
12468  * Chain-related parameters used to construct a new `ChannelManager`.
12469  *
12470  * Typically, the block-specific parameters are derived from the best block hash for the network,
12471  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
12472  * are not needed when deserializing a previously constructed `ChannelManager`.
12473  */
12474 typedef struct MUST_USE_STRUCT LDKChainParameters {
12475    /**
12476     * A pointer to the opaque Rust object.
12477     * Nearly everywhere, inner must be non-null, however in places where
12478     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12479     */
12480    LDKnativeChainParameters *inner;
12481    /**
12482     * Indicates that this is the only struct which contains the same pointer.
12483     * Rust functions which take ownership of an object provided via an argument require
12484     * this to be true and invalidate the object pointed to by inner.
12485     */
12486    bool is_owned;
12487 } LDKChainParameters;
12488
12489 /**
12490  * A trait to describe an object which can receive channel messages.
12491  *
12492  * Messages MAY be called in parallel when they originate from different their_node_ids, however
12493  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
12494  */
12495 typedef struct LDKChannelMessageHandler {
12496    /**
12497     * An opaque pointer which is passed to your function implementations as an argument.
12498     * This has no meaning in the LDK, and can be NULL or any other value.
12499     */
12500    void *this_arg;
12501    /**
12502     * Handle an incoming open_channel message from the given peer.
12503     */
12504    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
12505    /**
12506     * Handle an incoming accept_channel message from the given peer.
12507     */
12508    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
12509    /**
12510     * Handle an incoming funding_created message from the given peer.
12511     */
12512    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
12513    /**
12514     * Handle an incoming funding_signed message from the given peer.
12515     */
12516    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
12517    /**
12518     * Handle an incoming channel_ready message from the given peer.
12519     */
12520    void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg);
12521    /**
12522     * Handle an incoming shutdown message from the given peer.
12523     */
12524    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);
12525    /**
12526     * Handle an incoming closing_signed message from the given peer.
12527     */
12528    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
12529    /**
12530     * Handle an incoming update_add_htlc message from the given peer.
12531     */
12532    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
12533    /**
12534     * Handle an incoming update_fulfill_htlc message from the given peer.
12535     */
12536    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
12537    /**
12538     * Handle an incoming update_fail_htlc message from the given peer.
12539     */
12540    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
12541    /**
12542     * Handle an incoming update_fail_malformed_htlc message from the given peer.
12543     */
12544    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
12545    /**
12546     * Handle an incoming commitment_signed message from the given peer.
12547     */
12548    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
12549    /**
12550     * Handle an incoming revoke_and_ack message from the given peer.
12551     */
12552    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
12553    /**
12554     * Handle an incoming update_fee message from the given peer.
12555     */
12556    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
12557    /**
12558     * Handle an incoming announcement_signatures message from the given peer.
12559     */
12560    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
12561    /**
12562     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
12563     * is believed to be possible in the future (eg they're sending us messages we don't
12564     * understand or indicate they require unknown feature bits), no_connection_possible is set
12565     * and any outstanding channels should be failed.
12566     */
12567    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
12568    /**
12569     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
12570     */
12571    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
12572    /**
12573     * Handle an incoming channel_reestablish message from the given peer.
12574     */
12575    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
12576    /**
12577     * Handle an incoming channel update from the given peer.
12578     */
12579    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
12580    /**
12581     * Handle an incoming error message from the given peer.
12582     */
12583    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
12584    /**
12585     * Gets the node feature flags which this handler itself supports. All available handlers are
12586     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
12587     * which are broadcasted in our [`NodeAnnouncement`] message.
12588     */
12589    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
12590    /**
12591     * Gets the init feature flags which should be sent to the given peer. All available handlers
12592     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
12593     * which are sent in our [`Init`] message.
12594     *
12595     * Note that this method is called before [`Self::peer_connected`].
12596     */
12597    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
12598    /**
12599     * Implementation of MessageSendEventsProvider for this object.
12600     */
12601    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
12602    /**
12603     * Frees any resources associated with this object given its this_arg pointer.
12604     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12605     */
12606    void (*free)(void *this_arg);
12607 } LDKChannelMessageHandler;
12608
12609
12610
12611 /**
12612  * Arguments for the creation of a ChannelManager that are not deserialized.
12613  *
12614  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
12615  * is:
12616  * 1) Deserialize all stored [`ChannelMonitor`]s.
12617  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
12618  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
12619  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
12620  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
12621  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
12622  *    same way you would handle a [`chain::Filter`] call using
12623  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
12624  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
12625  * 5) Disconnect/connect blocks on the [`ChannelManager`].
12626  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
12627  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
12628  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
12629  *    the next step.
12630  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
12631  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
12632  *
12633  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
12634  * call any other methods on the newly-deserialized [`ChannelManager`].
12635  *
12636  * Note that because some channels may be closed during deserialization, it is critical that you
12637  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
12638  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
12639  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
12640  * not force-close the same channels but consider them live), you may end up revoking a state for
12641  * which you've already broadcasted the transaction.
12642  *
12643  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
12644  */
12645 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
12646    /**
12647     * A pointer to the opaque Rust object.
12648     * Nearly everywhere, inner must be non-null, however in places where
12649     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12650     */
12651    LDKnativeChannelManagerReadArgs *inner;
12652    /**
12653     * Indicates that this is the only struct which contains the same pointer.
12654     * Rust functions which take ownership of an object provided via an argument require
12655     * this to be true and invalidate the object pointed to by inner.
12656     */
12657    bool is_owned;
12658 } LDKChannelManagerReadArgs;
12659
12660
12661
12662 /**
12663  * A set of keys that were HKDF-expanded from an initial call to
12664  * [`KeysInterface::get_inbound_payment_key_material`].
12665  *
12666  * [`KeysInterface::get_inbound_payment_key_material`]: crate::chain::keysinterface::KeysInterface::get_inbound_payment_key_material
12667  */
12668 typedef struct MUST_USE_STRUCT LDKExpandedKey {
12669    /**
12670     * A pointer to the opaque Rust object.
12671     * Nearly everywhere, inner must be non-null, however in places where
12672     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12673     */
12674    LDKnativeExpandedKey *inner;
12675    /**
12676     * Indicates that this is the only struct which contains the same pointer.
12677     * Rust functions which take ownership of an object provided via an argument require
12678     * this to be true and invalidate the object pointed to by inner.
12679     */
12680    bool is_owned;
12681 } LDKExpandedKey;
12682
12683
12684
12685 /**
12686  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
12687  * This is used to convince the recipient that the channel is at a certain commitment
12688  * number even if they lost that data due to a local failure.  Of course, the peer may lie
12689  * and even later commitments may have been revoked.
12690  */
12691 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
12692    /**
12693     * A pointer to the opaque Rust object.
12694     * Nearly everywhere, inner must be non-null, however in places where
12695     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12696     */
12697    LDKnativeDataLossProtect *inner;
12698    /**
12699     * Indicates that this is the only struct which contains the same pointer.
12700     * Rust functions which take ownership of an object provided via an argument require
12701     * this to be true and invalidate the object pointed to by inner.
12702     */
12703    bool is_owned;
12704 } LDKDataLossProtect;
12705
12706 /**
12707  * A 3-byte byte array.
12708  */
12709 typedef struct LDKThreeBytes {
12710    /**
12711     * The three bytes
12712     */
12713    uint8_t data[3];
12714 } LDKThreeBytes;
12715
12716 /**
12717  * A trait to describe an object which can receive routing messages.
12718  *
12719  * # Implementor DoS Warnings
12720  *
12721  * For `gossip_queries` messages there are potential DoS vectors when handling
12722  * inbound queries. Implementors using an on-disk network graph should be aware of
12723  * repeated disk I/O for queries accessing different parts of the network graph.
12724  */
12725 typedef struct LDKRoutingMessageHandler {
12726    /**
12727     * An opaque pointer which is passed to your function implementations as an argument.
12728     * This has no meaning in the LDK, and can be NULL or any other value.
12729     */
12730    void *this_arg;
12731    /**
12732     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
12733     * false or returning an Err otherwise.
12734     */
12735    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
12736    /**
12737     * Handle a channel_announcement message, returning true if it should be forwarded on, false
12738     * or returning an Err otherwise.
12739     */
12740    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
12741    /**
12742     * Handle an incoming channel_update message, returning true if it should be forwarded on,
12743     * false or returning an Err otherwise.
12744     */
12745    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
12746    /**
12747     * Gets channel announcements and updates required to dump our routing table to a remote node,
12748     * starting at the short_channel_id indicated by starting_point and including announcements
12749     * for a single channel.
12750     */
12751    struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcement)(const void *this_arg, uint64_t starting_point);
12752    /**
12753     * Gets a node announcement required to dump our routing table to a remote node, starting at
12754     * the node *after* the provided pubkey and including up to one announcement immediately
12755     * higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
12756     * If None is provided for starting_point, we start at the first node.
12757     *
12758     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
12759     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
12760     */
12761    struct LDKNodeAnnouncement (*get_next_node_announcement)(const void *this_arg, struct LDKPublicKey starting_point);
12762    /**
12763     * Called when a connection is established with a peer. This can be used to
12764     * perform routing table synchronization using a strategy defined by the
12765     * implementor.
12766     */
12767    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
12768    /**
12769     * Handles the reply of a query we initiated to learn about channels
12770     * for a given range of blocks. We can expect to receive one or more
12771     * replies to a single query.
12772     */
12773    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
12774    /**
12775     * Handles the reply of a query we initiated asking for routing gossip
12776     * messages for a list of channels. We should receive this message when
12777     * a node has completed its best effort to send us the pertaining routing
12778     * gossip messages.
12779     */
12780    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
12781    /**
12782     * Handles when a peer asks us to send a list of short_channel_ids
12783     * for the requested range of blocks.
12784     */
12785    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
12786    /**
12787     * Handles when a peer asks us to send routing gossip messages for a
12788     * list of short_channel_ids.
12789     */
12790    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
12791    /**
12792     * Gets the node feature flags which this handler itself supports. All available handlers are
12793     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
12794     * which are broadcasted in our [`NodeAnnouncement`] message.
12795     */
12796    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
12797    /**
12798     * Gets the init feature flags which should be sent to the given peer. All available handlers
12799     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
12800     * which are sent in our [`Init`] message.
12801     *
12802     * Note that this method is called before [`Self::peer_connected`].
12803     */
12804    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
12805    /**
12806     * Implementation of MessageSendEventsProvider for this object.
12807     */
12808    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
12809    /**
12810     * Frees any resources associated with this object given its this_arg pointer.
12811     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12812     */
12813    void (*free)(void *this_arg);
12814 } LDKRoutingMessageHandler;
12815
12816 /**
12817  * A trait to describe an object that can receive onion messages.
12818  */
12819 typedef struct LDKOnionMessageHandler {
12820    /**
12821     * An opaque pointer which is passed to your function implementations as an argument.
12822     * This has no meaning in the LDK, and can be NULL or any other value.
12823     */
12824    void *this_arg;
12825    /**
12826     * Handle an incoming onion_message message from the given peer.
12827     */
12828    void (*handle_onion_message)(const void *this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg);
12829    /**
12830     * Called when a connection is established with a peer. Can be used to track which peers
12831     * advertise onion message support and are online.
12832     */
12833    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
12834    /**
12835     * Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to
12836     * drop and refuse to forward onion messages to this peer.
12837     */
12838    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
12839    /**
12840     * Gets the node feature flags which this handler itself supports. All available handlers are
12841     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
12842     * which are broadcasted in our [`NodeAnnouncement`] message.
12843     */
12844    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
12845    /**
12846     * Gets the init feature flags which should be sent to the given peer. All available handlers
12847     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
12848     * which are sent in our [`Init`] message.
12849     *
12850     * Note that this method is called before [`Self::peer_connected`].
12851     */
12852    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
12853    /**
12854     * Implementation of OnionMessageProvider for this object.
12855     */
12856    struct LDKOnionMessageProvider OnionMessageProvider;
12857    /**
12858     * Frees any resources associated with this object given its this_arg pointer.
12859     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12860     */
12861    void (*free)(void *this_arg);
12862 } LDKOnionMessageHandler;
12863
12864 /**
12865  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
12866  * decoders.
12867  */
12868 typedef struct LDKCustomMessageReader {
12869    /**
12870     * An opaque pointer which is passed to your function implementations as an argument.
12871     * This has no meaning in the LDK, and can be NULL or any other value.
12872     */
12873    void *this_arg;
12874    /**
12875     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
12876     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
12877     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
12878     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
12879     */
12880    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
12881    /**
12882     * Frees any resources associated with this object given its this_arg pointer.
12883     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12884     */
12885    void (*free)(void *this_arg);
12886 } LDKCustomMessageReader;
12887
12888 /**
12889  * Handler for BOLT1-compliant messages.
12890  */
12891 typedef struct LDKCustomMessageHandler {
12892    /**
12893     * An opaque pointer which is passed to your function implementations as an argument.
12894     * This has no meaning in the LDK, and can be NULL or any other value.
12895     */
12896    void *this_arg;
12897    /**
12898     * Called with the message type that was received and the buffer to be read.
12899     * Can return a `MessageHandlingError` if the message could not be handled.
12900     */
12901    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
12902    /**
12903     * Gets the list of pending messages which were generated by the custom message
12904     * handler, clearing the list in the process. The first tuple element must
12905     * correspond to the intended recipients node ids. If no connection to one of the
12906     * specified node does not exist, the message is simply not sent to it.
12907     */
12908    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
12909    /**
12910     * Implementation of CustomMessageReader for this object.
12911     */
12912    struct LDKCustomMessageReader CustomMessageReader;
12913    /**
12914     * Frees any resources associated with this object given its this_arg pointer.
12915     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12916     */
12917    void (*free)(void *this_arg);
12918 } LDKCustomMessageHandler;
12919
12920
12921
12922 /**
12923  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
12924  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
12925  */
12926 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
12927    /**
12928     * A pointer to the opaque Rust object.
12929     * Nearly everywhere, inner must be non-null, however in places where
12930     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12931     */
12932    LDKnativeIgnoringMessageHandler *inner;
12933    /**
12934     * Indicates that this is the only struct which contains the same pointer.
12935     * Rust functions which take ownership of an object provided via an argument require
12936     * this to be true and invalidate the object pointed to by inner.
12937     */
12938    bool is_owned;
12939 } LDKIgnoringMessageHandler;
12940
12941
12942
12943 /**
12944  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
12945  * You can provide one of these as the route_handler in a MessageHandler.
12946  */
12947 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
12948    /**
12949     * A pointer to the opaque Rust object.
12950     * Nearly everywhere, inner must be non-null, however in places where
12951     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12952     */
12953    LDKnativeErroringMessageHandler *inner;
12954    /**
12955     * Indicates that this is the only struct which contains the same pointer.
12956     * Rust functions which take ownership of an object provided via an argument require
12957     * this to be true and invalidate the object pointed to by inner.
12958     */
12959    bool is_owned;
12960 } LDKErroringMessageHandler;
12961
12962
12963
12964 /**
12965  * Provides references to trait impls which handle different types of messages.
12966  */
12967 typedef struct MUST_USE_STRUCT LDKMessageHandler {
12968    /**
12969     * A pointer to the opaque Rust object.
12970     * Nearly everywhere, inner must be non-null, however in places where
12971     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12972     */
12973    LDKnativeMessageHandler *inner;
12974    /**
12975     * Indicates that this is the only struct which contains the same pointer.
12976     * Rust functions which take ownership of an object provided via an argument require
12977     * this to be true and invalidate the object pointed to by inner.
12978     */
12979    bool is_owned;
12980 } LDKMessageHandler;
12981
12982 /**
12983  * Provides an object which can be used to send data to and which uniquely identifies a connection
12984  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
12985  * implement Hash to meet the PeerManager API.
12986  *
12987  * For efficiency, Clone should be relatively cheap for this type.
12988  *
12989  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
12990  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
12991  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
12992  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
12993  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
12994  * to simply use another value which is guaranteed to be globally unique instead.
12995  */
12996 typedef struct LDKSocketDescriptor {
12997    /**
12998     * An opaque pointer which is passed to your function implementations as an argument.
12999     * This has no meaning in the LDK, and can be NULL or any other value.
13000     */
13001    void *this_arg;
13002    /**
13003     * Attempts to send some data from the given slice to the peer.
13004     *
13005     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
13006     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
13007     * called and further write attempts may occur until that time.
13008     *
13009     * If the returned size is smaller than `data.len()`, a
13010     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
13011     * written. Additionally, until a `send_data` event completes fully, no further
13012     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
13013     * prevent denial-of-service issues, you should not read or buffer any data from the socket
13014     * until then.
13015     *
13016     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
13017     * (indicating that read events should be paused to prevent DoS in the send buffer),
13018     * `resume_read` may be set indicating that read events on this descriptor should resume. A
13019     * `resume_read` of false carries no meaning, and should not cause any action.
13020     */
13021    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
13022    /**
13023     * Disconnect the socket pointed to by this SocketDescriptor.
13024     *
13025     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
13026     * call (doing so is a noop).
13027     */
13028    void (*disconnect_socket)(void *this_arg);
13029    /**
13030     * Checks if two objects are equal given this object's this_arg pointer and another object.
13031     */
13032    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
13033    /**
13034     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
13035     * This is used, for example, for inclusion of this object in a hash map.
13036     */
13037    uint64_t (*hash)(const void *this_arg);
13038    /**
13039     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
13040     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
13041     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
13042     */
13043    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
13044    /**
13045     * Frees any resources associated with this object given its this_arg pointer.
13046     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13047     */
13048    void (*free)(void *this_arg);
13049 } LDKSocketDescriptor;
13050
13051
13052
13053 /**
13054  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
13055  * socket events into messages which it passes on to its [`MessageHandler`].
13056  *
13057  * Locks are taken internally, so you must never assume that reentrancy from a
13058  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
13059  *
13060  * Calls to [`read_event`] will decode relevant messages and pass them to the
13061  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
13062  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
13063  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
13064  * calls only after previous ones have returned.
13065  *
13066  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
13067  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
13068  * essentially you should default to using a SimpleRefPeerManager, and use a
13069  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
13070  * you're using lightning-net-tokio.
13071  *
13072  * [`read_event`]: PeerManager::read_event
13073  */
13074 typedef struct MUST_USE_STRUCT LDKPeerManager {
13075    /**
13076     * A pointer to the opaque Rust object.
13077     * Nearly everywhere, inner must be non-null, however in places where
13078     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13079     */
13080    LDKnativePeerManager *inner;
13081    /**
13082     * Indicates that this is the only struct which contains the same pointer.
13083     * Rust functions which take ownership of an object provided via an argument require
13084     * this to be true and invalidate the object pointed to by inner.
13085     */
13086    bool is_owned;
13087 } LDKPeerManager;
13088
13089
13090
13091 /**
13092  * Static channel fields used to build transactions given per-commitment fields, organized by
13093  * broadcaster/countersignatory.
13094  *
13095  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
13096  * as_holder_broadcastable and as_counterparty_broadcastable functions.
13097  */
13098 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
13099    /**
13100     * A pointer to the opaque Rust object.
13101     * Nearly everywhere, inner must be non-null, however in places where
13102     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13103     */
13104    LDKnativeDirectedChannelTransactionParameters *inner;
13105    /**
13106     * Indicates that this is the only struct which contains the same pointer.
13107     * Rust functions which take ownership of an object provided via an argument require
13108     * this to be true and invalidate the object pointed to by inner.
13109     */
13110    bool is_owned;
13111 } LDKDirectedChannelTransactionParameters;
13112
13113 /**
13114  * Integer in the range `0..=16`
13115  */
13116 typedef struct LDKWitnessVersion {
13117    uint8_t _0;
13118 } LDKWitnessVersion;
13119
13120
13121
13122 /**
13123  * A read-only view of [`NetworkGraph`].
13124  */
13125 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
13126    /**
13127     * A pointer to the opaque Rust object.
13128     * Nearly everywhere, inner must be non-null, however in places where
13129     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13130     */
13131    LDKnativeReadOnlyNetworkGraph *inner;
13132    /**
13133     * Indicates that this is the only struct which contains the same pointer.
13134     * Rust functions which take ownership of an object provided via an argument require
13135     * this to be true and invalidate the object pointed to by inner.
13136     */
13137    bool is_owned;
13138 } LDKReadOnlyNetworkGraph;
13139
13140
13141
13142 /**
13143  * Receives and validates network updates from peers,
13144  * stores authentic and relevant data as a network graph.
13145  * This network graph is then used for routing payments.
13146  * Provides interface to help with initial routing sync by
13147  * serving historical announcements.
13148  *
13149  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
13150  * [`NetworkGraph`].
13151  */
13152 typedef struct MUST_USE_STRUCT LDKP2PGossipSync {
13153    /**
13154     * A pointer to the opaque Rust object.
13155     * Nearly everywhere, inner must be non-null, however in places where
13156     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13157     */
13158    LDKnativeP2PGossipSync *inner;
13159    /**
13160     * Indicates that this is the only struct which contains the same pointer.
13161     * Rust functions which take ownership of an object provided via an argument require
13162     * this to be true and invalidate the object pointed to by inner.
13163     */
13164    bool is_owned;
13165 } LDKP2PGossipSync;
13166
13167
13168
13169 /**
13170  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
13171  * source node to a target node.
13172  */
13173 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
13174    /**
13175     * A pointer to the opaque Rust object.
13176     * Nearly everywhere, inner must be non-null, however in places where
13177     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13178     */
13179    LDKnativeDirectedChannelInfo *inner;
13180    /**
13181     * Indicates that this is the only struct which contains the same pointer.
13182     * Rust functions which take ownership of an object provided via an argument require
13183     * this to be true and invalidate the object pointed to by inner.
13184     */
13185    bool is_owned;
13186 } LDKDirectedChannelInfo;
13187
13188 /**
13189  * The effective capacity of a channel for routing purposes.
13190  *
13191  * While this may be smaller than the actual channel capacity, amounts greater than
13192  * [`Self::as_msat`] should not be routed through the channel.
13193  */
13194 typedef enum LDKEffectiveCapacity_Tag {
13195    /**
13196     * The available liquidity in the channel known from being a channel counterparty, and thus a
13197     * direct hop.
13198     */
13199    LDKEffectiveCapacity_ExactLiquidity,
13200    /**
13201     * The maximum HTLC amount in one direction as advertised on the gossip network.
13202     */
13203    LDKEffectiveCapacity_MaximumHTLC,
13204    /**
13205     * The total capacity of the channel as determined by the funding transaction.
13206     */
13207    LDKEffectiveCapacity_Total,
13208    /**
13209     * A capacity sufficient to route any payment, typically used for private channels provided by
13210     * an invoice.
13211     */
13212    LDKEffectiveCapacity_Infinite,
13213    /**
13214     * A capacity that is unknown possibly because either the chain state is unavailable to know
13215     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
13216     */
13217    LDKEffectiveCapacity_Unknown,
13218    /**
13219     * Must be last for serialization purposes
13220     */
13221    LDKEffectiveCapacity_Sentinel,
13222 } LDKEffectiveCapacity_Tag;
13223
13224 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
13225    /**
13226     * Either the inbound or outbound liquidity depending on the direction, denominated in
13227     * millisatoshi.
13228     */
13229    uint64_t liquidity_msat;
13230 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
13231
13232 typedef struct LDKEffectiveCapacity_LDKMaximumHTLC_Body {
13233    /**
13234     * The maximum HTLC amount denominated in millisatoshi.
13235     */
13236    uint64_t amount_msat;
13237 } LDKEffectiveCapacity_LDKMaximumHTLC_Body;
13238
13239 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
13240    /**
13241     * The funding amount denominated in millisatoshi.
13242     */
13243    uint64_t capacity_msat;
13244    /**
13245     * The maximum HTLC amount denominated in millisatoshi.
13246     */
13247    struct LDKCOption_u64Z htlc_maximum_msat;
13248 } LDKEffectiveCapacity_LDKTotal_Body;
13249
13250 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
13251    LDKEffectiveCapacity_Tag tag;
13252    union {
13253       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
13254       LDKEffectiveCapacity_LDKMaximumHTLC_Body maximum_htlc;
13255       LDKEffectiveCapacity_LDKTotal_Body total;
13256    };
13257 } LDKEffectiveCapacity;
13258
13259
13260
13261 /**
13262  * A concrete implementation of [`LockableScore`] which supports multi-threading.
13263  */
13264 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
13265    /**
13266     * A pointer to the opaque Rust object.
13267     * Nearly everywhere, inner must be non-null, however in places where
13268     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13269     */
13270    LDKnativeMultiThreadedLockableScore *inner;
13271    /**
13272     * Indicates that this is the only struct which contains the same pointer.
13273     * Rust functions which take ownership of an object provided via an argument require
13274     * this to be true and invalidate the object pointed to by inner.
13275     */
13276    bool is_owned;
13277 } LDKMultiThreadedLockableScore;
13278
13279
13280
13281 /**
13282  * A locked `MultiThreadedLockableScore`.
13283  */
13284 typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLock {
13285    /**
13286     * A pointer to the opaque Rust object.
13287     * Nearly everywhere, inner must be non-null, however in places where
13288     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13289     */
13290    LDKnativeMultiThreadedScoreLock *inner;
13291    /**
13292     * Indicates that this is the only struct which contains the same pointer.
13293     * Rust functions which take ownership of an object provided via an argument require
13294     * this to be true and invalidate the object pointed to by inner.
13295     */
13296    bool is_owned;
13297 } LDKMultiThreadedScoreLock;
13298
13299
13300
13301 /**
13302  * Parameters for configuring [`ProbabilisticScorer`].
13303  *
13304  * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
13305  * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
13306  *
13307  * The penalty applied to any channel by the [`ProbabilisticScorer`] is the sum of each of the
13308  * parameters here.
13309  */
13310 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
13311    /**
13312     * A pointer to the opaque Rust object.
13313     * Nearly everywhere, inner must be non-null, however in places where
13314     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13315     */
13316    LDKnativeProbabilisticScoringParameters *inner;
13317    /**
13318     * Indicates that this is the only struct which contains the same pointer.
13319     * Rust functions which take ownership of an object provided via an argument require
13320     * this to be true and invalidate the object pointed to by inner.
13321     */
13322    bool is_owned;
13323 } LDKProbabilisticScoringParameters;
13324
13325
13326
13327 /**
13328  * A sender, receiver and forwarder of onion messages. In upcoming releases, this object will be
13329  * used to retrieve invoices and fulfill invoice requests from [offers]. Currently, only sending
13330  * and receiving empty onion messages is supported.
13331  *
13332  * # Example
13333  *
13334  * ```
13335  * # extern crate bitcoin;
13336  * # use bitcoin::hashes::_export::_core::time::Duration;
13337  * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
13338  * # use lightning::chain::keysinterface::{InMemorySigner, KeysManager, KeysInterface};
13339  * # use lightning::onion_message::messenger::{Destination, OnionMessenger};
13340  * # use lightning::onion_message::blinded_route::BlindedRoute;
13341  * # use lightning::util::logger::{Logger, Record};
13342  * # use std::sync::Arc;
13343  * # struct FakeLogger {};
13344  * # impl Logger for FakeLogger {
13345  * #     fn log(&self, record: &Record) { unimplemented!() }
13346  * # }
13347  * # let seed = [42u8; 32];
13348  * # let time = Duration::from_secs(123456);
13349  * # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos());
13350  * # let logger = Arc::new(FakeLogger {});
13351  * # let node_secret = SecretKey::from_slice(&hex::decode(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap();
13352  * # let secp_ctx = Secp256k1::new();
13353  * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret);
13354  * # let (hop_node_id2, hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1,
13355  * hop_node_id1);
13356  * # let destination_node_id = hop_node_id1;
13357  * #
13358  * // Create the onion messenger. This must use the same `keys_manager` as is passed to your
13359  * // ChannelManager.
13360  * let onion_messenger = OnionMessenger::new(&keys_manager, logger);
13361  *
13362  * // Send an empty onion message to a node id.
13363  * let intermediate_hops = [hop_node_id1, hop_node_id2];
13364  * let reply_path = None;
13365  * onion_messenger.send_onion_message(&intermediate_hops, Destination::Node(destination_node_id), reply_path);
13366  *
13367  * // Create a blinded route to yourself, for someone to send an onion message to.
13368  * # let your_node_id = hop_node_id1;
13369  * let hops = [hop_node_id3, hop_node_id4, your_node_id];
13370  * let blinded_route = BlindedRoute::new(&hops, &keys_manager, &secp_ctx).unwrap();
13371  *
13372  * // Send an empty onion message to a blinded route.
13373  * # let intermediate_hops = [hop_node_id1, hop_node_id2];
13374  * let reply_path = None;
13375  * onion_messenger.send_onion_message(&intermediate_hops, Destination::BlindedRoute(blinded_route), reply_path);
13376  * ```
13377  *
13378  * [offers]: <https://github.com/lightning/bolts/pull/798>
13379  * [`OnionMessenger`]: crate::onion_message::OnionMessenger
13380  */
13381 typedef struct MUST_USE_STRUCT LDKOnionMessenger {
13382    /**
13383     * A pointer to the opaque Rust object.
13384     * Nearly everywhere, inner must be non-null, however in places where
13385     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13386     */
13387    LDKnativeOnionMessenger *inner;
13388    /**
13389     * Indicates that this is the only struct which contains the same pointer.
13390     * Rust functions which take ownership of an object provided via an argument require
13391     * this to be true and invalidate the object pointed to by inner.
13392     */
13393    bool is_owned;
13394 } LDKOnionMessenger;
13395
13396 /**
13397  * The destination of an onion message.
13398  */
13399 typedef enum LDKDestination_Tag {
13400    /**
13401     * We're sending this onion message to a node.
13402     */
13403    LDKDestination_Node,
13404    /**
13405     * We're sending this onion message to a blinded route.
13406     */
13407    LDKDestination_BlindedRoute,
13408    /**
13409     * Must be last for serialization purposes
13410     */
13411    LDKDestination_Sentinel,
13412 } LDKDestination_Tag;
13413
13414 typedef struct MUST_USE_STRUCT LDKDestination {
13415    LDKDestination_Tag tag;
13416    union {
13417       struct {
13418          struct LDKPublicKey node;
13419       };
13420       struct {
13421          struct LDKBlindedRoute blinded_route;
13422       };
13423    };
13424 } LDKDestination;
13425
13426
13427
13428 /**
13429  * FilesystemPersister persists channel data on disk, where each channel's
13430  * data is stored in a file named after its funding outpoint.
13431  *
13432  * Warning: this module does the best it can with calls to persist data, but it
13433  * can only guarantee that the data is passed to the drive. It is up to the
13434  * drive manufacturers to do the actual persistence properly, which they often
13435  * don't (especially on consumer-grade hardware). Therefore, it is up to the
13436  * user to validate their entire storage stack, to ensure the writes are
13437  * persistent.
13438  * Corollary: especially when dealing with larger amounts of money, it is best
13439  * practice to have multiple channel data backups and not rely only on one
13440  * FilesystemPersister.
13441  */
13442 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
13443    /**
13444     * A pointer to the opaque Rust object.
13445     * Nearly everywhere, inner must be non-null, however in places where
13446     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13447     */
13448    LDKnativeFilesystemPersister *inner;
13449    /**
13450     * Indicates that this is the only struct which contains the same pointer.
13451     * Rust functions which take ownership of an object provided via an argument require
13452     * this to be true and invalidate the object pointed to by inner.
13453     */
13454    bool is_owned;
13455 } LDKFilesystemPersister;
13456
13457
13458
13459 /**
13460  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
13461  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
13462  * responsibilities are:
13463  * * Processing [`Event`]s with a user-provided [`EventHandler`].
13464  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
13465  *   writing it to disk/backups by invoking the callback given to it at startup.
13466  *   [`ChannelManager`] persistence should be done in the background.
13467  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
13468  *   at the appropriate intervals.
13469  * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`GossipSync`] with a [`NetworkGraph`]
13470  *   is provided to [`BackgroundProcessor::start`]).
13471  *
13472  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
13473  * upon as doing so may result in high latency.
13474  *
13475  * # Note
13476  *
13477  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
13478  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
13479  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
13480  * unilateral chain closure fees are at risk.
13481  *
13482  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
13483  * [`Event`]: lightning::util::events::Event
13484  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
13485  */
13486 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
13487    /**
13488     * A pointer to the opaque Rust object.
13489     * Nearly everywhere, inner must be non-null, however in places where
13490     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13491     */
13492    LDKnativeBackgroundProcessor *inner;
13493    /**
13494     * Indicates that this is the only struct which contains the same pointer.
13495     * Rust functions which take ownership of an object provided via an argument require
13496     * this to be true and invalidate the object pointed to by inner.
13497     */
13498    bool is_owned;
13499 } LDKBackgroundProcessor;
13500
13501
13502
13503 /**
13504  * Rapid Gossip Sync struct
13505  * See [crate-level documentation] for usage.
13506  *
13507  * [crate-level documentation]: crate
13508  */
13509 typedef struct MUST_USE_STRUCT LDKRapidGossipSync {
13510    /**
13511     * A pointer to the opaque Rust object.
13512     * Nearly everywhere, inner must be non-null, however in places where
13513     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13514     */
13515    LDKnativeRapidGossipSync *inner;
13516    /**
13517     * Indicates that this is the only struct which contains the same pointer.
13518     * Rust functions which take ownership of an object provided via an argument require
13519     * this to be true and invalidate the object pointed to by inner.
13520     */
13521    bool is_owned;
13522 } LDKRapidGossipSync;
13523
13524 /**
13525  * Either [`P2PGossipSync`] or [`RapidGossipSync`].
13526  */
13527 typedef enum LDKGossipSync_Tag {
13528    /**
13529     * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7.
13530     */
13531    LDKGossipSync_P2P,
13532    /**
13533     * Rapid gossip sync from a trusted server.
13534     */
13535    LDKGossipSync_Rapid,
13536    /**
13537     * No gossip sync.
13538     */
13539    LDKGossipSync_None,
13540    /**
13541     * Must be last for serialization purposes
13542     */
13543    LDKGossipSync_Sentinel,
13544 } LDKGossipSync_Tag;
13545
13546 typedef struct MUST_USE_STRUCT LDKGossipSync {
13547    LDKGossipSync_Tag tag;
13548    union {
13549       struct {
13550          /**
13551           * Note that this field is expected to be a reference.
13552           */
13553          struct LDKP2PGossipSync p2p;
13554       };
13555       struct {
13556          /**
13557           * Note that this field is expected to be a reference.
13558           */
13559          struct LDKRapidGossipSync rapid;
13560       };
13561    };
13562 } LDKGossipSync;
13563
13564
13565
13566 /**
13567  * Data of the `RawInvoice` that is encoded in the data part
13568  */
13569 typedef struct MUST_USE_STRUCT LDKRawDataPart {
13570    /**
13571     * A pointer to the opaque Rust object.
13572     * Nearly everywhere, inner must be non-null, however in places where
13573     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13574     */
13575    LDKnativeRawDataPart *inner;
13576    /**
13577     * Indicates that this is the only struct which contains the same pointer.
13578     * Rust functions which take ownership of an object provided via an argument require
13579     * this to be true and invalidate the object pointed to by inner.
13580     */
13581    bool is_owned;
13582 } LDKRawDataPart;
13583
13584
13585
13586 /**
13587  * SHA-256 hash
13588  */
13589 typedef struct MUST_USE_STRUCT LDKSha256 {
13590    /**
13591     * A pointer to the opaque Rust object.
13592     * Nearly everywhere, inner must be non-null, however in places where
13593     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13594     */
13595    LDKnativeSha256 *inner;
13596    /**
13597     * Indicates that this is the only struct which contains the same pointer.
13598     * Rust functions which take ownership of an object provided via an argument require
13599     * this to be true and invalidate the object pointed to by inner.
13600     */
13601    bool is_owned;
13602 } LDKSha256;
13603
13604
13605
13606 /**
13607  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
13608  * expires
13609  */
13610 typedef struct MUST_USE_STRUCT LDKExpiryTime {
13611    /**
13612     * A pointer to the opaque Rust object.
13613     * Nearly everywhere, inner must be non-null, however in places where
13614     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13615     */
13616    LDKnativeExpiryTime *inner;
13617    /**
13618     * Indicates that this is the only struct which contains the same pointer.
13619     * Rust functions which take ownership of an object provided via an argument require
13620     * this to be true and invalidate the object pointed to by inner.
13621     */
13622    bool is_owned;
13623 } LDKExpiryTime;
13624
13625
13626
13627 /**
13628  * `min_final_cltv_expiry` to use for the last HTLC in the route
13629  */
13630 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
13631    /**
13632     * A pointer to the opaque Rust object.
13633     * Nearly everywhere, inner must be non-null, however in places where
13634     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13635     */
13636    LDKnativeMinFinalCltvExpiry *inner;
13637    /**
13638     * Indicates that this is the only struct which contains the same pointer.
13639     * Rust functions which take ownership of an object provided via an argument require
13640     * this to be true and invalidate the object pointed to by inner.
13641     */
13642    bool is_owned;
13643 } LDKMinFinalCltvExpiry;
13644
13645 /**
13646  * A 20-byte byte array.
13647  */
13648 typedef struct LDKTwentyBytes {
13649    /**
13650     * The twenty bytes
13651     */
13652    uint8_t data[20];
13653 } LDKTwentyBytes;
13654
13655 /**
13656  * Fallback address in case no LN payment is possible
13657  */
13658 typedef enum LDKFallback_Tag {
13659    LDKFallback_SegWitProgram,
13660    LDKFallback_PubKeyHash,
13661    LDKFallback_ScriptHash,
13662    /**
13663     * Must be last for serialization purposes
13664     */
13665    LDKFallback_Sentinel,
13666 } LDKFallback_Tag;
13667
13668 typedef struct LDKFallback_LDKSegWitProgram_Body {
13669    struct LDKu5 version;
13670    struct LDKCVec_u8Z program;
13671 } LDKFallback_LDKSegWitProgram_Body;
13672
13673 typedef struct MUST_USE_STRUCT LDKFallback {
13674    LDKFallback_Tag tag;
13675    union {
13676       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
13677       struct {
13678          struct LDKTwentyBytes pub_key_hash;
13679       };
13680       struct {
13681          struct LDKTwentyBytes script_hash;
13682       };
13683    };
13684 } LDKFallback;
13685
13686 /**
13687  * A trait defining behavior of an [`Invoice`] payer.
13688  */
13689 typedef struct LDKPayer {
13690    /**
13691     * An opaque pointer which is passed to your function implementations as an argument.
13692     * This has no meaning in the LDK, and can be NULL or any other value.
13693     */
13694    void *this_arg;
13695    /**
13696     * Returns the payer's node id.
13697     */
13698    struct LDKPublicKey (*node_id)(const void *this_arg);
13699    /**
13700     * Returns the payer's channels.
13701     */
13702    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
13703    /**
13704     * Sends a payment over the Lightning Network using the given [`Route`].
13705     *
13706     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
13707     */
13708    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
13709    /**
13710     * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
13711     */
13712    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
13713    /**
13714     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
13715     */
13716    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
13717    /**
13718     * Signals that no further retries for the given payment will occur.
13719     */
13720    void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id);
13721    /**
13722     * Frees any resources associated with this object given its this_arg pointer.
13723     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13724     */
13725    void (*free)(void *this_arg);
13726 } LDKPayer;
13727
13728 /**
13729  * A trait defining behavior for routing an [`Invoice`] payment.
13730  */
13731 typedef struct LDKRouter {
13732    /**
13733     * An opaque pointer which is passed to your function implementations as an argument.
13734     * This has no meaning in the LDK, and can be NULL or any other value.
13735     */
13736    void *this_arg;
13737    /**
13738     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
13739     *
13740     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
13741     */
13742    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, struct LDKInFlightHtlcs inflight_htlcs);
13743    /**
13744     * Lets the router know that payment through a specific path has failed.
13745     */
13746    void (*notify_payment_path_failed)(const void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
13747    /**
13748     * Lets the router know that payment through a specific path was successful.
13749     */
13750    void (*notify_payment_path_successful)(const void *this_arg, struct LDKCVec_RouteHopZ path);
13751    /**
13752     * Lets the router know that a payment probe was successful.
13753     */
13754    void (*notify_payment_probe_successful)(const void *this_arg, struct LDKCVec_RouteHopZ path);
13755    /**
13756     * Lets the router know that a payment probe failed.
13757     */
13758    void (*notify_payment_probe_failed)(const void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
13759    /**
13760     * Frees any resources associated with this object given its this_arg pointer.
13761     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13762     */
13763    void (*free)(void *this_arg);
13764 } LDKRouter;
13765
13766
13767
13768 /**
13769  * A utility for paying [`Invoice`]s and sending spontaneous payments.
13770  *
13771  * See [module-level documentation] for details.
13772  *
13773  * [module-level documentation]: crate::payment
13774  */
13775 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
13776    /**
13777     * A pointer to the opaque Rust object.
13778     * Nearly everywhere, inner must be non-null, however in places where
13779     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13780     */
13781    LDKnativeInvoicePayer *inner;
13782    /**
13783     * Indicates that this is the only struct which contains the same pointer.
13784     * Rust functions which take ownership of an object provided via an argument require
13785     * this to be true and invalidate the object pointed to by inner.
13786     */
13787    bool is_owned;
13788 } LDKInvoicePayer;
13789
13790 /**
13791  * Strategies available to retry payment path failures for an [`Invoice`].
13792  *
13793  */
13794 typedef enum LDKRetry_Tag {
13795    /**
13796     * Max number of attempts to retry payment.
13797     *
13798     * Note that this is the number of *path* failures, not full payment retries. For multi-path
13799     * payments, if this is less than the total number of paths, we will never even retry all of the
13800     * payment's paths.
13801     */
13802    LDKRetry_Attempts,
13803    /**
13804     * Time elapsed before abandoning retries for a payment.
13805     */
13806    LDKRetry_Timeout,
13807    /**
13808     * Must be last for serialization purposes
13809     */
13810    LDKRetry_Sentinel,
13811 } LDKRetry_Tag;
13812
13813 typedef struct MUST_USE_STRUCT LDKRetry {
13814    LDKRetry_Tag tag;
13815    union {
13816       struct {
13817          uintptr_t attempts;
13818       };
13819       struct {
13820          uint64_t timeout;
13821       };
13822    };
13823 } LDKRetry;
13824
13825
13826
13827 /**
13828  * A [`Router`] implemented using [`find_route`].
13829  */
13830 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
13831    /**
13832     * A pointer to the opaque Rust object.
13833     * Nearly everywhere, inner must be non-null, however in places where
13834     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13835     */
13836    LDKnativeDefaultRouter *inner;
13837    /**
13838     * Indicates that this is the only struct which contains the same pointer.
13839     * Rust functions which take ownership of an object provided via an argument require
13840     * this to be true and invalidate the object pointed to by inner.
13841     */
13842    bool is_owned;
13843 } LDKDefaultRouter;
13844
13845 extern const uintptr_t MAX_BUF_SIZE;
13846
13847 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
13848
13849 extern const uint32_t FEERATE_FLOOR_SATS_PER_KW;
13850
13851 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
13852
13853 extern const uint32_t ANTI_REORG_DELAY;
13854
13855 extern const uint16_t BREAKDOWN_TIMEOUT;
13856
13857 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
13858
13859 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
13860
13861 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
13862
13863 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
13864
13865 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
13866
13867 extern const uint8_t DEFAULT_MAX_PATH_COUNT;
13868
13869 extern const uint64_t MAX_TIMESTAMP;
13870
13871 extern const uint64_t DEFAULT_EXPIRY_TIME;
13872
13873 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
13874
13875 extern const uint8_t TAG_PAYMENT_HASH;
13876
13877 extern const uint8_t TAG_DESCRIPTION;
13878
13879 extern const uint8_t TAG_PAYEE_PUB_KEY;
13880
13881 extern const uint8_t TAG_DESCRIPTION_HASH;
13882
13883 extern const uint8_t TAG_EXPIRY_TIME;
13884
13885 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
13886
13887 extern const uint8_t TAG_FALLBACK;
13888
13889 extern const uint8_t TAG_PRIVATE_ROUTE;
13890
13891 extern const uint8_t TAG_PAYMENT_SECRET;
13892
13893 extern const uint8_t TAG_FEATURES;
13894
13895 struct LDKStr _ldk_get_compiled_version(void);
13896
13897 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
13898
13899 /**
13900  * Convenience function for constructing a new BigEndianScalar
13901  */
13902 struct LDKBigEndianScalar BigEndianScalar_new(struct LDKThirtyTwoBytes big_endian_bytes);
13903
13904 /**
13905  * Creates a new Bech32Error which has the same data as `orig`
13906  */
13907 struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig);
13908
13909 /**
13910  * Releases any memory held by the given `Bech32Error` (which is currently none)
13911  */
13912 void Bech32Error_free(struct LDKBech32Error o);
13913
13914 /**
13915  * Frees the data buffer, if data_is_owned is set and datalen > 0.
13916  */
13917 void Transaction_free(struct LDKTransaction _res);
13918
13919 /**
13920  * Convenience function for constructing a new TxOut
13921  */
13922 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
13923
13924 /**
13925  * Frees the data pointed to by script_pubkey.
13926  */
13927 void TxOut_free(struct LDKTxOut _res);
13928
13929 /**
13930  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
13931  */
13932 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
13933
13934 /**
13935  * Frees the data buffer, if chars_is_owned is set and len > 0.
13936  */
13937 void Str_free(struct LDKStr _res);
13938
13939 #if defined(LDK_DEBUG_BUILD)
13940 /**
13941  * This function exists for memory safety testing purposes. It should never be used in production
13942  * code
13943  */
13944 const void *__unmangle_inner_ptr(const void *ptr);
13945 #endif
13946
13947 /**
13948  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13949  */
13950 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
13951
13952 /**
13953  * Creates a new CResult_BlindedRouteNoneZ in the success state.
13954  */
13955 struct LDKCResult_BlindedRouteNoneZ CResult_BlindedRouteNoneZ_ok(struct LDKBlindedRoute o);
13956
13957 /**
13958  * Creates a new CResult_BlindedRouteNoneZ in the error state.
13959  */
13960 struct LDKCResult_BlindedRouteNoneZ CResult_BlindedRouteNoneZ_err(void);
13961
13962 /**
13963  * Checks if the given object is currently in the success state
13964  */
13965 bool CResult_BlindedRouteNoneZ_is_ok(const struct LDKCResult_BlindedRouteNoneZ *NONNULL_PTR o);
13966
13967 /**
13968  * Frees any resources used by the CResult_BlindedRouteNoneZ.
13969  */
13970 void CResult_BlindedRouteNoneZ_free(struct LDKCResult_BlindedRouteNoneZ _res);
13971
13972 /**
13973  * Creates a new CResult_BlindedRouteDecodeErrorZ in the success state.
13974  */
13975 struct LDKCResult_BlindedRouteDecodeErrorZ CResult_BlindedRouteDecodeErrorZ_ok(struct LDKBlindedRoute o);
13976
13977 /**
13978  * Creates a new CResult_BlindedRouteDecodeErrorZ in the error state.
13979  */
13980 struct LDKCResult_BlindedRouteDecodeErrorZ CResult_BlindedRouteDecodeErrorZ_err(struct LDKDecodeError e);
13981
13982 /**
13983  * Checks if the given object is currently in the success state
13984  */
13985 bool CResult_BlindedRouteDecodeErrorZ_is_ok(const struct LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR o);
13986
13987 /**
13988  * Frees any resources used by the CResult_BlindedRouteDecodeErrorZ.
13989  */
13990 void CResult_BlindedRouteDecodeErrorZ_free(struct LDKCResult_BlindedRouteDecodeErrorZ _res);
13991
13992 /**
13993  * Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
13994  */
13995 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o);
13996
13997 /**
13998  * Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
13999  */
14000 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e);
14001
14002 /**
14003  * Checks if the given object is currently in the success state
14004  */
14005 bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o);
14006
14007 /**
14008  * Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
14009  */
14010 void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res);
14011
14012 /**
14013  * Creates a new CResult_NoneNoneZ in the success state.
14014  */
14015 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
14016
14017 /**
14018  * Creates a new CResult_NoneNoneZ in the error state.
14019  */
14020 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
14021
14022 /**
14023  * Checks if the given object is currently in the success state
14024  */
14025 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
14026
14027 /**
14028  * Frees any resources used by the CResult_NoneNoneZ.
14029  */
14030 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
14031
14032 /**
14033  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
14034  * but with all dynamically-allocated buffers duplicated in new buffers.
14035  */
14036 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
14037
14038 /**
14039  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
14040  */
14041 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
14042
14043 /**
14044  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
14045  */
14046 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
14047
14048 /**
14049  * Checks if the given object is currently in the success state
14050  */
14051 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
14052
14053 /**
14054  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
14055  */
14056 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
14057
14058 /**
14059  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
14060  * but with all dynamically-allocated buffers duplicated in new buffers.
14061  */
14062 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
14063
14064 /**
14065  * Creates a new CResult_SecretKeyErrorZ in the success state.
14066  */
14067 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
14068
14069 /**
14070  * Creates a new CResult_SecretKeyErrorZ in the error state.
14071  */
14072 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
14073
14074 /**
14075  * Checks if the given object is currently in the success state
14076  */
14077 bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o);
14078
14079 /**
14080  * Frees any resources used by the CResult_SecretKeyErrorZ.
14081  */
14082 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
14083
14084 /**
14085  * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
14086  * but with all dynamically-allocated buffers duplicated in new buffers.
14087  */
14088 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig);
14089
14090 /**
14091  * Creates a new CResult_PublicKeyErrorZ in the success state.
14092  */
14093 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
14094
14095 /**
14096  * Creates a new CResult_PublicKeyErrorZ in the error state.
14097  */
14098 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
14099
14100 /**
14101  * Checks if the given object is currently in the success state
14102  */
14103 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
14104
14105 /**
14106  * Frees any resources used by the CResult_PublicKeyErrorZ.
14107  */
14108 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
14109
14110 /**
14111  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
14112  * but with all dynamically-allocated buffers duplicated in new buffers.
14113  */
14114 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
14115
14116 /**
14117  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
14118  */
14119 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
14120
14121 /**
14122  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
14123  */
14124 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
14125
14126 /**
14127  * Checks if the given object is currently in the success state
14128  */
14129 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
14130
14131 /**
14132  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
14133  */
14134 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
14135
14136 /**
14137  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
14138  * but with all dynamically-allocated buffers duplicated in new buffers.
14139  */
14140 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
14141
14142 /**
14143  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
14144  */
14145 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
14146
14147 /**
14148  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
14149  */
14150 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
14151
14152 /**
14153  * Checks if the given object is currently in the success state
14154  */
14155 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
14156
14157 /**
14158  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
14159  */
14160 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
14161
14162 /**
14163  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
14164  * but with all dynamically-allocated buffers duplicated in new buffers.
14165  */
14166 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
14167
14168 /**
14169  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
14170  */
14171 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
14172
14173 /**
14174  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
14175  */
14176 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
14177
14178 /**
14179  * Checks if the given object is currently in the success state
14180  */
14181 bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o);
14182
14183 /**
14184  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
14185  */
14186 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
14187
14188 /**
14189  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
14190  * but with all dynamically-allocated buffers duplicated in new buffers.
14191  */
14192 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
14193
14194 /**
14195  * Constructs a new COption_u32Z containing a u32
14196  */
14197 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
14198
14199 /**
14200  * Constructs a new COption_u32Z containing nothing
14201  */
14202 struct LDKCOption_u32Z COption_u32Z_none(void);
14203
14204 /**
14205  * Frees any resources associated with the u32, if we are in the Some state
14206  */
14207 void COption_u32Z_free(struct LDKCOption_u32Z _res);
14208
14209 /**
14210  * Creates a new COption_u32Z which has the same data as `orig`
14211  * but with all dynamically-allocated buffers duplicated in new buffers.
14212  */
14213 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
14214
14215 /**
14216  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
14217  */
14218 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
14219
14220 /**
14221  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
14222  */
14223 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
14224
14225 /**
14226  * Checks if the given object is currently in the success state
14227  */
14228 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
14229
14230 /**
14231  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
14232  */
14233 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
14234
14235 /**
14236  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
14237  * but with all dynamically-allocated buffers duplicated in new buffers.
14238  */
14239 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
14240
14241 /**
14242  * Constructs a new COption_NoneZ containing a
14243  */
14244 enum LDKCOption_NoneZ COption_NoneZ_some(void);
14245
14246 /**
14247  * Constructs a new COption_NoneZ containing nothing
14248  */
14249 enum LDKCOption_NoneZ COption_NoneZ_none(void);
14250
14251 /**
14252  * Frees any resources associated with the , if we are in the Some state
14253  */
14254 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
14255
14256 /**
14257  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
14258  */
14259 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
14260
14261 /**
14262  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
14263  */
14264 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
14265
14266 /**
14267  * Checks if the given object is currently in the success state
14268  */
14269 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
14270
14271 /**
14272  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
14273  */
14274 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
14275
14276 /**
14277  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
14278  * but with all dynamically-allocated buffers duplicated in new buffers.
14279  */
14280 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
14281
14282 /**
14283  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
14284  */
14285 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
14286
14287 /**
14288  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
14289  */
14290 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
14291
14292 /**
14293  * Checks if the given object is currently in the success state
14294  */
14295 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
14296
14297 /**
14298  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
14299  */
14300 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
14301
14302 /**
14303  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
14304  * but with all dynamically-allocated buffers duplicated in new buffers.
14305  */
14306 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
14307
14308 /**
14309  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14310  */
14311 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
14312
14313 /**
14314  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
14315  */
14316 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
14317
14318 /**
14319  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
14320  */
14321 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
14322
14323 /**
14324  * Checks if the given object is currently in the success state
14325  */
14326 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
14327
14328 /**
14329  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
14330  */
14331 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
14332
14333 /**
14334  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
14335  * but with all dynamically-allocated buffers duplicated in new buffers.
14336  */
14337 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
14338
14339 /**
14340  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
14341  */
14342 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
14343
14344 /**
14345  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
14346  */
14347 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
14348
14349 /**
14350  * Checks if the given object is currently in the success state
14351  */
14352 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
14353
14354 /**
14355  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
14356  */
14357 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
14358
14359 /**
14360  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
14361  * but with all dynamically-allocated buffers duplicated in new buffers.
14362  */
14363 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
14364
14365 /**
14366  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
14367  */
14368 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
14369
14370 /**
14371  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
14372  */
14373 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
14374
14375 /**
14376  * Checks if the given object is currently in the success state
14377  */
14378 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
14379
14380 /**
14381  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
14382  */
14383 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
14384
14385 /**
14386  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
14387  */
14388 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
14389
14390 /**
14391  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
14392  */
14393 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
14394
14395 /**
14396  * Checks if the given object is currently in the success state
14397  */
14398 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
14399
14400 /**
14401  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
14402  */
14403 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
14404
14405 /**
14406  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
14407  * but with all dynamically-allocated buffers duplicated in new buffers.
14408  */
14409 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
14410
14411 /**
14412  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
14413  */
14414 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
14415
14416 /**
14417  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
14418  */
14419 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
14420
14421 /**
14422  * Checks if the given object is currently in the success state
14423  */
14424 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
14425
14426 /**
14427  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
14428  */
14429 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
14430
14431 /**
14432  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
14433  */
14434 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
14435
14436 /**
14437  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
14438  */
14439 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
14440
14441 /**
14442  * Checks if the given object is currently in the success state
14443  */
14444 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
14445
14446 /**
14447  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
14448  */
14449 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
14450
14451 /**
14452  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
14453  * but with all dynamically-allocated buffers duplicated in new buffers.
14454  */
14455 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
14456
14457 /**
14458  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
14459  */
14460 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
14461
14462 /**
14463  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
14464  */
14465 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
14466
14467 /**
14468  * Checks if the given object is currently in the success state
14469  */
14470 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
14471
14472 /**
14473  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
14474  */
14475 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
14476
14477 /**
14478  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
14479  * but with all dynamically-allocated buffers duplicated in new buffers.
14480  */
14481 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
14482
14483 /**
14484  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
14485  */
14486 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
14487
14488 /**
14489  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
14490  */
14491 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
14492
14493 /**
14494  * Checks if the given object is currently in the success state
14495  */
14496 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
14497
14498 /**
14499  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
14500  */
14501 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
14502
14503 /**
14504  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
14505  * but with all dynamically-allocated buffers duplicated in new buffers.
14506  */
14507 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
14508
14509 /**
14510  * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
14511  */
14512 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o);
14513
14514 /**
14515  * Constructs a new COption_WriteableScoreZ containing nothing
14516  */
14517 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void);
14518
14519 /**
14520  * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
14521  */
14522 void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res);
14523
14524 /**
14525  * Creates a new CResult_NoneErrorZ in the success state.
14526  */
14527 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
14528
14529 /**
14530  * Creates a new CResult_NoneErrorZ in the error state.
14531  */
14532 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
14533
14534 /**
14535  * Checks if the given object is currently in the success state
14536  */
14537 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
14538
14539 /**
14540  * Frees any resources used by the CResult_NoneErrorZ.
14541  */
14542 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
14543
14544 /**
14545  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
14546  * but with all dynamically-allocated buffers duplicated in new buffers.
14547  */
14548 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
14549
14550 /**
14551  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
14552  */
14553 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
14554
14555 /**
14556  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
14557  */
14558 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
14559
14560 /**
14561  * Checks if the given object is currently in the success state
14562  */
14563 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
14564
14565 /**
14566  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
14567  */
14568 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
14569
14570 /**
14571  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
14572  * but with all dynamically-allocated buffers duplicated in new buffers.
14573  */
14574 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
14575
14576 /**
14577  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14578  */
14579 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
14580
14581 /**
14582  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14583  */
14584 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
14585
14586 /**
14587  * Creates a new CResult_RouteDecodeErrorZ in the success state.
14588  */
14589 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
14590
14591 /**
14592  * Creates a new CResult_RouteDecodeErrorZ in the error state.
14593  */
14594 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
14595
14596 /**
14597  * Checks if the given object is currently in the success state
14598  */
14599 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
14600
14601 /**
14602  * Frees any resources used by the CResult_RouteDecodeErrorZ.
14603  */
14604 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
14605
14606 /**
14607  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
14608  * but with all dynamically-allocated buffers duplicated in new buffers.
14609  */
14610 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
14611
14612 /**
14613  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
14614  */
14615 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
14616
14617 /**
14618  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
14619  */
14620 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
14621
14622 /**
14623  * Checks if the given object is currently in the success state
14624  */
14625 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
14626
14627 /**
14628  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
14629  */
14630 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
14631
14632 /**
14633  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
14634  * but with all dynamically-allocated buffers duplicated in new buffers.
14635  */
14636 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
14637
14638 /**
14639  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14640  */
14641 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
14642
14643 /**
14644  * Constructs a new COption_u64Z containing a u64
14645  */
14646 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
14647
14648 /**
14649  * Constructs a new COption_u64Z containing nothing
14650  */
14651 struct LDKCOption_u64Z COption_u64Z_none(void);
14652
14653 /**
14654  * Frees any resources associated with the u64, if we are in the Some state
14655  */
14656 void COption_u64Z_free(struct LDKCOption_u64Z _res);
14657
14658 /**
14659  * Creates a new COption_u64Z which has the same data as `orig`
14660  * but with all dynamically-allocated buffers duplicated in new buffers.
14661  */
14662 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
14663
14664 /**
14665  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14666  */
14667 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
14668
14669 /**
14670  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
14671  */
14672 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
14673
14674 /**
14675  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
14676  */
14677 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
14678
14679 /**
14680  * Checks if the given object is currently in the success state
14681  */
14682 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
14683
14684 /**
14685  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
14686  */
14687 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
14688
14689 /**
14690  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
14691  * but with all dynamically-allocated buffers duplicated in new buffers.
14692  */
14693 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
14694
14695 /**
14696  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14697  */
14698 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
14699
14700 /**
14701  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
14702  */
14703 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
14704
14705 /**
14706  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
14707  */
14708 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
14709
14710 /**
14711  * Checks if the given object is currently in the success state
14712  */
14713 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
14714
14715 /**
14716  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
14717  */
14718 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
14719
14720 /**
14721  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
14722  * but with all dynamically-allocated buffers duplicated in new buffers.
14723  */
14724 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
14725
14726 /**
14727  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
14728  */
14729 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
14730
14731 /**
14732  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
14733  */
14734 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
14735
14736 /**
14737  * Checks if the given object is currently in the success state
14738  */
14739 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
14740
14741 /**
14742  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
14743  */
14744 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
14745
14746 /**
14747  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
14748  * but with all dynamically-allocated buffers duplicated in new buffers.
14749  */
14750 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
14751
14752 /**
14753  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14754  */
14755 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
14756
14757 /**
14758  * Creates a new CResult_RouteLightningErrorZ in the success state.
14759  */
14760 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
14761
14762 /**
14763  * Creates a new CResult_RouteLightningErrorZ in the error state.
14764  */
14765 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
14766
14767 /**
14768  * Checks if the given object is currently in the success state
14769  */
14770 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
14771
14772 /**
14773  * Frees any resources used by the CResult_RouteLightningErrorZ.
14774  */
14775 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
14776
14777 /**
14778  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
14779  * but with all dynamically-allocated buffers duplicated in new buffers.
14780  */
14781 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
14782
14783 /**
14784  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
14785  */
14786 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o);
14787
14788 /**
14789  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
14790  */
14791 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e);
14792
14793 /**
14794  * Checks if the given object is currently in the success state
14795  */
14796 bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o);
14797
14798 /**
14799  * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
14800  */
14801 void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res);
14802
14803 /**
14804  * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
14805  * but with all dynamically-allocated buffers duplicated in new buffers.
14806  */
14807 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig);
14808
14809 /**
14810  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
14811  */
14812 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
14813
14814 /**
14815  * Constructs a new COption_ClosureReasonZ containing nothing
14816  */
14817 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
14818
14819 /**
14820  * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
14821  */
14822 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
14823
14824 /**
14825  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
14826  * but with all dynamically-allocated buffers duplicated in new buffers.
14827  */
14828 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
14829
14830 /**
14831  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
14832  */
14833 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
14834
14835 /**
14836  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
14837  */
14838 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
14839
14840 /**
14841  * Checks if the given object is currently in the success state
14842  */
14843 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
14844
14845 /**
14846  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
14847  */
14848 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
14849
14850 /**
14851  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
14852  * but with all dynamically-allocated buffers duplicated in new buffers.
14853  */
14854 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
14855
14856 /**
14857  * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
14858  */
14859 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o);
14860
14861 /**
14862  * Constructs a new COption_HTLCDestinationZ containing nothing
14863  */
14864 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void);
14865
14866 /**
14867  * Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state
14868  */
14869 void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res);
14870
14871 /**
14872  * Creates a new COption_HTLCDestinationZ which has the same data as `orig`
14873  * but with all dynamically-allocated buffers duplicated in new buffers.
14874  */
14875 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig);
14876
14877 /**
14878  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
14879  */
14880 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o);
14881
14882 /**
14883  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
14884  */
14885 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e);
14886
14887 /**
14888  * Checks if the given object is currently in the success state
14889  */
14890 bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o);
14891
14892 /**
14893  * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
14894  */
14895 void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res);
14896
14897 /**
14898  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
14899  * but with all dynamically-allocated buffers duplicated in new buffers.
14900  */
14901 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig);
14902
14903 /**
14904  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
14905  */
14906 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
14907
14908 /**
14909  * Constructs a new COption_NetworkUpdateZ containing nothing
14910  */
14911 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
14912
14913 /**
14914  * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
14915  */
14916 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
14917
14918 /**
14919  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
14920  * but with all dynamically-allocated buffers duplicated in new buffers.
14921  */
14922 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
14923
14924 /**
14925  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14926  */
14927 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
14928
14929 /**
14930  * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
14931  */
14932 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
14933
14934 /**
14935  * Constructs a new COption_EventZ containing nothing
14936  */
14937 struct LDKCOption_EventZ COption_EventZ_none(void);
14938
14939 /**
14940  * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
14941  */
14942 void COption_EventZ_free(struct LDKCOption_EventZ _res);
14943
14944 /**
14945  * Creates a new COption_EventZ which has the same data as `orig`
14946  * but with all dynamically-allocated buffers duplicated in new buffers.
14947  */
14948 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
14949
14950 /**
14951  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
14952  */
14953 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
14954
14955 /**
14956  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
14957  */
14958 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
14959
14960 /**
14961  * Checks if the given object is currently in the success state
14962  */
14963 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
14964
14965 /**
14966  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
14967  */
14968 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
14969
14970 /**
14971  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
14972  * but with all dynamically-allocated buffers duplicated in new buffers.
14973  */
14974 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
14975
14976 /**
14977  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14978  */
14979 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
14980
14981 /**
14982  * Creates a new CResult_TxOutAccessErrorZ in the success state.
14983  */
14984 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
14985
14986 /**
14987  * Creates a new CResult_TxOutAccessErrorZ in the error state.
14988  */
14989 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
14990
14991 /**
14992  * Checks if the given object is currently in the success state
14993  */
14994 bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
14995
14996 /**
14997  * Frees any resources used by the CResult_TxOutAccessErrorZ.
14998  */
14999 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
15000
15001 /**
15002  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
15003  * but with all dynamically-allocated buffers duplicated in new buffers.
15004  */
15005 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
15006
15007 /**
15008  * Creates a new tuple which has the same data as `orig`
15009  * but with all dynamically-allocated buffers duplicated in new buffers.
15010  */
15011 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
15012
15013 /**
15014  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
15015  */
15016 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
15017
15018 /**
15019  * Frees any resources used by the C2Tuple_usizeTransactionZ.
15020  */
15021 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
15022
15023 /**
15024  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15025  */
15026 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
15027
15028 /**
15029  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15030  */
15031 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
15032
15033 /**
15034  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
15035  */
15036 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
15037
15038 /**
15039  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
15040  */
15041 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
15042
15043 /**
15044  * Checks if the given object is currently in the success state
15045  */
15046 bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
15047
15048 /**
15049  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
15050  */
15051 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
15052
15053 /**
15054  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
15055  * but with all dynamically-allocated buffers duplicated in new buffers.
15056  */
15057 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
15058
15059 /**
15060  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15061  */
15062 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
15063
15064 /**
15065  * Creates a new tuple which has the same data as `orig`
15066  * but with all dynamically-allocated buffers duplicated in new buffers.
15067  */
15068 struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig);
15069
15070 /**
15071  * Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
15072  */
15073 struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b, struct LDKPublicKey c);
15074
15075 /**
15076  * Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
15077  */
15078 void C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res);
15079
15080 /**
15081  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15082  */
15083 void CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res);
15084
15085 /**
15086  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
15087  */
15088 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
15089
15090 /**
15091  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
15092  */
15093 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
15094
15095 /**
15096  * Checks if the given object is currently in the success state
15097  */
15098 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
15099
15100 /**
15101  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
15102  */
15103 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
15104
15105 /**
15106  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
15107  * but with all dynamically-allocated buffers duplicated in new buffers.
15108  */
15109 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
15110
15111 /**
15112  * Creates a new tuple which has the same data as `orig`
15113  * but with all dynamically-allocated buffers duplicated in new buffers.
15114  */
15115 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig);
15116
15117 /**
15118  * Creates a new C2Tuple_u64u64Z from the contained elements.
15119  */
15120 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
15121
15122 /**
15123  * Frees any resources used by the C2Tuple_u64u64Z.
15124  */
15125 void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res);
15126
15127 /**
15128  * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
15129  */
15130 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o);
15131
15132 /**
15133  * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
15134  */
15135 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void);
15136
15137 /**
15138  * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
15139  */
15140 void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res);
15141
15142 /**
15143  * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
15144  * but with all dynamically-allocated buffers duplicated in new buffers.
15145  */
15146 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig);
15147
15148 /**
15149  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15150  */
15151 void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res);
15152
15153 /**
15154  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
15155  */
15156 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
15157
15158 /**
15159  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
15160  */
15161 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
15162
15163 /**
15164  * Checks if the given object is currently in the success state
15165  */
15166 bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
15167
15168 /**
15169  * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
15170  */
15171 void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
15172
15173 /**
15174  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
15175  */
15176 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
15177
15178 /**
15179  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
15180  */
15181 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
15182
15183 /**
15184  * Checks if the given object is currently in the success state
15185  */
15186 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
15187
15188 /**
15189  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
15190  */
15191 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
15192
15193 /**
15194  * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
15195  * but with all dynamically-allocated buffers duplicated in new buffers.
15196  */
15197 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig);
15198
15199 /**
15200  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
15201  */
15202 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
15203
15204 /**
15205  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
15206  */
15207 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
15208
15209 /**
15210  * Checks if the given object is currently in the success state
15211  */
15212 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
15213
15214 /**
15215  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
15216  */
15217 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
15218
15219 /**
15220  * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
15221  * but with all dynamically-allocated buffers duplicated in new buffers.
15222  */
15223 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig);
15224
15225 /**
15226  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
15227  */
15228 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
15229
15230 /**
15231  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
15232  */
15233 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
15234
15235 /**
15236  * Checks if the given object is currently in the success state
15237  */
15238 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
15239
15240 /**
15241  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
15242  */
15243 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
15244
15245 /**
15246  * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
15247  * but with all dynamically-allocated buffers duplicated in new buffers.
15248  */
15249 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig);
15250
15251 /**
15252  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
15253  */
15254 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
15255
15256 /**
15257  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
15258  */
15259 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
15260
15261 /**
15262  * Checks if the given object is currently in the success state
15263  */
15264 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
15265
15266 /**
15267  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
15268  */
15269 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
15270
15271 /**
15272  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
15273  * but with all dynamically-allocated buffers duplicated in new buffers.
15274  */
15275 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig);
15276
15277 /**
15278  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
15279  */
15280 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
15281
15282 /**
15283  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
15284  */
15285 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
15286
15287 /**
15288  * Checks if the given object is currently in the success state
15289  */
15290 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
15291
15292 /**
15293  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
15294  */
15295 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
15296
15297 /**
15298  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
15299  * but with all dynamically-allocated buffers duplicated in new buffers.
15300  */
15301 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig);
15302
15303 /**
15304  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
15305  */
15306 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
15307
15308 /**
15309  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
15310  */
15311 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
15312
15313 /**
15314  * Checks if the given object is currently in the success state
15315  */
15316 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
15317
15318 /**
15319  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
15320  */
15321 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
15322
15323 /**
15324  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
15325  * but with all dynamically-allocated buffers duplicated in new buffers.
15326  */
15327 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
15328
15329 /**
15330  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
15331  */
15332 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
15333
15334 /**
15335  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
15336  */
15337 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
15338
15339 /**
15340  * Checks if the given object is currently in the success state
15341  */
15342 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
15343
15344 /**
15345  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
15346  */
15347 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
15348
15349 /**
15350  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
15351  * but with all dynamically-allocated buffers duplicated in new buffers.
15352  */
15353 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
15354
15355 /**
15356  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
15357  */
15358 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
15359
15360 /**
15361  * Constructs a new COption_AccessZ containing nothing
15362  */
15363 struct LDKCOption_AccessZ COption_AccessZ_none(void);
15364
15365 /**
15366  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
15367  */
15368 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
15369
15370 /**
15371  * Creates a new CResult_boolLightningErrorZ in the success state.
15372  */
15373 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
15374
15375 /**
15376  * Creates a new CResult_boolLightningErrorZ in the error state.
15377  */
15378 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
15379
15380 /**
15381  * Checks if the given object is currently in the success state
15382  */
15383 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
15384
15385 /**
15386  * Frees any resources used by the CResult_boolLightningErrorZ.
15387  */
15388 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
15389
15390 /**
15391  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
15392  * but with all dynamically-allocated buffers duplicated in new buffers.
15393  */
15394 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
15395
15396 /**
15397  * Creates a new tuple which has the same data as `orig`
15398  * but with all dynamically-allocated buffers duplicated in new buffers.
15399  */
15400 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
15401
15402 /**
15403  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
15404  */
15405 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
15406
15407 /**
15408  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
15409  */
15410 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
15411
15412 /**
15413  * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
15414  */
15415 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o);
15416
15417 /**
15418  * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
15419  */
15420 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none(void);
15421
15422 /**
15423  * Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
15424  */
15425 void COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
15426
15427 /**
15428  * Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
15429  * but with all dynamically-allocated buffers duplicated in new buffers.
15430  */
15431 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR orig);
15432
15433 /**
15434  * Creates a new CResult_NoneLightningErrorZ in the success state.
15435  */
15436 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
15437
15438 /**
15439  * Creates a new CResult_NoneLightningErrorZ in the error state.
15440  */
15441 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
15442
15443 /**
15444  * Checks if the given object is currently in the success state
15445  */
15446 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
15447
15448 /**
15449  * Frees any resources used by the CResult_NoneLightningErrorZ.
15450  */
15451 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
15452
15453 /**
15454  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
15455  * but with all dynamically-allocated buffers duplicated in new buffers.
15456  */
15457 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
15458
15459 /**
15460  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
15461  */
15462 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
15463
15464 /**
15465  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
15466  */
15467 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
15468
15469 /**
15470  * Checks if the given object is currently in the success state
15471  */
15472 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
15473
15474 /**
15475  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
15476  */
15477 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
15478
15479 /**
15480  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
15481  * but with all dynamically-allocated buffers duplicated in new buffers.
15482  */
15483 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
15484
15485 /**
15486  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
15487  */
15488 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
15489
15490 /**
15491  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
15492  */
15493 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
15494
15495 /**
15496  * Checks if the given object is currently in the success state
15497  */
15498 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
15499
15500 /**
15501  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
15502  */
15503 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
15504
15505 /**
15506  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
15507  * but with all dynamically-allocated buffers duplicated in new buffers.
15508  */
15509 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
15510
15511 /**
15512  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
15513  */
15514 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
15515
15516 /**
15517  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
15518  */
15519 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
15520
15521 /**
15522  * Checks if the given object is currently in the success state
15523  */
15524 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
15525
15526 /**
15527  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
15528  */
15529 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
15530
15531 /**
15532  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
15533  * but with all dynamically-allocated buffers duplicated in new buffers.
15534  */
15535 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
15536
15537 /**
15538  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15539  */
15540 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
15541
15542 /**
15543  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
15544  */
15545 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
15546
15547 /**
15548  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
15549  */
15550 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
15551
15552 /**
15553  * Checks if the given object is currently in the success state
15554  */
15555 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
15556
15557 /**
15558  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
15559  */
15560 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
15561
15562 /**
15563  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
15564  * but with all dynamically-allocated buffers duplicated in new buffers.
15565  */
15566 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
15567
15568 /**
15569  * Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
15570  */
15571 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o);
15572
15573 /**
15574  * Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
15575  */
15576 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e);
15577
15578 /**
15579  * Checks if the given object is currently in the success state
15580  */
15581 bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o);
15582
15583 /**
15584  * Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
15585  */
15586 void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res);
15587
15588 /**
15589  * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
15590  * but with all dynamically-allocated buffers duplicated in new buffers.
15591  */
15592 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig);
15593
15594 /**
15595  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
15596  */
15597 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
15598
15599 /**
15600  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
15601  */
15602 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
15603
15604 /**
15605  * Checks if the given object is currently in the success state
15606  */
15607 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
15608
15609 /**
15610  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
15611  */
15612 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
15613
15614 /**
15615  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
15616  * but with all dynamically-allocated buffers duplicated in new buffers.
15617  */
15618 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
15619
15620 /**
15621  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
15622  */
15623 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
15624
15625 /**
15626  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
15627  */
15628 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
15629
15630 /**
15631  * Checks if the given object is currently in the success state
15632  */
15633 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
15634
15635 /**
15636  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
15637  */
15638 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
15639
15640 /**
15641  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
15642  */
15643 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
15644
15645 /**
15646  * Constructs a new COption_CVec_NetAddressZZ containing nothing
15647  */
15648 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
15649
15650 /**
15651  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
15652  */
15653 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
15654
15655 /**
15656  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
15657  * but with all dynamically-allocated buffers duplicated in new buffers.
15658  */
15659 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
15660
15661 /**
15662  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
15663  */
15664 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
15665
15666 /**
15667  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
15668  */
15669 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
15670
15671 /**
15672  * Checks if the given object is currently in the success state
15673  */
15674 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
15675
15676 /**
15677  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
15678  */
15679 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
15680
15681 /**
15682  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
15683  * but with all dynamically-allocated buffers duplicated in new buffers.
15684  */
15685 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
15686
15687 /**
15688  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
15689  */
15690 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
15691
15692 /**
15693  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
15694  */
15695 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
15696
15697 /**
15698  * Checks if the given object is currently in the success state
15699  */
15700 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
15701
15702 /**
15703  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
15704  */
15705 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
15706
15707 /**
15708  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
15709  * but with all dynamically-allocated buffers duplicated in new buffers.
15710  */
15711 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
15712
15713 /**
15714  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
15715  */
15716 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
15717
15718 /**
15719  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
15720  */
15721 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
15722
15723 /**
15724  * Checks if the given object is currently in the success state
15725  */
15726 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
15727
15728 /**
15729  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
15730  */
15731 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
15732
15733 /**
15734  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
15735  * but with all dynamically-allocated buffers duplicated in new buffers.
15736  */
15737 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
15738
15739 /**
15740  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15741  */
15742 void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
15743
15744 /**
15745  * Creates a new tuple which has the same data as `orig`
15746  * but with all dynamically-allocated buffers duplicated in new buffers.
15747  */
15748 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
15749
15750 /**
15751  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
15752  */
15753 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
15754
15755 /**
15756  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
15757  */
15758 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
15759
15760 /**
15761  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
15762  */
15763 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
15764
15765 /**
15766  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
15767  */
15768 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
15769
15770 /**
15771  * Checks if the given object is currently in the success state
15772  */
15773 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
15774
15775 /**
15776  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
15777  */
15778 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
15779
15780 /**
15781  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
15782  * but with all dynamically-allocated buffers duplicated in new buffers.
15783  */
15784 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
15785
15786 /**
15787  * Creates a new CResult_SignatureNoneZ in the success state.
15788  */
15789 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
15790
15791 /**
15792  * Creates a new CResult_SignatureNoneZ in the error state.
15793  */
15794 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
15795
15796 /**
15797  * Checks if the given object is currently in the success state
15798  */
15799 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
15800
15801 /**
15802  * Frees any resources used by the CResult_SignatureNoneZ.
15803  */
15804 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
15805
15806 /**
15807  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
15808  * but with all dynamically-allocated buffers duplicated in new buffers.
15809  */
15810 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
15811
15812 /**
15813  * Creates a new tuple which has the same data as `orig`
15814  * but with all dynamically-allocated buffers duplicated in new buffers.
15815  */
15816 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig);
15817
15818 /**
15819  * Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
15820  */
15821 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b);
15822
15823 /**
15824  * Frees any resources used by the C2Tuple_SignatureSignatureZ.
15825  */
15826 void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res);
15827
15828 /**
15829  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
15830  */
15831 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o);
15832
15833 /**
15834  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
15835  */
15836 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void);
15837
15838 /**
15839  * Checks if the given object is currently in the success state
15840  */
15841 bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o);
15842
15843 /**
15844  * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
15845  */
15846 void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res);
15847
15848 /**
15849  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
15850  * but with all dynamically-allocated buffers duplicated in new buffers.
15851  */
15852 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig);
15853
15854 /**
15855  * Creates a new CResult_SecretKeyNoneZ in the success state.
15856  */
15857 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o);
15858
15859 /**
15860  * Creates a new CResult_SecretKeyNoneZ in the error state.
15861  */
15862 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void);
15863
15864 /**
15865  * Checks if the given object is currently in the success state
15866  */
15867 bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o);
15868
15869 /**
15870  * Frees any resources used by the CResult_SecretKeyNoneZ.
15871  */
15872 void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
15873
15874 /**
15875  * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
15876  * but with all dynamically-allocated buffers duplicated in new buffers.
15877  */
15878 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
15879
15880 /**
15881  * Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
15882  */
15883 struct LDKCOption_ScalarZ COption_ScalarZ_some(struct LDKBigEndianScalar o);
15884
15885 /**
15886  * Constructs a new COption_ScalarZ containing nothing
15887  */
15888 struct LDKCOption_ScalarZ COption_ScalarZ_none(void);
15889
15890 /**
15891  * Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
15892  */
15893 void COption_ScalarZ_free(struct LDKCOption_ScalarZ _res);
15894
15895 /**
15896  * Creates a new CResult_SharedSecretNoneZ in the success state.
15897  */
15898 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
15899
15900 /**
15901  * Creates a new CResult_SharedSecretNoneZ in the error state.
15902  */
15903 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_err(void);
15904
15905 /**
15906  * Checks if the given object is currently in the success state
15907  */
15908 bool CResult_SharedSecretNoneZ_is_ok(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR o);
15909
15910 /**
15911  * Frees any resources used by the CResult_SharedSecretNoneZ.
15912  */
15913 void CResult_SharedSecretNoneZ_free(struct LDKCResult_SharedSecretNoneZ _res);
15914
15915 /**
15916  * Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
15917  * but with all dynamically-allocated buffers duplicated in new buffers.
15918  */
15919 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_clone(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR orig);
15920
15921 /**
15922  * Creates a new CResult_SignDecodeErrorZ in the success state.
15923  */
15924 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
15925
15926 /**
15927  * Creates a new CResult_SignDecodeErrorZ in the error state.
15928  */
15929 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
15930
15931 /**
15932  * Checks if the given object is currently in the success state
15933  */
15934 bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
15935
15936 /**
15937  * Frees any resources used by the CResult_SignDecodeErrorZ.
15938  */
15939 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
15940
15941 /**
15942  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
15943  * but with all dynamically-allocated buffers duplicated in new buffers.
15944  */
15945 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
15946
15947 /**
15948  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15949  */
15950 void CVec_u5Z_free(struct LDKCVec_u5Z _res);
15951
15952 /**
15953  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
15954  */
15955 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
15956
15957 /**
15958  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
15959  */
15960 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
15961
15962 /**
15963  * Checks if the given object is currently in the success state
15964  */
15965 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
15966
15967 /**
15968  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
15969  */
15970 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
15971
15972 /**
15973  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
15974  * but with all dynamically-allocated buffers duplicated in new buffers.
15975  */
15976 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
15977
15978 /**
15979  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15980  */
15981 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
15982
15983 /**
15984  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15985  */
15986 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
15987
15988 /**
15989  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
15990  */
15991 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
15992
15993 /**
15994  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
15995  */
15996 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
15997
15998 /**
15999  * Checks if the given object is currently in the success state
16000  */
16001 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
16002
16003 /**
16004  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
16005  */
16006 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
16007
16008 /**
16009  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
16010  * but with all dynamically-allocated buffers duplicated in new buffers.
16011  */
16012 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
16013
16014 /**
16015  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
16016  */
16017 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
16018
16019 /**
16020  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
16021  */
16022 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
16023
16024 /**
16025  * Checks if the given object is currently in the success state
16026  */
16027 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
16028
16029 /**
16030  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
16031  */
16032 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
16033
16034 /**
16035  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
16036  * but with all dynamically-allocated buffers duplicated in new buffers.
16037  */
16038 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
16039
16040 /**
16041  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16042  */
16043 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
16044
16045 /**
16046  * Creates a new CResult_TransactionNoneZ in the success state.
16047  */
16048 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
16049
16050 /**
16051  * Creates a new CResult_TransactionNoneZ in the error state.
16052  */
16053 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
16054
16055 /**
16056  * Checks if the given object is currently in the success state
16057  */
16058 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
16059
16060 /**
16061  * Frees any resources used by the CResult_TransactionNoneZ.
16062  */
16063 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
16064
16065 /**
16066  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
16067  * but with all dynamically-allocated buffers duplicated in new buffers.
16068  */
16069 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
16070
16071 /**
16072  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
16073  */
16074 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
16075
16076 /**
16077  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
16078  */
16079 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
16080
16081 /**
16082  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16083  */
16084 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
16085
16086 /**
16087  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
16088  */
16089 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
16090
16091 /**
16092  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
16093  */
16094 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
16095
16096 /**
16097  * Checks if the given object is currently in the success state
16098  */
16099 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
16100
16101 /**
16102  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
16103  */
16104 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
16105
16106 /**
16107  * Constructs a new COption_u16Z containing a u16
16108  */
16109 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
16110
16111 /**
16112  * Constructs a new COption_u16Z containing nothing
16113  */
16114 struct LDKCOption_u16Z COption_u16Z_none(void);
16115
16116 /**
16117  * Frees any resources associated with the u16, if we are in the Some state
16118  */
16119 void COption_u16Z_free(struct LDKCOption_u16Z _res);
16120
16121 /**
16122  * Creates a new COption_u16Z which has the same data as `orig`
16123  * but with all dynamically-allocated buffers duplicated in new buffers.
16124  */
16125 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
16126
16127 /**
16128  * Creates a new CResult_NoneAPIErrorZ in the success state.
16129  */
16130 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
16131
16132 /**
16133  * Creates a new CResult_NoneAPIErrorZ in the error state.
16134  */
16135 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
16136
16137 /**
16138  * Checks if the given object is currently in the success state
16139  */
16140 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
16141
16142 /**
16143  * Frees any resources used by the CResult_NoneAPIErrorZ.
16144  */
16145 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
16146
16147 /**
16148  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
16149  * but with all dynamically-allocated buffers duplicated in new buffers.
16150  */
16151 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
16152
16153 /**
16154  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16155  */
16156 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
16157
16158 /**
16159  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16160  */
16161 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
16162
16163 /**
16164  * Creates a new CResult__u832APIErrorZ in the success state.
16165  */
16166 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
16167
16168 /**
16169  * Creates a new CResult__u832APIErrorZ in the error state.
16170  */
16171 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
16172
16173 /**
16174  * Checks if the given object is currently in the success state
16175  */
16176 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
16177
16178 /**
16179  * Frees any resources used by the CResult__u832APIErrorZ.
16180  */
16181 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
16182
16183 /**
16184  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
16185  * but with all dynamically-allocated buffers duplicated in new buffers.
16186  */
16187 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
16188
16189 /**
16190  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
16191  */
16192 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
16193
16194 /**
16195  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
16196  */
16197 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
16198
16199 /**
16200  * Checks if the given object is currently in the success state
16201  */
16202 bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
16203
16204 /**
16205  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
16206  */
16207 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
16208
16209 /**
16210  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
16211  * but with all dynamically-allocated buffers duplicated in new buffers.
16212  */
16213 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
16214
16215 /**
16216  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
16217  */
16218 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
16219
16220 /**
16221  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
16222  */
16223 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
16224
16225 /**
16226  * Checks if the given object is currently in the success state
16227  */
16228 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
16229
16230 /**
16231  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
16232  */
16233 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
16234
16235 /**
16236  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
16237  * but with all dynamically-allocated buffers duplicated in new buffers.
16238  */
16239 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
16240
16241 /**
16242  * Creates a new tuple which has the same data as `orig`
16243  * but with all dynamically-allocated buffers duplicated in new buffers.
16244  */
16245 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
16246
16247 /**
16248  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
16249  */
16250 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
16251
16252 /**
16253  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
16254  */
16255 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
16256
16257 /**
16258  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
16259  */
16260 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
16261
16262 /**
16263  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
16264  */
16265 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
16266
16267 /**
16268  * Checks if the given object is currently in the success state
16269  */
16270 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
16271
16272 /**
16273  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
16274  */
16275 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
16276
16277 /**
16278  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
16279  * but with all dynamically-allocated buffers duplicated in new buffers.
16280  */
16281 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
16282
16283 /**
16284  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16285  */
16286 void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res);
16287
16288 /**
16289  * Creates a new tuple which has the same data as `orig`
16290  * but with all dynamically-allocated buffers duplicated in new buffers.
16291  */
16292 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
16293
16294 /**
16295  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
16296  */
16297 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
16298
16299 /**
16300  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
16301  */
16302 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
16303
16304 /**
16305  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
16306  */
16307 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
16308
16309 /**
16310  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
16311  */
16312 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
16313
16314 /**
16315  * Checks if the given object is currently in the success state
16316  */
16317 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
16318
16319 /**
16320  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
16321  */
16322 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
16323
16324 /**
16325  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
16326  * but with all dynamically-allocated buffers duplicated in new buffers.
16327  */
16328 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
16329
16330 /**
16331  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
16332  */
16333 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
16334
16335 /**
16336  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
16337  */
16338 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
16339
16340 /**
16341  * Checks if the given object is currently in the success state
16342  */
16343 bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
16344
16345 /**
16346  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
16347  */
16348 void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
16349
16350 /**
16351  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
16352  * but with all dynamically-allocated buffers duplicated in new buffers.
16353  */
16354 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
16355
16356 /**
16357  * Creates a new CResult_PaymentSecretNoneZ in the success state.
16358  */
16359 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
16360
16361 /**
16362  * Creates a new CResult_PaymentSecretNoneZ in the error state.
16363  */
16364 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
16365
16366 /**
16367  * Checks if the given object is currently in the success state
16368  */
16369 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
16370
16371 /**
16372  * Frees any resources used by the CResult_PaymentSecretNoneZ.
16373  */
16374 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
16375
16376 /**
16377  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
16378  * but with all dynamically-allocated buffers duplicated in new buffers.
16379  */
16380 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
16381
16382 /**
16383  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
16384  */
16385 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
16386
16387 /**
16388  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
16389  */
16390 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
16391
16392 /**
16393  * Checks if the given object is currently in the success state
16394  */
16395 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
16396
16397 /**
16398  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
16399  */
16400 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
16401
16402 /**
16403  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
16404  * but with all dynamically-allocated buffers duplicated in new buffers.
16405  */
16406 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
16407
16408 /**
16409  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
16410  */
16411 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
16412
16413 /**
16414  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
16415  */
16416 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
16417
16418 /**
16419  * Checks if the given object is currently in the success state
16420  */
16421 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
16422
16423 /**
16424  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
16425  */
16426 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
16427
16428 /**
16429  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
16430  * but with all dynamically-allocated buffers duplicated in new buffers.
16431  */
16432 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
16433
16434 /**
16435  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
16436  */
16437 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
16438
16439 /**
16440  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
16441  */
16442 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
16443
16444 /**
16445  * Checks if the given object is currently in the success state
16446  */
16447 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
16448
16449 /**
16450  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
16451  */
16452 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
16453
16454 /**
16455  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
16456  * but with all dynamically-allocated buffers duplicated in new buffers.
16457  */
16458 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
16459
16460 /**
16461  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
16462  */
16463 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
16464
16465 /**
16466  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
16467  */
16468 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
16469
16470 /**
16471  * Checks if the given object is currently in the success state
16472  */
16473 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
16474
16475 /**
16476  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
16477  */
16478 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
16479
16480 /**
16481  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
16482  * but with all dynamically-allocated buffers duplicated in new buffers.
16483  */
16484 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
16485
16486 /**
16487  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
16488  */
16489 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
16490
16491 /**
16492  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
16493  */
16494 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
16495
16496 /**
16497  * Checks if the given object is currently in the success state
16498  */
16499 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
16500
16501 /**
16502  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
16503  */
16504 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
16505
16506 /**
16507  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
16508  * but with all dynamically-allocated buffers duplicated in new buffers.
16509  */
16510 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
16511
16512 /**
16513  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
16514  */
16515 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
16516
16517 /**
16518  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
16519  */
16520 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
16521
16522 /**
16523  * Checks if the given object is currently in the success state
16524  */
16525 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
16526
16527 /**
16528  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
16529  */
16530 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
16531
16532 /**
16533  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
16534  * but with all dynamically-allocated buffers duplicated in new buffers.
16535  */
16536 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
16537
16538 /**
16539  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16540  */
16541 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
16542
16543 /**
16544  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
16545  */
16546 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
16547
16548 /**
16549  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
16550  */
16551 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
16552
16553 /**
16554  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
16555  */
16556 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
16557
16558 /**
16559  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
16560  */
16561 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
16562
16563 /**
16564  * Checks if the given object is currently in the success state
16565  */
16566 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
16567
16568 /**
16569  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
16570  */
16571 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
16572
16573 /**
16574  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
16575  */
16576 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
16577
16578 /**
16579  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
16580  */
16581 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
16582
16583 /**
16584  * Checks if the given object is currently in the success state
16585  */
16586 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
16587
16588 /**
16589  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
16590  */
16591 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
16592
16593 /**
16594  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
16595  * but with all dynamically-allocated buffers duplicated in new buffers.
16596  */
16597 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
16598
16599 /**
16600  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
16601  */
16602 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
16603
16604 /**
16605  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
16606  */
16607 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
16608
16609 /**
16610  * Checks if the given object is currently in the success state
16611  */
16612 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
16613
16614 /**
16615  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
16616  */
16617 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
16618
16619 /**
16620  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
16621  * but with all dynamically-allocated buffers duplicated in new buffers.
16622  */
16623 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
16624
16625 /**
16626  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
16627  */
16628 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
16629
16630 /**
16631  * Constructs a new COption_TypeZ containing nothing
16632  */
16633 struct LDKCOption_TypeZ COption_TypeZ_none(void);
16634
16635 /**
16636  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
16637  */
16638 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
16639
16640 /**
16641  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
16642  */
16643 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
16644
16645 /**
16646  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
16647  */
16648 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
16649
16650 /**
16651  * Checks if the given object is currently in the success state
16652  */
16653 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
16654
16655 /**
16656  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
16657  */
16658 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
16659
16660 /**
16661  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
16662  */
16663 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
16664
16665 /**
16666  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
16667  */
16668 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
16669
16670 /**
16671  * Checks if the given object is currently in the success state
16672  */
16673 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
16674
16675 /**
16676  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
16677  */
16678 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
16679
16680 /**
16681  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
16682  * but with all dynamically-allocated buffers duplicated in new buffers.
16683  */
16684 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
16685
16686 /**
16687  * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
16688  */
16689 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o);
16690
16691 /**
16692  * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
16693  */
16694 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e);
16695
16696 /**
16697  * Checks if the given object is currently in the success state
16698  */
16699 bool CResult_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o);
16700
16701 /**
16702  * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
16703  */
16704 void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res);
16705
16706 /**
16707  * Creates a new CResult_SiPrefixParseErrorZ in the success state.
16708  */
16709 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
16710
16711 /**
16712  * Creates a new CResult_SiPrefixParseErrorZ in the error state.
16713  */
16714 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
16715
16716 /**
16717  * Checks if the given object is currently in the success state
16718  */
16719 bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
16720
16721 /**
16722  * Frees any resources used by the CResult_SiPrefixParseErrorZ.
16723  */
16724 void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
16725
16726 /**
16727  * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
16728  * but with all dynamically-allocated buffers duplicated in new buffers.
16729  */
16730 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
16731
16732 /**
16733  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
16734  */
16735 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
16736
16737 /**
16738  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
16739  */
16740 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
16741
16742 /**
16743  * Checks if the given object is currently in the success state
16744  */
16745 bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
16746
16747 /**
16748  * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
16749  */
16750 void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
16751
16752 /**
16753  * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
16754  * but with all dynamically-allocated buffers duplicated in new buffers.
16755  */
16756 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
16757
16758 /**
16759  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
16760  */
16761 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
16762
16763 /**
16764  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
16765  */
16766 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
16767
16768 /**
16769  * Checks if the given object is currently in the success state
16770  */
16771 bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
16772
16773 /**
16774  * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
16775  */
16776 void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
16777
16778 /**
16779  * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
16780  * but with all dynamically-allocated buffers duplicated in new buffers.
16781  */
16782 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
16783
16784 /**
16785  * Creates a new tuple which has the same data as `orig`
16786  * but with all dynamically-allocated buffers duplicated in new buffers.
16787  */
16788 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
16789
16790 /**
16791  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
16792  */
16793 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
16794
16795 /**
16796  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
16797  */
16798 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
16799
16800 /**
16801  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
16802  */
16803 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
16804
16805 /**
16806  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
16807  */
16808 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
16809
16810 /**
16811  * Checks if the given object is currently in the success state
16812  */
16813 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
16814
16815 /**
16816  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
16817  */
16818 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
16819
16820 /**
16821  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
16822  * but with all dynamically-allocated buffers duplicated in new buffers.
16823  */
16824 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
16825
16826 /**
16827  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16828  */
16829 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
16830
16831 /**
16832  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
16833  */
16834 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
16835
16836 /**
16837  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
16838  */
16839 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
16840
16841 /**
16842  * Checks if the given object is currently in the success state
16843  */
16844 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
16845
16846 /**
16847  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
16848  */
16849 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
16850
16851 /**
16852  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
16853  * but with all dynamically-allocated buffers duplicated in new buffers.
16854  */
16855 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
16856
16857 /**
16858  * Creates a new CResult_NoneSemanticErrorZ in the success state.
16859  */
16860 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
16861
16862 /**
16863  * Creates a new CResult_NoneSemanticErrorZ in the error state.
16864  */
16865 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
16866
16867 /**
16868  * Checks if the given object is currently in the success state
16869  */
16870 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
16871
16872 /**
16873  * Frees any resources used by the CResult_NoneSemanticErrorZ.
16874  */
16875 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
16876
16877 /**
16878  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
16879  * but with all dynamically-allocated buffers duplicated in new buffers.
16880  */
16881 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
16882
16883 /**
16884  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
16885  */
16886 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
16887
16888 /**
16889  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
16890  */
16891 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
16892
16893 /**
16894  * Checks if the given object is currently in the success state
16895  */
16896 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
16897
16898 /**
16899  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
16900  */
16901 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
16902
16903 /**
16904  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
16905  * but with all dynamically-allocated buffers duplicated in new buffers.
16906  */
16907 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
16908
16909 /**
16910  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
16911  */
16912 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
16913
16914 /**
16915  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
16916  */
16917 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
16918
16919 /**
16920  * Checks if the given object is currently in the success state
16921  */
16922 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
16923
16924 /**
16925  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
16926  */
16927 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
16928
16929 /**
16930  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
16931  * but with all dynamically-allocated buffers duplicated in new buffers.
16932  */
16933 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
16934
16935 /**
16936  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
16937  */
16938 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
16939
16940 /**
16941  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
16942  */
16943 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
16944
16945 /**
16946  * Checks if the given object is currently in the success state
16947  */
16948 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
16949
16950 /**
16951  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
16952  */
16953 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
16954
16955 /**
16956  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
16957  * but with all dynamically-allocated buffers duplicated in new buffers.
16958  */
16959 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
16960
16961 /**
16962  * Creates a new CResult_StringErrorZ in the success state.
16963  */
16964 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
16965
16966 /**
16967  * Creates a new CResult_StringErrorZ in the error state.
16968  */
16969 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
16970
16971 /**
16972  * Checks if the given object is currently in the success state
16973  */
16974 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
16975
16976 /**
16977  * Frees any resources used by the CResult_StringErrorZ.
16978  */
16979 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
16980
16981 /**
16982  * Creates a new CResult_StringErrorZ which has the same data as `orig`
16983  * but with all dynamically-allocated buffers duplicated in new buffers.
16984  */
16985 struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig);
16986
16987 /**
16988  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
16989  */
16990 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
16991
16992 /**
16993  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
16994  */
16995 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16996
16997 /**
16998  * Checks if the given object is currently in the success state
16999  */
17000 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
17001
17002 /**
17003  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
17004  */
17005 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
17006
17007 /**
17008  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
17009  * but with all dynamically-allocated buffers duplicated in new buffers.
17010  */
17011 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
17012
17013 /**
17014  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
17015  */
17016 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
17017
17018 /**
17019  * Constructs a new COption_MonitorEventZ containing nothing
17020  */
17021 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
17022
17023 /**
17024  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
17025  */
17026 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
17027
17028 /**
17029  * Creates a new COption_MonitorEventZ which has the same data as `orig`
17030  * but with all dynamically-allocated buffers duplicated in new buffers.
17031  */
17032 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
17033
17034 /**
17035  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
17036  */
17037 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
17038
17039 /**
17040  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
17041  */
17042 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
17043
17044 /**
17045  * Checks if the given object is currently in the success state
17046  */
17047 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
17048
17049 /**
17050  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
17051  */
17052 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
17053
17054 /**
17055  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
17056  * but with all dynamically-allocated buffers duplicated in new buffers.
17057  */
17058 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
17059
17060 /**
17061  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
17062  */
17063 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
17064
17065 /**
17066  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
17067  */
17068 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
17069
17070 /**
17071  * Checks if the given object is currently in the success state
17072  */
17073 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
17074
17075 /**
17076  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
17077  */
17078 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
17079
17080 /**
17081  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
17082  * but with all dynamically-allocated buffers duplicated in new buffers.
17083  */
17084 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
17085
17086 /**
17087  * Creates a new tuple which has the same data as `orig`
17088  * but with all dynamically-allocated buffers duplicated in new buffers.
17089  */
17090 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
17091
17092 /**
17093  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
17094  */
17095 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
17096
17097 /**
17098  * Frees any resources used by the C2Tuple_OutPointScriptZ.
17099  */
17100 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
17101
17102 /**
17103  * Creates a new tuple which has the same data as `orig`
17104  * but with all dynamically-allocated buffers duplicated in new buffers.
17105  */
17106 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
17107
17108 /**
17109  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
17110  */
17111 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
17112
17113 /**
17114  * Frees any resources used by the C2Tuple_u32ScriptZ.
17115  */
17116 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
17117
17118 /**
17119  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17120  */
17121 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
17122
17123 /**
17124  * Creates a new tuple which has the same data as `orig`
17125  * but with all dynamically-allocated buffers duplicated in new buffers.
17126  */
17127 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
17128
17129 /**
17130  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
17131  */
17132 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
17133
17134 /**
17135  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
17136  */
17137 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
17138
17139 /**
17140  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17141  */
17142 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
17143
17144 /**
17145  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17146  */
17147 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
17148
17149 /**
17150  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17151  */
17152 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
17153
17154 /**
17155  * Creates a new tuple which has the same data as `orig`
17156  * but with all dynamically-allocated buffers duplicated in new buffers.
17157  */
17158 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
17159
17160 /**
17161  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
17162  */
17163 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
17164
17165 /**
17166  * Frees any resources used by the C2Tuple_u32TxOutZ.
17167  */
17168 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
17169
17170 /**
17171  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17172  */
17173 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
17174
17175 /**
17176  * Creates a new tuple which has the same data as `orig`
17177  * but with all dynamically-allocated buffers duplicated in new buffers.
17178  */
17179 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
17180
17181 /**
17182  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
17183  */
17184 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
17185
17186 /**
17187  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
17188  */
17189 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
17190
17191 /**
17192  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17193  */
17194 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
17195
17196 /**
17197  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17198  */
17199 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
17200
17201 /**
17202  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
17203  */
17204 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
17205
17206 /**
17207  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
17208  */
17209 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
17210
17211 /**
17212  * Checks if the given object is currently in the success state
17213  */
17214 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
17215
17216 /**
17217  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
17218  */
17219 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
17220
17221 /**
17222  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
17223  */
17224 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
17225
17226 /**
17227  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
17228  */
17229 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
17230
17231 /**
17232  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17233  */
17234 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
17235
17236 /**
17237  * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
17238  */
17239 struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
17240
17241 /**
17242  * Constructs a new COption_NetAddressZ containing nothing
17243  */
17244 struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
17245
17246 /**
17247  * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
17248  */
17249 void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
17250
17251 /**
17252  * Creates a new COption_NetAddressZ which has the same data as `orig`
17253  * but with all dynamically-allocated buffers duplicated in new buffers.
17254  */
17255 struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
17256
17257 /**
17258  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
17259  */
17260 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
17261
17262 /**
17263  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
17264  */
17265 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
17266
17267 /**
17268  * Checks if the given object is currently in the success state
17269  */
17270 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
17271
17272 /**
17273  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
17274  */
17275 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
17276
17277 /**
17278  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
17279  * but with all dynamically-allocated buffers duplicated in new buffers.
17280  */
17281 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
17282
17283 /**
17284  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
17285  */
17286 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
17287
17288 /**
17289  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
17290  */
17291 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
17292
17293 /**
17294  * Checks if the given object is currently in the success state
17295  */
17296 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
17297
17298 /**
17299  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
17300  */
17301 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
17302
17303 /**
17304  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
17305  * but with all dynamically-allocated buffers duplicated in new buffers.
17306  */
17307 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
17308
17309 /**
17310  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
17311  */
17312 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
17313
17314 /**
17315  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
17316  */
17317 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
17318
17319 /**
17320  * Checks if the given object is currently in the success state
17321  */
17322 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
17323
17324 /**
17325  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
17326  */
17327 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
17328
17329 /**
17330  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
17331  * but with all dynamically-allocated buffers duplicated in new buffers.
17332  */
17333 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
17334
17335 /**
17336  * Creates a new CResult_NoneSendErrorZ in the success state.
17337  */
17338 struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void);
17339
17340 /**
17341  * Creates a new CResult_NoneSendErrorZ in the error state.
17342  */
17343 struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e);
17344
17345 /**
17346  * Checks if the given object is currently in the success state
17347  */
17348 bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o);
17349
17350 /**
17351  * Frees any resources used by the CResult_NoneSendErrorZ.
17352  */
17353 void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res);
17354
17355 /**
17356  * Creates a new CResult_u32GraphSyncErrorZ in the success state.
17357  */
17358 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o);
17359
17360 /**
17361  * Creates a new CResult_u32GraphSyncErrorZ in the error state.
17362  */
17363 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e);
17364
17365 /**
17366  * Checks if the given object is currently in the success state
17367  */
17368 bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o);
17369
17370 /**
17371  * Frees any resources used by the CResult_u32GraphSyncErrorZ.
17372  */
17373 void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res);
17374
17375 /**
17376  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
17377  */
17378 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
17379
17380 /**
17381  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
17382  */
17383 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
17384
17385 /**
17386  * Checks if the given object is currently in the success state
17387  */
17388 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
17389
17390 /**
17391  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
17392  */
17393 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
17394
17395 /**
17396  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
17397  * but with all dynamically-allocated buffers duplicated in new buffers.
17398  */
17399 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
17400
17401 /**
17402  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17403  */
17404 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
17405
17406 /**
17407  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17408  */
17409 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
17410
17411 /**
17412  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17413  */
17414 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
17415
17416 /**
17417  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17418  */
17419 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
17420
17421 /**
17422  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
17423  */
17424 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
17425
17426 /**
17427  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
17428  */
17429 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
17430
17431 /**
17432  * Checks if the given object is currently in the success state
17433  */
17434 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
17435
17436 /**
17437  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
17438  */
17439 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
17440
17441 /**
17442  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
17443  * but with all dynamically-allocated buffers duplicated in new buffers.
17444  */
17445 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
17446
17447 /**
17448  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
17449  */
17450 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
17451
17452 /**
17453  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
17454  */
17455 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
17456
17457 /**
17458  * Checks if the given object is currently in the success state
17459  */
17460 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
17461
17462 /**
17463  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
17464  */
17465 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
17466
17467 /**
17468  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
17469  * but with all dynamically-allocated buffers duplicated in new buffers.
17470  */
17471 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
17472
17473 /**
17474  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
17475  */
17476 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
17477
17478 /**
17479  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
17480  */
17481 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
17482
17483 /**
17484  * Checks if the given object is currently in the success state
17485  */
17486 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
17487
17488 /**
17489  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
17490  */
17491 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
17492
17493 /**
17494  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
17495  * but with all dynamically-allocated buffers duplicated in new buffers.
17496  */
17497 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
17498
17499 /**
17500  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
17501  */
17502 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
17503
17504 /**
17505  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
17506  */
17507 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
17508
17509 /**
17510  * Checks if the given object is currently in the success state
17511  */
17512 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
17513
17514 /**
17515  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
17516  */
17517 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
17518
17519 /**
17520  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
17521  * but with all dynamically-allocated buffers duplicated in new buffers.
17522  */
17523 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
17524
17525 /**
17526  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
17527  */
17528 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
17529
17530 /**
17531  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
17532  */
17533 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
17534
17535 /**
17536  * Checks if the given object is currently in the success state
17537  */
17538 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
17539
17540 /**
17541  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
17542  */
17543 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
17544
17545 /**
17546  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
17547  * but with all dynamically-allocated buffers duplicated in new buffers.
17548  */
17549 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
17550
17551 /**
17552  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
17553  */
17554 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
17555
17556 /**
17557  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
17558  */
17559 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
17560
17561 /**
17562  * Checks if the given object is currently in the success state
17563  */
17564 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
17565
17566 /**
17567  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
17568  */
17569 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
17570
17571 /**
17572  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
17573  * but with all dynamically-allocated buffers duplicated in new buffers.
17574  */
17575 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
17576
17577 /**
17578  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
17579  */
17580 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
17581
17582 /**
17583  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
17584  */
17585 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
17586
17587 /**
17588  * Checks if the given object is currently in the success state
17589  */
17590 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
17591
17592 /**
17593  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
17594  */
17595 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
17596
17597 /**
17598  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
17599  * but with all dynamically-allocated buffers duplicated in new buffers.
17600  */
17601 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
17602
17603 /**
17604  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
17605  */
17606 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
17607
17608 /**
17609  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
17610  */
17611 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
17612
17613 /**
17614  * Checks if the given object is currently in the success state
17615  */
17616 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
17617
17618 /**
17619  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
17620  */
17621 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
17622
17623 /**
17624  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
17625  * but with all dynamically-allocated buffers duplicated in new buffers.
17626  */
17627 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
17628
17629 /**
17630  * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
17631  */
17632 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o);
17633
17634 /**
17635  * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
17636  */
17637 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e);
17638
17639 /**
17640  * Checks if the given object is currently in the success state
17641  */
17642 bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o);
17643
17644 /**
17645  * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
17646  */
17647 void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res);
17648
17649 /**
17650  * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
17651  * but with all dynamically-allocated buffers duplicated in new buffers.
17652  */
17653 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig);
17654
17655 /**
17656  * Creates a new CResult_InitDecodeErrorZ in the success state.
17657  */
17658 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
17659
17660 /**
17661  * Creates a new CResult_InitDecodeErrorZ in the error state.
17662  */
17663 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
17664
17665 /**
17666  * Checks if the given object is currently in the success state
17667  */
17668 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
17669
17670 /**
17671  * Frees any resources used by the CResult_InitDecodeErrorZ.
17672  */
17673 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
17674
17675 /**
17676  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
17677  * but with all dynamically-allocated buffers duplicated in new buffers.
17678  */
17679 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
17680
17681 /**
17682  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
17683  */
17684 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
17685
17686 /**
17687  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
17688  */
17689 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
17690
17691 /**
17692  * Checks if the given object is currently in the success state
17693  */
17694 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
17695
17696 /**
17697  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
17698  */
17699 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
17700
17701 /**
17702  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
17703  * but with all dynamically-allocated buffers duplicated in new buffers.
17704  */
17705 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
17706
17707 /**
17708  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
17709  */
17710 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
17711
17712 /**
17713  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
17714  */
17715 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
17716
17717 /**
17718  * Checks if the given object is currently in the success state
17719  */
17720 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
17721
17722 /**
17723  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
17724  */
17725 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
17726
17727 /**
17728  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
17729  * but with all dynamically-allocated buffers duplicated in new buffers.
17730  */
17731 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
17732
17733 /**
17734  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
17735  */
17736 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
17737
17738 /**
17739  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
17740  */
17741 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
17742
17743 /**
17744  * Checks if the given object is currently in the success state
17745  */
17746 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
17747
17748 /**
17749  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
17750  */
17751 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
17752
17753 /**
17754  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
17755  * but with all dynamically-allocated buffers duplicated in new buffers.
17756  */
17757 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
17758
17759 /**
17760  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
17761  */
17762 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
17763
17764 /**
17765  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
17766  */
17767 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
17768
17769 /**
17770  * Checks if the given object is currently in the success state
17771  */
17772 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
17773
17774 /**
17775  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
17776  */
17777 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
17778
17779 /**
17780  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
17781  * but with all dynamically-allocated buffers duplicated in new buffers.
17782  */
17783 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
17784
17785 /**
17786  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
17787  */
17788 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
17789
17790 /**
17791  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
17792  */
17793 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
17794
17795 /**
17796  * Checks if the given object is currently in the success state
17797  */
17798 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
17799
17800 /**
17801  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
17802  */
17803 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
17804
17805 /**
17806  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
17807  * but with all dynamically-allocated buffers duplicated in new buffers.
17808  */
17809 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
17810
17811 /**
17812  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
17813  */
17814 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
17815
17816 /**
17817  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
17818  */
17819 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
17820
17821 /**
17822  * Checks if the given object is currently in the success state
17823  */
17824 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
17825
17826 /**
17827  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
17828  */
17829 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
17830
17831 /**
17832  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
17833  * but with all dynamically-allocated buffers duplicated in new buffers.
17834  */
17835 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
17836
17837 /**
17838  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
17839  */
17840 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
17841
17842 /**
17843  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
17844  */
17845 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
17846
17847 /**
17848  * Checks if the given object is currently in the success state
17849  */
17850 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
17851
17852 /**
17853  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
17854  */
17855 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
17856
17857 /**
17858  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
17859  * but with all dynamically-allocated buffers duplicated in new buffers.
17860  */
17861 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
17862
17863 /**
17864  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
17865  */
17866 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
17867
17868 /**
17869  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
17870  */
17871 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
17872
17873 /**
17874  * Checks if the given object is currently in the success state
17875  */
17876 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
17877
17878 /**
17879  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
17880  */
17881 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
17882
17883 /**
17884  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
17885  * but with all dynamically-allocated buffers duplicated in new buffers.
17886  */
17887 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
17888
17889 /**
17890  * Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
17891  */
17892 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_ok(struct LDKOnionMessage o);
17893
17894 /**
17895  * Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
17896  */
17897 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_err(struct LDKDecodeError e);
17898
17899 /**
17900  * Checks if the given object is currently in the success state
17901  */
17902 bool CResult_OnionMessageDecodeErrorZ_is_ok(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR o);
17903
17904 /**
17905  * Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
17906  */
17907 void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeErrorZ _res);
17908
17909 /**
17910  * Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
17911  * but with all dynamically-allocated buffers duplicated in new buffers.
17912  */
17913 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig);
17914
17915 /**
17916  * Creates a new CResult_PingDecodeErrorZ in the success state.
17917  */
17918 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
17919
17920 /**
17921  * Creates a new CResult_PingDecodeErrorZ in the error state.
17922  */
17923 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
17924
17925 /**
17926  * Checks if the given object is currently in the success state
17927  */
17928 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
17929
17930 /**
17931  * Frees any resources used by the CResult_PingDecodeErrorZ.
17932  */
17933 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
17934
17935 /**
17936  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
17937  * but with all dynamically-allocated buffers duplicated in new buffers.
17938  */
17939 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
17940
17941 /**
17942  * Creates a new CResult_PongDecodeErrorZ in the success state.
17943  */
17944 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
17945
17946 /**
17947  * Creates a new CResult_PongDecodeErrorZ in the error state.
17948  */
17949 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
17950
17951 /**
17952  * Checks if the given object is currently in the success state
17953  */
17954 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
17955
17956 /**
17957  * Frees any resources used by the CResult_PongDecodeErrorZ.
17958  */
17959 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
17960
17961 /**
17962  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
17963  * but with all dynamically-allocated buffers duplicated in new buffers.
17964  */
17965 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
17966
17967 /**
17968  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
17969  */
17970 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
17971
17972 /**
17973  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
17974  */
17975 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
17976
17977 /**
17978  * Checks if the given object is currently in the success state
17979  */
17980 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
17981
17982 /**
17983  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
17984  */
17985 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
17986
17987 /**
17988  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
17989  * but with all dynamically-allocated buffers duplicated in new buffers.
17990  */
17991 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
17992
17993 /**
17994  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
17995  */
17996 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
17997
17998 /**
17999  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
18000  */
18001 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
18002
18003 /**
18004  * Checks if the given object is currently in the success state
18005  */
18006 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
18007
18008 /**
18009  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
18010  */
18011 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
18012
18013 /**
18014  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
18015  * but with all dynamically-allocated buffers duplicated in new buffers.
18016  */
18017 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
18018
18019 /**
18020  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
18021  */
18022 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
18023
18024 /**
18025  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
18026  */
18027 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
18028
18029 /**
18030  * Checks if the given object is currently in the success state
18031  */
18032 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
18033
18034 /**
18035  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
18036  */
18037 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
18038
18039 /**
18040  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
18041  * but with all dynamically-allocated buffers duplicated in new buffers.
18042  */
18043 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
18044
18045 /**
18046  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
18047  */
18048 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
18049
18050 /**
18051  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
18052  */
18053 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
18054
18055 /**
18056  * Checks if the given object is currently in the success state
18057  */
18058 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
18059
18060 /**
18061  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
18062  */
18063 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
18064
18065 /**
18066  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
18067  * but with all dynamically-allocated buffers duplicated in new buffers.
18068  */
18069 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
18070
18071 /**
18072  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
18073  */
18074 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
18075
18076 /**
18077  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
18078  */
18079 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
18080
18081 /**
18082  * Checks if the given object is currently in the success state
18083  */
18084 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
18085
18086 /**
18087  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
18088  */
18089 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
18090
18091 /**
18092  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
18093  * but with all dynamically-allocated buffers duplicated in new buffers.
18094  */
18095 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
18096
18097 /**
18098  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
18099  */
18100 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
18101
18102 /**
18103  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
18104  */
18105 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
18106
18107 /**
18108  * Checks if the given object is currently in the success state
18109  */
18110 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
18111
18112 /**
18113  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
18114  */
18115 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
18116
18117 /**
18118  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
18119  * but with all dynamically-allocated buffers duplicated in new buffers.
18120  */
18121 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
18122
18123 /**
18124  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
18125  */
18126 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
18127
18128 /**
18129  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
18130  */
18131 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
18132
18133 /**
18134  * Checks if the given object is currently in the success state
18135  */
18136 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
18137
18138 /**
18139  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
18140  */
18141 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
18142
18143 /**
18144  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
18145  * but with all dynamically-allocated buffers duplicated in new buffers.
18146  */
18147 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
18148
18149 /**
18150  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
18151  */
18152 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
18153
18154 /**
18155  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
18156  */
18157 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
18158
18159 /**
18160  * Checks if the given object is currently in the success state
18161  */
18162 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
18163
18164 /**
18165  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
18166  */
18167 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
18168
18169 /**
18170  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
18171  * but with all dynamically-allocated buffers duplicated in new buffers.
18172  */
18173 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
18174
18175 /**
18176  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
18177  */
18178 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
18179
18180 /**
18181  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
18182  */
18183 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
18184
18185 /**
18186  * Checks if the given object is currently in the success state
18187  */
18188 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
18189
18190 /**
18191  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
18192  */
18193 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
18194
18195 /**
18196  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
18197  * but with all dynamically-allocated buffers duplicated in new buffers.
18198  */
18199 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
18200
18201 /**
18202  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
18203  */
18204 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
18205
18206 /**
18207  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
18208  */
18209 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
18210
18211 /**
18212  * Checks if the given object is currently in the success state
18213  */
18214 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
18215
18216 /**
18217  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
18218  */
18219 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
18220
18221 /**
18222  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
18223  * but with all dynamically-allocated buffers duplicated in new buffers.
18224  */
18225 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
18226
18227 /**
18228  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
18229  */
18230 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
18231
18232 /**
18233  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
18234  */
18235 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
18236
18237 /**
18238  * Checks if the given object is currently in the success state
18239  */
18240 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
18241
18242 /**
18243  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
18244  */
18245 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
18246
18247 /**
18248  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
18249  * but with all dynamically-allocated buffers duplicated in new buffers.
18250  */
18251 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
18252
18253 /**
18254  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
18255  */
18256 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
18257
18258 /**
18259  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
18260  */
18261 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
18262
18263 /**
18264  * Checks if the given object is currently in the success state
18265  */
18266 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
18267
18268 /**
18269  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
18270  */
18271 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
18272
18273 /**
18274  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
18275  * but with all dynamically-allocated buffers duplicated in new buffers.
18276  */
18277 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
18278
18279 /**
18280  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
18281  */
18282 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
18283
18284 /**
18285  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
18286  */
18287 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
18288
18289 /**
18290  * Checks if the given object is currently in the success state
18291  */
18292 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
18293
18294 /**
18295  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
18296  */
18297 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
18298
18299 /**
18300  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
18301  * but with all dynamically-allocated buffers duplicated in new buffers.
18302  */
18303 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
18304
18305 /**
18306  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18307  */
18308 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
18309
18310 /**
18311  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
18312  */
18313 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
18314
18315 /**
18316  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
18317  */
18318 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
18319
18320 /**
18321  * Checks if the given object is currently in the success state
18322  */
18323 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
18324
18325 /**
18326  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
18327  */
18328 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
18329
18330 /**
18331  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
18332  * but with all dynamically-allocated buffers duplicated in new buffers.
18333  */
18334 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
18335
18336 /**
18337  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
18338  */
18339 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
18340
18341 /**
18342  * Constructs a new COption_FilterZ containing nothing
18343  */
18344 struct LDKCOption_FilterZ COption_FilterZ_none(void);
18345
18346 /**
18347  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
18348  */
18349 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
18350
18351 /**
18352  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
18353  */
18354 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
18355
18356 /**
18357  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
18358  */
18359 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
18360
18361 /**
18362  * Checks if the given object is currently in the success state
18363  */
18364 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
18365
18366 /**
18367  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
18368  */
18369 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
18370
18371 /**
18372  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18373  */
18374 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
18375
18376 /**
18377  * Frees any resources used by the PaymentPurpose
18378  */
18379 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
18380
18381 /**
18382  * Creates a copy of the PaymentPurpose
18383  */
18384 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
18385
18386 /**
18387  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
18388  */
18389 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
18390
18391 /**
18392  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
18393  */
18394 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
18395
18396 /**
18397  * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
18398  */
18399 struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj);
18400
18401 /**
18402  * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
18403  */
18404 struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser);
18405
18406 /**
18407  * Frees any resources used by the ClosureReason
18408  */
18409 void ClosureReason_free(struct LDKClosureReason this_ptr);
18410
18411 /**
18412  * Creates a copy of the ClosureReason
18413  */
18414 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
18415
18416 /**
18417  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
18418  */
18419 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
18420
18421 /**
18422  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
18423  */
18424 struct LDKClosureReason ClosureReason_holder_force_closed(void);
18425
18426 /**
18427  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
18428  */
18429 struct LDKClosureReason ClosureReason_cooperative_closure(void);
18430
18431 /**
18432  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
18433  */
18434 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
18435
18436 /**
18437  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
18438  */
18439 struct LDKClosureReason ClosureReason_funding_timed_out(void);
18440
18441 /**
18442  * Utility method to constructs a new ProcessingError-variant ClosureReason
18443  */
18444 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
18445
18446 /**
18447  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
18448  */
18449 struct LDKClosureReason ClosureReason_disconnected_peer(void);
18450
18451 /**
18452  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
18453  */
18454 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
18455
18456 /**
18457  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
18458  */
18459 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
18460
18461 /**
18462  * Read a ClosureReason from a byte array, created by ClosureReason_write
18463  */
18464 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
18465
18466 /**
18467  * Frees any resources used by the HTLCDestination
18468  */
18469 void HTLCDestination_free(struct LDKHTLCDestination this_ptr);
18470
18471 /**
18472  * Creates a copy of the HTLCDestination
18473  */
18474 struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig);
18475
18476 /**
18477  * Utility method to constructs a new NextHopChannel-variant HTLCDestination
18478  */
18479 struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKThirtyTwoBytes channel_id);
18480
18481 /**
18482  * Utility method to constructs a new UnknownNextHop-variant HTLCDestination
18483  */
18484 struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid);
18485
18486 /**
18487  * Utility method to constructs a new FailedPayment-variant HTLCDestination
18488  */
18489 struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash);
18490
18491 /**
18492  * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read
18493  */
18494 struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj);
18495
18496 /**
18497  * Read a HTLCDestination from a byte array, created by HTLCDestination_write
18498  */
18499 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser);
18500
18501 /**
18502  * Frees any resources used by the Event
18503  */
18504 void Event_free(struct LDKEvent this_ptr);
18505
18506 /**
18507  * Creates a copy of the Event
18508  */
18509 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
18510
18511 /**
18512  * Utility method to constructs a new FundingGenerationReady-variant Event
18513  */
18514 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);
18515
18516 /**
18517  * Utility method to constructs a new PaymentReceived-variant Event
18518  */
18519 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
18520
18521 /**
18522  * Utility method to constructs a new PaymentClaimed-variant Event
18523  */
18524 struct LDKEvent Event_payment_claimed(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
18525
18526 /**
18527  * Utility method to constructs a new PaymentSent-variant Event
18528  */
18529 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
18530
18531 /**
18532  * Utility method to constructs a new PaymentFailed-variant Event
18533  */
18534 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
18535
18536 /**
18537  * Utility method to constructs a new PaymentPathSuccessful-variant Event
18538  */
18539 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
18540
18541 /**
18542  * Utility method to constructs a new PaymentPathFailed-variant Event
18543  */
18544 struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry);
18545
18546 /**
18547  * Utility method to constructs a new ProbeSuccessful-variant Event
18548  */
18549 struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
18550
18551 /**
18552  * Utility method to constructs a new ProbeFailed-variant Event
18553  */
18554 struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id);
18555
18556 /**
18557  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
18558  */
18559 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
18560
18561 /**
18562  * Utility method to constructs a new SpendableOutputs-variant Event
18563  */
18564 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
18565
18566 /**
18567  * Utility method to constructs a new PaymentForwarded-variant Event
18568  */
18569 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);
18570
18571 /**
18572  * Utility method to constructs a new ChannelClosed-variant Event
18573  */
18574 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
18575
18576 /**
18577  * Utility method to constructs a new DiscardFunding-variant Event
18578  */
18579 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
18580
18581 /**
18582  * Utility method to constructs a new OpenChannelRequest-variant Event
18583  */
18584 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);
18585
18586 /**
18587  * Utility method to constructs a new HTLCHandlingFailed-variant Event
18588  */
18589 struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination);
18590
18591 /**
18592  * Serialize the Event object into a byte array which can be read by Event_read
18593  */
18594 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
18595
18596 /**
18597  * Read a Event from a byte array, created by Event_write
18598  */
18599 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
18600
18601 /**
18602  * Frees any resources used by the MessageSendEvent
18603  */
18604 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
18605
18606 /**
18607  * Creates a copy of the MessageSendEvent
18608  */
18609 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
18610
18611 /**
18612  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
18613  */
18614 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
18615
18616 /**
18617  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
18618  */
18619 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
18620
18621 /**
18622  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
18623  */
18624 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
18625
18626 /**
18627  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
18628  */
18629 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
18630
18631 /**
18632  * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
18633  */
18634 struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg);
18635
18636 /**
18637  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
18638  */
18639 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
18640
18641 /**
18642  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
18643  */
18644 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
18645
18646 /**
18647  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
18648  */
18649 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
18650
18651 /**
18652  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
18653  */
18654 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
18655
18656 /**
18657  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
18658  */
18659 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
18660
18661 /**
18662  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
18663  */
18664 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
18665
18666 /**
18667  * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent
18668  */
18669 struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
18670
18671 /**
18672  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
18673  */
18674 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
18675
18676 /**
18677  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
18678  */
18679 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
18680
18681 /**
18682  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
18683  */
18684 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
18685
18686 /**
18687  * Utility method to constructs a new HandleError-variant MessageSendEvent
18688  */
18689 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
18690
18691 /**
18692  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
18693  */
18694 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
18695
18696 /**
18697  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
18698  */
18699 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
18700
18701 /**
18702  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
18703  */
18704 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
18705
18706 /**
18707  * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
18708  */
18709 struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
18710
18711 /**
18712  * Calls the free function if one is set
18713  */
18714 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
18715
18716 /**
18717  * Calls the free function if one is set
18718  */
18719 void OnionMessageProvider_free(struct LDKOnionMessageProvider this_ptr);
18720
18721 /**
18722  * Calls the free function if one is set
18723  */
18724 void EventsProvider_free(struct LDKEventsProvider this_ptr);
18725
18726 /**
18727  * Calls the free function if one is set
18728  */
18729 void EventHandler_free(struct LDKEventHandler this_ptr);
18730
18731 /**
18732  * Frees any resources used by the APIError
18733  */
18734 void APIError_free(struct LDKAPIError this_ptr);
18735
18736 /**
18737  * Creates a copy of the APIError
18738  */
18739 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
18740
18741 /**
18742  * Utility method to constructs a new APIMisuseError-variant APIError
18743  */
18744 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
18745
18746 /**
18747  * Utility method to constructs a new FeeRateTooHigh-variant APIError
18748  */
18749 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
18750
18751 /**
18752  * Utility method to constructs a new RouteError-variant APIError
18753  */
18754 struct LDKAPIError APIError_route_error(struct LDKStr err);
18755
18756 /**
18757  * Utility method to constructs a new ChannelUnavailable-variant APIError
18758  */
18759 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
18760
18761 /**
18762  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
18763  */
18764 struct LDKAPIError APIError_monitor_update_failed(void);
18765
18766 /**
18767  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
18768  */
18769 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
18770
18771 /**
18772  * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL.
18773  */
18774 void BigSize_free(struct LDKBigSize this_obj);
18775
18776 uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr);
18777
18778 void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val);
18779
18780 /**
18781  * Constructs a new BigSize given each field
18782  */
18783 MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg);
18784
18785 /**
18786  * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL.
18787  */
18788 void Hostname_free(struct LDKHostname this_obj);
18789
18790 /**
18791  * Creates a copy of the Hostname
18792  */
18793 struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig);
18794
18795 /**
18796  * Returns the length of the hostname.
18797  */
18798 MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg);
18799
18800 /**
18801  * Creates a digital signature of a message given a SecretKey, like the node's secret.
18802  * 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.
18803  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
18804  */
18805 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
18806
18807 /**
18808  * Recovers the PublicKey of the signer of the message given the message and the signature.
18809  */
18810 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
18811
18812 /**
18813  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
18814  * and the PublicKey.
18815  */
18816 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
18817
18818 /**
18819  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
18820  */
18821 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature);
18822
18823 /**
18824  * Calls the free function if one is set
18825  */
18826 void Persister_free(struct LDKPersister this_ptr);
18827
18828 /**
18829  * Calls the free function if one is set
18830  */
18831 void FutureCallback_free(struct LDKFutureCallback this_ptr);
18832
18833 /**
18834  * Frees any resources used by the Future, if is_owned is set and inner is non-NULL.
18835  */
18836 void Future_free(struct LDKFuture this_obj);
18837
18838 /**
18839  * Registers a callback to be called upon completion of this future. If the future has already
18840  * completed, the callback will be called immediately.
18841  */
18842 void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback);
18843
18844 /**
18845  * Creates a copy of the Level
18846  */
18847 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
18848
18849 /**
18850  * Utility method to constructs a new Gossip-variant Level
18851  */
18852 enum LDKLevel Level_gossip(void);
18853
18854 /**
18855  * Utility method to constructs a new Trace-variant Level
18856  */
18857 enum LDKLevel Level_trace(void);
18858
18859 /**
18860  * Utility method to constructs a new Debug-variant Level
18861  */
18862 enum LDKLevel Level_debug(void);
18863
18864 /**
18865  * Utility method to constructs a new Info-variant Level
18866  */
18867 enum LDKLevel Level_info(void);
18868
18869 /**
18870  * Utility method to constructs a new Warn-variant Level
18871  */
18872 enum LDKLevel Level_warn(void);
18873
18874 /**
18875  * Utility method to constructs a new Error-variant Level
18876  */
18877 enum LDKLevel Level_error(void);
18878
18879 /**
18880  * Checks if two Levels contain equal inner contents.
18881  * This ignores pointers and is_owned flags and looks at the values in fields.
18882  */
18883 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
18884
18885 /**
18886  * Checks if two Levels contain equal inner contents.
18887  */
18888 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
18889
18890 /**
18891  * Returns the most verbose logging level.
18892  */
18893 MUST_USE_RES enum LDKLevel Level_max(void);
18894
18895 /**
18896  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
18897  */
18898 void Record_free(struct LDKRecord this_obj);
18899
18900 /**
18901  * The verbosity level of the message.
18902  */
18903 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
18904
18905 /**
18906  * The verbosity level of the message.
18907  */
18908 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
18909
18910 /**
18911  * The message body.
18912  */
18913 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
18914
18915 /**
18916  * The message body.
18917  */
18918 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
18919
18920 /**
18921  * The module path of the message.
18922  */
18923 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
18924
18925 /**
18926  * The module path of the message.
18927  */
18928 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
18929
18930 /**
18931  * The source file containing the message.
18932  */
18933 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
18934
18935 /**
18936  * The source file containing the message.
18937  */
18938 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
18939
18940 /**
18941  * The line containing the message.
18942  */
18943 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
18944
18945 /**
18946  * The line containing the message.
18947  */
18948 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
18949
18950 /**
18951  * Creates a copy of the Record
18952  */
18953 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
18954
18955 /**
18956  * Calls the free function if one is set
18957  */
18958 void Logger_free(struct LDKLogger this_ptr);
18959
18960 /**
18961  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
18962  */
18963 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
18964
18965 /**
18966  * Confirmations we will wait for before considering the channel locked in.
18967  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
18968  * equivalent limit applied to outbound channels).
18969  *
18970  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
18971  * transaction before operation. If you wish to accept channels with zero confirmations, see
18972  * [`UserConfig::manually_accept_inbound_channels`] and
18973  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
18974  *
18975  * Default value: 6.
18976  *
18977  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
18978  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
18979  */
18980 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
18981
18982 /**
18983  * Confirmations we will wait for before considering the channel locked in.
18984  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
18985  * equivalent limit applied to outbound channels).
18986  *
18987  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
18988  * transaction before operation. If you wish to accept channels with zero confirmations, see
18989  * [`UserConfig::manually_accept_inbound_channels`] and
18990  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
18991  *
18992  * Default value: 6.
18993  *
18994  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
18995  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
18996  */
18997 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
18998
18999 /**
19000  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
19001  * the number of blocks we have to punish our counterparty if they broadcast a revoked
19002  * transaction).
19003  *
19004  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
19005  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
19006  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
19007  * possibly with time in between to RBF the spending transaction).
19008  *
19009  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
19010  * case of an honest unilateral channel close, which implicitly decrease the economic value of
19011  * our channel.
19012  *
19013  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
19014  * can tweak config to ask for more security, not less.
19015  */
19016 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19017
19018 /**
19019  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
19020  * the number of blocks we have to punish our counterparty if they broadcast a revoked
19021  * transaction).
19022  *
19023  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
19024  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
19025  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
19026  * possibly with time in between to RBF the spending transaction).
19027  *
19028  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
19029  * case of an honest unilateral channel close, which implicitly decrease the economic value of
19030  * our channel.
19031  *
19032  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
19033  * can tweak config to ask for more security, not less.
19034  */
19035 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
19036
19037 /**
19038  * Set to the smallest value HTLC we will accept to process.
19039  *
19040  * This value is sent to our counterparty on channel-open and we close the channel any time
19041  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
19042  *
19043  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
19044  * by the protocol.
19045  */
19046 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19047
19048 /**
19049  * Set to the smallest value HTLC we will accept to process.
19050  *
19051  * This value is sent to our counterparty on channel-open and we close the channel any time
19052  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
19053  *
19054  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
19055  * by the protocol.
19056  */
19057 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
19058
19059 /**
19060  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
19061  * HTLCs to.
19062  *
19063  * This can be set to a value between 1-100, where the value corresponds to the percent of the
19064  * channel value in whole percentages.
19065  *
19066  * Note that:
19067  * * If configured to another value than the default value 10, any new channels created with
19068  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
19069  * `ChannelManager`.
19070  *
19071  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
19072  * no way to configure the cap for the total value of outbound HTLCs in-flight.
19073  *
19074  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
19075  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
19076  * restrict exposure to loss due to being offline for too long.
19077  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
19078  * for more information.
19079  *
19080  * Default value: 10.
19081  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
19082  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
19083  */
19084 uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19085
19086 /**
19087  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
19088  * HTLCs to.
19089  *
19090  * This can be set to a value between 1-100, where the value corresponds to the percent of the
19091  * channel value in whole percentages.
19092  *
19093  * Note that:
19094  * * If configured to another value than the default value 10, any new channels created with
19095  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
19096  * `ChannelManager`.
19097  *
19098  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
19099  * no way to configure the cap for the total value of outbound HTLCs in-flight.
19100  *
19101  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
19102  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
19103  * restrict exposure to loss due to being offline for too long.
19104  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
19105  * for more information.
19106  *
19107  * Default value: 10.
19108  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
19109  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
19110  */
19111 void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val);
19112
19113 /**
19114  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
19115  * BOLTs) option for outbound private channels. This provides better privacy by not including
19116  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
19117  * relay HTLCs to us using the channel's SCID alias.
19118  *
19119  * If this option is set, channels may be created that will not be readable by LDK versions
19120  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
19121  * [`DecodeError::InvalidValue`].
19122  *
19123  * Note that setting this to true does *not* prevent us from opening channels with
19124  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
19125  * private channel without that option.
19126  *
19127  * Ignored if the channel is negotiated to be announced, see
19128  * [`ChannelHandshakeConfig::announced_channel`] and
19129  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
19130  *
19131  * Default value: false. This value is likely to change to true in the future.
19132  *
19133  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
19134  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
19135  */
19136 bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19137
19138 /**
19139  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
19140  * BOLTs) option for outbound private channels. This provides better privacy by not including
19141  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
19142  * relay HTLCs to us using the channel's SCID alias.
19143  *
19144  * If this option is set, channels may be created that will not be readable by LDK versions
19145  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
19146  * [`DecodeError::InvalidValue`].
19147  *
19148  * Note that setting this to true does *not* prevent us from opening channels with
19149  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
19150  * private channel without that option.
19151  *
19152  * Ignored if the channel is negotiated to be announced, see
19153  * [`ChannelHandshakeConfig::announced_channel`] and
19154  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
19155  *
19156  * Default value: false. This value is likely to change to true in the future.
19157  *
19158  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
19159  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
19160  */
19161 void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
19162
19163 /**
19164  * Set to announce the channel publicly and notify all nodes that they can route via this
19165  * channel.
19166  *
19167  * This should only be set to true for nodes which expect to be online reliably.
19168  *
19169  * As the node which funds a channel picks this value this will only apply for new outbound
19170  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
19171  *
19172  * Default value: false.
19173  */
19174 bool ChannelHandshakeConfig_get_announced_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19175
19176 /**
19177  * Set to announce the channel publicly and notify all nodes that they can route via this
19178  * channel.
19179  *
19180  * This should only be set to true for nodes which expect to be online reliably.
19181  *
19182  * As the node which funds a channel picks this value this will only apply for new outbound
19183  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
19184  *
19185  * Default value: false.
19186  */
19187 void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
19188
19189 /**
19190  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
19191  * supports it, they will then enforce the mutual-close output to us matches what we provided
19192  * at intialization, preventing us from closing to an alternate pubkey.
19193  *
19194  * This is set to true by default to provide a slight increase in security, though ultimately
19195  * any attacker who is able to take control of a channel can just as easily send the funds via
19196  * lightning payments, so we never require that our counterparties support this option.
19197  *
19198  * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`].
19199  *
19200  * Default value: true.
19201  *
19202  * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
19203  */
19204 bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19205
19206 /**
19207  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
19208  * supports it, they will then enforce the mutual-close output to us matches what we provided
19209  * at intialization, preventing us from closing to an alternate pubkey.
19210  *
19211  * This is set to true by default to provide a slight increase in security, though ultimately
19212  * any attacker who is able to take control of a channel can just as easily send the funds via
19213  * lightning payments, so we never require that our counterparties support this option.
19214  *
19215  * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`].
19216  *
19217  * Default value: true.
19218  *
19219  * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
19220  */
19221 void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
19222
19223 /**
19224  * The Proportion of the channel value to configure as counterparty's channel reserve,
19225  * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
19226  *
19227  * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
19228  * on their side, at all times.
19229  * This ensures that if our counterparty broadcasts a revoked state, we can punish them by
19230  * claiming at least this value on chain.
19231  *
19232  * Channel reserve values greater than 30% could be considered highly unreasonable, since that
19233  * amount can never be used for payments.
19234  * Also, if our selected channel reserve for counterparty and counterparty's selected
19235  * channel reserve for us sum up to equal or greater than channel value, channel negotiations
19236  * will fail.
19237  *
19238  * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
19239  * other than the default value.
19240  *
19241  * Default value: 1% of channel value, i.e., configured as 10,000 millionths.
19242  * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
19243  *                as 1000 sats instead, which is a safe implementation-specific lower bound.
19244  * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
19245  *                instead, although channel negotiations will fail in that case.
19246  */
19247 uint32_t ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19248
19249 /**
19250  * The Proportion of the channel value to configure as counterparty's channel reserve,
19251  * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
19252  *
19253  * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
19254  * on their side, at all times.
19255  * This ensures that if our counterparty broadcasts a revoked state, we can punish them by
19256  * claiming at least this value on chain.
19257  *
19258  * Channel reserve values greater than 30% could be considered highly unreasonable, since that
19259  * amount can never be used for payments.
19260  * Also, if our selected channel reserve for counterparty and counterparty's selected
19261  * channel reserve for us sum up to equal or greater than channel value, channel negotiations
19262  * will fail.
19263  *
19264  * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
19265  * other than the default value.
19266  *
19267  * Default value: 1% of channel value, i.e., configured as 10,000 millionths.
19268  * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
19269  *                as 1000 sats instead, which is a safe implementation-specific lower bound.
19270  * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
19271  *                instead, although channel negotiations will fail in that case.
19272  */
19273 void ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
19274
19275 /**
19276  * Constructs a new ChannelHandshakeConfig given each field
19277  */
19278 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, uint32_t their_channel_reserve_proportional_millionths_arg);
19279
19280 /**
19281  * Creates a copy of the ChannelHandshakeConfig
19282  */
19283 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
19284
19285 /**
19286  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
19287  */
19288 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
19289
19290 /**
19291  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
19292  */
19293 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
19294
19295 /**
19296  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
19297  * only applies to inbound channels.
19298  *
19299  * Default value: 0.
19300  */
19301 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19302
19303 /**
19304  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
19305  * only applies to inbound channels.
19306  *
19307  * Default value: 0.
19308  */
19309 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
19310
19311 /**
19312  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
19313  * only applies to inbound channels.
19314  *
19315  * Default value: 2^24 - 1.
19316  */
19317 uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19318
19319 /**
19320  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
19321  * only applies to inbound channels.
19322  *
19323  * Default value: 2^24 - 1.
19324  */
19325 void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
19326
19327 /**
19328  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
19329  * you to limit the maximum minimum-size they can require.
19330  *
19331  * Default value: u64::max_value.
19332  */
19333 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19334
19335 /**
19336  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
19337  * you to limit the maximum minimum-size they can require.
19338  *
19339  * Default value: u64::max_value.
19340  */
19341 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
19342
19343 /**
19344  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
19345  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
19346  *
19347  * Default value: 0.
19348  */
19349 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19350
19351 /**
19352  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
19353  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
19354  *
19355  * Default value: 0.
19356  */
19357 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
19358
19359 /**
19360  * The remote node will require we keep a certain amount in direct payment to ourselves at all
19361  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
19362  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
19363  *
19364  * Default value: u64::max_value.
19365  */
19366 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19367
19368 /**
19369  * The remote node will require we keep a certain amount in direct payment to ourselves at all
19370  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
19371  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
19372  *
19373  * Default value: u64::max_value.
19374  */
19375 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
19376
19377 /**
19378  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
19379  * time. This allows you to set a minimum such value.
19380  *
19381  * Default value: 0.
19382  */
19383 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19384
19385 /**
19386  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
19387  * time. This allows you to set a minimum such value.
19388  *
19389  * Default value: 0.
19390  */
19391 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
19392
19393 /**
19394  * Before a channel is usable the funding transaction will need to be confirmed by at least a
19395  * certain number of blocks, specified by the node which is not the funder (as the funder can
19396  * assume they aren't going to double-spend themselves).
19397  * This config allows you to set a limit on the maximum amount of time to wait.
19398  *
19399  * Default value: 144, or roughly one day and only applies to outbound channels.
19400  */
19401 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19402
19403 /**
19404  * Before a channel is usable the funding transaction will need to be confirmed by at least a
19405  * certain number of blocks, specified by the node which is not the funder (as the funder can
19406  * assume they aren't going to double-spend themselves).
19407  * This config allows you to set a limit on the maximum amount of time to wait.
19408  *
19409  * Default value: 144, or roughly one day and only applies to outbound channels.
19410  */
19411 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
19412
19413 /**
19414  * Whether we implicitly trust funding transactions generated by us for our own outbound
19415  * channels to not be double-spent.
19416  *
19417  * If this is set, we assume that our own funding transactions are *never* double-spent, and
19418  * thus we can trust them without any confirmations. This is generally a reasonable
19419  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
19420  * control of the signing keys).
19421  *
19422  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
19423  * double-spend the funding transaction to RBF with an alternative channel open.
19424  *
19425  * This only applies if our counterparty set their confirmations-required value to 0, and we
19426  * always trust our own funding transaction at 1 confirmation irrespective of this value.
19427  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
19428  * `true` (0) and `false` (1).
19429  *
19430  * Default value: true
19431  */
19432 bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19433
19434 /**
19435  * Whether we implicitly trust funding transactions generated by us for our own outbound
19436  * channels to not be double-spent.
19437  *
19438  * If this is set, we assume that our own funding transactions are *never* double-spent, and
19439  * thus we can trust them without any confirmations. This is generally a reasonable
19440  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
19441  * control of the signing keys).
19442  *
19443  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
19444  * double-spend the funding transaction to RBF with an alternative channel open.
19445  *
19446  * This only applies if our counterparty set their confirmations-required value to 0, and we
19447  * always trust our own funding transaction at 1 confirmation irrespective of this value.
19448  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
19449  * `true` (0) and `false` (1).
19450  *
19451  * Default value: true
19452  */
19453 void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
19454
19455 /**
19456  * Set to force an incoming channel to match our announced channel preference in
19457  * [`ChannelHandshakeConfig::announced_channel`].
19458  *
19459  * For a node which is not online reliably, this should be set to true and
19460  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
19461  * channels will ever be opened.
19462  *
19463  * Default value: true.
19464  */
19465 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19466
19467 /**
19468  * Set to force an incoming channel to match our announced channel preference in
19469  * [`ChannelHandshakeConfig::announced_channel`].
19470  *
19471  * For a node which is not online reliably, this should be set to true and
19472  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
19473  * channels will ever be opened.
19474  *
19475  * Default value: true.
19476  */
19477 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
19478
19479 /**
19480  * Set to the amount of time we're willing to wait to claim money back to us.
19481  *
19482  * Not checking this value would be a security issue, as our peer would be able to set it to
19483  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
19484  *
19485  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
19486  * reduce the loss of having useless locked funds (if your peer accepts)
19487  */
19488 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19489
19490 /**
19491  * Set to the amount of time we're willing to wait to claim money back to us.
19492  *
19493  * Not checking this value would be a security issue, as our peer would be able to set it to
19494  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
19495  *
19496  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
19497  * reduce the loss of having useless locked funds (if your peer accepts)
19498  */
19499 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
19500
19501 /**
19502  * Constructs a new ChannelHandshakeLimits given each field
19503  */
19504 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);
19505
19506 /**
19507  * Creates a copy of the ChannelHandshakeLimits
19508  */
19509 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
19510
19511 /**
19512  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
19513  */
19514 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
19515
19516 /**
19517  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
19518  */
19519 void ChannelConfig_free(struct LDKChannelConfig this_obj);
19520
19521 /**
19522  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
19523  * over the channel.
19524  * This may be allowed to change at runtime in a later update, however doing so must result in
19525  * update messages sent to notify all nodes of our updated relay fee.
19526  *
19527  * Default value: 0.
19528  */
19529 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
19530
19531 /**
19532  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
19533  * over the channel.
19534  * This may be allowed to change at runtime in a later update, however doing so must result in
19535  * update messages sent to notify all nodes of our updated relay fee.
19536  *
19537  * Default value: 0.
19538  */
19539 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
19540
19541 /**
19542  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
19543  * excess of [`forwarding_fee_proportional_millionths`].
19544  * This may be allowed to change at runtime in a later update, however doing so must result in
19545  * update messages sent to notify all nodes of our updated relay fee.
19546  *
19547  * The default value of a single satoshi roughly matches the market rate on many routing nodes
19548  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
19549  * this node.
19550  *
19551  * Default value: 1000.
19552  *
19553  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
19554  */
19555 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
19556
19557 /**
19558  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
19559  * excess of [`forwarding_fee_proportional_millionths`].
19560  * This may be allowed to change at runtime in a later update, however doing so must result in
19561  * update messages sent to notify all nodes of our updated relay fee.
19562  *
19563  * The default value of a single satoshi roughly matches the market rate on many routing nodes
19564  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
19565  * this node.
19566  *
19567  * Default value: 1000.
19568  *
19569  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
19570  */
19571 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
19572
19573 /**
19574  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
19575  * the channel this config applies to.
19576  *
19577  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
19578  * HTLC balance when a channel appears on-chain whereas
19579  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
19580  * (non-HTLC-encumbered) balance.
19581  *
19582  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
19583  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
19584  * commitment transaction at least once per this many blocks (minus some margin to allow us
19585  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
19586  * the spending transaction).
19587  *
19588  * Default value: 72 (12 hours at an average of 6 blocks/hour).
19589  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
19590  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
19591  *
19592  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
19593  */
19594 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
19595
19596 /**
19597  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
19598  * the channel this config applies to.
19599  *
19600  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
19601  * HTLC balance when a channel appears on-chain whereas
19602  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
19603  * (non-HTLC-encumbered) balance.
19604  *
19605  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
19606  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
19607  * commitment transaction at least once per this many blocks (minus some margin to allow us
19608  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
19609  * the spending transaction).
19610  *
19611  * Default value: 72 (12 hours at an average of 6 blocks/hour).
19612  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
19613  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
19614  *
19615  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
19616  */
19617 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
19618
19619 /**
19620  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
19621  * small to claim on-chain.
19622  *
19623  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
19624  * not be claimable on-chain, instead being turned into additional miner fees if either
19625  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
19626  * to such payments may be sustantial if there are many dust HTLCs present when the
19627  * channel is force-closed.
19628  *
19629  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
19630  * exposure across all three types per-channel. Setting this too low may prevent the
19631  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
19632  * important to prevent stealing of dust HTLCs by miners.
19633  *
19634  * Default value: 5_000_000 msat.
19635  */
19636 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
19637
19638 /**
19639  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
19640  * small to claim on-chain.
19641  *
19642  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
19643  * not be claimable on-chain, instead being turned into additional miner fees if either
19644  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
19645  * to such payments may be sustantial if there are many dust HTLCs present when the
19646  * channel is force-closed.
19647  *
19648  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
19649  * exposure across all three types per-channel. Setting this too low may prevent the
19650  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
19651  * important to prevent stealing of dust HTLCs by miners.
19652  *
19653  * Default value: 5_000_000 msat.
19654  */
19655 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
19656
19657 /**
19658  * The additional fee we're willing to pay to avoid waiting for the counterparty's
19659  * `to_self_delay` to reclaim funds.
19660  *
19661  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
19662  * closing transaction which both sides find acceptable, ultimately paid by the channel
19663  * funder/initiator.
19664  *
19665  * When we are the funder, because we have to pay the channel closing fee, we bound the
19666  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
19667  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
19668  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
19669  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
19670  * funds.
19671  *
19672  * When we are not the funder, we require the closing transaction fee pay at least our
19673  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
19674  * Thus, this value is ignored when we are not the funder.
19675  *
19676  * Default value: 1000 satoshis.
19677  *
19678  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
19679  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
19680  */
19681 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
19682
19683 /**
19684  * The additional fee we're willing to pay to avoid waiting for the counterparty's
19685  * `to_self_delay` to reclaim funds.
19686  *
19687  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
19688  * closing transaction which both sides find acceptable, ultimately paid by the channel
19689  * funder/initiator.
19690  *
19691  * When we are the funder, because we have to pay the channel closing fee, we bound the
19692  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
19693  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
19694  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
19695  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
19696  * funds.
19697  *
19698  * When we are not the funder, we require the closing transaction fee pay at least our
19699  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
19700  * Thus, this value is ignored when we are not the funder.
19701  *
19702  * Default value: 1000 satoshis.
19703  *
19704  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
19705  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
19706  */
19707 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
19708
19709 /**
19710  * Constructs a new ChannelConfig given each field
19711  */
19712 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);
19713
19714 /**
19715  * Creates a copy of the ChannelConfig
19716  */
19717 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
19718
19719 /**
19720  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
19721  */
19722 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
19723
19724 /**
19725  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
19726  */
19727 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
19728
19729 /**
19730  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
19731  */
19732 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
19733
19734 /**
19735  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
19736  */
19737 void UserConfig_free(struct LDKUserConfig this_obj);
19738
19739 /**
19740  * Channel handshake config that we propose to our counterparty.
19741  */
19742 struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
19743
19744 /**
19745  * Channel handshake config that we propose to our counterparty.
19746  */
19747 void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
19748
19749 /**
19750  * Limits applied to our counterparty's proposed channel handshake config settings.
19751  */
19752 struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
19753
19754 /**
19755  * Limits applied to our counterparty's proposed channel handshake config settings.
19756  */
19757 void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
19758
19759 /**
19760  * Channel config which affects behavior during channel lifetime.
19761  */
19762 struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
19763
19764 /**
19765  * Channel config which affects behavior during channel lifetime.
19766  */
19767 void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
19768
19769 /**
19770  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
19771  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
19772  * node which is not online reliably.
19773  *
19774  * For nodes which are not online reliably, you should set all channels to *not* be announced
19775  * (using [`ChannelHandshakeConfig::announced_channel`] and
19776  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
19777  * ensure you are not exposed to any forwarding risk.
19778  *
19779  * Note that because you cannot change a channel's announced state after creation, there is no
19780  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
19781  * from a publicly-announced forwarding node to a private non-forwarding node you must close
19782  * all your channels and open new ones. For privacy, you should also change your node_id
19783  * (swapping all private and public key material for new ones) at that time.
19784  *
19785  * Default value: false.
19786  */
19787 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
19788
19789 /**
19790  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
19791  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
19792  * node which is not online reliably.
19793  *
19794  * For nodes which are not online reliably, you should set all channels to *not* be announced
19795  * (using [`ChannelHandshakeConfig::announced_channel`] and
19796  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
19797  * ensure you are not exposed to any forwarding risk.
19798  *
19799  * Note that because you cannot change a channel's announced state after creation, there is no
19800  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
19801  * from a publicly-announced forwarding node to a private non-forwarding node you must close
19802  * all your channels and open new ones. For privacy, you should also change your node_id
19803  * (swapping all private and public key material for new ones) at that time.
19804  *
19805  * Default value: false.
19806  */
19807 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
19808
19809 /**
19810  * If this is set to false, we do not accept inbound requests to open a new channel.
19811  * Default value: true.
19812  */
19813 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
19814
19815 /**
19816  * If this is set to false, we do not accept inbound requests to open a new channel.
19817  * Default value: true.
19818  */
19819 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
19820
19821 /**
19822  * If this is set to true, the user needs to manually accept inbound requests to open a new
19823  * channel.
19824  *
19825  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
19826  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
19827  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
19828  * user explicitly chooses to accept the request.
19829  *
19830  * Default value: false.
19831  *
19832  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
19833  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
19834  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
19835  */
19836 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
19837
19838 /**
19839  * If this is set to true, the user needs to manually accept inbound requests to open a new
19840  * channel.
19841  *
19842  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
19843  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
19844  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
19845  * user explicitly chooses to accept the request.
19846  *
19847  * Default value: false.
19848  *
19849  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
19850  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
19851  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
19852  */
19853 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
19854
19855 /**
19856  * Constructs a new UserConfig given each field
19857  */
19858 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);
19859
19860 /**
19861  * Creates a copy of the UserConfig
19862  */
19863 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
19864
19865 /**
19866  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
19867  */
19868 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
19869
19870 /**
19871  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
19872  */
19873 void BestBlock_free(struct LDKBestBlock this_obj);
19874
19875 /**
19876  * Creates a copy of the BestBlock
19877  */
19878 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
19879
19880 /**
19881  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
19882  * network.
19883  */
19884 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
19885
19886 /**
19887  * Returns a `BestBlock` as identified by the given block hash and height.
19888  */
19889 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
19890
19891 /**
19892  * Returns the best block hash.
19893  */
19894 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
19895
19896 /**
19897  * Returns the best block height.
19898  */
19899 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
19900
19901 /**
19902  * Creates a copy of the AccessError
19903  */
19904 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
19905
19906 /**
19907  * Utility method to constructs a new UnknownChain-variant AccessError
19908  */
19909 enum LDKAccessError AccessError_unknown_chain(void);
19910
19911 /**
19912  * Utility method to constructs a new UnknownTx-variant AccessError
19913  */
19914 enum LDKAccessError AccessError_unknown_tx(void);
19915
19916 /**
19917  * Calls the free function if one is set
19918  */
19919 void Access_free(struct LDKAccess this_ptr);
19920
19921 /**
19922  * Calls the free function if one is set
19923  */
19924 void Listen_free(struct LDKListen this_ptr);
19925
19926 /**
19927  * Calls the free function if one is set
19928  */
19929 void Confirm_free(struct LDKConfirm this_ptr);
19930
19931 /**
19932  * Creates a copy of the ChannelMonitorUpdateErr
19933  */
19934 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
19935
19936 /**
19937  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
19938  */
19939 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
19940
19941 /**
19942  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
19943  */
19944 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
19945
19946 /**
19947  * Calls the free function if one is set
19948  */
19949 void Watch_free(struct LDKWatch this_ptr);
19950
19951 /**
19952  * Calls the free function if one is set
19953  */
19954 void Filter_free(struct LDKFilter this_ptr);
19955
19956 /**
19957  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
19958  */
19959 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
19960
19961 /**
19962  * First block where the transaction output may have been spent.
19963  *
19964  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19965  */
19966 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
19967
19968 /**
19969  * First block where the transaction output may have been spent.
19970  *
19971  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19972  */
19973 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19974
19975 /**
19976  * Outpoint identifying the transaction output.
19977  */
19978 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
19979
19980 /**
19981  * Outpoint identifying the transaction output.
19982  */
19983 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19984
19985 /**
19986  * Spending condition of the transaction output.
19987  */
19988 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
19989
19990 /**
19991  * Spending condition of the transaction output.
19992  */
19993 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
19994
19995 /**
19996  * Constructs a new WatchedOutput given each field
19997  */
19998 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
19999
20000 /**
20001  * Creates a copy of the WatchedOutput
20002  */
20003 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
20004
20005 /**
20006  * Checks if two WatchedOutputs contain equal inner contents.
20007  */
20008 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
20009
20010 /**
20011  * Calls the free function if one is set
20012  */
20013 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
20014
20015 /**
20016  * Creates a copy of the ConfirmationTarget
20017  */
20018 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
20019
20020 /**
20021  * Utility method to constructs a new Background-variant ConfirmationTarget
20022  */
20023 enum LDKConfirmationTarget ConfirmationTarget_background(void);
20024
20025 /**
20026  * Utility method to constructs a new Normal-variant ConfirmationTarget
20027  */
20028 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
20029
20030 /**
20031  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
20032  */
20033 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
20034
20035 /**
20036  * Checks if two ConfirmationTargets contain equal inner contents.
20037  * This ignores pointers and is_owned flags and looks at the values in fields.
20038  */
20039 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
20040
20041 /**
20042  * Calls the free function if one is set
20043  */
20044 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
20045
20046 /**
20047  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
20048  */
20049 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
20050
20051 /**
20052  * Creates a copy of the MonitorUpdateId
20053  */
20054 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
20055
20056 /**
20057  * Checks if two MonitorUpdateIds contain equal inner contents.
20058  */
20059 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
20060
20061 /**
20062  * Checks if two MonitorUpdateIds contain equal inner contents.
20063  * This ignores pointers and is_owned flags and looks at the values in fields.
20064  * Two objects with NULL inner values will be considered "equal" here.
20065  */
20066 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
20067
20068 /**
20069  * Calls the free function if one is set
20070  */
20071 void Persist_free(struct LDKPersist this_ptr);
20072
20073 /**
20074  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
20075  */
20076 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
20077
20078 /**
20079  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
20080  */
20081 void ChainMonitor_free(struct LDKChainMonitor this_obj);
20082
20083 /**
20084  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
20085  *
20086  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
20087  * will call back to it indicating transactions and outputs of interest. This allows clients to
20088  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
20089  * always need to fetch full blocks absent another means for determining which blocks contain
20090  * transactions relevant to the watched channels.
20091  */
20092 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
20093
20094 /**
20095  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
20096  * claims which are awaiting confirmation.
20097  *
20098  * Includes the balances from each [`ChannelMonitor`] *except* those included in
20099  * `ignored_channels`, allowing you to filter out balances from channels which are still open
20100  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
20101  *
20102  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
20103  * inclusion in the return value.
20104  */
20105 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
20106
20107 /**
20108  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
20109  * such [`ChannelMonitor`] is currently being monitored for.
20110  *
20111  * Note that the result holds a mutex over our monitor set, and should not be held
20112  * indefinitely.
20113  */
20114 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
20115
20116 /**
20117  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
20118  *
20119  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
20120  * monitoring for on-chain state resolutions.
20121  */
20122 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
20123
20124 /**
20125  * Indicates the persistence of a [`ChannelMonitor`] has completed after
20126  * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
20127  *
20128  * Thus, the anticipated use is, at a high level:
20129  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
20130  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
20131  *     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
20132  *  2) once all remote copies are updated, you call this function with the
20133  *     `completed_update_id` that completed, and once all pending updates have completed the
20134  *     channel will be re-enabled.
20135  *
20136  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
20137  * registered [`ChannelMonitor`]s.
20138  */
20139 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);
20140
20141 /**
20142  * Constructs a new Listen which calls the relevant methods on this_arg.
20143  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
20144  */
20145 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
20146
20147 /**
20148  * Constructs a new Confirm which calls the relevant methods on this_arg.
20149  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
20150  */
20151 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
20152
20153 /**
20154  * Constructs a new Watch which calls the relevant methods on this_arg.
20155  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
20156  */
20157 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
20158
20159 /**
20160  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
20161  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
20162  */
20163 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
20164
20165 /**
20166  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
20167  */
20168 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
20169
20170 /**
20171  * The sequence number of this update. Updates *must* be replayed in-order according to this
20172  * sequence number (and updates may panic if they are not). The update_id values are strictly
20173  * increasing and increase by one for each new update, with one exception specified below.
20174  *
20175  * This sequence number is also used to track up to which points updates which returned
20176  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
20177  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
20178  *
20179  * The only instance where update_id values are not strictly increasing is the case where we
20180  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
20181  * its docs for more details.
20182  */
20183 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
20184
20185 /**
20186  * The sequence number of this update. Updates *must* be replayed in-order according to this
20187  * sequence number (and updates may panic if they are not). The update_id values are strictly
20188  * increasing and increase by one for each new update, with one exception specified below.
20189  *
20190  * This sequence number is also used to track up to which points updates which returned
20191  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
20192  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
20193  *
20194  * The only instance where update_id values are not strictly increasing is the case where we
20195  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
20196  * its docs for more details.
20197  */
20198 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
20199
20200 /**
20201  * Creates a copy of the ChannelMonitorUpdate
20202  */
20203 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
20204
20205 /**
20206  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
20207  */
20208 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
20209
20210 /**
20211  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
20212  */
20213 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
20214
20215 /**
20216  * Frees any resources used by the MonitorEvent
20217  */
20218 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
20219
20220 /**
20221  * Creates a copy of the MonitorEvent
20222  */
20223 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
20224
20225 /**
20226  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
20227  */
20228 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
20229
20230 /**
20231  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
20232  */
20233 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
20234
20235 /**
20236  * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
20237  */
20238 struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
20239
20240 /**
20241  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
20242  */
20243 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
20244
20245 /**
20246  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
20247  */
20248 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
20249
20250 /**
20251  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
20252  */
20253 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
20254
20255 /**
20256  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
20257  */
20258 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
20259
20260 /**
20261  * Creates a copy of the HTLCUpdate
20262  */
20263 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
20264
20265 /**
20266  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
20267  */
20268 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
20269
20270 /**
20271  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
20272  */
20273 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
20274
20275 /**
20276  * Frees any resources used by the Balance
20277  */
20278 void Balance_free(struct LDKBalance this_ptr);
20279
20280 /**
20281  * Creates a copy of the Balance
20282  */
20283 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
20284
20285 /**
20286  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
20287  */
20288 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
20289
20290 /**
20291  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
20292  */
20293 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
20294
20295 /**
20296  * Utility method to constructs a new ContentiousClaimable-variant Balance
20297  */
20298 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
20299
20300 /**
20301  * Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance
20302  */
20303 struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
20304
20305 /**
20306  * Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance
20307  */
20308 struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t expiry_height);
20309
20310 /**
20311  * Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance
20312  */
20313 struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t claimable_amount_satoshis);
20314
20315 /**
20316  * Checks if two Balances contain equal inner contents.
20317  * This ignores pointers and is_owned flags and looks at the values in fields.
20318  */
20319 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
20320
20321 /**
20322  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
20323  */
20324 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
20325
20326 /**
20327  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
20328  */
20329 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
20330
20331 /**
20332  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
20333  * itself.
20334  *
20335  * panics if the given update is not the next update by update_id.
20336  */
20337 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);
20338
20339 /**
20340  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
20341  * ChannelMonitor.
20342  */
20343 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20344
20345 /**
20346  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
20347  */
20348 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20349
20350 /**
20351  * Gets a list of txids, with their output scripts (in the order they appear in the
20352  * transaction), which we must learn about spends of via block_connected().
20353  */
20354 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20355
20356 /**
20357  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
20358  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
20359  * have been registered.
20360  */
20361 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
20362
20363 /**
20364  * Get the list of HTLCs who's status has been updated on chain. This should be called by
20365  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
20366  */
20367 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20368
20369 /**
20370  * Gets the list of pending events which were generated by previous actions, clearing the list
20371  * in the process.
20372  *
20373  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
20374  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
20375  * no internal locking in ChannelMonitors.
20376  */
20377 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20378
20379 /**
20380  * Gets the `node_id` of the counterparty for this channel.
20381  *
20382  * Will be `None` for channels constructed on LDK versions prior to 0.0.110 and always `Some`
20383  * otherwise.
20384  *
20385  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20386  */
20387 MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20388
20389 /**
20390  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
20391  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
20392  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
20393  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
20394  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
20395  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
20396  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
20397  * out-of-band the other node operator to coordinate with him if option is available to you.
20398  * In any-case, choice is up to the user.
20399  */
20400 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);
20401
20402 /**
20403  * Processes transactions in a newly connected block, which may result in any of the following:
20404  * - update the monitor's state against resolved HTLCs
20405  * - punish the counterparty in the case of seeing a revoked commitment transaction
20406  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
20407  * - detect settled outputs for later spending
20408  * - schedule and bump any in-flight claims
20409  *
20410  * Returns any new outputs to watch from `txdata`; after called, these are also included in
20411  * [`get_outputs_to_watch`].
20412  *
20413  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
20414  */
20415 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);
20416
20417 /**
20418  * Determines if the disconnected block contained any transactions of interest and updates
20419  * appropriately.
20420  */
20421 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);
20422
20423 /**
20424  * Processes transactions confirmed in a block with the given header and height, returning new
20425  * outputs to watch. See [`block_connected`] for details.
20426  *
20427  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
20428  * blocks. See [`chain::Confirm`] for calling expectations.
20429  *
20430  * [`block_connected`]: Self::block_connected
20431  */
20432 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);
20433
20434 /**
20435  * Processes a transaction that was reorganized out of the chain.
20436  *
20437  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
20438  * than blocks. See [`chain::Confirm`] for calling expectations.
20439  *
20440  * [`block_disconnected`]: Self::block_disconnected
20441  */
20442 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);
20443
20444 /**
20445  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
20446  * [`block_connected`] for details.
20447  *
20448  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
20449  * blocks. See [`chain::Confirm`] for calling expectations.
20450  *
20451  * [`block_connected`]: Self::block_connected
20452  */
20453 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);
20454
20455 /**
20456  * Returns the set of txids that should be monitored for re-organization out of the chain.
20457  */
20458 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20459
20460 /**
20461  * Gets the latest best block which was connected either via the [`chain::Listen`] or
20462  * [`chain::Confirm`] interfaces.
20463  */
20464 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20465
20466 /**
20467  * Gets the balances in this channel which are either claimable by us if we were to
20468  * force-close the channel now or which are claimable on-chain (possibly awaiting
20469  * confirmation).
20470  *
20471  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
20472  * included here until an [`Event::SpendableOutputs`] event has been generated for the
20473  * balance, or until our counterparty has claimed the balance and accrued several
20474  * confirmations on the claim transaction.
20475  *
20476  * Note that for `ChannelMonitors` which track a channel which went on-chain with versions of
20477  * LDK prior to 0.0.111, balances may not be fully captured if our counterparty broadcasted
20478  * a revoked state.
20479  *
20480  * See [`Balance`] for additional details on the types of claimable balances which
20481  * may be returned here and their meanings.
20482  */
20483 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20484
20485 /**
20486  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
20487  */
20488 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
20489
20490 /**
20491  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
20492  */
20493 void OutPoint_free(struct LDKOutPoint this_obj);
20494
20495 /**
20496  * The referenced transaction's txid.
20497  */
20498 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
20499
20500 /**
20501  * The referenced transaction's txid.
20502  */
20503 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20504
20505 /**
20506  * The index of the referenced output in its transaction's vout.
20507  */
20508 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
20509
20510 /**
20511  * The index of the referenced output in its transaction's vout.
20512  */
20513 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
20514
20515 /**
20516  * Constructs a new OutPoint given each field
20517  */
20518 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
20519
20520 /**
20521  * Creates a copy of the OutPoint
20522  */
20523 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
20524
20525 /**
20526  * Checks if two OutPoints contain equal inner contents.
20527  * This ignores pointers and is_owned flags and looks at the values in fields.
20528  * Two objects with NULL inner values will be considered "equal" here.
20529  */
20530 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
20531
20532 /**
20533  * Checks if two OutPoints contain equal inner contents.
20534  */
20535 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
20536
20537 /**
20538  * Convert an `OutPoint` to a lightning channel id.
20539  */
20540 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
20541
20542 /**
20543  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
20544  */
20545 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
20546
20547 /**
20548  * Read a OutPoint from a byte array, created by OutPoint_write
20549  */
20550 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
20551
20552 /**
20553  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
20554  */
20555 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
20556
20557 /**
20558  * The outpoint which is spendable
20559  */
20560 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
20561
20562 /**
20563  * The outpoint which is spendable
20564  */
20565 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
20566
20567 /**
20568  * Per commitment point to derive delayed_payment_key by key holder
20569  */
20570 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
20571
20572 /**
20573  * Per commitment point to derive delayed_payment_key by key holder
20574  */
20575 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20576
20577 /**
20578  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
20579  * the witness_script.
20580  */
20581 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
20582
20583 /**
20584  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
20585  * the witness_script.
20586  */
20587 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
20588
20589 /**
20590  * The output which is referenced by the given outpoint
20591  *
20592  * Returns a copy of the field.
20593  */
20594 struct LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
20595
20596 /**
20597  * The output which is referenced by the given outpoint
20598  */
20599 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
20600
20601 /**
20602  * The revocation point specific to the commitment transaction which was broadcast. Used to
20603  * derive the witnessScript for this output.
20604  */
20605 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
20606
20607 /**
20608  * The revocation point specific to the commitment transaction which was broadcast. Used to
20609  * derive the witnessScript for this output.
20610  */
20611 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20612
20613 /**
20614  * Arbitrary identification information returned by a call to
20615  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
20616  * the channel to spend the output.
20617  */
20618 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
20619
20620 /**
20621  * Arbitrary identification information returned by a call to
20622  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
20623  * the channel to spend the output.
20624  */
20625 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20626
20627 /**
20628  * The value of the channel which this output originated from, possibly indirectly.
20629  */
20630 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
20631
20632 /**
20633  * The value of the channel which this output originated from, possibly indirectly.
20634  */
20635 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
20636
20637 /**
20638  * Constructs a new DelayedPaymentOutputDescriptor given each field
20639  */
20640 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);
20641
20642 /**
20643  * Creates a copy of the DelayedPaymentOutputDescriptor
20644  */
20645 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
20646
20647 /**
20648  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
20649  */
20650 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
20651
20652 /**
20653  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
20654  */
20655 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
20656
20657 /**
20658  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
20659  */
20660 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
20661
20662 /**
20663  * The outpoint which is spendable
20664  */
20665 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
20666
20667 /**
20668  * The outpoint which is spendable
20669  */
20670 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
20671
20672 /**
20673  * The output which is referenced by the given outpoint
20674  *
20675  * Returns a copy of the field.
20676  */
20677 struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
20678
20679 /**
20680  * The output which is referenced by the given outpoint
20681  */
20682 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
20683
20684 /**
20685  * Arbitrary identification information returned by a call to
20686  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
20687  * the channel to spend the output.
20688  */
20689 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
20690
20691 /**
20692  * Arbitrary identification information returned by a call to
20693  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
20694  * the channel to spend the output.
20695  */
20696 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20697
20698 /**
20699  * The value of the channel which this transactions spends.
20700  */
20701 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
20702
20703 /**
20704  * The value of the channel which this transactions spends.
20705  */
20706 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
20707
20708 /**
20709  * Constructs a new StaticPaymentOutputDescriptor given each field
20710  */
20711 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);
20712
20713 /**
20714  * Creates a copy of the StaticPaymentOutputDescriptor
20715  */
20716 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
20717
20718 /**
20719  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
20720  */
20721 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
20722
20723 /**
20724  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
20725  */
20726 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
20727
20728 /**
20729  * Frees any resources used by the SpendableOutputDescriptor
20730  */
20731 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
20732
20733 /**
20734  * Creates a copy of the SpendableOutputDescriptor
20735  */
20736 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
20737
20738 /**
20739  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
20740  */
20741 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
20742
20743 /**
20744  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
20745  */
20746 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
20747
20748 /**
20749  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
20750  */
20751 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
20752
20753 /**
20754  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
20755  */
20756 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
20757
20758 /**
20759  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
20760  */
20761 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
20762
20763 /**
20764  * Calls the free function if one is set
20765  */
20766 void BaseSign_free(struct LDKBaseSign this_ptr);
20767
20768 /**
20769  * Creates a copy of a Sign
20770  */
20771 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
20772
20773 /**
20774  * Calls the free function if one is set
20775  */
20776 void Sign_free(struct LDKSign this_ptr);
20777
20778 /**
20779  * Creates a copy of the Recipient
20780  */
20781 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
20782
20783 /**
20784  * Utility method to constructs a new Node-variant Recipient
20785  */
20786 enum LDKRecipient Recipient_node(void);
20787
20788 /**
20789  * Utility method to constructs a new PhantomNode-variant Recipient
20790  */
20791 enum LDKRecipient Recipient_phantom_node(void);
20792
20793 /**
20794  * Calls the free function if one is set
20795  */
20796 void KeysInterface_free(struct LDKKeysInterface this_ptr);
20797
20798 /**
20799  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
20800  */
20801 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
20802
20803 /**
20804  * Private key of anchor tx
20805  */
20806 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
20807
20808 /**
20809  * Private key of anchor tx
20810  */
20811 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
20812
20813 /**
20814  * Holder secret key for blinded revocation pubkey
20815  */
20816 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
20817
20818 /**
20819  * Holder secret key for blinded revocation pubkey
20820  */
20821 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
20822
20823 /**
20824  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
20825  */
20826 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
20827
20828 /**
20829  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
20830  */
20831 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
20832
20833 /**
20834  * Holder secret key used in HTLC tx
20835  */
20836 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
20837
20838 /**
20839  * Holder secret key used in HTLC tx
20840  */
20841 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
20842
20843 /**
20844  * Holder htlc secret key used in commitment tx htlc outputs
20845  */
20846 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
20847
20848 /**
20849  * Holder htlc secret key used in commitment tx htlc outputs
20850  */
20851 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
20852
20853 /**
20854  * Commitment seed
20855  */
20856 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
20857
20858 /**
20859  * Commitment seed
20860  */
20861 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20862
20863 /**
20864  * Creates a copy of the InMemorySigner
20865  */
20866 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
20867
20868 /**
20869  * Create a new InMemorySigner
20870  */
20871 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);
20872
20873 /**
20874  * Counterparty pubkeys.
20875  * Will panic if ready_channel wasn't called.
20876  */
20877 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
20878
20879 /**
20880  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
20881  * transactions, ie the amount of time that we have to wait to recover our funds if we
20882  * broadcast a transaction.
20883  * Will panic if ready_channel wasn't called.
20884  */
20885 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
20886
20887 /**
20888  * The contest_delay value specified by us and applied on transactions broadcastable
20889  * by our counterparty, ie the amount of time that they have to wait to recover their funds
20890  * if they broadcast a transaction.
20891  * Will panic if ready_channel wasn't called.
20892  */
20893 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
20894
20895 /**
20896  * Whether the holder is the initiator
20897  * Will panic if ready_channel wasn't called.
20898  */
20899 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
20900
20901 /**
20902  * Funding outpoint
20903  * Will panic if ready_channel wasn't called.
20904  */
20905 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
20906
20907 /**
20908  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
20909  * building transactions.
20910  *
20911  * Will panic if ready_channel wasn't called.
20912  */
20913 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
20914
20915 /**
20916  * Whether anchors should be used.
20917  * Will panic if ready_channel wasn't called.
20918  */
20919 MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
20920
20921 /**
20922  * Sign the single input of spend_tx at index `input_idx` which spends the output
20923  * described by descriptor, returning the witness stack for the input.
20924  *
20925  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
20926  * is not spending the outpoint described by `descriptor.outpoint`,
20927  * or if an output descriptor script_pubkey does not match the one we can spend.
20928  */
20929 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);
20930
20931 /**
20932  * Sign the single input of spend_tx at index `input_idx` which spends the output
20933  * described by descriptor, returning the witness stack for the input.
20934  *
20935  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
20936  * is not spending the outpoint described by `descriptor.outpoint`, does not have a
20937  * sequence set to `descriptor.to_self_delay`, or if an output descriptor
20938  * script_pubkey does not match the one we can spend.
20939  */
20940 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);
20941
20942 /**
20943  * Constructs a new BaseSign which calls the relevant methods on this_arg.
20944  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
20945  */
20946 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
20947
20948 /**
20949  * Constructs a new Sign which calls the relevant methods on this_arg.
20950  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
20951  */
20952 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
20953
20954 /**
20955  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
20956  */
20957 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
20958
20959 /**
20960  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
20961  */
20962 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg);
20963
20964 /**
20965  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
20966  */
20967 void KeysManager_free(struct LDKKeysManager this_obj);
20968
20969 /**
20970  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
20971  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
20972  * starting_time isn't strictly required to actually be a time, but it must absolutely,
20973  * without a doubt, be unique to this instance. ie if you start multiple times with the same
20974  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
20975  * simply use the current time (with very high precision).
20976  *
20977  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
20978  * obviously, starting_time should be unique every time you reload the library - it is only
20979  * used to generate new ephemeral key data (which will be stored by the individual channel if
20980  * necessary).
20981  *
20982  * Note that the seed is required to recover certain on-chain funds independent of
20983  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
20984  * channel, and some on-chain during-closing funds.
20985  *
20986  * Note that until the 0.1 release there is no guarantee of backward compatibility between
20987  * versions. Once the library is more fully supported, the docs will be updated to include a
20988  * detailed description of the guarantee.
20989  */
20990 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
20991
20992 /**
20993  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
20994  *
20995  * Key derivation parameters are accessible through a per-channel secrets
20996  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
20997  * onchain output detection for which a corresponding delayed_payment_key must be derived.
20998  */
20999 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]);
21000
21001 /**
21002  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
21003  * output to the given change destination (if sufficient change value remains). The
21004  * transaction will have a feerate, at least, of the given value.
21005  *
21006  * Returns `Err(())` if the output value is greater than the input value minus required fee,
21007  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
21008  * does not match the one we can spend.
21009  *
21010  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
21011  *
21012  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
21013  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
21014  */
21015 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);
21016
21017 /**
21018  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
21019  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
21020  */
21021 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
21022
21023 /**
21024  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
21025  */
21026 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
21027
21028 /**
21029  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
21030  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
21031  */
21032 struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
21033
21034 /**
21035  * Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed`
21036  * that is shared across all nodes that intend to participate in [phantom node payments] together.
21037  *
21038  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
21039  * `starting_time_nanos`.
21040  *
21041  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
21042  * same across restarts, or else inbound payments may fail.
21043  *
21044  * [phantom node payments]: PhantomKeysManager
21045  */
21046 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]);
21047
21048 /**
21049  * See [`KeysManager::spend_spendable_outputs`] for documentation on this method.
21050  */
21051 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);
21052
21053 /**
21054  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
21055  */
21056 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]);
21057
21058 /**
21059  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
21060  */
21061 void ChannelManager_free(struct LDKChannelManager this_obj);
21062
21063 /**
21064  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
21065  */
21066 void ChainParameters_free(struct LDKChainParameters this_obj);
21067
21068 /**
21069  * The network for determining the `chain_hash` in Lightning messages.
21070  */
21071 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
21072
21073 /**
21074  * The network for determining the `chain_hash` in Lightning messages.
21075  */
21076 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
21077
21078 /**
21079  * The hash and height of the latest block successfully connected.
21080  *
21081  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
21082  */
21083 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
21084
21085 /**
21086  * The hash and height of the latest block successfully connected.
21087  *
21088  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
21089  */
21090 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
21091
21092 /**
21093  * Constructs a new ChainParameters given each field
21094  */
21095 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
21096
21097 /**
21098  * Creates a copy of the ChainParameters
21099  */
21100 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
21101
21102 /**
21103  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
21104  */
21105 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
21106
21107 /**
21108  * Base routing fee in millisatoshis.
21109  */
21110 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
21111
21112 /**
21113  * Base routing fee in millisatoshis.
21114  */
21115 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
21116
21117 /**
21118  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
21119  */
21120 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
21121
21122 /**
21123  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
21124  */
21125 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
21126
21127 /**
21128  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
21129  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
21130  * `cltv_expiry_delta` for more details.
21131  */
21132 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
21133
21134 /**
21135  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
21136  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
21137  * `cltv_expiry_delta` for more details.
21138  */
21139 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
21140
21141 /**
21142  * Constructs a new CounterpartyForwardingInfo given each field
21143  */
21144 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);
21145
21146 /**
21147  * Creates a copy of the CounterpartyForwardingInfo
21148  */
21149 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
21150
21151 /**
21152  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
21153  */
21154 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
21155
21156 /**
21157  * The node_id of our counterparty
21158  */
21159 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
21160
21161 /**
21162  * The node_id of our counterparty
21163  */
21164 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21165
21166 /**
21167  * The Features the channel counterparty provided upon last connection.
21168  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
21169  * many routing-relevant features are present in the init context.
21170  */
21171 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
21172
21173 /**
21174  * The Features the channel counterparty provided upon last connection.
21175  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
21176  * many routing-relevant features are present in the init context.
21177  */
21178 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
21179
21180 /**
21181  * The value, in satoshis, that must always be held in the channel for our counterparty. This
21182  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
21183  * claiming at least this value on chain.
21184  *
21185  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
21186  *
21187  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
21188  */
21189 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
21190
21191 /**
21192  * The value, in satoshis, that must always be held in the channel for our counterparty. This
21193  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
21194  * claiming at least this value on chain.
21195  *
21196  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
21197  *
21198  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
21199  */
21200 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
21201
21202 /**
21203  * Information on the fees and requirements that the counterparty requires when forwarding
21204  * payments to us through this channel.
21205  *
21206  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21207  */
21208 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
21209
21210 /**
21211  * Information on the fees and requirements that the counterparty requires when forwarding
21212  * payments to us through this channel.
21213  *
21214  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21215  */
21216 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
21217
21218 /**
21219  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
21220  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
21221  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
21222  */
21223 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
21224
21225 /**
21226  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
21227  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
21228  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
21229  */
21230 void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21231
21232 /**
21233  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
21234  */
21235 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
21236
21237 /**
21238  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
21239  */
21240 void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21241
21242 /**
21243  * Constructs a new ChannelCounterparty given each field
21244  */
21245 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);
21246
21247 /**
21248  * Creates a copy of the ChannelCounterparty
21249  */
21250 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
21251
21252 /**
21253  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
21254  */
21255 void ChannelDetails_free(struct LDKChannelDetails this_obj);
21256
21257 /**
21258  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
21259  * thereafter this is the txid of the funding transaction xor the funding transaction output).
21260  * Note that this means this value is *not* persistent - it can change once during the
21261  * lifetime of the channel.
21262  */
21263 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
21264
21265 /**
21266  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
21267  * thereafter this is the txid of the funding transaction xor the funding transaction output).
21268  * Note that this means this value is *not* persistent - it can change once during the
21269  * lifetime of the channel.
21270  */
21271 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21272
21273 /**
21274  * Parameters which apply to our counterparty. See individual fields for more information.
21275  */
21276 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21277
21278 /**
21279  * Parameters which apply to our counterparty. See individual fields for more information.
21280  */
21281 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
21282
21283 /**
21284  * The Channel's funding transaction output, if we've negotiated the funding transaction with
21285  * our counterparty already.
21286  *
21287  * Note that, if this has been set, `channel_id` will be equivalent to
21288  * `funding_txo.unwrap().to_channel_id()`.
21289  *
21290  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21291  */
21292 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21293
21294 /**
21295  * The Channel's funding transaction output, if we've negotiated the funding transaction with
21296  * our counterparty already.
21297  *
21298  * Note that, if this has been set, `channel_id` will be equivalent to
21299  * `funding_txo.unwrap().to_channel_id()`.
21300  *
21301  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21302  */
21303 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
21304
21305 /**
21306  * The features which this channel operates with. See individual features for more info.
21307  *
21308  * `None` until negotiation completes and the channel type is finalized.
21309  *
21310  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21311  */
21312 struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21313
21314 /**
21315  * The features which this channel operates with. See individual features for more info.
21316  *
21317  * `None` until negotiation completes and the channel type is finalized.
21318  *
21319  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21320  */
21321 void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
21322
21323 /**
21324  * The position of the funding transaction in the chain. None if the funding transaction has
21325  * not yet been confirmed and the channel fully opened.
21326  *
21327  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
21328  * payments instead of this. See [`get_inbound_payment_scid`].
21329  *
21330  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
21331  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
21332  *
21333  * [`inbound_scid_alias`]: Self::inbound_scid_alias
21334  * [`outbound_scid_alias`]: Self::outbound_scid_alias
21335  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
21336  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
21337  * [`confirmations_required`]: Self::confirmations_required
21338  */
21339 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21340
21341 /**
21342  * The position of the funding transaction in the chain. None if the funding transaction has
21343  * not yet been confirmed and the channel fully opened.
21344  *
21345  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
21346  * payments instead of this. See [`get_inbound_payment_scid`].
21347  *
21348  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
21349  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
21350  *
21351  * [`inbound_scid_alias`]: Self::inbound_scid_alias
21352  * [`outbound_scid_alias`]: Self::outbound_scid_alias
21353  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
21354  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
21355  * [`confirmations_required`]: Self::confirmations_required
21356  */
21357 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21358
21359 /**
21360  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
21361  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
21362  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
21363  * `Some(0)`).
21364  *
21365  * This will be `None` as long as the channel is not available for routing outbound payments.
21366  *
21367  * [`short_channel_id`]: Self::short_channel_id
21368  * [`confirmations_required`]: Self::confirmations_required
21369  */
21370 struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21371
21372 /**
21373  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
21374  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
21375  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
21376  * `Some(0)`).
21377  *
21378  * This will be `None` as long as the channel is not available for routing outbound payments.
21379  *
21380  * [`short_channel_id`]: Self::short_channel_id
21381  * [`confirmations_required`]: Self::confirmations_required
21382  */
21383 void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21384
21385 /**
21386  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
21387  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
21388  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
21389  * when they see a payment to be routed to us.
21390  *
21391  * Our counterparty may choose to rotate this value at any time, though will always recognize
21392  * previous values for inbound payment forwarding.
21393  *
21394  * [`short_channel_id`]: Self::short_channel_id
21395  */
21396 struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21397
21398 /**
21399  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
21400  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
21401  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
21402  * when they see a payment to be routed to us.
21403  *
21404  * Our counterparty may choose to rotate this value at any time, though will always recognize
21405  * previous values for inbound payment forwarding.
21406  *
21407  * [`short_channel_id`]: Self::short_channel_id
21408  */
21409 void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21410
21411 /**
21412  * The value, in satoshis, of this channel as appears in the funding output
21413  */
21414 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21415
21416 /**
21417  * The value, in satoshis, of this channel as appears in the funding output
21418  */
21419 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
21420
21421 /**
21422  * The value, in satoshis, that must always be held in the channel for us. This value ensures
21423  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
21424  * this value on chain.
21425  *
21426  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
21427  *
21428  * This value will be `None` for outbound channels until the counterparty accepts the channel.
21429  *
21430  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
21431  */
21432 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21433
21434 /**
21435  * The value, in satoshis, that must always be held in the channel for us. This value ensures
21436  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
21437  * this value on chain.
21438  *
21439  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
21440  *
21441  * This value will be `None` for outbound channels until the counterparty accepts the channel.
21442  *
21443  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
21444  */
21445 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21446
21447 /**
21448  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
21449  */
21450 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21451
21452 /**
21453  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
21454  */
21455 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
21456
21457 /**
21458  * Our total balance.  This is the amount we would get if we close the channel.
21459  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
21460  * amount is not likely to be recoverable on close.
21461  *
21462  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
21463  * balance is not available for inclusion in new outbound HTLCs). This further does not include
21464  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
21465  * This does not consider any on-chain fees.
21466  *
21467  * See also [`ChannelDetails::outbound_capacity_msat`]
21468  */
21469 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21470
21471 /**
21472  * Our total balance.  This is the amount we would get if we close the channel.
21473  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
21474  * amount is not likely to be recoverable on close.
21475  *
21476  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
21477  * balance is not available for inclusion in new outbound HTLCs). This further does not include
21478  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
21479  * This does not consider any on-chain fees.
21480  *
21481  * See also [`ChannelDetails::outbound_capacity_msat`]
21482  */
21483 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
21484
21485 /**
21486  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
21487  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
21488  * available for inclusion in new outbound HTLCs). This further does not include any pending
21489  * outgoing HTLCs which are awaiting some other resolution to be sent.
21490  *
21491  * See also [`ChannelDetails::balance_msat`]
21492  *
21493  * This value is not exact. Due to various in-flight changes, feerate changes, and our
21494  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
21495  * should be able to spend nearly this amount.
21496  */
21497 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21498
21499 /**
21500  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
21501  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
21502  * available for inclusion in new outbound HTLCs). This further does not include any pending
21503  * outgoing HTLCs which are awaiting some other resolution to be sent.
21504  *
21505  * See also [`ChannelDetails::balance_msat`]
21506  *
21507  * This value is not exact. Due to various in-flight changes, feerate changes, and our
21508  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
21509  * should be able to spend nearly this amount.
21510  */
21511 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
21512
21513 /**
21514  * The available outbound capacity for sending a single HTLC to the remote peer. This is
21515  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
21516  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
21517  * to use a limit as close as possible to the HTLC limit we can currently send.
21518  *
21519  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
21520  */
21521 uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21522
21523 /**
21524  * The available outbound capacity for sending a single HTLC to the remote peer. This is
21525  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
21526  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
21527  * to use a limit as close as possible to the HTLC limit we can currently send.
21528  *
21529  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
21530  */
21531 void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
21532
21533 /**
21534  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
21535  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
21536  * available for inclusion in new inbound HTLCs).
21537  * Note that there are some corner cases not fully handled here, so the actual available
21538  * inbound capacity may be slightly higher than this.
21539  *
21540  * This value is not exact. Due to various in-flight changes, feerate changes, and our
21541  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
21542  * However, our counterparty should be able to spend nearly this amount.
21543  */
21544 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21545
21546 /**
21547  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
21548  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
21549  * available for inclusion in new inbound HTLCs).
21550  * Note that there are some corner cases not fully handled here, so the actual available
21551  * inbound capacity may be slightly higher than this.
21552  *
21553  * This value is not exact. Due to various in-flight changes, feerate changes, and our
21554  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
21555  * However, our counterparty should be able to spend nearly this amount.
21556  */
21557 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
21558
21559 /**
21560  * The number of required confirmations on the funding transaction before the funding will be
21561  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
21562  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
21563  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
21564  * [`ChannelHandshakeLimits::max_minimum_depth`].
21565  *
21566  * This value will be `None` for outbound channels until the counterparty accepts the channel.
21567  *
21568  * [`is_outbound`]: ChannelDetails::is_outbound
21569  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
21570  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
21571  */
21572 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21573
21574 /**
21575  * The number of required confirmations on the funding transaction before the funding will be
21576  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
21577  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
21578  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
21579  * [`ChannelHandshakeLimits::max_minimum_depth`].
21580  *
21581  * This value will be `None` for outbound channels until the counterparty accepts the channel.
21582  *
21583  * [`is_outbound`]: ChannelDetails::is_outbound
21584  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
21585  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
21586  */
21587 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
21588
21589 /**
21590  * The number of blocks (after our commitment transaction confirms) that we will need to wait
21591  * until we can claim our funds after we force-close the channel. During this time our
21592  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
21593  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
21594  * time to claim our non-HTLC-encumbered funds.
21595  *
21596  * This value will be `None` for outbound channels until the counterparty accepts the channel.
21597  */
21598 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21599
21600 /**
21601  * The number of blocks (after our commitment transaction confirms) that we will need to wait
21602  * until we can claim our funds after we force-close the channel. During this time our
21603  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
21604  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
21605  * time to claim our non-HTLC-encumbered funds.
21606  *
21607  * This value will be `None` for outbound channels until the counterparty accepts the channel.
21608  */
21609 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
21610
21611 /**
21612  * True if the channel was initiated (and thus funded) by us.
21613  */
21614 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21615
21616 /**
21617  * True if the channel was initiated (and thus funded) by us.
21618  */
21619 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
21620
21621 /**
21622  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
21623  * channel is not currently being shut down. `channel_ready` message exchange implies the
21624  * required confirmation count has been reached (and we were connected to the peer at some
21625  * point after the funding transaction received enough confirmations). The required
21626  * confirmation count is provided in [`confirmations_required`].
21627  *
21628  * [`confirmations_required`]: ChannelDetails::confirmations_required
21629  */
21630 bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21631
21632 /**
21633  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
21634  * channel is not currently being shut down. `channel_ready` message exchange implies the
21635  * required confirmation count has been reached (and we were connected to the peer at some
21636  * point after the funding transaction received enough confirmations). The required
21637  * confirmation count is provided in [`confirmations_required`].
21638  *
21639  * [`confirmations_required`]: ChannelDetails::confirmations_required
21640  */
21641 void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
21642
21643 /**
21644  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
21645  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
21646  *
21647  * This is a strict superset of `is_channel_ready`.
21648  */
21649 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21650
21651 /**
21652  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
21653  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
21654  *
21655  * This is a strict superset of `is_channel_ready`.
21656  */
21657 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
21658
21659 /**
21660  * True if this channel is (or will be) publicly-announced.
21661  */
21662 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21663
21664 /**
21665  * True if this channel is (or will be) publicly-announced.
21666  */
21667 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
21668
21669 /**
21670  * The smallest value HTLC (in msat) we will accept, for this channel. This field
21671  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
21672  */
21673 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21674
21675 /**
21676  * The smallest value HTLC (in msat) we will accept, for this channel. This field
21677  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
21678  */
21679 void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21680
21681 /**
21682  * The largest value HTLC (in msat) we currently will accept, for this channel.
21683  */
21684 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21685
21686 /**
21687  * The largest value HTLC (in msat) we currently will accept, for this channel.
21688  */
21689 void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21690
21691 /**
21692  * Set of configurable parameters that affect channel operation.
21693  *
21694  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
21695  *
21696  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21697  */
21698 struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21699
21700 /**
21701  * Set of configurable parameters that affect channel operation.
21702  *
21703  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
21704  *
21705  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21706  */
21707 void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
21708
21709 /**
21710  * Constructs a new ChannelDetails given each field
21711  */
21712 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);
21713
21714 /**
21715  * Creates a copy of the ChannelDetails
21716  */
21717 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
21718
21719 /**
21720  * Gets the current SCID which should be used to identify this channel for inbound payments.
21721  * This should be used for providing invoice hints or in any other context where our
21722  * counterparty will forward a payment to us.
21723  *
21724  * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
21725  * [`ChannelDetails::short_channel_id`]. See those for more information.
21726  */
21727 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
21728
21729 /**
21730  * Gets the current SCID which should be used to identify this channel for outbound payments.
21731  * This should be used in [`Route`]s to describe the first hop or in other contexts where
21732  * we're sending or forwarding a payment outbound over this channel.
21733  *
21734  * This is either the [`ChannelDetails::short_channel_id`], if set, or the
21735  * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
21736  */
21737 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
21738
21739 /**
21740  * Frees any resources used by the PaymentSendFailure
21741  */
21742 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
21743
21744 /**
21745  * Creates a copy of the PaymentSendFailure
21746  */
21747 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
21748
21749 /**
21750  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
21751  */
21752 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
21753
21754 /**
21755  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
21756  */
21757 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
21758
21759 /**
21760  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
21761  */
21762 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
21763
21764 /**
21765  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
21766  */
21767 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
21768
21769 /**
21770  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
21771  */
21772 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
21773
21774 /**
21775  * The list of channels to be included in the invoice route hints.
21776  */
21777 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
21778
21779 /**
21780  * The list of channels to be included in the invoice route hints.
21781  */
21782 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
21783
21784 /**
21785  * A fake scid used for representing the phantom node's fake channel in generating the invoice
21786  * route hints.
21787  */
21788 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
21789
21790 /**
21791  * A fake scid used for representing the phantom node's fake channel in generating the invoice
21792  * route hints.
21793  */
21794 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
21795
21796 /**
21797  * The pubkey of the real backing node that would ultimately receive the payment.
21798  */
21799 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
21800
21801 /**
21802  * The pubkey of the real backing node that would ultimately receive the payment.
21803  */
21804 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21805
21806 /**
21807  * Constructs a new PhantomRouteHints given each field
21808  */
21809 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
21810
21811 /**
21812  * Creates a copy of the PhantomRouteHints
21813  */
21814 struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
21815
21816 /**
21817  * Constructs a new ChannelManager to hold several channels and route between them.
21818  *
21819  * This is the main \"logic hub\" for all channel-related actions, and implements
21820  * ChannelMessageHandler.
21821  *
21822  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
21823  *
21824  * Users need to notify the new ChannelManager when a new block is connected or
21825  * disconnected using its `block_connected` and `block_disconnected` methods, starting
21826  * from after `params.latest_hash`.
21827  */
21828 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);
21829
21830 /**
21831  * Gets the current configuration applied to all new channels.
21832  */
21833 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
21834
21835 /**
21836  * Creates a new outbound channel to the given remote node and with the given value.
21837  *
21838  * `user_channel_id` will be provided back as in
21839  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
21840  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
21841  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
21842  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
21843  * ignored.
21844  *
21845  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
21846  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
21847  *
21848  * Note that we do not check if you are currently connected to the given peer. If no
21849  * connection is available, the outbound `open_channel` message may fail to send, resulting in
21850  * the channel eventually being silently forgotten (dropped on reload).
21851  *
21852  * Returns the new Channel's temporary `channel_id`. This ID will appear as
21853  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
21854  * [`ChannelDetails::channel_id`] until after
21855  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
21856  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
21857  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
21858  *
21859  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
21860  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
21861  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
21862  *
21863  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
21864  */
21865 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);
21866
21867 /**
21868  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
21869  * more information.
21870  */
21871 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
21872
21873 /**
21874  * Gets the list of usable channels, in random order. Useful as an argument to [`find_route`]
21875  * to ensure non-announced channels are used.
21876  *
21877  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
21878  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
21879  * are.
21880  *
21881  * [`find_route`]: crate::routing::router::find_route
21882  */
21883 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
21884
21885 /**
21886  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
21887  * will be accepted on the given channel, and after additional timeout/the closing of all
21888  * pending HTLCs, the channel will be closed on chain.
21889  *
21890  *  * If we are the channel initiator, we will pay between our [`Background`] and
21891  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
21892  *    estimate.
21893  *  * If our counterparty is the channel initiator, we will require a channel closing
21894  *    transaction feerate of at least our [`Background`] feerate or the feerate which
21895  *    would appear on a force-closure transaction, whichever is lower. We will allow our
21896  *    counterparty to pay as much fee as they'd like, however.
21897  *
21898  * May generate a SendShutdown message event on success, which should be relayed.
21899  *
21900  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
21901  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
21902  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
21903  */
21904 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);
21905
21906 /**
21907  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
21908  * will be accepted on the given channel, and after additional timeout/the closing of all
21909  * pending HTLCs, the channel will be closed on chain.
21910  *
21911  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
21912  * the channel being closed or not:
21913  *  * If we are the channel initiator, we will pay at least this feerate on the closing
21914  *    transaction. The upper-bound is set by
21915  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
21916  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
21917  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
21918  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
21919  *    will appear on a force-closure transaction, whichever is lower).
21920  *
21921  * May generate a SendShutdown message event on success, which should be relayed.
21922  *
21923  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
21924  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
21925  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
21926  */
21927 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);
21928
21929 /**
21930  * Force closes a channel, immediately broadcasting the latest local transaction(s) and
21931  * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
21932  * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
21933  * channel.
21934  */
21935 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);
21936
21937 /**
21938  * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting
21939  * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the
21940  * `counterparty_node_id` isn't the counterparty of the corresponding channel.
21941  *
21942  * You can always get the latest local transaction(s) to broadcast from
21943  * [`ChannelMonitor::get_latest_holder_commitment_txn`].
21944  */
21945 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);
21946
21947 /**
21948  * Force close all channels, immediately broadcasting the latest local commitment transaction
21949  * for each to the chain and rejecting new HTLCs on each.
21950  */
21951 void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
21952
21953 /**
21954  * Force close all channels rejecting new HTLCs on each but without broadcasting the latest
21955  * local transaction(s).
21956  */
21957 void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
21958
21959 /**
21960  * Sends a payment along a given route.
21961  *
21962  * Value parameters are provided via the last hop in route, see documentation for RouteHop
21963  * fields for more info.
21964  *
21965  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
21966  * payment), we don't do anything to stop you! We always try to ensure that if the provided
21967  * next hop knows the preimage to payment_hash they can claim an additional amount as
21968  * specified in the last hop in the route! Thus, you should probably do your own
21969  * payment_preimage tracking (which you should already be doing as they represent \"proof of
21970  * payment\") and prevent double-sends yourself.
21971  *
21972  * May generate SendHTLCs message(s) event on success, which should be relayed.
21973  *
21974  * Each path may have a different return value, and PaymentSendValue may return a Vec with
21975  * each entry matching the corresponding-index entry in the route paths, see
21976  * PaymentSendFailure for more info.
21977  *
21978  * In general, a path may raise:
21979  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
21980  *    node public key) is specified.
21981  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
21982  *    (including due to previous monitor update failure or new permanent monitor update
21983  *    failure).
21984  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
21985  *    relevant updates.
21986  *
21987  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
21988  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
21989  * different route unless you intend to pay twice!
21990  *
21991  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
21992  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
21993  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
21994  * must not contain multiple paths as multi-path payments require a recipient-provided
21995  * payment_secret.
21996  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
21997  * bit set (either as required or as available). If multiple paths are present in the Route,
21998  * we assume the invoice had the basic_mpp feature set.
21999  *
22000  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
22001  */
22002 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);
22003
22004 /**
22005  * Retries a payment along the given [`Route`].
22006  *
22007  * Errors returned are a superset of those returned from [`send_payment`], so see
22008  * [`send_payment`] documentation for more details on errors. This method will also error if the
22009  * retry amount puts the payment more than 10% over the payment's total amount, if the payment
22010  * for the given `payment_id` cannot be found (likely due to timeout or success), or if
22011  * further retries have been disabled with [`abandon_payment`].
22012  *
22013  * [`send_payment`]: [`ChannelManager::send_payment`]
22014  * [`abandon_payment`]: [`ChannelManager::abandon_payment`]
22015  */
22016 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);
22017
22018 /**
22019  * Signals that no further retries for the given payment will occur.
22020  *
22021  * After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
22022  * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
22023  * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
22024  * pending HTLCs for this payment.
22025  *
22026  * Note that calling this method does *not* prevent a payment from succeeding. You must still
22027  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
22028  * determine the ultimate status of a payment.
22029  *
22030  * [`retry_payment`]: Self::retry_payment
22031  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
22032  * [`Event::PaymentSent`]: events::Event::PaymentSent
22033  */
22034 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
22035
22036 /**
22037  * Send a spontaneous payment, which is a payment that does not require the recipient to have
22038  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
22039  * the preimage, it must be a cryptographically secure random value that no intermediate node
22040  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
22041  * never reach the recipient.
22042  *
22043  * See [`send_payment`] documentation for more details on the return value of this function.
22044  *
22045  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
22046  * [`send_payment`] for more information about the risks of duplicate preimage usage.
22047  *
22048  * Note that `route` must have exactly one path.
22049  *
22050  * [`send_payment`]: Self::send_payment
22051  *
22052  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
22053  */
22054 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);
22055
22056 /**
22057  * Send a payment that is probing the given route for liquidity. We calculate the
22058  * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows
22059  * us to easily discern them from real payments.
22060  */
22061 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ hops);
22062
22063 /**
22064  * Call this upon creation of a funding transaction for the given channel.
22065  *
22066  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
22067  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
22068  *
22069  * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation
22070  * across the p2p network.
22071  *
22072  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
22073  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
22074  *
22075  * May panic if the output found in the funding transaction is duplicative with some other
22076  * channel (note that this should be trivially prevented by using unique funding transaction
22077  * keys per-channel).
22078  *
22079  * Do NOT broadcast the funding transaction yourself. When we have safely received our
22080  * counterparty's signature the funding transaction will automatically be broadcast via the
22081  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
22082  *
22083  * Note that this includes RBF or similar transaction replacement strategies - lightning does
22084  * not currently support replacing a funding transaction on an existing channel. Instead,
22085  * create a new channel with a conflicting funding transaction.
22086  *
22087  * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend
22088  * the wallet software generating the funding transaction to apply anti-fee sniping as
22089  * implemented by Bitcoin Core wallet. See <https://bitcoinops.org/en/topics/fee-sniping/>
22090  * for more details.
22091  *
22092  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
22093  * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
22094  */
22095 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);
22096
22097 /**
22098  * Atomically updates the [`ChannelConfig`] for the given channels.
22099  *
22100  * Once the updates are applied, each eligible channel (advertised with a known short channel
22101  * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
22102  * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
22103  * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
22104  *
22105  * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
22106  * `counterparty_node_id` is provided.
22107  *
22108  * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
22109  * below [`MIN_CLTV_EXPIRY_DELTA`].
22110  *
22111  * If an error is returned, none of the updates should be considered applied.
22112  *
22113  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
22114  * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
22115  * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
22116  * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
22117  * [`ChannelUpdate`]: msgs::ChannelUpdate
22118  * [`ChannelUnavailable`]: APIError::ChannelUnavailable
22119  * [`APIMisuseError`]: APIError::APIMisuseError
22120  */
22121 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);
22122
22123 /**
22124  * Processes HTLCs which are pending waiting on random forward delay.
22125  *
22126  * Should only really ever be called in response to a PendingHTLCsForwardable event.
22127  * Will likely generate further events.
22128  */
22129 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
22130
22131 /**
22132  * Performs actions which should happen on startup and roughly once per minute thereafter.
22133  *
22134  * This currently includes:
22135  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
22136  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
22137  *    than a minute, informing the network that they should no longer attempt to route over
22138  *    the channel.
22139  *  * Expiring a channel's previous `ChannelConfig` if necessary to only allow forwarding HTLCs
22140  *    with the current `ChannelConfig`.
22141  *
22142  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
22143  * estimate fetches.
22144  */
22145 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
22146
22147 /**
22148  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
22149  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
22150  * along the path (including in our own channel on which we received it).
22151  *
22152  * Note that in some cases around unclean shutdown, it is possible the payment may have
22153  * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
22154  * second copy of) the [`events::Event::PaymentReceived`] event. Alternatively, the payment
22155  * may have already been failed automatically by LDK if it was nearing its expiration time.
22156  *
22157  * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
22158  * [`ChannelManager::claim_funds`]), you should still monitor for
22159  * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
22160  * startup during which time claims that were in-progress at shutdown may be replayed.
22161  */
22162 void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
22163
22164 /**
22165  * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
22166  * [`MessageSendEvent`]s needed to claim the payment.
22167  *
22168  * Note that calling this method does *not* guarantee that the payment has been claimed. You
22169  * *must* wait for an [`Event::PaymentClaimed`] event which upon a successful claim will be
22170  * provided to your [`EventHandler`] when [`process_pending_events`] is next called.
22171  *
22172  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
22173  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
22174  * event matches your expectation. If you fail to do so and call this method, you may provide
22175  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
22176  *
22177  * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
22178  * [`Event::PaymentClaimed`]: crate::util::events::Event::PaymentClaimed
22179  * [`process_pending_events`]: EventsProvider::process_pending_events
22180  * [`create_inbound_payment`]: Self::create_inbound_payment
22181  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
22182  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
22183  */
22184 void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
22185
22186 /**
22187  * Gets the node_id held by this ChannelManager
22188  */
22189 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
22190
22191 /**
22192  * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
22193  *
22194  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
22195  * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
22196  * the channel.
22197  *
22198  * The `user_channel_id` parameter will be provided back in
22199  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
22200  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
22201  *
22202  * Note that this method will return an error and reject the channel, if it requires support
22203  * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
22204  * used to accept such channels.
22205  *
22206  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
22207  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
22208  */
22209 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);
22210
22211 /**
22212  * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
22213  * it as confirmed immediately.
22214  *
22215  * The `user_channel_id` parameter will be provided back in
22216  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
22217  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
22218  *
22219  * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
22220  * and (if the counterparty agrees), enables forwarding of payments immediately.
22221  *
22222  * This fully trusts that the counterparty has honestly and correctly constructed the funding
22223  * transaction and blindly assumes that it will eventually confirm.
22224  *
22225  * If it does not confirm before we decide to close the channel, or if the funding transaction
22226  * does not pay to the correct script the correct amount, *you will lose funds*.
22227  *
22228  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
22229  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
22230  */
22231 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);
22232
22233 /**
22234  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
22235  * to pay us.
22236  *
22237  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
22238  * [`PaymentHash`] and [`PaymentPreimage`] for you.
22239  *
22240  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
22241  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
22242  * passed directly to [`claim_funds`].
22243  *
22244  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
22245  *
22246  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
22247  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
22248  *
22249  * # Note
22250  *
22251  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
22252  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
22253  *
22254  * Errors if `min_value_msat` is greater than total bitcoin supply.
22255  *
22256  * [`claim_funds`]: Self::claim_funds
22257  * [`PaymentReceived`]: events::Event::PaymentReceived
22258  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
22259  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
22260  */
22261 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);
22262
22263 /**
22264  * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
22265  * serialized state with LDK node(s) running 0.0.103 and earlier.
22266  *
22267  * May panic if `invoice_expiry_delta_secs` is greater than one year.
22268  *
22269  * # Note
22270  * This method is deprecated and will be removed soon.
22271  *
22272  * [`create_inbound_payment`]: Self::create_inbound_payment
22273  */
22274 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);
22275
22276 /**
22277  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
22278  * stored external to LDK.
22279  *
22280  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
22281  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
22282  * the `min_value_msat` provided here, if one is provided.
22283  *
22284  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
22285  * note that LDK will not stop you from registering duplicate payment hashes for inbound
22286  * payments.
22287  *
22288  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
22289  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
22290  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
22291  * sender \"proof-of-payment\" unless they have paid the required amount.
22292  *
22293  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
22294  * in excess of the current time. This should roughly match the expiry time set in the invoice.
22295  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
22296  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
22297  * invoices when no timeout is set.
22298  *
22299  * Note that we use block header time to time-out pending inbound payments (with some margin
22300  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
22301  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
22302  * If you need exact expiry semantics, you should enforce them upon receipt of
22303  * [`PaymentReceived`].
22304  *
22305  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
22306  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
22307  *
22308  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
22309  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
22310  *
22311  * # Note
22312  *
22313  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
22314  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
22315  *
22316  * Errors if `min_value_msat` is greater than total bitcoin supply.
22317  *
22318  * [`create_inbound_payment`]: Self::create_inbound_payment
22319  * [`PaymentReceived`]: events::Event::PaymentReceived
22320  */
22321 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);
22322
22323 /**
22324  * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
22325  * serialized state with LDK node(s) running 0.0.103 and earlier.
22326  *
22327  * May panic if `invoice_expiry_delta_secs` is greater than one year.
22328  *
22329  * # Note
22330  * This method is deprecated and will be removed soon.
22331  *
22332  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
22333  */
22334 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);
22335
22336 /**
22337  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
22338  * previously returned from [`create_inbound_payment`].
22339  *
22340  * [`create_inbound_payment`]: Self::create_inbound_payment
22341  */
22342 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);
22343
22344 /**
22345  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
22346  * are used when constructing the phantom invoice's route hints.
22347  *
22348  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
22349  */
22350 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
22351
22352 /**
22353  * Gets route hints for use in receiving [phantom node payments].
22354  *
22355  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
22356  */
22357 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
22358
22359 /**
22360  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
22361  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
22362  */
22363 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
22364
22365 /**
22366  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
22367  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
22368  */
22369 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
22370
22371 /**
22372  * Constructs a new Listen which calls the relevant methods on this_arg.
22373  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
22374  */
22375 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
22376
22377 /**
22378  * Constructs a new Confirm which calls the relevant methods on this_arg.
22379  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
22380  */
22381 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
22382
22383 /**
22384  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
22385  * indicating whether persistence is necessary. Only one listener on
22386  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
22387  * up.
22388  *
22389  * Note that this method is not available with the `no-std` feature.
22390  */
22391 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
22392
22393 /**
22394  * Blocks until ChannelManager needs to be persisted. Only one listener on
22395  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
22396  * up.
22397  */
22398 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
22399
22400 /**
22401  * Gets a [`Future`] that completes when a persistable update is available. Note that
22402  * callbacks registered on the [`Future`] MUST NOT call back into this [`ChannelManager`] and
22403  * should instead register actions to be taken later.
22404  */
22405 MUST_USE_RES struct LDKFuture ChannelManager_get_persistable_update_future(const struct LDKChannelManager *NONNULL_PTR this_arg);
22406
22407 /**
22408  * Gets the latest best block which was connected either via the [`chain::Listen`] or
22409  * [`chain::Confirm`] interfaces.
22410  */
22411 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
22412
22413 /**
22414  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
22415  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
22416  */
22417 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
22418
22419 /**
22420  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
22421  */
22422 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
22423
22424 /**
22425  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
22426  */
22427 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
22428
22429 /**
22430  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
22431  */
22432 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
22433
22434 /**
22435  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
22436  */
22437 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
22438
22439 /**
22440  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
22441  */
22442 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
22443
22444 /**
22445  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
22446  */
22447 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
22448
22449 /**
22450  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
22451  */
22452 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
22453
22454 /**
22455  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
22456  */
22457 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
22458
22459 /**
22460  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
22461  */
22462 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
22463
22464 /**
22465  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
22466  */
22467 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
22468
22469 /**
22470  * The keys provider which will give us relevant keys. Some keys will be loaded during
22471  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
22472  * signing data.
22473  */
22474 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
22475
22476 /**
22477  * The keys provider which will give us relevant keys. Some keys will be loaded during
22478  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
22479  * signing data.
22480  */
22481 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
22482
22483 /**
22484  * The fee_estimator for use in the ChannelManager in the future.
22485  *
22486  * No calls to the FeeEstimator will be made during deserialization.
22487  */
22488 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
22489
22490 /**
22491  * The fee_estimator for use in the ChannelManager in the future.
22492  *
22493  * No calls to the FeeEstimator will be made during deserialization.
22494  */
22495 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
22496
22497 /**
22498  * The chain::Watch for use in the ChannelManager in the future.
22499  *
22500  * No calls to the chain::Watch will be made during deserialization. It is assumed that
22501  * you have deserialized ChannelMonitors separately and will add them to your
22502  * chain::Watch after deserializing this ChannelManager.
22503  */
22504 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
22505
22506 /**
22507  * The chain::Watch for use in the ChannelManager in the future.
22508  *
22509  * No calls to the chain::Watch will be made during deserialization. It is assumed that
22510  * you have deserialized ChannelMonitors separately and will add them to your
22511  * chain::Watch after deserializing this ChannelManager.
22512  */
22513 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
22514
22515 /**
22516  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
22517  * used to broadcast the latest local commitment transactions of channels which must be
22518  * force-closed during deserialization.
22519  */
22520 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
22521
22522 /**
22523  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
22524  * used to broadcast the latest local commitment transactions of channels which must be
22525  * force-closed during deserialization.
22526  */
22527 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
22528
22529 /**
22530  * The Logger for use in the ChannelManager and which may be used to log information during
22531  * deserialization.
22532  */
22533 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
22534
22535 /**
22536  * The Logger for use in the ChannelManager and which may be used to log information during
22537  * deserialization.
22538  */
22539 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
22540
22541 /**
22542  * Default settings used for new channels. Any existing channels will continue to use the
22543  * runtime settings which were stored when the ChannelManager was serialized.
22544  */
22545 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
22546
22547 /**
22548  * Default settings used for new channels. Any existing channels will continue to use the
22549  * runtime settings which were stored when the ChannelManager was serialized.
22550  */
22551 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
22552
22553 /**
22554  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
22555  * HashMap for you. This is primarily useful for C bindings where it is not practical to
22556  * populate a HashMap directly from C.
22557  */
22558 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);
22559
22560 /**
22561  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
22562  */
22563 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
22564
22565 /**
22566  * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL.
22567  */
22568 void ExpandedKey_free(struct LDKExpandedKey this_obj);
22569
22570 /**
22571  * Create a  new [`ExpandedKey`] for generating an inbound payment hash and secret.
22572  *
22573  * It is recommended to cache this value and not regenerate it for each new inbound payment.
22574  */
22575 MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]);
22576
22577 /**
22578  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
22579  * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
22580  * a `ChannelManager`.
22581  *
22582  * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then
22583  * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
22584  * regenerate it for each new inbound payment.
22585  *
22586  * `current_time` is a Unix timestamp representing the current time.
22587  *
22588  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
22589  */
22590 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);
22591
22592 /**
22593  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
22594  * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
22595  * without a `ChannelManager`.
22596  *
22597  * See [`create`] for information on the `keys` and `current_time` parameters.
22598  *
22599  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
22600  */
22601 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);
22602
22603 /**
22604  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
22605  */
22606 void DecodeError_free(struct LDKDecodeError this_obj);
22607
22608 /**
22609  * Creates a copy of the DecodeError
22610  */
22611 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
22612
22613 /**
22614  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
22615  */
22616 void Init_free(struct LDKInit this_obj);
22617
22618 /**
22619  * The relevant features which the sender supports
22620  */
22621 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
22622
22623 /**
22624  * The relevant features which the sender supports
22625  */
22626 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
22627
22628 /**
22629  * The receipient's network address. This adds the option to report a remote IP address
22630  * back to a connecting peer using the init message. A node can decide to use that information
22631  * to discover a potential update to its public IPv4 address (NAT) and use
22632  * that for a node_announcement update message containing the new address.
22633  */
22634 struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr);
22635
22636 /**
22637  * The receipient's network address. This adds the option to report a remote IP address
22638  * back to a connecting peer using the init message. A node can decide to use that information
22639  * to discover a potential update to its public IPv4 address (NAT) and use
22640  * that for a node_announcement update message containing the new address.
22641  */
22642 void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val);
22643
22644 /**
22645  * Constructs a new Init given each field
22646  */
22647 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg);
22648
22649 /**
22650  * Creates a copy of the Init
22651  */
22652 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
22653
22654 /**
22655  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
22656  */
22657 void ErrorMessage_free(struct LDKErrorMessage this_obj);
22658
22659 /**
22660  * The channel ID involved in the error.
22661  *
22662  * All-0s indicates a general error unrelated to a specific channel, after which all channels
22663  * with the sending peer should be closed.
22664  */
22665 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
22666
22667 /**
22668  * The channel ID involved in the error.
22669  *
22670  * All-0s indicates a general error unrelated to a specific channel, after which all channels
22671  * with the sending peer should be closed.
22672  */
22673 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22674
22675 /**
22676  * A possibly human-readable error description.
22677  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
22678  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
22679  * the terminal emulator or the logging subsystem.
22680  */
22681 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
22682
22683 /**
22684  * A possibly human-readable error description.
22685  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
22686  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
22687  * the terminal emulator or the logging subsystem.
22688  */
22689 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
22690
22691 /**
22692  * Constructs a new ErrorMessage given each field
22693  */
22694 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
22695
22696 /**
22697  * Creates a copy of the ErrorMessage
22698  */
22699 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
22700
22701 /**
22702  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
22703  */
22704 void WarningMessage_free(struct LDKWarningMessage this_obj);
22705
22706 /**
22707  * The channel ID involved in the warning.
22708  *
22709  * All-0s indicates a warning unrelated to a specific channel.
22710  */
22711 const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32];
22712
22713 /**
22714  * The channel ID involved in the warning.
22715  *
22716  * All-0s indicates a warning unrelated to a specific channel.
22717  */
22718 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22719
22720 /**
22721  * A possibly human-readable warning description.
22722  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
22723  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
22724  * the terminal emulator or the logging subsystem.
22725  */
22726 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
22727
22728 /**
22729  * A possibly human-readable warning description.
22730  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
22731  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
22732  * the terminal emulator or the logging subsystem.
22733  */
22734 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
22735
22736 /**
22737  * Constructs a new WarningMessage given each field
22738  */
22739 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
22740
22741 /**
22742  * Creates a copy of the WarningMessage
22743  */
22744 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
22745
22746 /**
22747  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
22748  */
22749 void Ping_free(struct LDKPing this_obj);
22750
22751 /**
22752  * The desired response length
22753  */
22754 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
22755
22756 /**
22757  * The desired response length
22758  */
22759 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
22760
22761 /**
22762  * The ping packet size.
22763  * This field is not sent on the wire. byteslen zeros are sent.
22764  */
22765 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
22766
22767 /**
22768  * The ping packet size.
22769  * This field is not sent on the wire. byteslen zeros are sent.
22770  */
22771 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
22772
22773 /**
22774  * Constructs a new Ping given each field
22775  */
22776 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
22777
22778 /**
22779  * Creates a copy of the Ping
22780  */
22781 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
22782
22783 /**
22784  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
22785  */
22786 void Pong_free(struct LDKPong this_obj);
22787
22788 /**
22789  * The pong packet size.
22790  * This field is not sent on the wire. byteslen zeros are sent.
22791  */
22792 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
22793
22794 /**
22795  * The pong packet size.
22796  * This field is not sent on the wire. byteslen zeros are sent.
22797  */
22798 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
22799
22800 /**
22801  * Constructs a new Pong given each field
22802  */
22803 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
22804
22805 /**
22806  * Creates a copy of the Pong
22807  */
22808 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
22809
22810 /**
22811  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
22812  */
22813 void OpenChannel_free(struct LDKOpenChannel this_obj);
22814
22815 /**
22816  * The genesis hash of the blockchain where the channel is to be opened
22817  */
22818 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
22819
22820 /**
22821  * The genesis hash of the blockchain where the channel is to be opened
22822  */
22823 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22824
22825 /**
22826  * A temporary channel ID, until the funding outpoint is announced
22827  */
22828 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
22829
22830 /**
22831  * A temporary channel ID, until the funding outpoint is announced
22832  */
22833 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22834
22835 /**
22836  * The channel value
22837  */
22838 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22839
22840 /**
22841  * The channel value
22842  */
22843 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
22844
22845 /**
22846  * The amount to push to the counterparty as part of the open, in milli-satoshi
22847  */
22848 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22849
22850 /**
22851  * The amount to push to the counterparty as part of the open, in milli-satoshi
22852  */
22853 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
22854
22855 /**
22856  * The threshold below which outputs on transactions broadcast by sender will be omitted
22857  */
22858 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22859
22860 /**
22861  * The threshold below which outputs on transactions broadcast by sender will be omitted
22862  */
22863 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
22864
22865 /**
22866  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
22867  */
22868 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22869
22870 /**
22871  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
22872  */
22873 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
22874
22875 /**
22876  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
22877  */
22878 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22879
22880 /**
22881  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
22882  */
22883 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
22884
22885 /**
22886  * The minimum HTLC size incoming to sender, in milli-satoshi
22887  */
22888 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22889
22890 /**
22891  * The minimum HTLC size incoming to sender, in milli-satoshi
22892  */
22893 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
22894
22895 /**
22896  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
22897  */
22898 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22899
22900 /**
22901  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
22902  */
22903 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
22904
22905 /**
22906  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
22907  */
22908 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22909
22910 /**
22911  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
22912  */
22913 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
22914
22915 /**
22916  * The maximum number of inbound HTLCs towards sender
22917  */
22918 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22919
22920 /**
22921  * The maximum number of inbound HTLCs towards sender
22922  */
22923 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
22924
22925 /**
22926  * The sender's key controlling the funding transaction
22927  */
22928 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22929
22930 /**
22931  * The sender's key controlling the funding transaction
22932  */
22933 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22934
22935 /**
22936  * Used to derive a revocation key for transactions broadcast by counterparty
22937  */
22938 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22939
22940 /**
22941  * Used to derive a revocation key for transactions broadcast by counterparty
22942  */
22943 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22944
22945 /**
22946  * A payment key to sender for transactions broadcast by counterparty
22947  */
22948 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22949
22950 /**
22951  * A payment key to sender for transactions broadcast by counterparty
22952  */
22953 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22954
22955 /**
22956  * Used to derive a payment key to sender for transactions broadcast by sender
22957  */
22958 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22959
22960 /**
22961  * Used to derive a payment key to sender for transactions broadcast by sender
22962  */
22963 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22964
22965 /**
22966  * Used to derive an HTLC payment key to sender
22967  */
22968 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22969
22970 /**
22971  * Used to derive an HTLC payment key to sender
22972  */
22973 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22974
22975 /**
22976  * The first to-be-broadcast-by-sender transaction's per commitment point
22977  */
22978 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22979
22980 /**
22981  * The first to-be-broadcast-by-sender transaction's per commitment point
22982  */
22983 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22984
22985 /**
22986  * Channel flags
22987  */
22988 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
22989
22990 /**
22991  * Channel flags
22992  */
22993 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
22994
22995 /**
22996  * The channel type that this channel will represent. If none is set, we derive the channel
22997  * type from the intersection of our feature bits with our counterparty's feature bits from
22998  * the Init message.
22999  *
23000  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23001  */
23002 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23003
23004 /**
23005  * The channel type that this channel will represent. If none is set, we derive the channel
23006  * type from the intersection of our feature bits with our counterparty's feature bits from
23007  * the Init message.
23008  *
23009  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23010  */
23011 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
23012
23013 /**
23014  * Creates a copy of the OpenChannel
23015  */
23016 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
23017
23018 /**
23019  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
23020  */
23021 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
23022
23023 /**
23024  * A temporary channel ID, until the funding outpoint is announced
23025  */
23026 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
23027
23028 /**
23029  * A temporary channel ID, until the funding outpoint is announced
23030  */
23031 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23032
23033 /**
23034  * The threshold below which outputs on transactions broadcast by sender will be omitted
23035  */
23036 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23037
23038 /**
23039  * The threshold below which outputs on transactions broadcast by sender will be omitted
23040  */
23041 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
23042
23043 /**
23044  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
23045  */
23046 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23047
23048 /**
23049  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
23050  */
23051 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
23052
23053 /**
23054  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
23055  */
23056 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23057
23058 /**
23059  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
23060  */
23061 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
23062
23063 /**
23064  * The minimum HTLC size incoming to sender, in milli-satoshi
23065  */
23066 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23067
23068 /**
23069  * The minimum HTLC size incoming to sender, in milli-satoshi
23070  */
23071 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
23072
23073 /**
23074  * Minimum depth of the funding transaction before the channel is considered open
23075  */
23076 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23077
23078 /**
23079  * Minimum depth of the funding transaction before the channel is considered open
23080  */
23081 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
23082
23083 /**
23084  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
23085  */
23086 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23087
23088 /**
23089  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
23090  */
23091 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
23092
23093 /**
23094  * The maximum number of inbound HTLCs towards sender
23095  */
23096 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23097
23098 /**
23099  * The maximum number of inbound HTLCs towards sender
23100  */
23101 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
23102
23103 /**
23104  * The sender's key controlling the funding transaction
23105  */
23106 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23107
23108 /**
23109  * The sender's key controlling the funding transaction
23110  */
23111 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23112
23113 /**
23114  * Used to derive a revocation key for transactions broadcast by counterparty
23115  */
23116 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23117
23118 /**
23119  * Used to derive a revocation key for transactions broadcast by counterparty
23120  */
23121 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23122
23123 /**
23124  * A payment key to sender for transactions broadcast by counterparty
23125  */
23126 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23127
23128 /**
23129  * A payment key to sender for transactions broadcast by counterparty
23130  */
23131 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23132
23133 /**
23134  * Used to derive a payment key to sender for transactions broadcast by sender
23135  */
23136 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23137
23138 /**
23139  * Used to derive a payment key to sender for transactions broadcast by sender
23140  */
23141 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23142
23143 /**
23144  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
23145  */
23146 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23147
23148 /**
23149  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
23150  */
23151 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23152
23153 /**
23154  * The first to-be-broadcast-by-sender transaction's per commitment point
23155  */
23156 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23157
23158 /**
23159  * The first to-be-broadcast-by-sender transaction's per commitment point
23160  */
23161 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23162
23163 /**
23164  * The channel type that this channel will represent. If none is set, we derive the channel
23165  * type from the intersection of our feature bits with our counterparty's feature bits from
23166  * the Init message.
23167  *
23168  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
23169  *
23170  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23171  */
23172 struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23173
23174 /**
23175  * The channel type that this channel will represent. If none is set, we derive the channel
23176  * type from the intersection of our feature bits with our counterparty's feature bits from
23177  * the Init message.
23178  *
23179  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
23180  *
23181  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23182  */
23183 void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
23184
23185 /**
23186  * Creates a copy of the AcceptChannel
23187  */
23188 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
23189
23190 /**
23191  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
23192  */
23193 void FundingCreated_free(struct LDKFundingCreated this_obj);
23194
23195 /**
23196  * A temporary channel ID, until the funding is established
23197  */
23198 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
23199
23200 /**
23201  * A temporary channel ID, until the funding is established
23202  */
23203 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23204
23205 /**
23206  * The funding transaction ID
23207  */
23208 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
23209
23210 /**
23211  * The funding transaction ID
23212  */
23213 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23214
23215 /**
23216  * The specific output index funding this channel
23217  */
23218 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
23219
23220 /**
23221  * The specific output index funding this channel
23222  */
23223 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
23224
23225 /**
23226  * The signature of the channel initiator (funder) on the initial commitment transaction
23227  */
23228 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
23229
23230 /**
23231  * The signature of the channel initiator (funder) on the initial commitment transaction
23232  */
23233 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
23234
23235 /**
23236  * Constructs a new FundingCreated given each field
23237  */
23238 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);
23239
23240 /**
23241  * Creates a copy of the FundingCreated
23242  */
23243 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
23244
23245 /**
23246  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
23247  */
23248 void FundingSigned_free(struct LDKFundingSigned this_obj);
23249
23250 /**
23251  * The channel ID
23252  */
23253 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
23254
23255 /**
23256  * The channel ID
23257  */
23258 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23259
23260 /**
23261  * The signature of the channel acceptor (fundee) on the initial commitment transaction
23262  */
23263 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
23264
23265 /**
23266  * The signature of the channel acceptor (fundee) on the initial commitment transaction
23267  */
23268 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
23269
23270 /**
23271  * Constructs a new FundingSigned given each field
23272  */
23273 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
23274
23275 /**
23276  * Creates a copy of the FundingSigned
23277  */
23278 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
23279
23280 /**
23281  * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
23282  */
23283 void ChannelReady_free(struct LDKChannelReady this_obj);
23284
23285 /**
23286  * The channel ID
23287  */
23288 const uint8_t (*ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr))[32];
23289
23290 /**
23291  * The channel ID
23292  */
23293 void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23294
23295 /**
23296  * The per-commitment point of the second commitment transaction
23297  */
23298 struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr);
23299
23300 /**
23301  * The per-commitment point of the second commitment transaction
23302  */
23303 void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23304
23305 /**
23306  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
23307  * to be forwarded over this SCID and forward them to this messages' recipient.
23308  */
23309 struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr);
23310
23311 /**
23312  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
23313  * to be forwarded over this SCID and forward them to this messages' recipient.
23314  */
23315 void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23316
23317 /**
23318  * Constructs a new ChannelReady given each field
23319  */
23320 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);
23321
23322 /**
23323  * Creates a copy of the ChannelReady
23324  */
23325 struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig);
23326
23327 /**
23328  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
23329  */
23330 void Shutdown_free(struct LDKShutdown this_obj);
23331
23332 /**
23333  * The channel ID
23334  */
23335 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
23336
23337 /**
23338  * The channel ID
23339  */
23340 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23341
23342 /**
23343  * The destination of this peer's funds on closing.
23344  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
23345  */
23346 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
23347
23348 /**
23349  * The destination of this peer's funds on closing.
23350  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
23351  */
23352 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
23353
23354 /**
23355  * Constructs a new Shutdown given each field
23356  */
23357 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
23358
23359 /**
23360  * Creates a copy of the Shutdown
23361  */
23362 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
23363
23364 /**
23365  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
23366  */
23367 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
23368
23369 /**
23370  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
23371  * transaction.
23372  */
23373 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
23374
23375 /**
23376  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
23377  * transaction.
23378  */
23379 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
23380
23381 /**
23382  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
23383  * transaction.
23384  */
23385 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
23386
23387 /**
23388  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
23389  * transaction.
23390  */
23391 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
23392
23393 /**
23394  * Constructs a new ClosingSignedFeeRange given each field
23395  */
23396 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
23397
23398 /**
23399  * Creates a copy of the ClosingSignedFeeRange
23400  */
23401 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
23402
23403 /**
23404  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
23405  */
23406 void ClosingSigned_free(struct LDKClosingSigned this_obj);
23407
23408 /**
23409  * The channel ID
23410  */
23411 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
23412
23413 /**
23414  * The channel ID
23415  */
23416 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23417
23418 /**
23419  * The proposed total fee for the closing transaction
23420  */
23421 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
23422
23423 /**
23424  * The proposed total fee for the closing transaction
23425  */
23426 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
23427
23428 /**
23429  * A signature on the closing transaction
23430  */
23431 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
23432
23433 /**
23434  * A signature on the closing transaction
23435  */
23436 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
23437
23438 /**
23439  * The minimum and maximum fees which the sender is willing to accept, provided only by new
23440  * nodes.
23441  *
23442  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23443  */
23444 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
23445
23446 /**
23447  * The minimum and maximum fees which the sender is willing to accept, provided only by new
23448  * nodes.
23449  *
23450  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23451  */
23452 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
23453
23454 /**
23455  * Constructs a new ClosingSigned given each field
23456  */
23457 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);
23458
23459 /**
23460  * Creates a copy of the ClosingSigned
23461  */
23462 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
23463
23464 /**
23465  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
23466  */
23467 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
23468
23469 /**
23470  * The channel ID
23471  */
23472 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
23473
23474 /**
23475  * The channel ID
23476  */
23477 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23478
23479 /**
23480  * The HTLC ID
23481  */
23482 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
23483
23484 /**
23485  * The HTLC ID
23486  */
23487 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
23488
23489 /**
23490  * The HTLC value in milli-satoshi
23491  */
23492 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
23493
23494 /**
23495  * The HTLC value in milli-satoshi
23496  */
23497 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
23498
23499 /**
23500  * The payment hash, the pre-image of which controls HTLC redemption
23501  */
23502 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
23503
23504 /**
23505  * The payment hash, the pre-image of which controls HTLC redemption
23506  */
23507 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23508
23509 /**
23510  * The expiry height of the HTLC
23511  */
23512 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
23513
23514 /**
23515  * The expiry height of the HTLC
23516  */
23517 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
23518
23519 /**
23520  * Creates a copy of the UpdateAddHTLC
23521  */
23522 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
23523
23524 /**
23525  * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL.
23526  */
23527 void OnionMessage_free(struct LDKOnionMessage this_obj);
23528
23529 /**
23530  * Used in decrypting the onion packet's payload.
23531  */
23532 struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage *NONNULL_PTR this_ptr);
23533
23534 /**
23535  * Used in decrypting the onion packet's payload.
23536  */
23537 void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23538
23539 /**
23540  * Creates a copy of the OnionMessage
23541  */
23542 struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig);
23543
23544 /**
23545  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
23546  */
23547 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
23548
23549 /**
23550  * The channel ID
23551  */
23552 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
23553
23554 /**
23555  * The channel ID
23556  */
23557 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23558
23559 /**
23560  * The HTLC ID
23561  */
23562 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
23563
23564 /**
23565  * The HTLC ID
23566  */
23567 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
23568
23569 /**
23570  * The pre-image of the payment hash, allowing HTLC redemption
23571  */
23572 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
23573
23574 /**
23575  * The pre-image of the payment hash, allowing HTLC redemption
23576  */
23577 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23578
23579 /**
23580  * Constructs a new UpdateFulfillHTLC given each field
23581  */
23582 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
23583
23584 /**
23585  * Creates a copy of the UpdateFulfillHTLC
23586  */
23587 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
23588
23589 /**
23590  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
23591  */
23592 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
23593
23594 /**
23595  * The channel ID
23596  */
23597 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
23598
23599 /**
23600  * The channel ID
23601  */
23602 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23603
23604 /**
23605  * The HTLC ID
23606  */
23607 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
23608
23609 /**
23610  * The HTLC ID
23611  */
23612 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
23613
23614 /**
23615  * Creates a copy of the UpdateFailHTLC
23616  */
23617 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
23618
23619 /**
23620  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
23621  */
23622 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
23623
23624 /**
23625  * The channel ID
23626  */
23627 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
23628
23629 /**
23630  * The channel ID
23631  */
23632 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23633
23634 /**
23635  * The HTLC ID
23636  */
23637 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
23638
23639 /**
23640  * The HTLC ID
23641  */
23642 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
23643
23644 /**
23645  * The failure code
23646  */
23647 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
23648
23649 /**
23650  * The failure code
23651  */
23652 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
23653
23654 /**
23655  * Creates a copy of the UpdateFailMalformedHTLC
23656  */
23657 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
23658
23659 /**
23660  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
23661  */
23662 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
23663
23664 /**
23665  * The channel ID
23666  */
23667 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
23668
23669 /**
23670  * The channel ID
23671  */
23672 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23673
23674 /**
23675  * A signature on the commitment transaction
23676  */
23677 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
23678
23679 /**
23680  * A signature on the commitment transaction
23681  */
23682 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
23683
23684 /**
23685  * Signatures on the HTLC transactions
23686  *
23687  * Returns a copy of the field.
23688  */
23689 struct LDKCVec_SignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
23690
23691 /**
23692  * Signatures on the HTLC transactions
23693  */
23694 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
23695
23696 /**
23697  * Constructs a new CommitmentSigned given each field
23698  */
23699 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
23700
23701 /**
23702  * Creates a copy of the CommitmentSigned
23703  */
23704 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
23705
23706 /**
23707  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
23708  */
23709 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
23710
23711 /**
23712  * The channel ID
23713  */
23714 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
23715
23716 /**
23717  * The channel ID
23718  */
23719 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23720
23721 /**
23722  * The secret corresponding to the per-commitment point
23723  */
23724 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
23725
23726 /**
23727  * The secret corresponding to the per-commitment point
23728  */
23729 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23730
23731 /**
23732  * The next sender-broadcast commitment transaction's per-commitment point
23733  */
23734 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
23735
23736 /**
23737  * The next sender-broadcast commitment transaction's per-commitment point
23738  */
23739 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23740
23741 /**
23742  * Constructs a new RevokeAndACK given each field
23743  */
23744 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);
23745
23746 /**
23747  * Creates a copy of the RevokeAndACK
23748  */
23749 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
23750
23751 /**
23752  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
23753  */
23754 void UpdateFee_free(struct LDKUpdateFee this_obj);
23755
23756 /**
23757  * The channel ID
23758  */
23759 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
23760
23761 /**
23762  * The channel ID
23763  */
23764 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23765
23766 /**
23767  * Fee rate per 1000-weight of the transaction
23768  */
23769 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
23770
23771 /**
23772  * Fee rate per 1000-weight of the transaction
23773  */
23774 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
23775
23776 /**
23777  * Constructs a new UpdateFee given each field
23778  */
23779 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
23780
23781 /**
23782  * Creates a copy of the UpdateFee
23783  */
23784 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
23785
23786 /**
23787  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
23788  */
23789 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
23790
23791 /**
23792  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
23793  * belonging to the recipient
23794  */
23795 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
23796
23797 /**
23798  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
23799  * belonging to the recipient
23800  */
23801 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23802
23803 /**
23804  * The sender's per-commitment point for their current commitment transaction
23805  */
23806 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
23807
23808 /**
23809  * The sender's per-commitment point for their current commitment transaction
23810  */
23811 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23812
23813 /**
23814  * Constructs a new DataLossProtect given each field
23815  */
23816 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
23817
23818 /**
23819  * Creates a copy of the DataLossProtect
23820  */
23821 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
23822
23823 /**
23824  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
23825  */
23826 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
23827
23828 /**
23829  * The channel ID
23830  */
23831 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
23832
23833 /**
23834  * The channel ID
23835  */
23836 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23837
23838 /**
23839  * The next commitment number for the sender
23840  */
23841 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
23842
23843 /**
23844  * The next commitment number for the sender
23845  */
23846 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
23847
23848 /**
23849  * The next commitment number for the recipient
23850  */
23851 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
23852
23853 /**
23854  * The next commitment number for the recipient
23855  */
23856 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
23857
23858 /**
23859  * Creates a copy of the ChannelReestablish
23860  */
23861 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
23862
23863 /**
23864  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
23865  */
23866 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
23867
23868 /**
23869  * The channel ID
23870  */
23871 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
23872
23873 /**
23874  * The channel ID
23875  */
23876 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23877
23878 /**
23879  * The short channel ID
23880  */
23881 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
23882
23883 /**
23884  * The short channel ID
23885  */
23886 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
23887
23888 /**
23889  * A signature by the node key
23890  */
23891 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
23892
23893 /**
23894  * A signature by the node key
23895  */
23896 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
23897
23898 /**
23899  * A signature by the funding key
23900  */
23901 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
23902
23903 /**
23904  * A signature by the funding key
23905  */
23906 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
23907
23908 /**
23909  * Constructs a new AnnouncementSignatures given each field
23910  */
23911 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);
23912
23913 /**
23914  * Creates a copy of the AnnouncementSignatures
23915  */
23916 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
23917
23918 /**
23919  * Frees any resources used by the NetAddress
23920  */
23921 void NetAddress_free(struct LDKNetAddress this_ptr);
23922
23923 /**
23924  * Creates a copy of the NetAddress
23925  */
23926 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
23927
23928 /**
23929  * Utility method to constructs a new IPv4-variant NetAddress
23930  */
23931 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
23932
23933 /**
23934  * Utility method to constructs a new IPv6-variant NetAddress
23935  */
23936 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
23937
23938 /**
23939  * Utility method to constructs a new OnionV2-variant NetAddress
23940  */
23941 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
23942
23943 /**
23944  * Utility method to constructs a new OnionV3-variant NetAddress
23945  */
23946 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
23947
23948 /**
23949  * Utility method to constructs a new Hostname-variant NetAddress
23950  */
23951 struct LDKNetAddress NetAddress_hostname(struct LDKHostname hostname, uint16_t port);
23952
23953 /**
23954  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
23955  */
23956 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
23957
23958 /**
23959  * Read a NetAddress from a byte array, created by NetAddress_write
23960  */
23961 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
23962
23963 /**
23964  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
23965  */
23966 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
23967
23968 /**
23969  * The advertised features
23970  */
23971 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
23972
23973 /**
23974  * The advertised features
23975  */
23976 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
23977
23978 /**
23979  * A strictly monotonic announcement counter, with gaps allowed
23980  */
23981 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
23982
23983 /**
23984  * A strictly monotonic announcement counter, with gaps allowed
23985  */
23986 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
23987
23988 /**
23989  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
23990  * to this node).
23991  */
23992 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
23993
23994 /**
23995  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
23996  * to this node).
23997  */
23998 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23999
24000 /**
24001  * An RGB color for UI purposes
24002  */
24003 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
24004
24005 /**
24006  * An RGB color for UI purposes
24007  */
24008 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
24009
24010 /**
24011  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
24012  * of uniqueness.
24013  */
24014 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
24015
24016 /**
24017  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
24018  * of uniqueness.
24019  */
24020 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24021
24022 /**
24023  * List of addresses on which this node is reachable
24024  *
24025  * Returns a copy of the field.
24026  */
24027 struct LDKCVec_NetAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
24028
24029 /**
24030  * List of addresses on which this node is reachable
24031  */
24032 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
24033
24034 /**
24035  * Creates a copy of the UnsignedNodeAnnouncement
24036  */
24037 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
24038
24039 /**
24040  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
24041  */
24042 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
24043
24044 /**
24045  * The signature by the node key
24046  */
24047 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
24048
24049 /**
24050  * The signature by the node key
24051  */
24052 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
24053
24054 /**
24055  * The actual content of the announcement
24056  */
24057 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
24058
24059 /**
24060  * The actual content of the announcement
24061  */
24062 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
24063
24064 /**
24065  * Constructs a new NodeAnnouncement given each field
24066  */
24067 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
24068
24069 /**
24070  * Creates a copy of the NodeAnnouncement
24071  */
24072 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
24073
24074 /**
24075  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
24076  */
24077 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
24078
24079 /**
24080  * The advertised channel features
24081  */
24082 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
24083
24084 /**
24085  * The advertised channel features
24086  */
24087 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
24088
24089 /**
24090  * The genesis hash of the blockchain where the channel is to be opened
24091  */
24092 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
24093
24094 /**
24095  * The genesis hash of the blockchain where the channel is to be opened
24096  */
24097 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24098
24099 /**
24100  * The short channel ID
24101  */
24102 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
24103
24104 /**
24105  * The short channel ID
24106  */
24107 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
24108
24109 /**
24110  * One of the two node_ids which are endpoints of this channel
24111  */
24112 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
24113
24114 /**
24115  * One of the two node_ids which are endpoints of this channel
24116  */
24117 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24118
24119 /**
24120  * The other of the two node_ids which are endpoints of this channel
24121  */
24122 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
24123
24124 /**
24125  * The other of the two node_ids which are endpoints of this channel
24126  */
24127 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24128
24129 /**
24130  * The funding key for the first node
24131  */
24132 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
24133
24134 /**
24135  * The funding key for the first node
24136  */
24137 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24138
24139 /**
24140  * The funding key for the second node
24141  */
24142 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
24143
24144 /**
24145  * The funding key for the second node
24146  */
24147 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24148
24149 /**
24150  * Creates a copy of the UnsignedChannelAnnouncement
24151  */
24152 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
24153
24154 /**
24155  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
24156  */
24157 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
24158
24159 /**
24160  * Authentication of the announcement by the first public node
24161  */
24162 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
24163
24164 /**
24165  * Authentication of the announcement by the first public node
24166  */
24167 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
24168
24169 /**
24170  * Authentication of the announcement by the second public node
24171  */
24172 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
24173
24174 /**
24175  * Authentication of the announcement by the second public node
24176  */
24177 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
24178
24179 /**
24180  * Proof of funding UTXO ownership by the first public node
24181  */
24182 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
24183
24184 /**
24185  * Proof of funding UTXO ownership by the first public node
24186  */
24187 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
24188
24189 /**
24190  * Proof of funding UTXO ownership by the second public node
24191  */
24192 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
24193
24194 /**
24195  * Proof of funding UTXO ownership by the second public node
24196  */
24197 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
24198
24199 /**
24200  * The actual announcement
24201  */
24202 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
24203
24204 /**
24205  * The actual announcement
24206  */
24207 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
24208
24209 /**
24210  * Constructs a new ChannelAnnouncement given each field
24211  */
24212 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);
24213
24214 /**
24215  * Creates a copy of the ChannelAnnouncement
24216  */
24217 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
24218
24219 /**
24220  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
24221  */
24222 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
24223
24224 /**
24225  * The genesis hash of the blockchain where the channel is to be opened
24226  */
24227 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
24228
24229 /**
24230  * The genesis hash of the blockchain where the channel is to be opened
24231  */
24232 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24233
24234 /**
24235  * The short channel ID
24236  */
24237 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24238
24239 /**
24240  * The short channel ID
24241  */
24242 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
24243
24244 /**
24245  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
24246  */
24247 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24248
24249 /**
24250  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
24251  */
24252 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
24253
24254 /**
24255  * Channel flags
24256  */
24257 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24258
24259 /**
24260  * Channel flags
24261  */
24262 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
24263
24264 /**
24265  * The number of blocks such that if:
24266  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
24267  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
24268  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
24269  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
24270  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
24271  * forwarding. Note that the HTLC sender is the one who originally sets this value when
24272  * constructing the route.
24273  */
24274 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24275
24276 /**
24277  * The number of blocks such that if:
24278  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
24279  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
24280  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
24281  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
24282  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
24283  * forwarding. Note that the HTLC sender is the one who originally sets this value when
24284  * constructing the route.
24285  */
24286 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
24287
24288 /**
24289  * The minimum HTLC size incoming to sender, in milli-satoshi
24290  */
24291 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24292
24293 /**
24294  * The minimum HTLC size incoming to sender, in milli-satoshi
24295  */
24296 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
24297
24298 /**
24299  * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional.
24300  */
24301 uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24302
24303 /**
24304  * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional.
24305  */
24306 void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
24307
24308 /**
24309  * The base HTLC fee charged by sender, in milli-satoshi
24310  */
24311 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24312
24313 /**
24314  * The base HTLC fee charged by sender, in milli-satoshi
24315  */
24316 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
24317
24318 /**
24319  * The amount to fee multiplier, in micro-satoshi
24320  */
24321 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24322
24323 /**
24324  * The amount to fee multiplier, in micro-satoshi
24325  */
24326 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
24327
24328 /**
24329  * Excess data which was signed as a part of the message which we do not (yet) understand how
24330  * to decode. This is stored to ensure forward-compatibility as new fields are added to the
24331  * lightning gossip
24332  *
24333  * Returns a copy of the field.
24334  */
24335 struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24336
24337 /**
24338  * Excess data which was signed as a part of the message which we do not (yet) understand how
24339  * to decode. This is stored to ensure forward-compatibility as new fields are added to the
24340  * lightning gossip
24341  */
24342 void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
24343
24344 /**
24345  * Constructs a new UnsignedChannelUpdate given each field
24346  */
24347 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);
24348
24349 /**
24350  * Creates a copy of the UnsignedChannelUpdate
24351  */
24352 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
24353
24354 /**
24355  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
24356  */
24357 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
24358
24359 /**
24360  * A signature of the channel update
24361  */
24362 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
24363
24364 /**
24365  * A signature of the channel update
24366  */
24367 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
24368
24369 /**
24370  * The actual channel update
24371  */
24372 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
24373
24374 /**
24375  * The actual channel update
24376  */
24377 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
24378
24379 /**
24380  * Constructs a new ChannelUpdate given each field
24381  */
24382 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
24383
24384 /**
24385  * Creates a copy of the ChannelUpdate
24386  */
24387 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
24388
24389 /**
24390  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
24391  */
24392 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
24393
24394 /**
24395  * The genesis hash of the blockchain being queried
24396  */
24397 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
24398
24399 /**
24400  * The genesis hash of the blockchain being queried
24401  */
24402 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24403
24404 /**
24405  * The height of the first block for the channel UTXOs being queried
24406  */
24407 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
24408
24409 /**
24410  * The height of the first block for the channel UTXOs being queried
24411  */
24412 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
24413
24414 /**
24415  * The number of blocks to include in the query results
24416  */
24417 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
24418
24419 /**
24420  * The number of blocks to include in the query results
24421  */
24422 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
24423
24424 /**
24425  * Constructs a new QueryChannelRange given each field
24426  */
24427 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
24428
24429 /**
24430  * Creates a copy of the QueryChannelRange
24431  */
24432 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
24433
24434 /**
24435  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
24436  */
24437 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
24438
24439 /**
24440  * The genesis hash of the blockchain being queried
24441  */
24442 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
24443
24444 /**
24445  * The genesis hash of the blockchain being queried
24446  */
24447 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24448
24449 /**
24450  * The height of the first block in the range of the reply
24451  */
24452 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
24453
24454 /**
24455  * The height of the first block in the range of the reply
24456  */
24457 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
24458
24459 /**
24460  * The number of blocks included in the range of the reply
24461  */
24462 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
24463
24464 /**
24465  * The number of blocks included in the range of the reply
24466  */
24467 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
24468
24469 /**
24470  * True when this is the final reply for a query
24471  */
24472 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
24473
24474 /**
24475  * True when this is the final reply for a query
24476  */
24477 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
24478
24479 /**
24480  * The short_channel_ids in the channel range
24481  *
24482  * Returns a copy of the field.
24483  */
24484 struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
24485
24486 /**
24487  * The short_channel_ids in the channel range
24488  */
24489 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
24490
24491 /**
24492  * Constructs a new ReplyChannelRange given each field
24493  */
24494 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);
24495
24496 /**
24497  * Creates a copy of the ReplyChannelRange
24498  */
24499 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
24500
24501 /**
24502  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
24503  */
24504 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
24505
24506 /**
24507  * The genesis hash of the blockchain being queried
24508  */
24509 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
24510
24511 /**
24512  * The genesis hash of the blockchain being queried
24513  */
24514 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24515
24516 /**
24517  * The short_channel_ids that are being queried
24518  *
24519  * Returns a copy of the field.
24520  */
24521 struct LDKCVec_u64Z QueryShortChannelIds_get_short_channel_ids(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr);
24522
24523 /**
24524  * The short_channel_ids that are being queried
24525  */
24526 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
24527
24528 /**
24529  * Constructs a new QueryShortChannelIds given each field
24530  */
24531 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
24532
24533 /**
24534  * Creates a copy of the QueryShortChannelIds
24535  */
24536 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
24537
24538 /**
24539  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
24540  */
24541 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
24542
24543 /**
24544  * The genesis hash of the blockchain that was queried
24545  */
24546 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
24547
24548 /**
24549  * The genesis hash of the blockchain that was queried
24550  */
24551 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24552
24553 /**
24554  * Indicates if the query recipient maintains up-to-date channel
24555  * information for the chain_hash
24556  */
24557 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
24558
24559 /**
24560  * Indicates if the query recipient maintains up-to-date channel
24561  * information for the chain_hash
24562  */
24563 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
24564
24565 /**
24566  * Constructs a new ReplyShortChannelIdsEnd given each field
24567  */
24568 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
24569
24570 /**
24571  * Creates a copy of the ReplyShortChannelIdsEnd
24572  */
24573 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
24574
24575 /**
24576  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
24577  */
24578 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
24579
24580 /**
24581  * The genesis hash of the blockchain for channel and node information
24582  */
24583 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
24584
24585 /**
24586  * The genesis hash of the blockchain for channel and node information
24587  */
24588 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24589
24590 /**
24591  * The starting unix timestamp
24592  */
24593 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
24594
24595 /**
24596  * The starting unix timestamp
24597  */
24598 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
24599
24600 /**
24601  * The range of information in seconds
24602  */
24603 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
24604
24605 /**
24606  * The range of information in seconds
24607  */
24608 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
24609
24610 /**
24611  * Constructs a new GossipTimestampFilter given each field
24612  */
24613 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
24614
24615 /**
24616  * Creates a copy of the GossipTimestampFilter
24617  */
24618 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
24619
24620 /**
24621  * Frees any resources used by the ErrorAction
24622  */
24623 void ErrorAction_free(struct LDKErrorAction this_ptr);
24624
24625 /**
24626  * Creates a copy of the ErrorAction
24627  */
24628 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
24629
24630 /**
24631  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
24632  */
24633 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
24634
24635 /**
24636  * Utility method to constructs a new IgnoreError-variant ErrorAction
24637  */
24638 struct LDKErrorAction ErrorAction_ignore_error(void);
24639
24640 /**
24641  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
24642  */
24643 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
24644
24645 /**
24646  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
24647  */
24648 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
24649
24650 /**
24651  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
24652  */
24653 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
24654
24655 /**
24656  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
24657  */
24658 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
24659
24660 /**
24661  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
24662  */
24663 void LightningError_free(struct LDKLightningError this_obj);
24664
24665 /**
24666  * A human-readable message describing the error
24667  */
24668 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
24669
24670 /**
24671  * A human-readable message describing the error
24672  */
24673 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
24674
24675 /**
24676  * The action which should be taken against the offending peer.
24677  */
24678 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
24679
24680 /**
24681  * The action which should be taken against the offending peer.
24682  */
24683 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
24684
24685 /**
24686  * Constructs a new LightningError given each field
24687  */
24688 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
24689
24690 /**
24691  * Creates a copy of the LightningError
24692  */
24693 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
24694
24695 /**
24696  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
24697  */
24698 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
24699
24700 /**
24701  * update_add_htlc messages which should be sent
24702  */
24703 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
24704
24705 /**
24706  * update_add_htlc messages which should be sent
24707  */
24708 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
24709
24710 /**
24711  * update_fulfill_htlc messages which should be sent
24712  */
24713 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
24714
24715 /**
24716  * update_fulfill_htlc messages which should be sent
24717  */
24718 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
24719
24720 /**
24721  * update_fail_htlc messages which should be sent
24722  */
24723 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
24724
24725 /**
24726  * update_fail_htlc messages which should be sent
24727  */
24728 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
24729
24730 /**
24731  * update_fail_malformed_htlc messages which should be sent
24732  */
24733 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
24734
24735 /**
24736  * update_fail_malformed_htlc messages which should be sent
24737  */
24738 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
24739
24740 /**
24741  * An update_fee message which should be sent
24742  *
24743  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24744  */
24745 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
24746
24747 /**
24748  * An update_fee message which should be sent
24749  *
24750  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24751  */
24752 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
24753
24754 /**
24755  * Finally, the commitment_signed message which should be sent
24756  */
24757 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
24758
24759 /**
24760  * Finally, the commitment_signed message which should be sent
24761  */
24762 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
24763
24764 /**
24765  * Constructs a new CommitmentUpdate given each field
24766  */
24767 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);
24768
24769 /**
24770  * Creates a copy of the CommitmentUpdate
24771  */
24772 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
24773
24774 /**
24775  * Calls the free function if one is set
24776  */
24777 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
24778
24779 /**
24780  * Calls the free function if one is set
24781  */
24782 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
24783
24784 /**
24785  * Calls the free function if one is set
24786  */
24787 void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr);
24788
24789 /**
24790  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
24791  */
24792 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
24793
24794 /**
24795  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
24796  */
24797 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
24798
24799 /**
24800  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
24801  */
24802 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
24803
24804 /**
24805  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
24806  */
24807 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
24808
24809 /**
24810  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
24811  */
24812 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
24813
24814 /**
24815  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
24816  */
24817 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
24818
24819 /**
24820  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
24821  */
24822 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
24823
24824 /**
24825  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
24826  */
24827 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
24828
24829 /**
24830  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
24831  */
24832 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
24833
24834 /**
24835  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
24836  */
24837 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
24838
24839 /**
24840  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
24841  */
24842 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
24843
24844 /**
24845  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
24846  */
24847 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
24848
24849 /**
24850  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
24851  */
24852 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
24853
24854 /**
24855  * Read a FundingCreated from a byte array, created by FundingCreated_write
24856  */
24857 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
24858
24859 /**
24860  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
24861  */
24862 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
24863
24864 /**
24865  * Read a FundingSigned from a byte array, created by FundingSigned_write
24866  */
24867 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
24868
24869 /**
24870  * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
24871  */
24872 struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj);
24873
24874 /**
24875  * Read a ChannelReady from a byte array, created by ChannelReady_write
24876  */
24877 struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser);
24878
24879 /**
24880  * Serialize the Init object into a byte array which can be read by Init_read
24881  */
24882 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
24883
24884 /**
24885  * Read a Init from a byte array, created by Init_write
24886  */
24887 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
24888
24889 /**
24890  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
24891  */
24892 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
24893
24894 /**
24895  * Read a OpenChannel from a byte array, created by OpenChannel_write
24896  */
24897 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
24898
24899 /**
24900  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
24901  */
24902 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
24903
24904 /**
24905  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
24906  */
24907 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
24908
24909 /**
24910  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
24911  */
24912 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
24913
24914 /**
24915  * Read a Shutdown from a byte array, created by Shutdown_write
24916  */
24917 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
24918
24919 /**
24920  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
24921  */
24922 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
24923
24924 /**
24925  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
24926  */
24927 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
24928
24929 /**
24930  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
24931  */
24932 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
24933
24934 /**
24935  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
24936  */
24937 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
24938
24939 /**
24940  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
24941  */
24942 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
24943
24944 /**
24945  * Read a UpdateFee from a byte array, created by UpdateFee_write
24946  */
24947 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
24948
24949 /**
24950  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
24951  */
24952 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
24953
24954 /**
24955  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
24956  */
24957 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
24958
24959 /**
24960  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
24961  */
24962 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
24963
24964 /**
24965  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
24966  */
24967 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
24968
24969 /**
24970  * Read a OnionMessage from a byte array, created by OnionMessage_write
24971  */
24972 struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice ser);
24973
24974 /**
24975  * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read
24976  */
24977 struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj);
24978
24979 /**
24980  * Serialize the Ping object into a byte array which can be read by Ping_read
24981  */
24982 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
24983
24984 /**
24985  * Read a Ping from a byte array, created by Ping_write
24986  */
24987 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
24988
24989 /**
24990  * Serialize the Pong object into a byte array which can be read by Pong_read
24991  */
24992 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
24993
24994 /**
24995  * Read a Pong from a byte array, created by Pong_write
24996  */
24997 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
24998
24999 /**
25000  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
25001  */
25002 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
25003
25004 /**
25005  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
25006  */
25007 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
25008
25009 /**
25010  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
25011  */
25012 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
25013
25014 /**
25015  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
25016  */
25017 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
25018
25019 /**
25020  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
25021  */
25022 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
25023
25024 /**
25025  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
25026  */
25027 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
25028
25029 /**
25030  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
25031  */
25032 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
25033
25034 /**
25035  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
25036  */
25037 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
25038
25039 /**
25040  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
25041  */
25042 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
25043
25044 /**
25045  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
25046  */
25047 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
25048
25049 /**
25050  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
25051  */
25052 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
25053
25054 /**
25055  * Read a WarningMessage from a byte array, created by WarningMessage_write
25056  */
25057 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
25058
25059 /**
25060  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
25061  */
25062 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
25063
25064 /**
25065  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
25066  */
25067 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
25068
25069 /**
25070  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
25071  */
25072 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
25073
25074 /**
25075  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
25076  */
25077 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
25078
25079 /**
25080  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
25081  */
25082 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
25083
25084 /**
25085  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
25086  */
25087 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
25088
25089 /**
25090  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
25091  */
25092 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
25093
25094 /**
25095  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
25096  */
25097 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
25098
25099 /**
25100  *\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
25101  */
25102 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
25103
25104 /**
25105  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
25106  */
25107 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
25108
25109 /**
25110  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
25111  */
25112 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
25113
25114 /**
25115  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
25116  */
25117 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
25118
25119 /**
25120  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
25121  */
25122 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
25123
25124 /**
25125  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
25126  */
25127 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
25128
25129 /**
25130  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
25131  */
25132 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
25133
25134 /**
25135  * Calls the free function if one is set
25136  */
25137 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
25138
25139 /**
25140  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
25141  */
25142 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
25143
25144 /**
25145  * Constructs a new IgnoringMessageHandler given each field
25146  */
25147 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
25148
25149 /**
25150  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
25151  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
25152  */
25153 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
25154
25155 /**
25156  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
25157  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
25158  */
25159 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
25160
25161 /**
25162  * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
25163  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
25164  */
25165 struct LDKOnionMessageProvider IgnoringMessageHandler_as_OnionMessageProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
25166
25167 /**
25168  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
25169  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
25170  */
25171 struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
25172
25173 /**
25174  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
25175  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
25176  */
25177 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
25178
25179 /**
25180  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
25181  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
25182  */
25183 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
25184
25185 /**
25186  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
25187  */
25188 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
25189
25190 /**
25191  * Constructs a new ErroringMessageHandler
25192  */
25193 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
25194
25195 /**
25196  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
25197  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
25198  */
25199 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
25200
25201 /**
25202  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
25203  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
25204  */
25205 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
25206
25207 /**
25208  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
25209  */
25210 void MessageHandler_free(struct LDKMessageHandler this_obj);
25211
25212 /**
25213  * A message handler which handles messages specific to channels. Usually this is just a
25214  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
25215  *
25216  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
25217  */
25218 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
25219
25220 /**
25221  * A message handler which handles messages specific to channels. Usually this is just a
25222  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
25223  *
25224  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
25225  */
25226 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
25227
25228 /**
25229  * A message handler which handles messages updating our knowledge of the network channel
25230  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
25231  *
25232  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
25233  */
25234 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
25235
25236 /**
25237  * A message handler which handles messages updating our knowledge of the network channel
25238  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
25239  *
25240  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
25241  */
25242 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
25243
25244 /**
25245  * A message handler which handles onion messages. For now, this can only be an
25246  * [`IgnoringMessageHandler`].
25247  */
25248 const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
25249
25250 /**
25251  * A message handler which handles onion messages. For now, this can only be an
25252  * [`IgnoringMessageHandler`].
25253  */
25254 void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val);
25255
25256 /**
25257  * Constructs a new MessageHandler given each field
25258  */
25259 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg, struct LDKOnionMessageHandler onion_message_handler_arg);
25260
25261 /**
25262  * Creates a copy of a SocketDescriptor
25263  */
25264 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
25265
25266 /**
25267  * Calls the free function if one is set
25268  */
25269 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
25270
25271 /**
25272  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
25273  */
25274 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
25275
25276 /**
25277  * Used to indicate that we probably can't make any future connections to this peer (e.g.
25278  * because we required features that our peer was missing, or vice versa).
25279  *
25280  * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
25281  * any channels with this peer or check for new versions of LDK.
25282  *
25283  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
25284  */
25285 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
25286
25287 /**
25288  * Used to indicate that we probably can't make any future connections to this peer (e.g.
25289  * because we required features that our peer was missing, or vice versa).
25290  *
25291  * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
25292  * any channels with this peer or check for new versions of LDK.
25293  *
25294  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
25295  */
25296 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
25297
25298 /**
25299  * Constructs a new PeerHandleError given each field
25300  */
25301 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
25302
25303 /**
25304  * Creates a copy of the PeerHandleError
25305  */
25306 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
25307
25308 /**
25309  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
25310  */
25311 void PeerManager_free(struct LDKPeerManager this_obj);
25312
25313 /**
25314  * Constructs a new PeerManager with the given message handlers and node_id secret key
25315  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
25316  * cryptographically secure random bytes.
25317  *
25318  * `current_time` is used as an always-increasing counter that survives across restarts and is
25319  * incremented irregularly internally. In general it is best to simply use the current UNIX
25320  * timestamp, however if it is not available a persistent counter that increases once per
25321  * minute should suffice.
25322  */
25323 MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, uint64_t current_time, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler);
25324
25325 /**
25326  * Get the list of node ids for peers which have completed the initial handshake.
25327  *
25328  * For outbound connections, this will be the same as the their_node_id parameter passed in to
25329  * new_outbound_connection, however entries will only appear once the initial handshake has
25330  * completed and we are sure the remote peer has the private key for the given node_id.
25331  */
25332 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
25333
25334 /**
25335  * Indicates a new outbound connection has been established to a node with the given node_id
25336  * and an optional remote network address.
25337  *
25338  * The remote network address adds the option to report a remote IP address back to a connecting
25339  * peer using the init message.
25340  * The user should pass the remote network address of the host they are connected to.
25341  *
25342  * If an `Err` is returned here you must disconnect the connection immediately.
25343  *
25344  * Returns a small number of bytes to send to the remote node (currently always 50).
25345  *
25346  * Panics if descriptor is duplicative with some other descriptor which has not yet been
25347  * [`socket_disconnected()`].
25348  *
25349  * [`socket_disconnected()`]: PeerManager::socket_disconnected
25350  */
25351 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);
25352
25353 /**
25354  * Indicates a new inbound connection has been established to a node with an optional remote
25355  * network address.
25356  *
25357  * The remote network address adds the option to report a remote IP address back to a connecting
25358  * peer using the init message.
25359  * The user should pass the remote network address of the host they are connected to.
25360  *
25361  * May refuse the connection by returning an Err, but will never write bytes to the remote end
25362  * (outbound connector always speaks first). If an `Err` is returned here you must disconnect
25363  * the connection immediately.
25364  *
25365  * Panics if descriptor is duplicative with some other descriptor which has not yet been
25366  * [`socket_disconnected()`].
25367  *
25368  * [`socket_disconnected()`]: PeerManager::socket_disconnected
25369  */
25370 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);
25371
25372 /**
25373  * Indicates that there is room to write data to the given socket descriptor.
25374  *
25375  * May return an Err to indicate that the connection should be closed.
25376  *
25377  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
25378  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
25379  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
25380  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
25381  * sufficient!
25382  *
25383  * [`send_data`]: SocketDescriptor::send_data
25384  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
25385  */
25386 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
25387
25388 /**
25389  * Indicates that data was read from the given socket descriptor.
25390  *
25391  * May return an Err to indicate that the connection should be closed.
25392  *
25393  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
25394  * Thus, however, you should call [`process_events`] after any `read_event` to generate
25395  * [`send_data`] calls to handle responses.
25396  *
25397  * If `Ok(true)` is returned, further read_events should not be triggered until a
25398  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
25399  * send buffer).
25400  *
25401  * [`send_data`]: SocketDescriptor::send_data
25402  * [`process_events`]: PeerManager::process_events
25403  */
25404 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);
25405
25406 /**
25407  * Checks for any events generated by our handlers and processes them. Includes sending most
25408  * response messages as well as messages generated by calls to handler functions directly (eg
25409  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
25410  *
25411  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
25412  * issues!
25413  *
25414  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
25415  * or one of the other clients provided in our language bindings.
25416  *
25417  * Note that if there are any other calls to this function waiting on lock(s) this may return
25418  * without doing any work. All available events that need handling will be handled before the
25419  * other calls return.
25420  *
25421  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
25422  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
25423  * [`send_data`]: SocketDescriptor::send_data
25424  */
25425 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
25426
25427 /**
25428  * Indicates that the given socket descriptor's connection is now closed.
25429  */
25430 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
25431
25432 /**
25433  * Disconnect a peer given its node id.
25434  *
25435  * Set `no_connection_possible` to true to prevent any further connection with this peer,
25436  * force-closing any channels we have with it.
25437  *
25438  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
25439  * peer. Thus, be very careful about reentrancy issues.
25440  *
25441  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
25442  */
25443 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
25444
25445 /**
25446  * Disconnects all currently-connected peers. This is useful on platforms where there may be
25447  * an indication that TCP sockets have stalled even if we weren't around to time them out
25448  * using regular ping/pongs.
25449  */
25450 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
25451
25452 /**
25453  * Send pings to each peer and disconnect those which did not respond to the last round of
25454  * pings.
25455  *
25456  * This may be called on any timescale you want, however, roughly once every ten seconds is
25457  * preferred. The call rate determines both how often we send a ping to our peers and how much
25458  * time they have to respond before we disconnect them.
25459  *
25460  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
25461  * issues!
25462  *
25463  * [`send_data`]: SocketDescriptor::send_data
25464  */
25465 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
25466
25467 /**
25468  * Generates a signed node_announcement from the given arguments, sending it to all connected
25469  * peers. Note that peers will likely ignore this message unless we have at least one public
25470  * channel which has at least six confirmations on-chain.
25471  *
25472  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
25473  * node to humans. They carry no in-protocol meaning.
25474  *
25475  * `addresses` represent the set (possibly empty) of socket addresses on which this node
25476  * accepts incoming connections. These will be included in the node_announcement, publicly
25477  * tying these addresses together and to this node. If you wish to preserve user privacy,
25478  * addresses should likely contain only Tor Onion addresses.
25479  *
25480  * Panics if `addresses` is absurdly large (more than 100).
25481  *
25482  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
25483  */
25484 void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
25485
25486 /**
25487  * Gets the weight for an HTLC-Success transaction.
25488  */
25489 uint64_t htlc_success_tx_weight(bool opt_anchors);
25490
25491 /**
25492  * Gets the weight for an HTLC-Timeout transaction.
25493  */
25494 uint64_t htlc_timeout_tx_weight(bool opt_anchors);
25495
25496 /**
25497  * Build the commitment secret from the seed and the commitment number
25498  */
25499 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
25500
25501 /**
25502  * Build a closing transaction
25503  */
25504 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);
25505
25506 /**
25507  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
25508  */
25509 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
25510
25511 /**
25512  * Creates a copy of the CounterpartyCommitmentSecrets
25513  */
25514 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
25515
25516 /**
25517  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
25518  */
25519 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
25520
25521 /**
25522  * Returns the minimum index of all stored secrets. Note that indexes start
25523  * at 1 << 48 and get decremented by one for each new secret.
25524  */
25525 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
25526
25527 /**
25528  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
25529  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
25530  */
25531 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
25532
25533 /**
25534  * Returns the secret at `idx`.
25535  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
25536  *
25537  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25538  */
25539 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
25540
25541 /**
25542  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
25543  */
25544 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
25545
25546 /**
25547  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
25548  */
25549 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
25550
25551 /**
25552  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
25553  * from the base secret and the per_commitment_point.
25554  *
25555  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
25556  * generated (ie our own).
25557  */
25558 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
25559
25560 /**
25561  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
25562  * from the base point and the per_commitment_key. This is the public equivalent of
25563  * derive_private_key - using only public keys to derive a public key instead of private keys.
25564  *
25565  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
25566  * generated (ie our own).
25567  */
25568 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
25569
25570 /**
25571  * Derives a per-commitment-transaction revocation key from its constituent parts.
25572  *
25573  * Only the cheating participant owns a valid witness to propagate a revoked
25574  * commitment transaction, thus per_commitment_secret always come from cheater
25575  * and revocation_base_secret always come from punisher, which is the broadcaster
25576  * of the transaction spending with this key knowledge.
25577  *
25578  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
25579  * generated (ie our own).
25580  */
25581 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
25582
25583 /**
25584  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
25585  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
25586  * public key instead of private keys.
25587  *
25588  * Only the cheating participant owns a valid witness to propagate a revoked
25589  * commitment transaction, thus per_commitment_point always come from cheater
25590  * and revocation_base_point always come from punisher, which is the broadcaster
25591  * of the transaction spending with this key knowledge.
25592  *
25593  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
25594  * generated (ie our own).
25595  */
25596 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
25597
25598 /**
25599  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
25600  */
25601 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
25602
25603 /**
25604  * The broadcaster's per-commitment public key which was used to derive the other keys.
25605  */
25606 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
25607
25608 /**
25609  * The broadcaster's per-commitment public key which was used to derive the other keys.
25610  */
25611 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25612
25613 /**
25614  * The revocation key which is used to allow the broadcaster of the commitment
25615  * transaction to provide their counterparty the ability to punish them if they broadcast
25616  * an old state.
25617  */
25618 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
25619
25620 /**
25621  * The revocation key which is used to allow the broadcaster of the commitment
25622  * transaction to provide their counterparty the ability to punish them if they broadcast
25623  * an old state.
25624  */
25625 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25626
25627 /**
25628  * Broadcaster's HTLC Key
25629  */
25630 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
25631
25632 /**
25633  * Broadcaster's HTLC Key
25634  */
25635 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25636
25637 /**
25638  * Countersignatory's HTLC Key
25639  */
25640 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
25641
25642 /**
25643  * Countersignatory's HTLC Key
25644  */
25645 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25646
25647 /**
25648  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
25649  */
25650 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
25651
25652 /**
25653  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
25654  */
25655 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25656
25657 /**
25658  * Constructs a new TxCreationKeys given each field
25659  */
25660 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);
25661
25662 /**
25663  * Creates a copy of the TxCreationKeys
25664  */
25665 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
25666
25667 /**
25668  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
25669  */
25670 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
25671
25672 /**
25673  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
25674  */
25675 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
25676
25677 /**
25678  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
25679  */
25680 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
25681
25682 /**
25683  * The public key which is used to sign all commitment transactions, as it appears in the
25684  * on-chain channel lock-in 2-of-2 multisig output.
25685  */
25686 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
25687
25688 /**
25689  * The public key which is used to sign all commitment transactions, as it appears in the
25690  * on-chain channel lock-in 2-of-2 multisig output.
25691  */
25692 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25693
25694 /**
25695  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
25696  * revocation keys. This is combined with the per-commitment-secret generated by the
25697  * counterparty to create a secret which the counterparty can reveal to revoke previous
25698  * states.
25699  */
25700 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
25701
25702 /**
25703  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
25704  * revocation keys. This is combined with the per-commitment-secret generated by the
25705  * counterparty to create a secret which the counterparty can reveal to revoke previous
25706  * states.
25707  */
25708 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25709
25710 /**
25711  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
25712  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
25713  * static across every commitment transaction.
25714  */
25715 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
25716
25717 /**
25718  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
25719  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
25720  * static across every commitment transaction.
25721  */
25722 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25723
25724 /**
25725  * The base point which is used (with derive_public_key) to derive a per-commitment payment
25726  * public key which receives non-HTLC-encumbered funds which are only available for spending
25727  * after some delay (or can be claimed via the revocation path).
25728  */
25729 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
25730
25731 /**
25732  * The base point which is used (with derive_public_key) to derive a per-commitment payment
25733  * public key which receives non-HTLC-encumbered funds which are only available for spending
25734  * after some delay (or can be claimed via the revocation path).
25735  */
25736 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25737
25738 /**
25739  * The base point which is used (with derive_public_key) to derive a per-commitment public key
25740  * which is used to encumber HTLC-in-flight outputs.
25741  */
25742 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
25743
25744 /**
25745  * The base point which is used (with derive_public_key) to derive a per-commitment public key
25746  * which is used to encumber HTLC-in-flight outputs.
25747  */
25748 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25749
25750 /**
25751  * Constructs a new ChannelPublicKeys given each field
25752  */
25753 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);
25754
25755 /**
25756  * Creates a copy of the ChannelPublicKeys
25757  */
25758 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
25759
25760 /**
25761  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
25762  */
25763 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
25764
25765 /**
25766  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
25767  */
25768 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
25769
25770 /**
25771  * Create per-state keys from channel base points and the per-commitment point.
25772  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
25773  */
25774 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);
25775
25776 /**
25777  * Generate per-state keys from channel static keys.
25778  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
25779  */
25780 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);
25781
25782 /**
25783  * A script either spendable by the revocation
25784  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
25785  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
25786  */
25787 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
25788
25789 /**
25790  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
25791  */
25792 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
25793
25794 /**
25795  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
25796  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
25797  * need to compare this value to whether the commitment transaction in question is that of
25798  * the counterparty or our own.
25799  */
25800 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
25801
25802 /**
25803  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
25804  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
25805  * need to compare this value to whether the commitment transaction in question is that of
25806  * the counterparty or our own.
25807  */
25808 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
25809
25810 /**
25811  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
25812  * this divided by 1000.
25813  */
25814 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
25815
25816 /**
25817  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
25818  * this divided by 1000.
25819  */
25820 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
25821
25822 /**
25823  * The CLTV lock-time at which this HTLC expires.
25824  */
25825 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
25826
25827 /**
25828  * The CLTV lock-time at which this HTLC expires.
25829  */
25830 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
25831
25832 /**
25833  * The hash of the preimage which unlocks this HTLC.
25834  */
25835 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
25836
25837 /**
25838  * The hash of the preimage which unlocks this HTLC.
25839  */
25840 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25841
25842 /**
25843  * The position within the commitment transactions' outputs. This may be None if the value is
25844  * below the dust limit (in which case no output appears in the commitment transaction and the
25845  * value is spent to additional transaction fees).
25846  */
25847 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
25848
25849 /**
25850  * The position within the commitment transactions' outputs. This may be None if the value is
25851  * below the dust limit (in which case no output appears in the commitment transaction and the
25852  * value is spent to additional transaction fees).
25853  */
25854 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
25855
25856 /**
25857  * Constructs a new HTLCOutputInCommitment given each field
25858  */
25859 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);
25860
25861 /**
25862  * Creates a copy of the HTLCOutputInCommitment
25863  */
25864 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
25865
25866 /**
25867  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
25868  */
25869 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
25870
25871 /**
25872  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
25873  */
25874 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
25875
25876 /**
25877  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
25878  * does not need to have its previous_output_index filled.
25879  */
25880 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
25881
25882 /**
25883  * Gets the redeemscript for a funding output from the two funding public keys.
25884  * Note that the order of funding public keys does not matter.
25885  */
25886 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
25887
25888 /**
25889  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
25890  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
25891  * transaction which needs signing, and can be used to construct an HTLC transaction which is
25892  * broadcastable given a counterparty HTLC signature.
25893  *
25894  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
25895  * commitment transaction).
25896  */
25897 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);
25898
25899 /**
25900  * Gets the witnessScript for an anchor output from the funding public key.
25901  * The witness in the spending input must be:
25902  * <BIP 143 funding_signature>
25903  * After 16 blocks of confirmation, an alternative satisfying witness could be:
25904  * <>
25905  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
25906  */
25907 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
25908
25909 /**
25910  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
25911  */
25912 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
25913
25914 /**
25915  * Holder public keys
25916  */
25917 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
25918
25919 /**
25920  * Holder public keys
25921  */
25922 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
25923
25924 /**
25925  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
25926  */
25927 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
25928
25929 /**
25930  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
25931  */
25932 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
25933
25934 /**
25935  * Whether the holder is the initiator of this channel.
25936  * This is an input to the commitment number obscure factor computation.
25937  */
25938 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
25939
25940 /**
25941  * Whether the holder is the initiator of this channel.
25942  * This is an input to the commitment number obscure factor computation.
25943  */
25944 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
25945
25946 /**
25947  * The late-bound counterparty channel transaction parameters.
25948  * These parameters are populated at the point in the protocol where the counterparty provides them.
25949  *
25950  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25951  */
25952 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
25953
25954 /**
25955  * The late-bound counterparty channel transaction parameters.
25956  * These parameters are populated at the point in the protocol where the counterparty provides them.
25957  *
25958  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25959  */
25960 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
25961
25962 /**
25963  * The late-bound funding outpoint
25964  *
25965  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25966  */
25967 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
25968
25969 /**
25970  * The late-bound funding outpoint
25971  *
25972  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25973  */
25974 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
25975
25976 /**
25977  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
25978  */
25979 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
25980
25981 /**
25982  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
25983  */
25984 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
25985
25986 /**
25987  * Constructs a new ChannelTransactionParameters given each field
25988  */
25989 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);
25990
25991 /**
25992  * Creates a copy of the ChannelTransactionParameters
25993  */
25994 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
25995
25996 /**
25997  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
25998  */
25999 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
26000
26001 /**
26002  * Counter-party public keys
26003  */
26004 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
26005
26006 /**
26007  * Counter-party public keys
26008  */
26009 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
26010
26011 /**
26012  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
26013  */
26014 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
26015
26016 /**
26017  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
26018  */
26019 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
26020
26021 /**
26022  * Constructs a new CounterpartyChannelTransactionParameters given each field
26023  */
26024 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
26025
26026 /**
26027  * Creates a copy of the CounterpartyChannelTransactionParameters
26028  */
26029 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
26030
26031 /**
26032  * Whether the late bound parameters are populated.
26033  */
26034 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
26035
26036 /**
26037  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
26038  * given that the holder is the broadcaster.
26039  *
26040  * self.is_populated() must be true before calling this function.
26041  */
26042 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
26043
26044 /**
26045  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
26046  * given that the counterparty is the broadcaster.
26047  *
26048  * self.is_populated() must be true before calling this function.
26049  */
26050 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
26051
26052 /**
26053  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
26054  */
26055 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
26056
26057 /**
26058  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
26059  */
26060 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
26061
26062 /**
26063  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
26064  */
26065 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
26066
26067 /**
26068  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
26069  */
26070 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
26071
26072 /**
26073  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
26074  */
26075 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
26076
26077 /**
26078  * Get the channel pubkeys for the broadcaster
26079  */
26080 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
26081
26082 /**
26083  * Get the channel pubkeys for the countersignatory
26084  */
26085 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
26086
26087 /**
26088  * Get the contest delay applicable to the transactions.
26089  * Note that the contest delay was selected by the countersignatory.
26090  */
26091 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
26092
26093 /**
26094  * Whether the channel is outbound from the broadcaster.
26095  *
26096  * The boolean representing the side that initiated the channel is
26097  * an input to the commitment number obscure factor computation.
26098  */
26099 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
26100
26101 /**
26102  * The funding outpoint
26103  */
26104 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
26105
26106 /**
26107  * Whether to use anchors for this channel
26108  */
26109 MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
26110
26111 /**
26112  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
26113  */
26114 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
26115
26116 /**
26117  * Our counterparty's signature for the transaction
26118  */
26119 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
26120
26121 /**
26122  * Our counterparty's signature for the transaction
26123  */
26124 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
26125
26126 /**
26127  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
26128  *
26129  * Returns a copy of the field.
26130  */
26131 struct LDKCVec_SignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
26132
26133 /**
26134  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
26135  */
26136 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
26137
26138 /**
26139  * Creates a copy of the HolderCommitmentTransaction
26140  */
26141 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
26142
26143 /**
26144  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
26145  */
26146 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
26147
26148 /**
26149  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
26150  */
26151 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
26152
26153 /**
26154  * Create a new holder transaction with the given counterparty signatures.
26155  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
26156  */
26157 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);
26158
26159 /**
26160  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
26161  */
26162 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
26163
26164 /**
26165  * The commitment transaction
26166  */
26167 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
26168
26169 /**
26170  * The commitment transaction
26171  */
26172 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
26173
26174 /**
26175  * The txid for the commitment transaction.
26176  *
26177  * This is provided as a performance optimization, instead of calling transaction.txid()
26178  * multiple times.
26179  */
26180 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
26181
26182 /**
26183  * The txid for the commitment transaction.
26184  *
26185  * This is provided as a performance optimization, instead of calling transaction.txid()
26186  * multiple times.
26187  */
26188 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26189
26190 /**
26191  * Constructs a new BuiltCommitmentTransaction given each field
26192  */
26193 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
26194
26195 /**
26196  * Creates a copy of the BuiltCommitmentTransaction
26197  */
26198 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
26199
26200 /**
26201  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
26202  */
26203 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
26204
26205 /**
26206  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
26207  */
26208 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
26209
26210 /**
26211  * Get the SIGHASH_ALL sighash value of the transaction.
26212  *
26213  * This can be used to verify a signature.
26214  */
26215 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);
26216
26217 /**
26218  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
26219  * because we are about to broadcast a holder transaction.
26220  */
26221 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);
26222
26223 /**
26224  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
26225  */
26226 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
26227
26228 /**
26229  * Creates a copy of the ClosingTransaction
26230  */
26231 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
26232
26233 /**
26234  * Checks if two ClosingTransactions contain equal inner contents.
26235  */
26236 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
26237
26238 /**
26239  * Construct an object of the class
26240  */
26241 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);
26242
26243 /**
26244  * Trust our pre-built transaction.
26245  *
26246  * Applies a wrapper which allows access to the transaction.
26247  *
26248  * This should only be used if you fully trust the builder of this object. It should not
26249  * be used by an external signer - instead use the verify function.
26250  */
26251 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
26252
26253 /**
26254  * Verify our pre-built transaction.
26255  *
26256  * Applies a wrapper which allows access to the transaction.
26257  *
26258  * An external validating signer must call this method before signing
26259  * or using the built transaction.
26260  */
26261 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
26262
26263 /**
26264  * The value to be sent to the holder, or zero if the output will be omitted
26265  */
26266 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
26267
26268 /**
26269  * The value to be sent to the counterparty, or zero if the output will be omitted
26270  */
26271 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
26272
26273 /**
26274  * The destination of the holder's output
26275  */
26276 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
26277
26278 /**
26279  * The destination of the counterparty's output
26280  */
26281 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
26282
26283 /**
26284  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
26285  */
26286 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
26287
26288 /**
26289  * The pre-built Bitcoin commitment transaction
26290  */
26291 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
26292
26293 /**
26294  * Get the SIGHASH_ALL sighash value of the transaction.
26295  *
26296  * This can be used to verify a signature.
26297  */
26298 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);
26299
26300 /**
26301  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
26302  * because we are about to broadcast a holder transaction.
26303  */
26304 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);
26305
26306 /**
26307  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
26308  */
26309 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
26310
26311 /**
26312  * Creates a copy of the CommitmentTransaction
26313  */
26314 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
26315
26316 /**
26317  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
26318  */
26319 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
26320
26321 /**
26322  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
26323  */
26324 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
26325
26326 /**
26327  * The backwards-counting commitment number
26328  */
26329 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
26330
26331 /**
26332  * The value to be sent to the broadcaster
26333  */
26334 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
26335
26336 /**
26337  * The value to be sent to the counterparty
26338  */
26339 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
26340
26341 /**
26342  * The feerate paid per 1000-weight-unit in this commitment transaction.
26343  */
26344 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
26345
26346 /**
26347  * Trust our pre-built transaction and derived transaction creation public keys.
26348  *
26349  * Applies a wrapper which allows access to these fields.
26350  *
26351  * This should only be used if you fully trust the builder of this object.  It should not
26352  * be used by an external signer - instead use the verify function.
26353  */
26354 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
26355
26356 /**
26357  * Verify our pre-built transaction and derived transaction creation public keys.
26358  *
26359  * Applies a wrapper which allows access to these fields.
26360  *
26361  * An external validating signer must call this method before signing
26362  * or using the built transaction.
26363  */
26364 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);
26365
26366 /**
26367  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
26368  */
26369 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
26370
26371 /**
26372  * The transaction ID of the built Bitcoin transaction
26373  */
26374 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
26375
26376 /**
26377  * The pre-built Bitcoin commitment transaction
26378  */
26379 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
26380
26381 /**
26382  * The pre-calculated transaction creation public keys.
26383  */
26384 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
26385
26386 /**
26387  * Should anchors be used.
26388  */
26389 MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
26390
26391 /**
26392  * Get a signature for each HTLC which was included in the commitment transaction (ie for
26393  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
26394  *
26395  * The returned Vec has one entry for each HTLC, and in the same order.
26396  *
26397  * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
26398  */
26399 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);
26400
26401 /**
26402  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
26403  * shared secret first. This prevents on-chain observers from discovering how many commitment
26404  * transactions occurred in a channel before it was closed.
26405  *
26406  * This function gets the shared secret from relevant channel public keys and can be used to
26407  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
26408  */
26409 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
26410
26411 /**
26412  * Checks if two InitFeaturess contain equal inner contents.
26413  * This ignores pointers and is_owned flags and looks at the values in fields.
26414  * Two objects with NULL inner values will be considered "equal" here.
26415  */
26416 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
26417
26418 /**
26419  * Checks if two NodeFeaturess contain equal inner contents.
26420  * This ignores pointers and is_owned flags and looks at the values in fields.
26421  * Two objects with NULL inner values will be considered "equal" here.
26422  */
26423 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
26424
26425 /**
26426  * Checks if two ChannelFeaturess contain equal inner contents.
26427  * This ignores pointers and is_owned flags and looks at the values in fields.
26428  * Two objects with NULL inner values will be considered "equal" here.
26429  */
26430 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
26431
26432 /**
26433  * Checks if two InvoiceFeaturess contain equal inner contents.
26434  * This ignores pointers and is_owned flags and looks at the values in fields.
26435  * Two objects with NULL inner values will be considered "equal" here.
26436  */
26437 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
26438
26439 /**
26440  * Checks if two ChannelTypeFeaturess contain equal inner contents.
26441  * This ignores pointers and is_owned flags and looks at the values in fields.
26442  * Two objects with NULL inner values will be considered "equal" here.
26443  */
26444 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
26445
26446 /**
26447  * Creates a copy of the InitFeatures
26448  */
26449 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
26450
26451 /**
26452  * Creates a copy of the NodeFeatures
26453  */
26454 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
26455
26456 /**
26457  * Creates a copy of the ChannelFeatures
26458  */
26459 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
26460
26461 /**
26462  * Creates a copy of the InvoiceFeatures
26463  */
26464 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
26465
26466 /**
26467  * Creates a copy of the ChannelTypeFeatures
26468  */
26469 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
26470
26471 /**
26472  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
26473  */
26474 void InitFeatures_free(struct LDKInitFeatures this_obj);
26475
26476 /**
26477  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
26478  */
26479 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
26480
26481 /**
26482  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
26483  */
26484 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
26485
26486 /**
26487  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
26488  */
26489 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
26490
26491 /**
26492  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
26493  */
26494 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
26495
26496 /**
26497  * Returns the set of known init features that are related to channels. At least some of
26498  * these features are likely required for peers to talk to us.
26499  */
26500 MUST_USE_RES struct LDKInitFeatures InitFeatures_known_channel_features(void);
26501
26502 /**
26503  * Returns the set of known node features that are related to channels.
26504  */
26505 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known_channel_features(void);
26506
26507 /**
26508  * Create a blank Features with no features set
26509  */
26510 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
26511
26512 /**
26513  * Creates a Features with the bits set which are known by the implementation
26514  */
26515 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
26516
26517 /**
26518  * Returns true if this `Features` object contains unknown feature flags which are set as
26519  * \"required\".
26520  */
26521 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26522
26523 /**
26524  * Create a blank Features with no features set
26525  */
26526 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
26527
26528 /**
26529  * Creates a Features with the bits set which are known by the implementation
26530  */
26531 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
26532
26533 /**
26534  * Returns true if this `Features` object contains unknown feature flags which are set as
26535  * \"required\".
26536  */
26537 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26538
26539 /**
26540  * Create a blank Features with no features set
26541  */
26542 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
26543
26544 /**
26545  * Creates a Features with the bits set which are known by the implementation
26546  */
26547 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
26548
26549 /**
26550  * Returns true if this `Features` object contains unknown feature flags which are set as
26551  * \"required\".
26552  */
26553 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
26554
26555 /**
26556  * Create a blank Features with no features set
26557  */
26558 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
26559
26560 /**
26561  * Creates a Features with the bits set which are known by the implementation
26562  */
26563 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
26564
26565 /**
26566  * Returns true if this `Features` object contains unknown feature flags which are set as
26567  * \"required\".
26568  */
26569 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
26570
26571 /**
26572  * Create a blank Features with no features set
26573  */
26574 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
26575
26576 /**
26577  * Creates a Features with the bits set which are known by the implementation
26578  */
26579 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void);
26580
26581 /**
26582  * Returns true if this `Features` object contains unknown feature flags which are set as
26583  * \"required\".
26584  */
26585 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
26586
26587 /**
26588  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
26589  */
26590 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
26591
26592 /**
26593  * Read a InitFeatures from a byte array, created by InitFeatures_write
26594  */
26595 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
26596
26597 /**
26598  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
26599  */
26600 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
26601
26602 /**
26603  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
26604  */
26605 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
26606
26607 /**
26608  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
26609  */
26610 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
26611
26612 /**
26613  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
26614  */
26615 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
26616
26617 /**
26618  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
26619  */
26620 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
26621
26622 /**
26623  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
26624  */
26625 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
26626
26627 /**
26628  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
26629  */
26630 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
26631
26632 /**
26633  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
26634  */
26635 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
26636
26637 /**
26638  * Set this feature as optional.
26639  */
26640 void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
26641
26642 /**
26643  * Set this feature as required.
26644  */
26645 void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
26646
26647 /**
26648  * Checks if this feature is supported.
26649  */
26650 MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26651
26652 /**
26653  * Set this feature as optional.
26654  */
26655 void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26656
26657 /**
26658  * Set this feature as required.
26659  */
26660 void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26661
26662 /**
26663  * Checks if this feature is supported.
26664  */
26665 MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26666
26667 /**
26668  * Checks if this feature is required.
26669  */
26670 MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26671
26672 /**
26673  * Checks if this feature is required.
26674  */
26675 MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26676
26677 /**
26678  * Set this feature as optional.
26679  */
26680 void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
26681
26682 /**
26683  * Set this feature as required.
26684  */
26685 void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
26686
26687 /**
26688  * Checks if this feature is supported.
26689  */
26690 MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26691
26692 /**
26693  * Set this feature as optional.
26694  */
26695 void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
26696
26697 /**
26698  * Set this feature as required.
26699  */
26700 void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
26701
26702 /**
26703  * Checks if this feature is supported.
26704  */
26705 MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26706
26707 /**
26708  * Set this feature as optional.
26709  */
26710 void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26711
26712 /**
26713  * Set this feature as required.
26714  */
26715 void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26716
26717 /**
26718  * Checks if this feature is supported.
26719  */
26720 MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26721
26722 /**
26723  * Checks if this feature is required.
26724  */
26725 MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26726
26727 /**
26728  * Checks if this feature is required.
26729  */
26730 MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26731
26732 /**
26733  * Set this feature as optional.
26734  */
26735 void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
26736
26737 /**
26738  * Set this feature as required.
26739  */
26740 void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
26741
26742 /**
26743  * Checks if this feature is supported.
26744  */
26745 MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26746
26747 /**
26748  * Set this feature as optional.
26749  */
26750 void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26751
26752 /**
26753  * Set this feature as required.
26754  */
26755 void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26756
26757 /**
26758  * Checks if this feature is supported.
26759  */
26760 MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26761
26762 /**
26763  * Checks if this feature is required.
26764  */
26765 MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26766
26767 /**
26768  * Checks if this feature is required.
26769  */
26770 MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26771
26772 /**
26773  * Set this feature as optional.
26774  */
26775 void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
26776
26777 /**
26778  * Set this feature as required.
26779  */
26780 void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
26781
26782 /**
26783  * Checks if this feature is supported.
26784  */
26785 MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26786
26787 /**
26788  * Set this feature as optional.
26789  */
26790 void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26791
26792 /**
26793  * Set this feature as required.
26794  */
26795 void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26796
26797 /**
26798  * Checks if this feature is supported.
26799  */
26800 MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26801
26802 /**
26803  * Set this feature as optional.
26804  */
26805 void InvoiceFeatures_set_variable_length_onion_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
26806
26807 /**
26808  * Set this feature as required.
26809  */
26810 void InvoiceFeatures_set_variable_length_onion_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
26811
26812 /**
26813  * Checks if this feature is supported.
26814  */
26815 MUST_USE_RES bool InvoiceFeatures_supports_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
26816
26817 /**
26818  * Checks if this feature is required.
26819  */
26820 MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26821
26822 /**
26823  * Checks if this feature is required.
26824  */
26825 MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26826
26827 /**
26828  * Checks if this feature is required.
26829  */
26830 MUST_USE_RES bool InvoiceFeatures_requires_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
26831
26832 /**
26833  * Set this feature as optional.
26834  */
26835 void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
26836
26837 /**
26838  * Set this feature as required.
26839  */
26840 void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
26841
26842 /**
26843  * Checks if this feature is supported.
26844  */
26845 MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26846
26847 /**
26848  * Set this feature as optional.
26849  */
26850 void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26851
26852 /**
26853  * Set this feature as required.
26854  */
26855 void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26856
26857 /**
26858  * Checks if this feature is supported.
26859  */
26860 MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26861
26862 /**
26863  * Set this feature as optional.
26864  */
26865 void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
26866
26867 /**
26868  * Set this feature as required.
26869  */
26870 void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
26871
26872 /**
26873  * Checks if this feature is supported.
26874  */
26875 MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
26876
26877 /**
26878  * Checks if this feature is required.
26879  */
26880 MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26881
26882 /**
26883  * Checks if this feature is required.
26884  */
26885 MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26886
26887 /**
26888  * Checks if this feature is required.
26889  */
26890 MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
26891
26892 /**
26893  * Set this feature as optional.
26894  */
26895 void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
26896
26897 /**
26898  * Set this feature as required.
26899  */
26900 void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
26901
26902 /**
26903  * Checks if this feature is supported.
26904  */
26905 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26906
26907 /**
26908  * Set this feature as optional.
26909  */
26910 void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26911
26912 /**
26913  * Set this feature as required.
26914  */
26915 void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26916
26917 /**
26918  * Checks if this feature is supported.
26919  */
26920 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26921
26922 /**
26923  * Set this feature as optional.
26924  */
26925 void InvoiceFeatures_set_payment_secret_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
26926
26927 /**
26928  * Set this feature as required.
26929  */
26930 void InvoiceFeatures_set_payment_secret_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
26931
26932 /**
26933  * Checks if this feature is supported.
26934  */
26935 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
26936
26937 /**
26938  * Checks if this feature is required.
26939  */
26940 MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26941
26942 /**
26943  * Checks if this feature is required.
26944  */
26945 MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26946
26947 /**
26948  * Checks if this feature is required.
26949  */
26950 MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
26951
26952 /**
26953  * Set this feature as optional.
26954  */
26955 void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
26956
26957 /**
26958  * Set this feature as required.
26959  */
26960 void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
26961
26962 /**
26963  * Checks if this feature is supported.
26964  */
26965 MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26966
26967 /**
26968  * Set this feature as optional.
26969  */
26970 void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26971
26972 /**
26973  * Set this feature as required.
26974  */
26975 void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26976
26977 /**
26978  * Checks if this feature is supported.
26979  */
26980 MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26981
26982 /**
26983  * Set this feature as optional.
26984  */
26985 void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
26986
26987 /**
26988  * Set this feature as required.
26989  */
26990 void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
26991
26992 /**
26993  * Checks if this feature is supported.
26994  */
26995 MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
26996
26997 /**
26998  * Checks if this feature is required.
26999  */
27000 MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27001
27002 /**
27003  * Checks if this feature is required.
27004  */
27005 MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27006
27007 /**
27008  * Checks if this feature is required.
27009  */
27010 MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
27011
27012 /**
27013  * Set this feature as optional.
27014  */
27015 void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27016
27017 /**
27018  * Set this feature as required.
27019  */
27020 void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27021
27022 /**
27023  * Checks if this feature is supported.
27024  */
27025 MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27026
27027 /**
27028  * Set this feature as optional.
27029  */
27030 void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27031
27032 /**
27033  * Set this feature as required.
27034  */
27035 void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27036
27037 /**
27038  * Checks if this feature is supported.
27039  */
27040 MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27041
27042 /**
27043  * Checks if this feature is required.
27044  */
27045 MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27046
27047 /**
27048  * Checks if this feature is required.
27049  */
27050 MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27051
27052 /**
27053  * Set this feature as optional.
27054  */
27055 void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27056
27057 /**
27058  * Set this feature as required.
27059  */
27060 void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27061
27062 /**
27063  * Checks if this feature is supported.
27064  */
27065 MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27066
27067 /**
27068  * Set this feature as optional.
27069  */
27070 void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27071
27072 /**
27073  * Set this feature as required.
27074  */
27075 void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27076
27077 /**
27078  * Checks if this feature is supported.
27079  */
27080 MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27081
27082 /**
27083  * Checks if this feature is required.
27084  */
27085 MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27086
27087 /**
27088  * Checks if this feature is required.
27089  */
27090 MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27091
27092 /**
27093  * Set this feature as optional.
27094  */
27095 void InitFeatures_set_onion_messages_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27096
27097 /**
27098  * Set this feature as required.
27099  */
27100 void InitFeatures_set_onion_messages_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27101
27102 /**
27103  * Checks if this feature is supported.
27104  */
27105 MUST_USE_RES bool InitFeatures_supports_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27106
27107 /**
27108  * Set this feature as optional.
27109  */
27110 void NodeFeatures_set_onion_messages_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27111
27112 /**
27113  * Set this feature as required.
27114  */
27115 void NodeFeatures_set_onion_messages_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27116
27117 /**
27118  * Checks if this feature is supported.
27119  */
27120 MUST_USE_RES bool NodeFeatures_supports_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27121
27122 /**
27123  * Checks if this feature is required.
27124  */
27125 MUST_USE_RES bool InitFeatures_requires_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27126
27127 /**
27128  * Checks if this feature is required.
27129  */
27130 MUST_USE_RES bool NodeFeatures_requires_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27131
27132 /**
27133  * Set this feature as optional.
27134  */
27135 void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27136
27137 /**
27138  * Set this feature as required.
27139  */
27140 void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27141
27142 /**
27143  * Checks if this feature is supported.
27144  */
27145 MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27146
27147 /**
27148  * Set this feature as optional.
27149  */
27150 void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27151
27152 /**
27153  * Set this feature as required.
27154  */
27155 void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27156
27157 /**
27158  * Checks if this feature is supported.
27159  */
27160 MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27161
27162 /**
27163  * Checks if this feature is required.
27164  */
27165 MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27166
27167 /**
27168  * Checks if this feature is required.
27169  */
27170 MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27171
27172 /**
27173  * Set this feature as optional.
27174  */
27175 void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27176
27177 /**
27178  * Set this feature as required.
27179  */
27180 void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27181
27182 /**
27183  * Checks if this feature is supported.
27184  */
27185 MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27186
27187 /**
27188  * Set this feature as optional.
27189  */
27190 void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27191
27192 /**
27193  * Set this feature as required.
27194  */
27195 void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27196
27197 /**
27198  * Checks if this feature is supported.
27199  */
27200 MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27201
27202 /**
27203  * Set this feature as optional.
27204  */
27205 void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27206
27207 /**
27208  * Set this feature as required.
27209  */
27210 void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27211
27212 /**
27213  * Checks if this feature is supported.
27214  */
27215 MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27216
27217 /**
27218  * Checks if this feature is required.
27219  */
27220 MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27221
27222 /**
27223  * Checks if this feature is required.
27224  */
27225 MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27226
27227 /**
27228  * Checks if this feature is required.
27229  */
27230 MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27231
27232 /**
27233  * Set this feature as optional.
27234  */
27235 void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27236
27237 /**
27238  * Set this feature as required.
27239  */
27240 void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27241
27242 /**
27243  * Checks if this feature is supported.
27244  */
27245 MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27246
27247 /**
27248  * Set this feature as optional.
27249  */
27250 void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27251
27252 /**
27253  * Set this feature as required.
27254  */
27255 void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27256
27257 /**
27258  * Checks if this feature is supported.
27259  */
27260 MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27261
27262 /**
27263  * Set this feature as optional.
27264  */
27265 void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27266
27267 /**
27268  * Set this feature as required.
27269  */
27270 void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27271
27272 /**
27273  * Checks if this feature is supported.
27274  */
27275 MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27276
27277 /**
27278  * Checks if this feature is required.
27279  */
27280 MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27281
27282 /**
27283  * Checks if this feature is required.
27284  */
27285 MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27286
27287 /**
27288  * Checks if this feature is required.
27289  */
27290 MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27291
27292 /**
27293  * Set this feature as optional.
27294  */
27295 void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27296
27297 /**
27298  * Set this feature as required.
27299  */
27300 void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27301
27302 /**
27303  * Checks if this feature is supported.
27304  */
27305 MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27306
27307 /**
27308  * Checks if this feature is required.
27309  */
27310 MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27311
27312 /**
27313  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
27314  */
27315 void ShutdownScript_free(struct LDKShutdownScript this_obj);
27316
27317 /**
27318  * Creates a copy of the ShutdownScript
27319  */
27320 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
27321
27322 /**
27323  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
27324  */
27325 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
27326
27327 /**
27328  * The script that did not meet the requirements from [BOLT #2].
27329  *
27330  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
27331  */
27332 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
27333
27334 /**
27335  * The script that did not meet the requirements from [BOLT #2].
27336  *
27337  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
27338  */
27339 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
27340
27341 /**
27342  * Constructs a new InvalidShutdownScript given each field
27343  */
27344 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
27345
27346 /**
27347  * Creates a copy of the InvalidShutdownScript
27348  */
27349 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
27350
27351 /**
27352  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
27353  */
27354 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
27355
27356 /**
27357  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
27358  */
27359 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
27360
27361 /**
27362  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
27363  */
27364 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
27365
27366 /**
27367  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
27368  */
27369 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
27370
27371 /**
27372  * Generates a witness script pubkey from the given segwit version and program.
27373  *
27374  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
27375  * [`ShutdownScript::new_p2wsh`] instead.
27376  *
27377  * # Errors
27378  *
27379  * This function may return an error if `program` is invalid for the segwit `version`.
27380  */
27381 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program);
27382
27383 /**
27384  * Converts the shutdown script into the underlying [`Script`].
27385  */
27386 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
27387
27388 /**
27389  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
27390  *
27391  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27392  */
27393 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
27394
27395 /**
27396  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
27397  *
27398  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
27399  */
27400 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
27401
27402 /**
27403  * Calls the free function if one is set
27404  */
27405 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
27406
27407 /**
27408  * Calls the free function if one is set
27409  */
27410 void Type_free(struct LDKType this_ptr);
27411
27412 /**
27413  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
27414  */
27415 void NodeId_free(struct LDKNodeId this_obj);
27416
27417 /**
27418  * Creates a copy of the NodeId
27419  */
27420 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
27421
27422 /**
27423  * Create a new NodeId from a public key
27424  */
27425 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
27426
27427 /**
27428  * Get the public key slice from this NodeId
27429  */
27430 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
27431
27432 /**
27433  * Checks if two NodeIds contain equal inner contents.
27434  */
27435 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
27436
27437 /**
27438  * Serialize the NodeId object into a byte array which can be read by NodeId_read
27439  */
27440 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
27441
27442 /**
27443  * Read a NodeId from a byte array, created by NodeId_write
27444  */
27445 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
27446
27447 /**
27448  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
27449  */
27450 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
27451
27452 /**
27453  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
27454  */
27455 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
27456
27457 /**
27458  * Frees any resources used by the NetworkUpdate
27459  */
27460 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
27461
27462 /**
27463  * Creates a copy of the NetworkUpdate
27464  */
27465 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
27466
27467 /**
27468  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
27469  */
27470 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
27471
27472 /**
27473  * Utility method to constructs a new ChannelFailure-variant NetworkUpdate
27474  */
27475 struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent);
27476
27477 /**
27478  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
27479  */
27480 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
27481
27482 /**
27483  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
27484  */
27485 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
27486
27487 /**
27488  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
27489  */
27490 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
27491
27492 /**
27493  * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL.
27494  */
27495 void P2PGossipSync_free(struct LDKP2PGossipSync this_obj);
27496
27497 /**
27498  * Creates a new tracker of the actual state of the network of channels and nodes,
27499  * assuming an existing Network Graph.
27500  * Chain monitor is used to make sure announced channels exist on-chain,
27501  * channel data is correct, and that the announcement is signed with
27502  * channel owners' keys.
27503  */
27504 MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
27505
27506 /**
27507  * Adds a provider used to check new announcements. Does not affect
27508  * existing announcements unless they are updated.
27509  * Add, update or remove the provider would replace the current one.
27510  */
27511 void P2PGossipSync_add_chain_access(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
27512
27513 /**
27514  * Constructs a new EventHandler which calls the relevant methods on this_arg.
27515  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
27516  */
27517 struct LDKEventHandler NetworkGraph_as_EventHandler(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
27518
27519 /**
27520  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
27521  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
27522  */
27523 struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
27524
27525 /**
27526  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
27527  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
27528  */
27529 struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
27530
27531 /**
27532  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
27533  */
27534 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
27535
27536 /**
27537  * When the last update to the channel direction was issued.
27538  * Value is opaque, as set in the announcement.
27539  */
27540 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
27541
27542 /**
27543  * When the last update to the channel direction was issued.
27544  * Value is opaque, as set in the announcement.
27545  */
27546 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
27547
27548 /**
27549  * Whether the channel can be currently used for payments (in this one direction).
27550  */
27551 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
27552
27553 /**
27554  * Whether the channel can be currently used for payments (in this one direction).
27555  */
27556 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
27557
27558 /**
27559  * The difference in CLTV values that you must have when routing through this channel.
27560  */
27561 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
27562
27563 /**
27564  * The difference in CLTV values that you must have when routing through this channel.
27565  */
27566 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
27567
27568 /**
27569  * The minimum value, which must be relayed to the next hop via the channel
27570  */
27571 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
27572
27573 /**
27574  * The minimum value, which must be relayed to the next hop via the channel
27575  */
27576 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
27577
27578 /**
27579  * The maximum value which may be relayed to the next hop via the channel.
27580  */
27581 uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
27582
27583 /**
27584  * The maximum value which may be relayed to the next hop via the channel.
27585  */
27586 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
27587
27588 /**
27589  * Fees charged when the channel is used for routing
27590  */
27591 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
27592
27593 /**
27594  * Fees charged when the channel is used for routing
27595  */
27596 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
27597
27598 /**
27599  * Most recent update for the channel received from the network
27600  * Mostly redundant with the data we store in fields explicitly.
27601  * Everything else is useful only for sending out for initial routing sync.
27602  * Not stored if contains excess data to prevent DoS.
27603  *
27604  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27605  */
27606 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
27607
27608 /**
27609  * Most recent update for the channel received from the network
27610  * Mostly redundant with the data we store in fields explicitly.
27611  * Everything else is useful only for sending out for initial routing sync.
27612  * Not stored if contains excess data to prevent DoS.
27613  *
27614  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
27615  */
27616 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
27617
27618 /**
27619  * Constructs a new ChannelUpdateInfo given each field
27620  */
27621 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);
27622
27623 /**
27624  * Creates a copy of the ChannelUpdateInfo
27625  */
27626 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
27627
27628 /**
27629  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
27630  */
27631 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
27632
27633 /**
27634  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
27635  */
27636 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
27637
27638 /**
27639  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
27640  */
27641 void ChannelInfo_free(struct LDKChannelInfo this_obj);
27642
27643 /**
27644  * Protocol features of a channel communicated during its announcement
27645  */
27646 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
27647
27648 /**
27649  * Protocol features of a channel communicated during its announcement
27650  */
27651 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
27652
27653 /**
27654  * Source node of the first direction of a channel
27655  */
27656 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
27657
27658 /**
27659  * Source node of the first direction of a channel
27660  */
27661 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
27662
27663 /**
27664  * Details about the first direction of a channel
27665  *
27666  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27667  */
27668 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
27669
27670 /**
27671  * Details about the first direction of a channel
27672  *
27673  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
27674  */
27675 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
27676
27677 /**
27678  * Source node of the second direction of a channel
27679  */
27680 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
27681
27682 /**
27683  * Source node of the second direction of a channel
27684  */
27685 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
27686
27687 /**
27688  * Details about the second direction of a channel
27689  *
27690  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27691  */
27692 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
27693
27694 /**
27695  * Details about the second direction of a channel
27696  *
27697  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
27698  */
27699 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
27700
27701 /**
27702  * The channel capacity as seen on-chain, if chain lookup is available.
27703  */
27704 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
27705
27706 /**
27707  * The channel capacity as seen on-chain, if chain lookup is available.
27708  */
27709 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
27710
27711 /**
27712  * An initial announcement of the channel
27713  * Mostly redundant with the data we store in fields explicitly.
27714  * Everything else is useful only for sending out for initial routing sync.
27715  * Not stored if contains excess data to prevent DoS.
27716  *
27717  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27718  */
27719 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
27720
27721 /**
27722  * An initial announcement of the channel
27723  * Mostly redundant with the data we store in fields explicitly.
27724  * Everything else is useful only for sending out for initial routing sync.
27725  * Not stored if contains excess data to prevent DoS.
27726  *
27727  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
27728  */
27729 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
27730
27731 /**
27732  * Creates a copy of the ChannelInfo
27733  */
27734 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
27735
27736 /**
27737  * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
27738  *
27739  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27740  */
27741 MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags);
27742
27743 /**
27744  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
27745  */
27746 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
27747
27748 /**
27749  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
27750  */
27751 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
27752
27753 /**
27754  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
27755  */
27756 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
27757
27758 /**
27759  * Creates a copy of the DirectedChannelInfo
27760  */
27761 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
27762
27763 /**
27764  * Returns information for the channel.
27765  */
27766 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
27767
27768 /**
27769  * Returns information for the direction.
27770  *
27771  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27772  */
27773 MUST_USE_RES struct LDKChannelUpdateInfo DirectedChannelInfo_direction(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
27774
27775 /**
27776  * Returns the maximum HTLC amount allowed over the channel in the direction.
27777  */
27778 MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
27779
27780 /**
27781  * Returns the [`EffectiveCapacity`] of the channel in the direction.
27782  *
27783  * This is either the total capacity from the funding transaction, if known, or the
27784  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
27785  * otherwise.
27786  */
27787 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
27788
27789 /**
27790  * Frees any resources used by the EffectiveCapacity
27791  */
27792 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
27793
27794 /**
27795  * Creates a copy of the EffectiveCapacity
27796  */
27797 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
27798
27799 /**
27800  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
27801  */
27802 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
27803
27804 /**
27805  * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
27806  */
27807 struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat);
27808
27809 /**
27810  * Utility method to constructs a new Total-variant EffectiveCapacity
27811  */
27812 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, struct LDKCOption_u64Z htlc_maximum_msat);
27813
27814 /**
27815  * Utility method to constructs a new Infinite-variant EffectiveCapacity
27816  */
27817 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
27818
27819 /**
27820  * Utility method to constructs a new Unknown-variant EffectiveCapacity
27821  */
27822 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
27823
27824 /**
27825  * Returns the effective capacity denominated in millisatoshi.
27826  */
27827 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
27828
27829 /**
27830  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
27831  */
27832 void RoutingFees_free(struct LDKRoutingFees this_obj);
27833
27834 /**
27835  * Flat routing fee in satoshis
27836  */
27837 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
27838
27839 /**
27840  * Flat routing fee in satoshis
27841  */
27842 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
27843
27844 /**
27845  * Liquidity-based routing fee in millionths of a routed amount.
27846  * In other words, 10000 is 1%.
27847  */
27848 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
27849
27850 /**
27851  * Liquidity-based routing fee in millionths of a routed amount.
27852  * In other words, 10000 is 1%.
27853  */
27854 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
27855
27856 /**
27857  * Constructs a new RoutingFees given each field
27858  */
27859 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
27860
27861 /**
27862  * Checks if two RoutingFeess contain equal inner contents.
27863  * This ignores pointers and is_owned flags and looks at the values in fields.
27864  * Two objects with NULL inner values will be considered "equal" here.
27865  */
27866 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
27867
27868 /**
27869  * Creates a copy of the RoutingFees
27870  */
27871 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
27872
27873 /**
27874  * Checks if two RoutingFeess contain equal inner contents.
27875  */
27876 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
27877
27878 /**
27879  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
27880  */
27881 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
27882
27883 /**
27884  * Read a RoutingFees from a byte array, created by RoutingFees_write
27885  */
27886 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
27887
27888 /**
27889  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
27890  */
27891 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
27892
27893 /**
27894  * Protocol features the node announced support for
27895  */
27896 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
27897
27898 /**
27899  * Protocol features the node announced support for
27900  */
27901 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
27902
27903 /**
27904  * When the last known update to the node state was issued.
27905  * Value is opaque, as set in the announcement.
27906  */
27907 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
27908
27909 /**
27910  * When the last known update to the node state was issued.
27911  * Value is opaque, as set in the announcement.
27912  */
27913 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
27914
27915 /**
27916  * Color assigned to the node
27917  */
27918 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
27919
27920 /**
27921  * Color assigned to the node
27922  */
27923 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
27924
27925 /**
27926  * Moniker assigned to the node.
27927  * May be invalid or malicious (eg control chars),
27928  * should not be exposed to the user.
27929  */
27930 struct LDKNodeAlias NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
27931
27932 /**
27933  * Moniker assigned to the node.
27934  * May be invalid or malicious (eg control chars),
27935  * should not be exposed to the user.
27936  */
27937 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAlias val);
27938
27939 /**
27940  * Internet-level addresses via which one can connect to the node
27941  *
27942  * Returns a copy of the field.
27943  */
27944 struct LDKCVec_NetAddressZ NodeAnnouncementInfo_get_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
27945
27946 /**
27947  * Internet-level addresses via which one can connect to the node
27948  */
27949 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
27950
27951 /**
27952  * An initial announcement of the node
27953  * Mostly redundant with the data we store in fields explicitly.
27954  * Everything else is useful only for sending out for initial routing sync.
27955  * Not stored if contains excess data to prevent DoS.
27956  *
27957  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27958  */
27959 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
27960
27961 /**
27962  * An initial announcement of the node
27963  * Mostly redundant with the data we store in fields explicitly.
27964  * Everything else is useful only for sending out for initial routing sync.
27965  * Not stored if contains excess data to prevent DoS.
27966  *
27967  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
27968  */
27969 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
27970
27971 /**
27972  * Constructs a new NodeAnnouncementInfo given each field
27973  */
27974 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);
27975
27976 /**
27977  * Creates a copy of the NodeAnnouncementInfo
27978  */
27979 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
27980
27981 /**
27982  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
27983  */
27984 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
27985
27986 /**
27987  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
27988  */
27989 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
27990
27991 /**
27992  * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL.
27993  */
27994 void NodeAlias_free(struct LDKNodeAlias this_obj);
27995
27996 const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32];
27997
27998 void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27999
28000 /**
28001  * Constructs a new NodeAlias given each field
28002  */
28003 MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg);
28004
28005 /**
28006  * Creates a copy of the NodeAlias
28007  */
28008 struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig);
28009
28010 /**
28011  * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read
28012  */
28013 struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj);
28014
28015 /**
28016  * Read a NodeAlias from a byte array, created by NodeAlias_write
28017  */
28018 struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser);
28019
28020 /**
28021  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
28022  */
28023 void NodeInfo_free(struct LDKNodeInfo this_obj);
28024
28025 /**
28026  * All valid channels a node has announced
28027  *
28028  * Returns a copy of the field.
28029  */
28030 struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
28031
28032 /**
28033  * All valid channels a node has announced
28034  */
28035 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
28036
28037 /**
28038  * Lowest fees enabling routing via any of the enabled, known channels to a node.
28039  * The two fields (flat and proportional fee) are independent,
28040  * meaning they don't have to refer to the same channel.
28041  *
28042  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28043  */
28044 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
28045
28046 /**
28047  * Lowest fees enabling routing via any of the enabled, known channels to a node.
28048  * The two fields (flat and proportional fee) are independent,
28049  * meaning they don't have to refer to the same channel.
28050  *
28051  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28052  */
28053 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
28054
28055 /**
28056  * More information about a node from node_announcement.
28057  * Optional because we store a Node entry after learning about it from
28058  * a channel announcement, but before receiving a node announcement.
28059  *
28060  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28061  */
28062 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
28063
28064 /**
28065  * More information about a node from node_announcement.
28066  * Optional because we store a Node entry after learning about it from
28067  * a channel announcement, but before receiving a node announcement.
28068  *
28069  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28070  */
28071 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
28072
28073 /**
28074  * Constructs a new NodeInfo given each field
28075  */
28076 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
28077
28078 /**
28079  * Creates a copy of the NodeInfo
28080  */
28081 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
28082
28083 /**
28084  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
28085  */
28086 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
28087
28088 /**
28089  * Read a NodeInfo from a byte array, created by NodeInfo_write
28090  */
28091 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
28092
28093 /**
28094  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
28095  */
28096 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
28097
28098 /**
28099  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
28100  */
28101 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg);
28102
28103 /**
28104  * Creates a new, empty, network graph.
28105  */
28106 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKLogger logger);
28107
28108 /**
28109  * Returns a read-only view of the network graph.
28110  */
28111 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
28112
28113 /**
28114  * The unix timestamp provided by the most recent rapid gossip sync.
28115  * It will be set by the rapid sync process after every sync completion.
28116  */
28117 MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
28118
28119 /**
28120  * Update the unix timestamp provided by the most recent rapid gossip sync.
28121  * This should be done automatically by the rapid sync process after every sync completion.
28122  */
28123 void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp);
28124
28125 /**
28126  * For an already known node (from channel announcements), update its stored properties from a
28127  * given node announcement.
28128  *
28129  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
28130  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
28131  * routing messages from a source using a protocol other than the lightning P2P protocol.
28132  */
28133 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
28134
28135 /**
28136  * For an already known node (from channel announcements), update its stored properties from a
28137  * given node announcement without verifying the associated signatures. Because we aren't
28138  * given the associated signatures here we cannot relay the node announcement to any of our
28139  * peers.
28140  */
28141 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);
28142
28143 /**
28144  * Store or update channel info from a channel announcement.
28145  *
28146  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
28147  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
28148  * routing messages from a source using a protocol other than the lightning P2P protocol.
28149  *
28150  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
28151  * the corresponding UTXO exists on chain and is correctly-formatted.
28152  */
28153 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);
28154
28155 /**
28156  * Store or update channel info from a channel announcement without verifying the associated
28157  * signatures. Because we aren't given the associated signatures here we cannot relay the
28158  * channel announcement to any of our peers.
28159  *
28160  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
28161  * the corresponding UTXO exists on chain and is correctly-formatted.
28162  */
28163 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);
28164
28165 /**
28166  * Update channel from partial announcement data received via rapid gossip sync
28167  *
28168  * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the
28169  * rapid gossip sync server)
28170  *
28171  * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields.
28172  */
28173 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);
28174
28175 /**
28176  * Marks a channel in the graph as failed if a corresponding HTLC fail was sent.
28177  * If permanent, removes a channel from the local storage.
28178  * May cause the removal of nodes too, if this was their last channel.
28179  * If not permanent, makes channels unavailable for routing.
28180  */
28181 void NetworkGraph_channel_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
28182
28183 /**
28184  * Marks a node in the graph as failed.
28185  */
28186 void NetworkGraph_node_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
28187
28188 /**
28189  * Removes information about channels that we haven't heard any updates about in some time.
28190  * This can be used regularly to prune the network graph of channels that likely no longer
28191  * exist.
28192  *
28193  * While there is no formal requirement that nodes regularly re-broadcast their channel
28194  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
28195  * pruning occur for updates which are at least two weeks old, which we implement here.
28196  *
28197  * Note that for users of the `lightning-background-processor` crate this method may be
28198  * automatically called regularly for you.
28199  *
28200  * This method is only available with the `std` feature. See
28201  * [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use.
28202  */
28203 void NetworkGraph_remove_stale_channels(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
28204
28205 /**
28206  * Removes information about channels that we haven't heard any updates about in some time.
28207  * This can be used regularly to prune the network graph of channels that likely no longer
28208  * exist.
28209  *
28210  * While there is no formal requirement that nodes regularly re-broadcast their channel
28211  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
28212  * pruning occur for updates which are at least two weeks old, which we implement here.
28213  *
28214  * This function takes the current unix time as an argument. For users with the `std` feature
28215  * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
28216  */
28217 void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
28218
28219 /**
28220  * For an already known (from announcement) channel, update info about one of the directions
28221  * of the channel.
28222  *
28223  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
28224  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
28225  * routing messages from a source using a protocol other than the lightning P2P protocol.
28226  *
28227  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
28228  * materially in the future will be rejected.
28229  */
28230 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
28231
28232 /**
28233  * For an already known (from announcement) channel, update info about one of the directions
28234  * of the channel without verifying the associated signatures. Because we aren't given the
28235  * associated signatures here we cannot relay the channel update to any of our peers.
28236  *
28237  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
28238  * materially in the future will be rejected.
28239  */
28240 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
28241
28242 /**
28243  * Returns information on a channel with the given id.
28244  *
28245  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28246  */
28247 MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id);
28248
28249 /**
28250  * Returns the list of channels in the graph
28251  */
28252 MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg);
28253
28254 /**
28255  * Returns information on a node with the given id.
28256  *
28257  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28258  */
28259 MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
28260
28261 /**
28262  * Returns the list of nodes in the graph
28263  */
28264 MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg);
28265
28266 /**
28267  * Get network addresses by node id.
28268  * Returns None if the requested node is completely unknown,
28269  * or if node announcement for the node was never received.
28270  */
28271 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
28272
28273 /**
28274  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
28275  */
28276 void RouteHop_free(struct LDKRouteHop this_obj);
28277
28278 /**
28279  * The node_id of the node at this hop.
28280  */
28281 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
28282
28283 /**
28284  * The node_id of the node at this hop.
28285  */
28286 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28287
28288 /**
28289  * The node_announcement features of the node at this hop. For the last hop, these may be
28290  * amended to match the features present in the invoice this node generated.
28291  */
28292 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
28293
28294 /**
28295  * The node_announcement features of the node at this hop. For the last hop, these may be
28296  * amended to match the features present in the invoice this node generated.
28297  */
28298 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
28299
28300 /**
28301  * The channel that should be used from the previous hop to reach this node.
28302  */
28303 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
28304
28305 /**
28306  * The channel that should be used from the previous hop to reach this node.
28307  */
28308 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
28309
28310 /**
28311  * The channel_announcement features of the channel that should be used from the previous hop
28312  * to reach this node.
28313  */
28314 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
28315
28316 /**
28317  * The channel_announcement features of the channel that should be used from the previous hop
28318  * to reach this node.
28319  */
28320 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
28321
28322 /**
28323  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
28324  * For the last hop, this should be the full value of the payment (might be more than
28325  * requested if we had to match htlc_minimum_msat).
28326  */
28327 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
28328
28329 /**
28330  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
28331  * For the last hop, this should be the full value of the payment (might be more than
28332  * requested if we had to match htlc_minimum_msat).
28333  */
28334 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
28335
28336 /**
28337  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
28338  * expected at the destination, in excess of the current block height.
28339  */
28340 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
28341
28342 /**
28343  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
28344  * expected at the destination, in excess of the current block height.
28345  */
28346 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
28347
28348 /**
28349  * Constructs a new RouteHop given each field
28350  */
28351 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);
28352
28353 /**
28354  * Creates a copy of the RouteHop
28355  */
28356 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
28357
28358 /**
28359  * Checks if two RouteHops contain equal inner contents.
28360  */
28361 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
28362
28363 /**
28364  * Checks if two RouteHops contain equal inner contents.
28365  * This ignores pointers and is_owned flags and looks at the values in fields.
28366  * Two objects with NULL inner values will be considered "equal" here.
28367  */
28368 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
28369
28370 /**
28371  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
28372  */
28373 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
28374
28375 /**
28376  * Read a RouteHop from a byte array, created by RouteHop_write
28377  */
28378 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
28379
28380 /**
28381  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
28382  */
28383 void Route_free(struct LDKRoute this_obj);
28384
28385 /**
28386  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
28387  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
28388  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
28389  * least length one. While the maximum length of any given path is variable, keeping the length
28390  * of any path less or equal to 19 should currently ensure it is viable.
28391  */
28392 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
28393
28394 /**
28395  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
28396  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
28397  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
28398  * least length one. While the maximum length of any given path is variable, keeping the length
28399  * of any path less or equal to 19 should currently ensure it is viable.
28400  */
28401 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
28402
28403 /**
28404  * The `payment_params` parameter passed to [`find_route`].
28405  * This is used by `ChannelManager` to track information which may be required for retries,
28406  * provided back to you via [`Event::PaymentPathFailed`].
28407  *
28408  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
28409  *
28410  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28411  */
28412 struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr);
28413
28414 /**
28415  * The `payment_params` parameter passed to [`find_route`].
28416  * This is used by `ChannelManager` to track information which may be required for retries,
28417  * provided back to you via [`Event::PaymentPathFailed`].
28418  *
28419  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
28420  *
28421  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28422  */
28423 void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
28424
28425 /**
28426  * Constructs a new Route given each field
28427  */
28428 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg);
28429
28430 /**
28431  * Creates a copy of the Route
28432  */
28433 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
28434
28435 /**
28436  * Checks if two Routes contain equal inner contents.
28437  */
28438 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
28439
28440 /**
28441  * Checks if two Routes contain equal inner contents.
28442  * This ignores pointers and is_owned flags and looks at the values in fields.
28443  * Two objects with NULL inner values will be considered "equal" here.
28444  */
28445 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
28446
28447 /**
28448  * Returns the total amount of fees paid on this [`Route`].
28449  *
28450  * This doesn't include any extra payment made to the recipient, which can happen in excess of
28451  * the amount passed to [`find_route`]'s `params.final_value_msat`.
28452  */
28453 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
28454
28455 /**
28456  * Returns the total amount paid on this [`Route`], excluding the fees.
28457  */
28458 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
28459
28460 /**
28461  * Serialize the Route object into a byte array which can be read by Route_read
28462  */
28463 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
28464
28465 /**
28466  * Read a Route from a byte array, created by Route_write
28467  */
28468 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
28469
28470 /**
28471  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
28472  */
28473 void RouteParameters_free(struct LDKRouteParameters this_obj);
28474
28475 /**
28476  * The parameters of the failed payment path.
28477  */
28478 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
28479
28480 /**
28481  * The parameters of the failed payment path.
28482  */
28483 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
28484
28485 /**
28486  * The amount in msats sent on the failed payment path.
28487  */
28488 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
28489
28490 /**
28491  * The amount in msats sent on the failed payment path.
28492  */
28493 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
28494
28495 /**
28496  * The CLTV on the final hop of the failed payment path.
28497  */
28498 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
28499
28500 /**
28501  * The CLTV on the final hop of the failed payment path.
28502  */
28503 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
28504
28505 /**
28506  * Constructs a new RouteParameters given each field
28507  */
28508 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);
28509
28510 /**
28511  * Creates a copy of the RouteParameters
28512  */
28513 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
28514
28515 /**
28516  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
28517  */
28518 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
28519
28520 /**
28521  * Read a RouteParameters from a byte array, created by RouteParameters_write
28522  */
28523 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
28524
28525 /**
28526  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
28527  */
28528 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
28529
28530 /**
28531  * The node id of the payee.
28532  */
28533 struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
28534
28535 /**
28536  * The node id of the payee.
28537  */
28538 void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28539
28540 /**
28541  * Features supported by the payee.
28542  *
28543  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
28544  * does not contain any features.
28545  *
28546  * [`for_keysend`]: Self::for_keysend
28547  *
28548  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28549  */
28550 struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
28551
28552 /**
28553  * Features supported by the payee.
28554  *
28555  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
28556  * does not contain any features.
28557  *
28558  * [`for_keysend`]: Self::for_keysend
28559  *
28560  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28561  */
28562 void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
28563
28564 /**
28565  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
28566  */
28567 struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
28568
28569 /**
28570  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
28571  */
28572 void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
28573
28574 /**
28575  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
28576  */
28577 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
28578
28579 /**
28580  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
28581  */
28582 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
28583
28584 /**
28585  * The maximum total CLTV delta we accept for the route.
28586  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
28587  */
28588 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
28589
28590 /**
28591  * The maximum total CLTV delta we accept for the route.
28592  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
28593  */
28594 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
28595
28596 /**
28597  * The maximum number of paths that may be used by (MPP) payments.
28598  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
28599  */
28600 uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
28601
28602 /**
28603  * The maximum number of paths that may be used by (MPP) payments.
28604  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
28605  */
28606 void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
28607
28608 /**
28609  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
28610  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
28611  * a lower value prefers to send larger MPP parts, potentially saturating channels and
28612  * increasing failure probability for those paths.
28613  *
28614  * Note that this restriction will be relaxed during pathfinding after paths which meet this
28615  * restriction have been found. While paths which meet this criteria will be searched for, it
28616  * is ultimately up to the scorer to select them over other paths.
28617  *
28618  * A value of 0 will allow payments up to and including a channel's total announced usable
28619  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
28620  *
28621  * Default value: 2
28622  */
28623 uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
28624
28625 /**
28626  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
28627  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
28628  * a lower value prefers to send larger MPP parts, potentially saturating channels and
28629  * increasing failure probability for those paths.
28630  *
28631  * Note that this restriction will be relaxed during pathfinding after paths which meet this
28632  * restriction have been found. While paths which meet this criteria will be searched for, it
28633  * is ultimately up to the scorer to select them over other paths.
28634  *
28635  * A value of 0 will allow payments up to and including a channel's total announced usable
28636  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
28637  *
28638  * Default value: 2
28639  */
28640 void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
28641
28642 /**
28643  * A list of SCIDs which this payment was previously attempted over and which caused the
28644  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
28645  * these SCIDs.
28646  *
28647  * Returns a copy of the field.
28648  */
28649 struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
28650
28651 /**
28652  * A list of SCIDs which this payment was previously attempted over and which caused the
28653  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
28654  * these SCIDs.
28655  */
28656 void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
28657
28658 /**
28659  * Constructs a new PaymentParameters given each field
28660  */
28661 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);
28662
28663 /**
28664  * Creates a copy of the PaymentParameters
28665  */
28666 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
28667
28668 /**
28669  * Checks if two PaymentParameterss contain equal inner contents.
28670  */
28671 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
28672
28673 /**
28674  * Checks if two PaymentParameterss contain equal inner contents.
28675  * This ignores pointers and is_owned flags and looks at the values in fields.
28676  * Two objects with NULL inner values will be considered "equal" here.
28677  */
28678 bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
28679
28680 /**
28681  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
28682  */
28683 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
28684
28685 /**
28686  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
28687  */
28688 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser);
28689
28690 /**
28691  * Creates a payee with the node id of the given `pubkey`.
28692  */
28693 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey);
28694
28695 /**
28696  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
28697  */
28698 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey);
28699
28700 /**
28701  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
28702  */
28703 void RouteHint_free(struct LDKRouteHint this_obj);
28704
28705 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
28706
28707 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
28708
28709 /**
28710  * Constructs a new RouteHint given each field
28711  */
28712 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
28713
28714 /**
28715  * Creates a copy of the RouteHint
28716  */
28717 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
28718
28719 /**
28720  * Checks if two RouteHints contain equal inner contents.
28721  */
28722 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
28723
28724 /**
28725  * Checks if two RouteHints contain equal inner contents.
28726  * This ignores pointers and is_owned flags and looks at the values in fields.
28727  * Two objects with NULL inner values will be considered "equal" here.
28728  */
28729 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
28730
28731 /**
28732  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
28733  */
28734 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
28735
28736 /**
28737  * Read a RouteHint from a byte array, created by RouteHint_write
28738  */
28739 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
28740
28741 /**
28742  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
28743  */
28744 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
28745
28746 /**
28747  * The node_id of the non-target end of the route
28748  */
28749 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
28750
28751 /**
28752  * The node_id of the non-target end of the route
28753  */
28754 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28755
28756 /**
28757  * The short_channel_id of this channel
28758  */
28759 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
28760
28761 /**
28762  * The short_channel_id of this channel
28763  */
28764 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
28765
28766 /**
28767  * The fees which must be paid to use this channel
28768  */
28769 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
28770
28771 /**
28772  * The fees which must be paid to use this channel
28773  */
28774 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
28775
28776 /**
28777  * The difference in CLTV values between this node and the next node.
28778  */
28779 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
28780
28781 /**
28782  * The difference in CLTV values between this node and the next node.
28783  */
28784 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
28785
28786 /**
28787  * The minimum value, in msat, which must be relayed to the next hop.
28788  */
28789 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
28790
28791 /**
28792  * The minimum value, in msat, which must be relayed to the next hop.
28793  */
28794 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
28795
28796 /**
28797  * The maximum value in msat available for routing with a single HTLC.
28798  */
28799 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
28800
28801 /**
28802  * The maximum value in msat available for routing with a single HTLC.
28803  */
28804 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
28805
28806 /**
28807  * Constructs a new RouteHintHop given each field
28808  */
28809 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);
28810
28811 /**
28812  * Creates a copy of the RouteHintHop
28813  */
28814 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
28815
28816 /**
28817  * Checks if two RouteHintHops contain equal inner contents.
28818  */
28819 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
28820
28821 /**
28822  * Checks if two RouteHintHops contain equal inner contents.
28823  * This ignores pointers and is_owned flags and looks at the values in fields.
28824  * Two objects with NULL inner values will be considered "equal" here.
28825  */
28826 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
28827
28828 /**
28829  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
28830  */
28831 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
28832
28833 /**
28834  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
28835  */
28836 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
28837
28838 /**
28839  * Finds a route from us (payer) to the given target node (payee).
28840  *
28841  * If the payee provided features in their invoice, they should be provided via `params.payee`.
28842  * Without this, MPP will only be used if the payee's features are available in the network graph.
28843  *
28844  * Private routing paths between a public node and the target may be included in `params.payee`.
28845  *
28846  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
28847  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
28848  * from `network_graph` will be ignored, and only those in `first_hops` will be used.
28849  *
28850  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
28851  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
28852  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
28853  *
28854  * # Note
28855  *
28856  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
28857  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
28858  * function.
28859  *
28860  * # Panics
28861  *
28862  * Panics if first_hops contains channels without short_channel_ids;
28863  * [`ChannelManager::list_usable_channels`] will never include such channels.
28864  *
28865  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
28866  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
28867  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
28868  *
28869  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
28870  */
28871 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]);
28872
28873 /**
28874  * Construct a route from us (payer) to the target node (payee) via the given hops (which should
28875  * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
28876  *
28877  * Re-uses logic from `find_route`, so the restrictions described there also apply here.
28878  */
28879 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]);
28880
28881 /**
28882  * Calls the free function if one is set
28883  */
28884 void Score_free(struct LDKScore this_ptr);
28885
28886 /**
28887  * Calls the free function if one is set
28888  */
28889 void LockableScore_free(struct LDKLockableScore this_ptr);
28890
28891 /**
28892  * Calls the free function if one is set
28893  */
28894 void WriteableScore_free(struct LDKWriteableScore this_ptr);
28895
28896 /**
28897  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
28898  */
28899 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
28900
28901 /**
28902  * Frees any resources used by the MultiThreadedScoreLock, if is_owned is set and inner is non-NULL.
28903  */
28904 void MultiThreadedScoreLock_free(struct LDKMultiThreadedScoreLock this_obj);
28905
28906 /**
28907  * Constructs a new Score which calls the relevant methods on this_arg.
28908  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
28909  */
28910 struct LDKScore MultiThreadedScoreLock_as_Score(const struct LDKMultiThreadedScoreLock *NONNULL_PTR this_arg);
28911
28912 /**
28913  * Serialize the MultiThreadedScoreLock object into a byte array which can be read by MultiThreadedScoreLock_read
28914  */
28915 struct LDKCVec_u8Z MultiThreadedScoreLock_write(const struct LDKMultiThreadedScoreLock *NONNULL_PTR obj);
28916
28917 /**
28918  * Constructs a new LockableScore which calls the relevant methods on this_arg.
28919  * This copies the `inner` pointer in this_arg and thus the returned LockableScore must be freed before this_arg is
28920  */
28921 struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
28922
28923 /**
28924  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
28925  */
28926 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
28927
28928 /**
28929  * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL.
28930  */
28931 void ChannelUsage_free(struct LDKChannelUsage this_obj);
28932
28933 /**
28934  * The amount to send through the channel, denominated in millisatoshis.
28935  */
28936 uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
28937
28938 /**
28939  * The amount to send through the channel, denominated in millisatoshis.
28940  */
28941 void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
28942
28943 /**
28944  * Total amount, denominated in millisatoshis, already allocated to send through the channel
28945  * as part of a multi-path payment.
28946  */
28947 uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
28948
28949 /**
28950  * Total amount, denominated in millisatoshis, already allocated to send through the channel
28951  * as part of a multi-path payment.
28952  */
28953 void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
28954
28955 /**
28956  * The effective capacity of the channel.
28957  */
28958 struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
28959
28960 /**
28961  * The effective capacity of the channel.
28962  */
28963 void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val);
28964
28965 /**
28966  * Constructs a new ChannelUsage given each field
28967  */
28968 MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg);
28969
28970 /**
28971  * Creates a copy of the ChannelUsage
28972  */
28973 struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig);
28974
28975 /**
28976  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
28977  */
28978 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
28979
28980 /**
28981  * Creates a copy of the FixedPenaltyScorer
28982  */
28983 struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
28984
28985 /**
28986  * Creates a new scorer using `penalty_msat`.
28987  */
28988 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
28989
28990 /**
28991  * Constructs a new Score which calls the relevant methods on this_arg.
28992  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
28993  */
28994 struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
28995
28996 /**
28997  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
28998  */
28999 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
29000
29001 /**
29002  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
29003  */
29004 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
29005
29006 /**
29007  * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
29008  */
29009 void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
29010
29011 /**
29012  * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL.
29013  */
29014 void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj);
29015
29016 /**
29017  * A fixed penalty in msats to apply to each channel.
29018  *
29019  * Default value: 500 msat
29020  */
29021 uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
29022
29023 /**
29024  * A fixed penalty in msats to apply to each channel.
29025  *
29026  * Default value: 500 msat
29027  */
29028 void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
29029
29030 /**
29031  * A multiplier used with the payment amount to calculate a fixed penalty applied to each
29032  * channel, in excess of the [`base_penalty_msat`].
29033  *
29034  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
29035  * fees plus penalty) for large payments. The penalty is computed as the product of this
29036  * multiplier and `2^30`ths of the payment amount.
29037  *
29038  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
29039  *
29040  * Default value: 8,192 msat
29041  *
29042  * [`base_penalty_msat`]: Self::base_penalty_msat
29043  */
29044 uint64_t ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
29045
29046 /**
29047  * A multiplier used with the payment amount to calculate a fixed penalty applied to each
29048  * channel, in excess of the [`base_penalty_msat`].
29049  *
29050  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
29051  * fees plus penalty) for large payments. The penalty is computed as the product of this
29052  * multiplier and `2^30`ths of the payment amount.
29053  *
29054  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
29055  *
29056  * Default value: 8,192 msat
29057  *
29058  * [`base_penalty_msat`]: Self::base_penalty_msat
29059  */
29060 void ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
29061
29062 /**
29063  * A multiplier used in conjunction with the negative `log10` of the channel's success
29064  * probability for a payment to determine the liquidity penalty.
29065  *
29066  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
29067  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
29068  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
29069  * lower bounding the success probability to `0.01`) when the amount falls within the
29070  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
29071  * result in a `u64::max_value` penalty, however.
29072  *
29073  * Default value: 40,000 msat
29074  *
29075  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
29076  */
29077 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
29078
29079 /**
29080  * A multiplier used in conjunction with the negative `log10` of the channel's success
29081  * probability for a payment to determine the liquidity penalty.
29082  *
29083  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
29084  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
29085  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
29086  * lower bounding the success probability to `0.01`) when the amount falls within the
29087  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
29088  * result in a `u64::max_value` penalty, however.
29089  *
29090  * Default value: 40,000 msat
29091  *
29092  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
29093  */
29094 void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
29095
29096 /**
29097  * The time required to elapse before any knowledge learned about channel liquidity balances is
29098  * cut in half.
29099  *
29100  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
29101  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
29102  * the certainty of the channel liquidity balance.
29103  *
29104  * Default value: 1 hour
29105  *
29106  * # Note
29107  *
29108  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
29109  * liquidity knowledge will never decay except when the bounds cross.
29110  */
29111 uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
29112
29113 /**
29114  * The time required to elapse before any knowledge learned about channel liquidity balances is
29115  * cut in half.
29116  *
29117  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
29118  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
29119  * the certainty of the channel liquidity balance.
29120  *
29121  * Default value: 1 hour
29122  *
29123  * # Note
29124  *
29125  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
29126  * liquidity knowledge will never decay except when the bounds cross.
29127  */
29128 void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
29129
29130 /**
29131  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
29132  * channel's success probability for the payment to determine the amount penalty.
29133  *
29134  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
29135  * fees plus penalty) for large payments. The penalty is computed as the product of this
29136  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
29137  * success probability.
29138  *
29139  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
29140  *
29141  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
29142  * the amount will result in a penalty of the multiplier. And, as the success probability
29143  * decreases, the negative `log10` weighting will increase dramatically. For higher success
29144  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
29145  * fall below `1`.
29146  *
29147  * Default value: 256 msat
29148  */
29149 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
29150
29151 /**
29152  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
29153  * channel's success probability for the payment to determine the amount penalty.
29154  *
29155  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
29156  * fees plus penalty) for large payments. The penalty is computed as the product of this
29157  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
29158  * success probability.
29159  *
29160  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
29161  *
29162  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
29163  * the amount will result in a penalty of the multiplier. And, as the success probability
29164  * decreases, the negative `log10` weighting will increase dramatically. For higher success
29165  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
29166  * fall below `1`.
29167  *
29168  * Default value: 256 msat
29169  */
29170 void ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
29171
29172 /**
29173  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
29174  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
29175  * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
29176  * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
29177  *
29178  * Default value: 250 msat
29179  */
29180 uint64_t ProbabilisticScoringParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
29181
29182 /**
29183  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
29184  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
29185  * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
29186  * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
29187  *
29188  * Default value: 250 msat
29189  */
29190 void ProbabilisticScoringParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
29191
29192 /**
29193  * This penalty is applied when the amount we're attempting to send over a channel exceeds our
29194  * current estimate of the channel's available liquidity.
29195  *
29196  * Note that in this case all other penalties, including the
29197  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
29198  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
29199  * applicable, are still included in the overall penalty.
29200  *
29201  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
29202  * `u64::max_value()` will guarantee that.
29203  *
29204  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
29205  *
29206  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
29207  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
29208  * [`base_penalty_msat`]: Self::base_penalty_msat
29209  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
29210  */
29211 uint64_t ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
29212
29213 /**
29214  * This penalty is applied when the amount we're attempting to send over a channel exceeds our
29215  * current estimate of the channel's available liquidity.
29216  *
29217  * Note that in this case all other penalties, including the
29218  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
29219  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
29220  * applicable, are still included in the overall penalty.
29221  *
29222  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
29223  * `u64::max_value()` will guarantee that.
29224  *
29225  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
29226  *
29227  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
29228  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
29229  * [`base_penalty_msat`]: Self::base_penalty_msat
29230  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
29231  */
29232 void ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
29233
29234 /**
29235  * Creates a copy of the ProbabilisticScoringParameters
29236  */
29237 struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig);
29238
29239 /**
29240  * Creates a new scorer using the given scoring parameters for sending payments from a node
29241  * through a network graph.
29242  */
29243 MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
29244
29245 /**
29246  * Dump the contents of this scorer into the configured logger.
29247  *
29248  * Note that this writes roughly one line per channel for which we have a liquidity estimate,
29249  * which may be a substantial amount of log output.
29250  */
29251 void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
29252
29253 /**
29254  * Query the estimated minimum and maximum liquidity available for sending a payment over the
29255  * channel with `scid` towards the given `target` node.
29256  */
29257 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);
29258
29259 /**
29260  * Marks the node with the given `node_id` as banned, i.e.,
29261  * it will be avoided during path finding.
29262  */
29263 void ProbabilisticScorer_add_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
29264
29265 /**
29266  * Removes the node with the given `node_id` from the list of nodes to avoid.
29267  */
29268 void ProbabilisticScorer_remove_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
29269
29270 /**
29271  * Sets a manual penalty for the given node.
29272  */
29273 void ProbabilisticScorer_set_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty);
29274
29275 /**
29276  * Removes the node with the given `node_id` from the list of manual penalties.
29277  */
29278 void ProbabilisticScorer_remove_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
29279
29280 /**
29281  * Clears the list of manual penalties that are applied during path finding.
29282  */
29283 void ProbabilisticScorer_clear_manual_penalties(struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
29284
29285 /**
29286  * Marks all nodes in the given list as banned, i.e.,
29287  * they will be avoided during path finding.
29288  */
29289 void ProbabilisticScoringParameters_add_banned_from_list(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids);
29290
29291 /**
29292  * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
29293  */
29294 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
29295
29296 /**
29297  * Constructs a new Score which calls the relevant methods on this_arg.
29298  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
29299  */
29300 struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
29301
29302 /**
29303  * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
29304  */
29305 struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
29306
29307 /**
29308  * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
29309  */
29310 struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c);
29311
29312 /**
29313  * Frees any resources used by the BlindedRoute, if is_owned is set and inner is non-NULL.
29314  */
29315 void BlindedRoute_free(struct LDKBlindedRoute this_obj);
29316
29317 /**
29318  * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL.
29319  */
29320 void BlindedHop_free(struct LDKBlindedHop this_obj);
29321
29322 /**
29323  * Create a blinded route to be forwarded along `node_pks`. The last node pubkey in `node_pks`
29324  * will be the destination node.
29325  *
29326  * Errors if less than two hops are provided or if `node_pk`(s) are invalid.
29327  */
29328 MUST_USE_RES struct LDKCResult_BlindedRouteNoneZ BlindedRoute_new(struct LDKCVec_PublicKeyZ node_pks, const struct LDKKeysInterface *NONNULL_PTR keys_manager);
29329
29330 /**
29331  * Serialize the BlindedRoute object into a byte array which can be read by BlindedRoute_read
29332  */
29333 struct LDKCVec_u8Z BlindedRoute_write(const struct LDKBlindedRoute *NONNULL_PTR obj);
29334
29335 /**
29336  * Read a BlindedRoute from a byte array, created by BlindedRoute_write
29337  */
29338 struct LDKCResult_BlindedRouteDecodeErrorZ BlindedRoute_read(struct LDKu8slice ser);
29339
29340 /**
29341  * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read
29342  */
29343 struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj);
29344
29345 /**
29346  * Read a BlindedHop from a byte array, created by BlindedHop_write
29347  */
29348 struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser);
29349
29350 /**
29351  * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL.
29352  */
29353 void OnionMessenger_free(struct LDKOnionMessenger this_obj);
29354
29355 /**
29356  * Frees any resources used by the Destination
29357  */
29358 void Destination_free(struct LDKDestination this_ptr);
29359
29360 /**
29361  * Utility method to constructs a new Node-variant Destination
29362  */
29363 struct LDKDestination Destination_node(struct LDKPublicKey a);
29364
29365 /**
29366  * Utility method to constructs a new BlindedRoute-variant Destination
29367  */
29368 struct LDKDestination Destination_blinded_route(struct LDKBlindedRoute a);
29369
29370 /**
29371  * Frees any resources used by the SendError
29372  */
29373 void SendError_free(struct LDKSendError this_ptr);
29374
29375 /**
29376  * Creates a copy of the SendError
29377  */
29378 struct LDKSendError SendError_clone(const struct LDKSendError *NONNULL_PTR orig);
29379
29380 /**
29381  * Utility method to constructs a new Secp256k1-variant SendError
29382  */
29383 struct LDKSendError SendError_secp256k1(enum LDKSecp256k1Error a);
29384
29385 /**
29386  * Utility method to constructs a new TooBigPacket-variant SendError
29387  */
29388 struct LDKSendError SendError_too_big_packet(void);
29389
29390 /**
29391  * Utility method to constructs a new TooFewBlindedHops-variant SendError
29392  */
29393 struct LDKSendError SendError_too_few_blinded_hops(void);
29394
29395 /**
29396  * Utility method to constructs a new InvalidFirstHop-variant SendError
29397  */
29398 struct LDKSendError SendError_invalid_first_hop(void);
29399
29400 /**
29401  * Utility method to constructs a new BufferFull-variant SendError
29402  */
29403 struct LDKSendError SendError_buffer_full(void);
29404
29405 /**
29406  * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to
29407  * their respective handlers.
29408  */
29409 MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKKeysInterface keys_manager, struct LDKLogger logger);
29410
29411 /**
29412  * Send an empty onion message to `destination`, routing it through `intermediate_nodes`.
29413  * See [`OnionMessenger`] for example usage.
29414  *
29415  * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
29416  */
29417 MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKCVec_PublicKeyZ intermediate_nodes, struct LDKDestination destination, struct LDKBlindedRoute reply_path);
29418
29419 /**
29420  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
29421  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
29422  */
29423 struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
29424
29425 /**
29426  * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
29427  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
29428  */
29429 struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
29430
29431 /**
29432  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
29433  */
29434 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
29435
29436 /**
29437  * Initialize a new FilesystemPersister and set the path to the individual channels'
29438  * files.
29439  */
29440 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
29441
29442 /**
29443  * Get the directory which was provided when this persister was initialized.
29444  */
29445 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
29446
29447 /**
29448  * Read `ChannelMonitor`s from disk.
29449  */
29450 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
29451
29452 /**
29453  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
29454  */
29455 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
29456
29457 /**
29458  * Frees any resources used by the GossipSync
29459  */
29460 void GossipSync_free(struct LDKGossipSync this_ptr);
29461
29462 /**
29463  * Utility method to constructs a new P2P-variant GossipSync
29464  */
29465 struct LDKGossipSync GossipSync_p2_p(const struct LDKP2PGossipSync *NONNULL_PTR a);
29466
29467 /**
29468  * Utility method to constructs a new Rapid-variant GossipSync
29469  */
29470 struct LDKGossipSync GossipSync_rapid(const struct LDKRapidGossipSync *NONNULL_PTR a);
29471
29472 /**
29473  * Utility method to constructs a new None-variant GossipSync
29474  */
29475 struct LDKGossipSync GossipSync_none(void);
29476
29477 /**
29478  * Start a background thread that takes care of responsibilities enumerated in the [top-level
29479  * documentation].
29480  *
29481  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
29482  * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
29483  * either [`join`] or [`stop`].
29484  *
29485  * # Data Persistence
29486  *
29487  * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
29488  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
29489  * [`ChannelManager`]. See the `lightning-persister` crate for LDK's
29490  * provided implementation.
29491  *
29492  * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
29493  * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
29494  * See the `lightning-persister` crate for LDK's provided implementation.
29495  *
29496  * Typically, users should either implement [`Persister::persist_manager`] to never return an
29497  * error or call [`join`] and handle any error that may arise. For the latter case,
29498  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
29499  *
29500  * # Event Handling
29501  *
29502  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
29503  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
29504  * functionality implemented by other handlers.
29505  * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
29506  *
29507  * # Rapid Gossip Sync
29508  *
29509  * If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync`
29510  * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
29511  * until the [`RapidGossipSync`] instance completes its first sync.
29512  *
29513  * [top-level documentation]: BackgroundProcessor
29514  * [`join`]: Self::join
29515  * [`stop`]: Self::stop
29516  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
29517  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
29518  * [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
29519  * [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
29520  * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
29521  * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
29522  */
29523 MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKGossipSync gossip_sync, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger, struct LDKCOption_WriteableScoreZ scorer);
29524
29525 /**
29526  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
29527  * [`ChannelManager`].
29528  *
29529  * # Panics
29530  *
29531  * This function panics if the background thread has panicked such as while persisting or
29532  * handling events.
29533  *
29534  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
29535  */
29536 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
29537
29538 /**
29539  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
29540  * [`ChannelManager`].
29541  *
29542  * # Panics
29543  *
29544  * This function panics if the background thread has panicked such as while persisting or
29545  * handling events.
29546  *
29547  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
29548  */
29549 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
29550
29551 /**
29552  * Frees any resources used by the ParseError
29553  */
29554 void ParseError_free(struct LDKParseError this_ptr);
29555
29556 /**
29557  * Creates a copy of the ParseError
29558  */
29559 struct LDKParseError ParseError_clone(const struct LDKParseError *NONNULL_PTR orig);
29560
29561 /**
29562  * Utility method to constructs a new Bech32Error-variant ParseError
29563  */
29564 struct LDKParseError ParseError_bech32_error(struct LDKBech32Error a);
29565
29566 /**
29567  * Utility method to constructs a new ParseAmountError-variant ParseError
29568  */
29569 struct LDKParseError ParseError_parse_amount_error(struct LDKError a);
29570
29571 /**
29572  * Utility method to constructs a new MalformedSignature-variant ParseError
29573  */
29574 struct LDKParseError ParseError_malformed_signature(enum LDKSecp256k1Error a);
29575
29576 /**
29577  * Utility method to constructs a new BadPrefix-variant ParseError
29578  */
29579 struct LDKParseError ParseError_bad_prefix(void);
29580
29581 /**
29582  * Utility method to constructs a new UnknownCurrency-variant ParseError
29583  */
29584 struct LDKParseError ParseError_unknown_currency(void);
29585
29586 /**
29587  * Utility method to constructs a new UnknownSiPrefix-variant ParseError
29588  */
29589 struct LDKParseError ParseError_unknown_si_prefix(void);
29590
29591 /**
29592  * Utility method to constructs a new MalformedHRP-variant ParseError
29593  */
29594 struct LDKParseError ParseError_malformed_hrp(void);
29595
29596 /**
29597  * Utility method to constructs a new TooShortDataPart-variant ParseError
29598  */
29599 struct LDKParseError ParseError_too_short_data_part(void);
29600
29601 /**
29602  * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError
29603  */
29604 struct LDKParseError ParseError_unexpected_end_of_tagged_fields(void);
29605
29606 /**
29607  * Utility method to constructs a new DescriptionDecodeError-variant ParseError
29608  */
29609 struct LDKParseError ParseError_description_decode_error(struct LDKError a);
29610
29611 /**
29612  * Utility method to constructs a new PaddingError-variant ParseError
29613  */
29614 struct LDKParseError ParseError_padding_error(void);
29615
29616 /**
29617  * Utility method to constructs a new IntegerOverflowError-variant ParseError
29618  */
29619 struct LDKParseError ParseError_integer_overflow_error(void);
29620
29621 /**
29622  * Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError
29623  */
29624 struct LDKParseError ParseError_invalid_seg_wit_program_length(void);
29625
29626 /**
29627  * Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError
29628  */
29629 struct LDKParseError ParseError_invalid_pub_key_hash_length(void);
29630
29631 /**
29632  * Utility method to constructs a new InvalidScriptHashLength-variant ParseError
29633  */
29634 struct LDKParseError ParseError_invalid_script_hash_length(void);
29635
29636 /**
29637  * Utility method to constructs a new InvalidRecoveryId-variant ParseError
29638  */
29639 struct LDKParseError ParseError_invalid_recovery_id(void);
29640
29641 /**
29642  * Utility method to constructs a new InvalidSliceLength-variant ParseError
29643  */
29644 struct LDKParseError ParseError_invalid_slice_length(struct LDKStr a);
29645
29646 /**
29647  * Utility method to constructs a new Skip-variant ParseError
29648  */
29649 struct LDKParseError ParseError_skip(void);
29650
29651 /**
29652  * Frees any resources used by the ParseOrSemanticError
29653  */
29654 void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr);
29655
29656 /**
29657  * Creates a copy of the ParseOrSemanticError
29658  */
29659 struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig);
29660
29661 /**
29662  * Utility method to constructs a new ParseError-variant ParseOrSemanticError
29663  */
29664 struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKParseError a);
29665
29666 /**
29667  * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
29668  */
29669 struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKSemanticError a);
29670
29671 /**
29672  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
29673  */
29674 void Invoice_free(struct LDKInvoice this_obj);
29675
29676 /**
29677  * Checks if two Invoices contain equal inner contents.
29678  * This ignores pointers and is_owned flags and looks at the values in fields.
29679  * Two objects with NULL inner values will be considered "equal" here.
29680  */
29681 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
29682
29683 /**
29684  * Creates a copy of the Invoice
29685  */
29686 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
29687
29688 /**
29689  * Checks if two Invoices contain equal inner contents.
29690  */
29691 uint64_t Invoice_hash(const struct LDKInvoice *NONNULL_PTR o);
29692
29693 /**
29694  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
29695  */
29696 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
29697
29698 /**
29699  * Checks if two SignedRawInvoices contain equal inner contents.
29700  * This ignores pointers and is_owned flags and looks at the values in fields.
29701  * Two objects with NULL inner values will be considered "equal" here.
29702  */
29703 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
29704
29705 /**
29706  * Creates a copy of the SignedRawInvoice
29707  */
29708 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
29709
29710 /**
29711  * Checks if two SignedRawInvoices contain equal inner contents.
29712  */
29713 uint64_t SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR o);
29714
29715 /**
29716  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
29717  */
29718 void RawInvoice_free(struct LDKRawInvoice this_obj);
29719
29720 /**
29721  * data part
29722  */
29723 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
29724
29725 /**
29726  * data part
29727  */
29728 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
29729
29730 /**
29731  * Checks if two RawInvoices contain equal inner contents.
29732  * This ignores pointers and is_owned flags and looks at the values in fields.
29733  * Two objects with NULL inner values will be considered "equal" here.
29734  */
29735 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
29736
29737 /**
29738  * Creates a copy of the RawInvoice
29739  */
29740 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
29741
29742 /**
29743  * Checks if two RawInvoices contain equal inner contents.
29744  */
29745 uint64_t RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR o);
29746
29747 /**
29748  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
29749  */
29750 void RawDataPart_free(struct LDKRawDataPart this_obj);
29751
29752 /**
29753  * generation time of the invoice
29754  */
29755 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
29756
29757 /**
29758  * generation time of the invoice
29759  */
29760 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
29761
29762 /**
29763  * Checks if two RawDataParts contain equal inner contents.
29764  * This ignores pointers and is_owned flags and looks at the values in fields.
29765  * Two objects with NULL inner values will be considered "equal" here.
29766  */
29767 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
29768
29769 /**
29770  * Creates a copy of the RawDataPart
29771  */
29772 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
29773
29774 /**
29775  * Checks if two RawDataParts contain equal inner contents.
29776  */
29777 uint64_t RawDataPart_hash(const struct LDKRawDataPart *NONNULL_PTR o);
29778
29779 /**
29780  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
29781  */
29782 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
29783
29784 /**
29785  * Checks if two PositiveTimestamps contain equal inner contents.
29786  * This ignores pointers and is_owned flags and looks at the values in fields.
29787  * Two objects with NULL inner values will be considered "equal" here.
29788  */
29789 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
29790
29791 /**
29792  * Creates a copy of the PositiveTimestamp
29793  */
29794 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
29795
29796 /**
29797  * Checks if two PositiveTimestamps contain equal inner contents.
29798  */
29799 uint64_t PositiveTimestamp_hash(const struct LDKPositiveTimestamp *NONNULL_PTR o);
29800
29801 /**
29802  * Creates a copy of the SiPrefix
29803  */
29804 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
29805
29806 /**
29807  * Utility method to constructs a new Milli-variant SiPrefix
29808  */
29809 enum LDKSiPrefix SiPrefix_milli(void);
29810
29811 /**
29812  * Utility method to constructs a new Micro-variant SiPrefix
29813  */
29814 enum LDKSiPrefix SiPrefix_micro(void);
29815
29816 /**
29817  * Utility method to constructs a new Nano-variant SiPrefix
29818  */
29819 enum LDKSiPrefix SiPrefix_nano(void);
29820
29821 /**
29822  * Utility method to constructs a new Pico-variant SiPrefix
29823  */
29824 enum LDKSiPrefix SiPrefix_pico(void);
29825
29826 /**
29827  * Checks if two SiPrefixs contain equal inner contents.
29828  * This ignores pointers and is_owned flags and looks at the values in fields.
29829  */
29830 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
29831
29832 /**
29833  * Checks if two SiPrefixs contain equal inner contents.
29834  */
29835 uint64_t SiPrefix_hash(const enum LDKSiPrefix *NONNULL_PTR o);
29836
29837 /**
29838  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
29839  * This is effectively 10^12 * the prefix multiplier
29840  */
29841 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
29842
29843 /**
29844  * Creates a copy of the Currency
29845  */
29846 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
29847
29848 /**
29849  * Utility method to constructs a new Bitcoin-variant Currency
29850  */
29851 enum LDKCurrency Currency_bitcoin(void);
29852
29853 /**
29854  * Utility method to constructs a new BitcoinTestnet-variant Currency
29855  */
29856 enum LDKCurrency Currency_bitcoin_testnet(void);
29857
29858 /**
29859  * Utility method to constructs a new Regtest-variant Currency
29860  */
29861 enum LDKCurrency Currency_regtest(void);
29862
29863 /**
29864  * Utility method to constructs a new Simnet-variant Currency
29865  */
29866 enum LDKCurrency Currency_simnet(void);
29867
29868 /**
29869  * Utility method to constructs a new Signet-variant Currency
29870  */
29871 enum LDKCurrency Currency_signet(void);
29872
29873 /**
29874  * Checks if two Currencys contain equal inner contents.
29875  */
29876 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
29877
29878 /**
29879  * Checks if two Currencys contain equal inner contents.
29880  * This ignores pointers and is_owned flags and looks at the values in fields.
29881  */
29882 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
29883
29884 /**
29885  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
29886  */
29887 void Sha256_free(struct LDKSha256 this_obj);
29888
29889 /**
29890  * Creates a copy of the Sha256
29891  */
29892 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
29893
29894 /**
29895  * Checks if two Sha256s contain equal inner contents.
29896  */
29897 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
29898
29899 /**
29900  * Checks if two Sha256s contain equal inner contents.
29901  * This ignores pointers and is_owned flags and looks at the values in fields.
29902  * Two objects with NULL inner values will be considered "equal" here.
29903  */
29904 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
29905
29906 /**
29907  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
29908  */
29909 void Description_free(struct LDKDescription this_obj);
29910
29911 /**
29912  * Creates a copy of the Description
29913  */
29914 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
29915
29916 /**
29917  * Checks if two Descriptions contain equal inner contents.
29918  */
29919 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
29920
29921 /**
29922  * Checks if two Descriptions contain equal inner contents.
29923  * This ignores pointers and is_owned flags and looks at the values in fields.
29924  * Two objects with NULL inner values will be considered "equal" here.
29925  */
29926 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
29927
29928 /**
29929  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
29930  */
29931 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
29932
29933 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
29934
29935 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29936
29937 /**
29938  * Constructs a new PayeePubKey given each field
29939  */
29940 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
29941
29942 /**
29943  * Creates a copy of the PayeePubKey
29944  */
29945 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
29946
29947 /**
29948  * Checks if two PayeePubKeys contain equal inner contents.
29949  */
29950 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
29951
29952 /**
29953  * Checks if two PayeePubKeys contain equal inner contents.
29954  * This ignores pointers and is_owned flags and looks at the values in fields.
29955  * Two objects with NULL inner values will be considered "equal" here.
29956  */
29957 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
29958
29959 /**
29960  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
29961  */
29962 void ExpiryTime_free(struct LDKExpiryTime this_obj);
29963
29964 /**
29965  * Creates a copy of the ExpiryTime
29966  */
29967 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
29968
29969 /**
29970  * Checks if two ExpiryTimes contain equal inner contents.
29971  */
29972 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
29973
29974 /**
29975  * Checks if two ExpiryTimes contain equal inner contents.
29976  * This ignores pointers and is_owned flags and looks at the values in fields.
29977  * Two objects with NULL inner values will be considered "equal" here.
29978  */
29979 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
29980
29981 /**
29982  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
29983  */
29984 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
29985
29986 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
29987
29988 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
29989
29990 /**
29991  * Constructs a new MinFinalCltvExpiry given each field
29992  */
29993 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
29994
29995 /**
29996  * Creates a copy of the MinFinalCltvExpiry
29997  */
29998 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
29999
30000 /**
30001  * Checks if two MinFinalCltvExpirys contain equal inner contents.
30002  */
30003 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
30004
30005 /**
30006  * Checks if two MinFinalCltvExpirys contain equal inner contents.
30007  * This ignores pointers and is_owned flags and looks at the values in fields.
30008  * Two objects with NULL inner values will be considered "equal" here.
30009  */
30010 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
30011
30012 /**
30013  * Frees any resources used by the Fallback
30014  */
30015 void Fallback_free(struct LDKFallback this_ptr);
30016
30017 /**
30018  * Creates a copy of the Fallback
30019  */
30020 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
30021
30022 /**
30023  * Utility method to constructs a new SegWitProgram-variant Fallback
30024  */
30025 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
30026
30027 /**
30028  * Utility method to constructs a new PubKeyHash-variant Fallback
30029  */
30030 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
30031
30032 /**
30033  * Utility method to constructs a new ScriptHash-variant Fallback
30034  */
30035 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
30036
30037 /**
30038  * Checks if two Fallbacks contain equal inner contents.
30039  */
30040 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
30041
30042 /**
30043  * Checks if two Fallbacks contain equal inner contents.
30044  * This ignores pointers and is_owned flags and looks at the values in fields.
30045  */
30046 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
30047
30048 /**
30049  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
30050  */
30051 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
30052
30053 /**
30054  * Creates a copy of the InvoiceSignature
30055  */
30056 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
30057
30058 /**
30059  * Checks if two InvoiceSignatures contain equal inner contents.
30060  */
30061 uint64_t InvoiceSignature_hash(const struct LDKInvoiceSignature *NONNULL_PTR o);
30062
30063 /**
30064  * Checks if two InvoiceSignatures contain equal inner contents.
30065  * This ignores pointers and is_owned flags and looks at the values in fields.
30066  * Two objects with NULL inner values will be considered "equal" here.
30067  */
30068 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
30069
30070 /**
30071  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
30072  */
30073 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
30074
30075 /**
30076  * Creates a copy of the PrivateRoute
30077  */
30078 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
30079
30080 /**
30081  * Checks if two PrivateRoutes contain equal inner contents.
30082  */
30083 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
30084
30085 /**
30086  * Checks if two PrivateRoutes contain equal inner contents.
30087  * This ignores pointers and is_owned flags and looks at the values in fields.
30088  * Two objects with NULL inner values will be considered "equal" here.
30089  */
30090 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
30091
30092 /**
30093  * Disassembles the `SignedRawInvoice` into its three parts:
30094  *  1. raw invoice
30095  *  2. hash of the raw invoice
30096  *  3. signature
30097  */
30098 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
30099
30100 /**
30101  * The `RawInvoice` which was signed.
30102  */
30103 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
30104
30105 /**
30106  * The hash of the `RawInvoice` that was signed.
30107  */
30108 MUST_USE_RES const uint8_t (*SignedRawInvoice_signable_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
30109
30110 /**
30111  * InvoiceSignature for the invoice.
30112  */
30113 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
30114
30115 /**
30116  * Recovers the public key used for signing the invoice from the recoverable signature.
30117  */
30118 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
30119
30120 /**
30121  * Checks if the signature is valid for the included payee public key or if none exists if it's
30122  * valid for the recovered signature (which should always be true?).
30123  */
30124 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
30125
30126 /**
30127  * Calculate the hash of the encoded `RawInvoice` which should be signed.
30128  */
30129 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_signable_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
30130
30131 /**
30132  *
30133  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30134  */
30135 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
30136
30137 /**
30138  *
30139  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30140  */
30141 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
30142
30143 /**
30144  *
30145  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30146  */
30147 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
30148
30149 /**
30150  *
30151  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30152  */
30153 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
30154
30155 /**
30156  *
30157  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30158  */
30159 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
30160
30161 /**
30162  *
30163  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30164  */
30165 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
30166
30167 /**
30168  *
30169  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30170  */
30171 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
30172
30173 /**
30174  *
30175  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30176  */
30177 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
30178
30179 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
30180
30181 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
30182
30183 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
30184
30185 /**
30186  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
30187  *
30188  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
30189  */
30190 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
30191
30192 /**
30193  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
30194  * the range `0..=MAX_TIMESTAMP`.
30195  *
30196  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
30197  */
30198 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
30199
30200 /**
30201  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
30202  * `0..=MAX_TIMESTAMP`.
30203  *
30204  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
30205  */
30206 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
30207
30208 /**
30209  * Returns the Unix timestamp representing the stored time
30210  */
30211 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
30212
30213 /**
30214  * Returns the duration of the stored time since the Unix epoch
30215  */
30216 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
30217
30218 /**
30219  * Returns the [`SystemTime`] representing the stored time
30220  */
30221 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
30222
30223 /**
30224  * Transform the `Invoice` into it's unchecked version
30225  */
30226 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
30227
30228 /**
30229  * Check that the invoice is signed correctly and that key recovery works
30230  */
30231 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
30232
30233 /**
30234  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
30235  * ```
30236  * use lightning_invoice::*;
30237  *
30238  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
30239  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
30240  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
30241  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
30242  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
30243  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
30244  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
30245  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
30246  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
30247  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
30248  * j5r6drg6k6zcqj0fcwg\";
30249  *
30250  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
30251  *
30252  * assert!(Invoice::from_signed(signed).is_ok());
30253  * ```
30254  */
30255 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
30256
30257 /**
30258  * Returns the `Invoice`'s timestamp (should equal its creation time)
30259  */
30260 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
30261
30262 /**
30263  * Returns the `Invoice`'s timestamp as a duration since the Unix epoch
30264  */
30265 MUST_USE_RES uint64_t Invoice_duration_since_epoch(const struct LDKInvoice *NONNULL_PTR this_arg);
30266
30267 /**
30268  * Returns the hash to which we will receive the preimage on completion of the payment
30269  */
30270 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
30271
30272 /**
30273  * Get the payee's public key if one was included in the invoice
30274  *
30275  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30276  */
30277 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
30278
30279 /**
30280  * Get the payment secret if one was included in the invoice
30281  */
30282 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
30283
30284 /**
30285  * Get the invoice features if they were included in the invoice
30286  *
30287  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30288  */
30289 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
30290
30291 /**
30292  * Recover the payee's public key (only to be used if none was included in the invoice)
30293  */
30294 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
30295
30296 /**
30297  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
30298  */
30299 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
30300
30301 /**
30302  * Returns whether the invoice has expired.
30303  */
30304 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
30305
30306 /**
30307  * Returns whether the expiry time would pass at the given point in time.
30308  * `at_time` is the timestamp as a duration since the Unix epoch.
30309  */
30310 MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time);
30311
30312 /**
30313  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
30314  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
30315  */
30316 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
30317
30318 /**
30319  * Returns a list of all routes included in the invoice
30320  */
30321 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
30322
30323 /**
30324  * Returns a list of all routes included in the invoice as the underlying hints
30325  */
30326 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
30327
30328 /**
30329  * Returns the currency for which the invoice was issued
30330  */
30331 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
30332
30333 /**
30334  * Returns the amount if specified in the invoice as millisatoshis.
30335  */
30336 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
30337
30338 /**
30339  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
30340  * returns `CreationError::DescriptionTooLong` otherwise
30341  *
30342  * Please note that single characters may use more than one byte due to UTF8 encoding.
30343  */
30344 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
30345
30346 /**
30347  * Returns the underlying description `String`
30348  */
30349 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
30350
30351 /**
30352  * Construct an `ExpiryTime` from seconds.
30353  */
30354 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
30355
30356 /**
30357  * Construct an `ExpiryTime` from a `Duration`.
30358  */
30359 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
30360
30361 /**
30362  * Returns the expiry time in seconds
30363  */
30364 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
30365
30366 /**
30367  * Returns a reference to the underlying `Duration` (=expiry time)
30368  */
30369 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
30370
30371 /**
30372  * Creates a new (partial) route from a list of hops
30373  */
30374 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
30375
30376 /**
30377  * Returns the underlying list of hops
30378  */
30379 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
30380
30381 /**
30382  * Creates a copy of the CreationError
30383  */
30384 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
30385
30386 /**
30387  * Utility method to constructs a new DescriptionTooLong-variant CreationError
30388  */
30389 enum LDKCreationError CreationError_description_too_long(void);
30390
30391 /**
30392  * Utility method to constructs a new RouteTooLong-variant CreationError
30393  */
30394 enum LDKCreationError CreationError_route_too_long(void);
30395
30396 /**
30397  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
30398  */
30399 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
30400
30401 /**
30402  * Utility method to constructs a new InvalidAmount-variant CreationError
30403  */
30404 enum LDKCreationError CreationError_invalid_amount(void);
30405
30406 /**
30407  * Utility method to constructs a new MissingRouteHints-variant CreationError
30408  */
30409 enum LDKCreationError CreationError_missing_route_hints(void);
30410
30411 /**
30412  * Checks if two CreationErrors contain equal inner contents.
30413  * This ignores pointers and is_owned flags and looks at the values in fields.
30414  */
30415 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
30416
30417 /**
30418  * Get the string representation of a CreationError object
30419  */
30420 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
30421
30422 /**
30423  * Creates a copy of the SemanticError
30424  */
30425 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
30426
30427 /**
30428  * Utility method to constructs a new NoPaymentHash-variant SemanticError
30429  */
30430 enum LDKSemanticError SemanticError_no_payment_hash(void);
30431
30432 /**
30433  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
30434  */
30435 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
30436
30437 /**
30438  * Utility method to constructs a new NoDescription-variant SemanticError
30439  */
30440 enum LDKSemanticError SemanticError_no_description(void);
30441
30442 /**
30443  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
30444  */
30445 enum LDKSemanticError SemanticError_multiple_descriptions(void);
30446
30447 /**
30448  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
30449  */
30450 enum LDKSemanticError SemanticError_no_payment_secret(void);
30451
30452 /**
30453  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
30454  */
30455 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
30456
30457 /**
30458  * Utility method to constructs a new InvalidFeatures-variant SemanticError
30459  */
30460 enum LDKSemanticError SemanticError_invalid_features(void);
30461
30462 /**
30463  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
30464  */
30465 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
30466
30467 /**
30468  * Utility method to constructs a new InvalidSignature-variant SemanticError
30469  */
30470 enum LDKSemanticError SemanticError_invalid_signature(void);
30471
30472 /**
30473  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
30474  */
30475 enum LDKSemanticError SemanticError_imprecise_amount(void);
30476
30477 /**
30478  * Checks if two SemanticErrors contain equal inner contents.
30479  * This ignores pointers and is_owned flags and looks at the values in fields.
30480  */
30481 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
30482
30483 /**
30484  * Get the string representation of a SemanticError object
30485  */
30486 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
30487
30488 /**
30489  * Frees any resources used by the SignOrCreationError
30490  */
30491 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
30492
30493 /**
30494  * Creates a copy of the SignOrCreationError
30495  */
30496 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
30497
30498 /**
30499  * Utility method to constructs a new SignError-variant SignOrCreationError
30500  */
30501 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
30502
30503 /**
30504  * Utility method to constructs a new CreationError-variant SignOrCreationError
30505  */
30506 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
30507
30508 /**
30509  * Checks if two SignOrCreationErrors contain equal inner contents.
30510  * This ignores pointers and is_owned flags and looks at the values in fields.
30511  */
30512 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
30513
30514 /**
30515  * Get the string representation of a SignOrCreationError object
30516  */
30517 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
30518
30519 /**
30520  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
30521  */
30522 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
30523
30524 /**
30525  * Calls the free function if one is set
30526  */
30527 void Payer_free(struct LDKPayer this_ptr);
30528
30529 /**
30530  * Calls the free function if one is set
30531  */
30532 void Router_free(struct LDKRouter this_ptr);
30533
30534 /**
30535  * Frees any resources used by the Retry
30536  */
30537 void Retry_free(struct LDKRetry this_ptr);
30538
30539 /**
30540  * Creates a copy of the Retry
30541  */
30542 struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig);
30543
30544 /**
30545  * Utility method to constructs a new Attempts-variant Retry
30546  */
30547 struct LDKRetry Retry_attempts(uintptr_t a);
30548
30549 /**
30550  * Utility method to constructs a new Timeout-variant Retry
30551  */
30552 struct LDKRetry Retry_timeout(uint64_t a);
30553
30554 /**
30555  * Checks if two Retrys contain equal inner contents.
30556  * This ignores pointers and is_owned flags and looks at the values in fields.
30557  */
30558 bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b);
30559
30560 /**
30561  * Checks if two Retrys contain equal inner contents.
30562  */
30563 uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o);
30564
30565 /**
30566  * Frees any resources used by the PaymentError
30567  */
30568 void PaymentError_free(struct LDKPaymentError this_ptr);
30569
30570 /**
30571  * Creates a copy of the PaymentError
30572  */
30573 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
30574
30575 /**
30576  * Utility method to constructs a new Invoice-variant PaymentError
30577  */
30578 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
30579
30580 /**
30581  * Utility method to constructs a new Routing-variant PaymentError
30582  */
30583 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
30584
30585 /**
30586  * Utility method to constructs a new Sending-variant PaymentError
30587  */
30588 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
30589
30590 /**
30591  * Creates an invoice payer that retries failed payment paths.
30592  *
30593  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
30594  * `retry` has been exceeded for a given [`Invoice`].
30595  */
30596 MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetry retry);
30597
30598 /**
30599  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
30600  *
30601  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
30602  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
30603  * for you.
30604  */
30605 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
30606
30607 /**
30608  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
30609  * case a retry is needed.
30610  *
30611  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
30612  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
30613  * for you.
30614  */
30615 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);
30616
30617 /**
30618  * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in
30619  * case a retry is needed.
30620  *
30621  * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never
30622  * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
30623  */
30624 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);
30625
30626 /**
30627  * Removes the payment cached by the given payment hash.
30628  *
30629  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
30630  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
30631  */
30632 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
30633
30634 /**
30635  * Constructs a new EventHandler which calls the relevant methods on this_arg.
30636  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
30637  */
30638 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
30639
30640 /**
30641  * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL.
30642  */
30643 void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj);
30644
30645 /**
30646  * Returns liquidity in msat given the public key of the HTLC source, target, and short channel
30647  * id.
30648  */
30649 MUST_USE_RES struct LDKCOption_u64Z InFlightHtlcs_used_liquidity_msat(const struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, uint64_t channel_scid);
30650
30651 /**
30652  * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read
30653  */
30654 struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj);
30655
30656 /**
30657  * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write
30658  */
30659 struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser);
30660
30661 /**
30662  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
30663  * See [`PhantomKeysManager`] for more information on phantom node payments.
30664  *
30665  * `phantom_route_hints` parameter:
30666  * * Contains channel info for all nodes participating in the phantom invoice
30667  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
30668  *   participating node
30669  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
30670  *   updated when a channel becomes disabled or closes
30671  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
30672  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
30673  *   down
30674  *
30675  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
30676  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
30677  * If `None` is provided for `payment_hash`, then one will be created.
30678  *
30679  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
30680  * in excess of the current time.
30681  *
30682  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
30683  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
30684  * requirement).
30685  *
30686  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
30687  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
30688  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
30689  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
30690  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
30691  *
30692  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
30693  */
30694 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);
30695
30696 /**
30697  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
30698  * See [`PhantomKeysManager`] for more information on phantom node payments.
30699  *
30700  * `phantom_route_hints` parameter:
30701  * * Contains channel info for all nodes participating in the phantom invoice
30702  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
30703  *   participating node
30704  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
30705  *   updated when a channel becomes disabled or closes
30706  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
30707  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
30708  *   down
30709  *
30710  * `description_hash` is a SHA-256 hash of the description text
30711  *
30712  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
30713  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
30714  * If `None` is provided for `payment_hash`, then one will be created.
30715  *
30716  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
30717  * in excess of the current time.
30718  *
30719  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
30720  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
30721  * requirement).
30722  *
30723  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
30724  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
30725  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
30726  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
30727  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
30728  *
30729  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
30730  */
30731 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);
30732
30733 /**
30734  * Utility to construct an invoice. Generally, unless you want to do something like a custom
30735  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
30736  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
30737  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
30738  * that the payment secret is valid when the invoice is paid.
30739  *
30740  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
30741  * in excess of the current time.
30742  */
30743 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);
30744
30745 /**
30746  * Utility to construct an invoice. Generally, unless you want to do something like a custom
30747  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
30748  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
30749  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
30750  * that the payment secret is valid when the invoice is paid.
30751  * Use this variant if you want to pass the `description_hash` to the invoice.
30752  *
30753  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
30754  * in excess of the current time.
30755  */
30756 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);
30757
30758 /**
30759  * See [`create_invoice_from_channelmanager_with_description_hash`]
30760  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
30761  * available and the current time is supplied by the caller.
30762  */
30763 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);
30764
30765 /**
30766  * See [`create_invoice_from_channelmanager`]
30767  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
30768  * available and the current time is supplied by the caller.
30769  */
30770 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);
30771
30772 /**
30773  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
30774  */
30775 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
30776
30777 /**
30778  * Creates a new router using the given [`NetworkGraph`], a [`Logger`], and a randomness source
30779  * `random_seed_bytes`.
30780  */
30781 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes, struct LDKLockableScore scorer);
30782
30783 /**
30784  * Constructs a new Router which calls the relevant methods on this_arg.
30785  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
30786  */
30787 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
30788
30789 /**
30790  * Constructs a new Payer which calls the relevant methods on this_arg.
30791  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
30792  */
30793 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
30794
30795 /**
30796  * Read a SiPrefix object from a string
30797  */
30798 struct LDKCResult_SiPrefixParseErrorZ SiPrefix_from_str(struct LDKStr s);
30799
30800 /**
30801  * Read a Invoice object from a string
30802  */
30803 struct LDKCResult_InvoiceParseOrSemanticErrorZ Invoice_from_str(struct LDKStr s);
30804
30805 /**
30806  * Read a SignedRawInvoice object from a string
30807  */
30808 struct LDKCResult_SignedRawInvoiceParseErrorZ SignedRawInvoice_from_str(struct LDKStr s);
30809
30810 /**
30811  * Get the string representation of a ParseError object
30812  */
30813 struct LDKStr ParseError_to_str(const struct LDKParseError *NONNULL_PTR o);
30814
30815 /**
30816  * Get the string representation of a ParseOrSemanticError object
30817  */
30818 struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o);
30819
30820 /**
30821  * Get the string representation of a Invoice object
30822  */
30823 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
30824
30825 /**
30826  * Get the string representation of a SignedRawInvoice object
30827  */
30828 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
30829
30830 /**
30831  * Get the string representation of a Currency object
30832  */
30833 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
30834
30835 /**
30836  * Get the string representation of a SiPrefix object
30837  */
30838 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
30839
30840 /**
30841  * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL.
30842  */
30843 void RapidGossipSync_free(struct LDKRapidGossipSync this_obj);
30844
30845 /**
30846  * Instantiate a new [`RapidGossipSync`] instance
30847  */
30848 MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph);
30849
30850 /**
30851  * Sync gossip data from a file
30852  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
30853  *
30854  * `network_graph`: The network graph to apply the updates to
30855  *
30856  * `sync_path`: Path to the file where the gossip update data is located
30857  *
30858  */
30859 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_sync_network_graph_with_file_path(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKStr sync_path);
30860
30861 /**
30862  * Returns whether a rapid gossip sync has completed at least once
30863  */
30864 MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg);
30865
30866 /**
30867  * Frees any resources used by the GraphSyncError
30868  */
30869 void GraphSyncError_free(struct LDKGraphSyncError this_ptr);
30870
30871 /**
30872  * Creates a copy of the GraphSyncError
30873  */
30874 struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig);
30875
30876 /**
30877  * Utility method to constructs a new DecodeError-variant GraphSyncError
30878  */
30879 struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a);
30880
30881 /**
30882  * Utility method to constructs a new LightningError-variant GraphSyncError
30883  */
30884 struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a);
30885
30886 /**
30887  * Update network graph from binary data.
30888  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
30889  *
30890  * `network_graph`: network graph to be updated
30891  *
30892  * `update_data`: `&[u8]` binary stream that comprises the update data
30893  */
30894 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data);
30895
30896 #endif /* LDK_C_BINDINGS_H */
30897
30898 #include "ldk_ver.h"