Merge pull request #17 from TheBlueMatt/2021-04-upstream-confirm
[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.16.0 */
5
6 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
7
8 #include <stdarg.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11
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 error enum representing a failure to persist a channel monitor update.
33  */
34 typedef enum LDKChannelMonitorUpdateErr {
35    /**
36     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
37     * our state failed, but is expected to succeed at some point in the future).
38     *
39     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
40     * submitting new commitment transactions to the counterparty. Once the update(s) which failed
41     * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
42     * restore the channel to an operational state.
43     *
44     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
45     * you return a TemporaryFailure you must ensure that it is written to disk safely before
46     * writing out the latest ChannelManager state.
47     *
48     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
49     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
50     * to claim it on this channel) and those updates must be applied wherever they can be. At
51     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
52     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
53     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
54     * been \"frozen\".
55     *
56     * Note that even if updates made after TemporaryFailure succeed you must still call
57     * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
58     * operation.
59     *
60     * Note that the update being processed here will not be replayed for you when you call
61     * ChannelManager::channel_monitor_updated, so you must store the update itself along
62     * with the persisted ChannelMonitor on your own local disk prior to returning a
63     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
64     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
65     * reload-time.
66     *
67     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
68     * remote location (with local copies persisted immediately), it is anticipated that all
69     * updates will return TemporaryFailure until the remote copies could be updated.
70     */
71    LDKChannelMonitorUpdateErr_TemporaryFailure,
72    /**
73     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
74     * different watchtower and cannot update with all watchtowers that were previously informed
75     * of this channel).
76     *
77     * At reception of this error, ChannelManager will force-close the channel and return at
78     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
79     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
80     * update must be rejected.
81     *
82     * This failure may also signal a failure to update the local persisted copy of one of
83     * the channel monitor instance.
84     *
85     * Note that even when you fail a holder commitment transaction update, you must store the
86     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
87     * broadcasts it (e.g distributed channel-monitor deployment)
88     *
89     * In case of distributed watchtowers deployment, the new version must be written to disk, as
90     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
91     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
92     * lagging behind on block processing.
93     */
94    LDKChannelMonitorUpdateErr_PermanentFailure,
95    /**
96     * Must be last for serialization purposes
97     */
98    LDKChannelMonitorUpdateErr_Sentinel,
99 } LDKChannelMonitorUpdateErr;
100
101 /**
102  * An enum that represents the speed at which we want a transaction to confirm used for feerate
103  * estimation.
104  */
105 typedef enum LDKConfirmationTarget {
106    /**
107     * We are happy with this transaction confirming slowly when feerate drops some.
108     */
109    LDKConfirmationTarget_Background,
110    /**
111     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
112     */
113    LDKConfirmationTarget_Normal,
114    /**
115     * We'd like this transaction to confirm in the next few blocks.
116     */
117    LDKConfirmationTarget_HighPriority,
118    /**
119     * Must be last for serialization purposes
120     */
121    LDKConfirmationTarget_Sentinel,
122 } LDKConfirmationTarget;
123
124 /**
125  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
126  */
127 typedef enum LDKIOError {
128    LDKIOError_NotFound,
129    LDKIOError_PermissionDenied,
130    LDKIOError_ConnectionRefused,
131    LDKIOError_ConnectionReset,
132    LDKIOError_ConnectionAborted,
133    LDKIOError_NotConnected,
134    LDKIOError_AddrInUse,
135    LDKIOError_AddrNotAvailable,
136    LDKIOError_BrokenPipe,
137    LDKIOError_AlreadyExists,
138    LDKIOError_WouldBlock,
139    LDKIOError_InvalidInput,
140    LDKIOError_InvalidData,
141    LDKIOError_TimedOut,
142    LDKIOError_WriteZero,
143    LDKIOError_Interrupted,
144    LDKIOError_Other,
145    LDKIOError_UnexpectedEof,
146    /**
147     * Must be last for serialization purposes
148     */
149    LDKIOError_Sentinel,
150 } LDKIOError;
151
152 /**
153  * An enum representing the available verbosity levels of the logger.
154  */
155 typedef enum LDKLevel {
156    /**
157     *Designates logger being silent
158     */
159    LDKLevel_Off,
160    /**
161     * Designates very serious errors
162     */
163    LDKLevel_Error,
164    /**
165     * Designates hazardous situations
166     */
167    LDKLevel_Warn,
168    /**
169     * Designates useful information
170     */
171    LDKLevel_Info,
172    /**
173     * Designates lower priority information
174     */
175    LDKLevel_Debug,
176    /**
177     * Designates very low priority, often extremely verbose, information
178     */
179    LDKLevel_Trace,
180    /**
181     * Must be last for serialization purposes
182     */
183    LDKLevel_Sentinel,
184 } LDKLevel;
185
186 /**
187  * An enum representing the possible Bitcoin or test networks which we can run on
188  */
189 typedef enum LDKNetwork {
190    /**
191     * The main Bitcoin blockchain.
192     */
193    LDKNetwork_Bitcoin,
194    /**
195     * The testnet3 blockchain.
196     */
197    LDKNetwork_Testnet,
198    /**
199     * A local test blockchain.
200     */
201    LDKNetwork_Regtest,
202    /**
203     * A blockchain on which blocks are signed instead of mined.
204     */
205    LDKNetwork_Signet,
206    /**
207     * Must be last for serialization purposes
208     */
209    LDKNetwork_Sentinel,
210 } LDKNetwork;
211
212 /**
213  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
214  */
215 typedef enum LDKSecp256k1Error {
216    /**
217     * Signature failed verification
218     */
219    LDKSecp256k1Error_IncorrectSignature,
220    /**
221     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
222     */
223    LDKSecp256k1Error_InvalidMessage,
224    /**
225     * Bad public key
226     */
227    LDKSecp256k1Error_InvalidPublicKey,
228    /**
229     * Bad signature
230     */
231    LDKSecp256k1Error_InvalidSignature,
232    /**
233     * Bad secret key
234     */
235    LDKSecp256k1Error_InvalidSecretKey,
236    /**
237     * Bad recovery id
238     */
239    LDKSecp256k1Error_InvalidRecoveryId,
240    /**
241     * Invalid tweak for add_assign or mul_assign
242     */
243    LDKSecp256k1Error_InvalidTweak,
244    /**
245     * tweak_add_check failed on an xonly public key
246     */
247    LDKSecp256k1Error_TweakCheckFailed,
248    /**
249     * Didn't pass enough memory to context creation with preallocated memory
250     */
251    LDKSecp256k1Error_NotEnoughMemory,
252    /**
253     * Must be last for serialization purposes
254     */
255    LDKSecp256k1Error_Sentinel,
256 } LDKSecp256k1Error;
257
258 /**
259  * A serialized transaction, in (pointer, length) form.
260  *
261  * This type optionally owns its own memory, and thus the semantics around access change based on
262  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
263  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
264  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
265  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
266  * you would be invalid.
267  *
268  * Note that, while it may change in the future, because transactions on the Rust side are stored
269  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
270  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
271  * `data_is_owned` either set or unset at your discretion.
272  */
273 typedef struct LDKTransaction {
274    /**
275     * The serialized transaction data.
276     *
277     * This is non-const for your convenience, an object passed to Rust is never written to.
278     */
279    uint8_t *data;
280    /**
281     * The length of the serialized transaction
282     */
283    uintptr_t datalen;
284    /**
285     * Whether the data pointed to by `data` should be freed or not.
286     */
287    bool data_is_owned;
288 } LDKTransaction;
289
290 /**
291  * A dynamically-allocated array of u8s of arbitrary size.
292  * This corresponds to std::vector in C++
293  */
294 typedef struct LDKCVec_u8Z {
295    /**
296     * The elements in the array.
297     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
298     */
299    uint8_t *data;
300    /**
301     * The number of elements pointed to by `data`.
302     */
303    uintptr_t datalen;
304 } LDKCVec_u8Z;
305
306 /**
307  * A transaction output including a scriptPubKey and value.
308  * This type *does* own its own memory, so must be free'd appropriately.
309  */
310 typedef struct LDKTxOut {
311    /**
312     * The script_pubkey in this output
313     */
314    struct LDKCVec_u8Z script_pubkey;
315    /**
316     * The value, in satoshis, of this output
317     */
318    uint64_t value;
319 } LDKTxOut;
320
321
322
323 /**
324  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
325  * with our counterparty.
326  */
327 typedef struct MUST_USE_STRUCT LDKChannelConfig {
328    /**
329     * A pointer to the opaque Rust object.
330     * Nearly everywhere, inner must be non-null, however in places where
331     * the Rust equivalent takes an Option, it may be set to null to indicate None.
332     */
333    LDKnativeChannelConfig *inner;
334    /**
335     * Indicates that this is the only struct which contains the same pointer.
336     * Rust functions which take ownership of an object provided via an argument require
337     * this to be true and invalidate the object pointed to by inner.
338     */
339    bool is_owned;
340 } LDKChannelConfig;
341
342
343
344 /**
345  * An error in decoding a message or struct.
346  */
347 typedef struct MUST_USE_STRUCT LDKDecodeError {
348    /**
349     * A pointer to the opaque Rust object.
350     * Nearly everywhere, inner must be non-null, however in places where
351     * the Rust equivalent takes an Option, it may be set to null to indicate None.
352     */
353    LDKnativeDecodeError *inner;
354    /**
355     * Indicates that this is the only struct which contains the same pointer.
356     * Rust functions which take ownership of an object provided via an argument require
357     * this to be true and invalidate the object pointed to by inner.
358     */
359    bool is_owned;
360 } LDKDecodeError;
361
362 /**
363  * The contents of CResult_ChannelConfigDecodeErrorZ
364  */
365 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
366    /**
367     * A pointer to the contents in the success state.
368     * Reading from this pointer when `result_ok` is not set is undefined.
369     */
370    struct LDKChannelConfig *result;
371    /**
372     * A pointer to the contents in the error state.
373     * Reading from this pointer when `result_ok` is set is undefined.
374     */
375    struct LDKDecodeError *err;
376 } LDKCResult_ChannelConfigDecodeErrorZPtr;
377
378 /**
379  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
380  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
381  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
382  */
383 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
384    /**
385     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
386     * `err` or `result` depending on the state of `result_ok`.
387     */
388    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
389    /**
390     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
391     */
392    bool result_ok;
393 } LDKCResult_ChannelConfigDecodeErrorZ;
394
395
396
397 /**
398  * A reference to a transaction output.
399  *
400  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
401  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
402  */
403 typedef struct MUST_USE_STRUCT LDKOutPoint {
404    /**
405     * A pointer to the opaque Rust object.
406     * Nearly everywhere, inner must be non-null, however in places where
407     * the Rust equivalent takes an Option, it may be set to null to indicate None.
408     */
409    LDKnativeOutPoint *inner;
410    /**
411     * Indicates that this is the only struct which contains the same pointer.
412     * Rust functions which take ownership of an object provided via an argument require
413     * this to be true and invalidate the object pointed to by inner.
414     */
415    bool is_owned;
416 } LDKOutPoint;
417
418 /**
419  * The contents of CResult_OutPointDecodeErrorZ
420  */
421 typedef union LDKCResult_OutPointDecodeErrorZPtr {
422    /**
423     * A pointer to the contents in the success state.
424     * Reading from this pointer when `result_ok` is not set is undefined.
425     */
426    struct LDKOutPoint *result;
427    /**
428     * A pointer to the contents in the error state.
429     * Reading from this pointer when `result_ok` is set is undefined.
430     */
431    struct LDKDecodeError *err;
432 } LDKCResult_OutPointDecodeErrorZPtr;
433
434 /**
435  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
436  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
437  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
438  */
439 typedef struct LDKCResult_OutPointDecodeErrorZ {
440    /**
441     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
442     * `err` or `result` depending on the state of `result_ok`.
443     */
444    union LDKCResult_OutPointDecodeErrorZPtr contents;
445    /**
446     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
447     */
448    bool result_ok;
449 } LDKCResult_OutPointDecodeErrorZ;
450
451 /**
452  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
453  */
454 typedef struct LDKSecretKey {
455    /**
456     * The bytes of the secret key
457     */
458    uint8_t bytes[32];
459 } LDKSecretKey;
460
461 /**
462  * The contents of CResult_SecretKeyErrorZ
463  */
464 typedef union LDKCResult_SecretKeyErrorZPtr {
465    /**
466     * A pointer to the contents in the success state.
467     * Reading from this pointer when `result_ok` is not set is undefined.
468     */
469    struct LDKSecretKey *result;
470    /**
471     * A pointer to the contents in the error state.
472     * Reading from this pointer when `result_ok` is set is undefined.
473     */
474    enum LDKSecp256k1Error *err;
475 } LDKCResult_SecretKeyErrorZPtr;
476
477 /**
478  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
479  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
480  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
481  */
482 typedef struct LDKCResult_SecretKeyErrorZ {
483    /**
484     * The contents of this CResult_SecretKeyErrorZ, accessible via either
485     * `err` or `result` depending on the state of `result_ok`.
486     */
487    union LDKCResult_SecretKeyErrorZPtr contents;
488    /**
489     * Whether this CResult_SecretKeyErrorZ represents a success state.
490     */
491    bool result_ok;
492 } LDKCResult_SecretKeyErrorZ;
493
494 /**
495  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
496  */
497 typedef struct LDKPublicKey {
498    /**
499     * The bytes of the public key
500     */
501    uint8_t compressed_form[33];
502 } LDKPublicKey;
503
504 /**
505  * The contents of CResult_PublicKeyErrorZ
506  */
507 typedef union LDKCResult_PublicKeyErrorZPtr {
508    /**
509     * A pointer to the contents in the success state.
510     * Reading from this pointer when `result_ok` is not set is undefined.
511     */
512    struct LDKPublicKey *result;
513    /**
514     * A pointer to the contents in the error state.
515     * Reading from this pointer when `result_ok` is set is undefined.
516     */
517    enum LDKSecp256k1Error *err;
518 } LDKCResult_PublicKeyErrorZPtr;
519
520 /**
521  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
522  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
523  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
524  */
525 typedef struct LDKCResult_PublicKeyErrorZ {
526    /**
527     * The contents of this CResult_PublicKeyErrorZ, accessible via either
528     * `err` or `result` depending on the state of `result_ok`.
529     */
530    union LDKCResult_PublicKeyErrorZPtr contents;
531    /**
532     * Whether this CResult_PublicKeyErrorZ represents a success state.
533     */
534    bool result_ok;
535 } LDKCResult_PublicKeyErrorZ;
536
537
538
539 /**
540  * The set of public keys which are used in the creation of one commitment transaction.
541  * These are derived from the channel base keys and per-commitment data.
542  *
543  * A broadcaster key is provided from potential broadcaster of the computed transaction.
544  * A countersignatory key is coming from a protocol participant unable to broadcast the
545  * transaction.
546  *
547  * These keys are assumed to be good, either because the code derived them from
548  * channel basepoints via the new function, or they were obtained via
549  * CommitmentTransaction.trust().keys() because we trusted the source of the
550  * pre-calculated keys.
551  */
552 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
553    /**
554     * A pointer to the opaque Rust object.
555     * Nearly everywhere, inner must be non-null, however in places where
556     * the Rust equivalent takes an Option, it may be set to null to indicate None.
557     */
558    LDKnativeTxCreationKeys *inner;
559    /**
560     * Indicates that this is the only struct which contains the same pointer.
561     * Rust functions which take ownership of an object provided via an argument require
562     * this to be true and invalidate the object pointed to by inner.
563     */
564    bool is_owned;
565 } LDKTxCreationKeys;
566
567 /**
568  * The contents of CResult_TxCreationKeysDecodeErrorZ
569  */
570 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
571    /**
572     * A pointer to the contents in the success state.
573     * Reading from this pointer when `result_ok` is not set is undefined.
574     */
575    struct LDKTxCreationKeys *result;
576    /**
577     * A pointer to the contents in the error state.
578     * Reading from this pointer when `result_ok` is set is undefined.
579     */
580    struct LDKDecodeError *err;
581 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
582
583 /**
584  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
585  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
586  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
587  */
588 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
589    /**
590     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
591     * `err` or `result` depending on the state of `result_ok`.
592     */
593    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
594    /**
595     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
596     */
597    bool result_ok;
598 } LDKCResult_TxCreationKeysDecodeErrorZ;
599
600
601
602 /**
603  * One counterparty's public keys which do not change over the life of a channel.
604  */
605 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
606    /**
607     * A pointer to the opaque Rust object.
608     * Nearly everywhere, inner must be non-null, however in places where
609     * the Rust equivalent takes an Option, it may be set to null to indicate None.
610     */
611    LDKnativeChannelPublicKeys *inner;
612    /**
613     * Indicates that this is the only struct which contains the same pointer.
614     * Rust functions which take ownership of an object provided via an argument require
615     * this to be true and invalidate the object pointed to by inner.
616     */
617    bool is_owned;
618 } LDKChannelPublicKeys;
619
620 /**
621  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
622  */
623 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
624    /**
625     * A pointer to the contents in the success state.
626     * Reading from this pointer when `result_ok` is not set is undefined.
627     */
628    struct LDKChannelPublicKeys *result;
629    /**
630     * A pointer to the contents in the error state.
631     * Reading from this pointer when `result_ok` is set is undefined.
632     */
633    struct LDKDecodeError *err;
634 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
635
636 /**
637  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
638  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
639  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
640  */
641 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
642    /**
643     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
644     * `err` or `result` depending on the state of `result_ok`.
645     */
646    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
647    /**
648     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
649     */
650    bool result_ok;
651 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
652
653 /**
654  * The contents of CResult_TxCreationKeysErrorZ
655  */
656 typedef union LDKCResult_TxCreationKeysErrorZPtr {
657    /**
658     * A pointer to the contents in the success state.
659     * Reading from this pointer when `result_ok` is not set is undefined.
660     */
661    struct LDKTxCreationKeys *result;
662    /**
663     * A pointer to the contents in the error state.
664     * Reading from this pointer when `result_ok` is set is undefined.
665     */
666    enum LDKSecp256k1Error *err;
667 } LDKCResult_TxCreationKeysErrorZPtr;
668
669 /**
670  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
671  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
672  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
673  */
674 typedef struct LDKCResult_TxCreationKeysErrorZ {
675    /**
676     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
677     * `err` or `result` depending on the state of `result_ok`.
678     */
679    union LDKCResult_TxCreationKeysErrorZPtr contents;
680    /**
681     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
682     */
683    bool result_ok;
684 } LDKCResult_TxCreationKeysErrorZ;
685
686 /**
687  * An enum which can either contain a u32 or not
688  */
689 typedef enum LDKCOption_u32Z_Tag {
690    /**
691     * When we're in this state, this COption_u32Z contains a u32
692     */
693    LDKCOption_u32Z_Some,
694    /**
695     * When we're in this state, this COption_u32Z contains nothing
696     */
697    LDKCOption_u32Z_None,
698    /**
699     * Must be last for serialization purposes
700     */
701    LDKCOption_u32Z_Sentinel,
702 } LDKCOption_u32Z_Tag;
703
704 typedef struct LDKCOption_u32Z {
705    LDKCOption_u32Z_Tag tag;
706    union {
707       struct {
708          uint32_t some;
709       };
710    };
711 } LDKCOption_u32Z;
712
713
714
715 /**
716  * Information about an HTLC as it appears in a commitment transaction
717  */
718 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
719    /**
720     * A pointer to the opaque Rust object.
721     * Nearly everywhere, inner must be non-null, however in places where
722     * the Rust equivalent takes an Option, it may be set to null to indicate None.
723     */
724    LDKnativeHTLCOutputInCommitment *inner;
725    /**
726     * Indicates that this is the only struct which contains the same pointer.
727     * Rust functions which take ownership of an object provided via an argument require
728     * this to be true and invalidate the object pointed to by inner.
729     */
730    bool is_owned;
731 } LDKHTLCOutputInCommitment;
732
733 /**
734  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
735  */
736 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
737    /**
738     * A pointer to the contents in the success state.
739     * Reading from this pointer when `result_ok` is not set is undefined.
740     */
741    struct LDKHTLCOutputInCommitment *result;
742    /**
743     * A pointer to the contents in the error state.
744     * Reading from this pointer when `result_ok` is set is undefined.
745     */
746    struct LDKDecodeError *err;
747 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
748
749 /**
750  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
751  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
752  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
753  */
754 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
755    /**
756     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
757     * `err` or `result` depending on the state of `result_ok`.
758     */
759    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
760    /**
761     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
762     */
763    bool result_ok;
764 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
765
766
767
768 /**
769  * Late-bound per-channel counterparty data used to build transactions.
770  */
771 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
772    /**
773     * A pointer to the opaque Rust object.
774     * Nearly everywhere, inner must be non-null, however in places where
775     * the Rust equivalent takes an Option, it may be set to null to indicate None.
776     */
777    LDKnativeCounterpartyChannelTransactionParameters *inner;
778    /**
779     * Indicates that this is the only struct which contains the same pointer.
780     * Rust functions which take ownership of an object provided via an argument require
781     * this to be true and invalidate the object pointed to by inner.
782     */
783    bool is_owned;
784 } LDKCounterpartyChannelTransactionParameters;
785
786 /**
787  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
788  */
789 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
790    /**
791     * A pointer to the contents in the success state.
792     * Reading from this pointer when `result_ok` is not set is undefined.
793     */
794    struct LDKCounterpartyChannelTransactionParameters *result;
795    /**
796     * A pointer to the contents in the error state.
797     * Reading from this pointer when `result_ok` is set is undefined.
798     */
799    struct LDKDecodeError *err;
800 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
801
802 /**
803  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
804  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
805  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
806  */
807 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
808    /**
809     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
810     * `err` or `result` depending on the state of `result_ok`.
811     */
812    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
813    /**
814     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
815     */
816    bool result_ok;
817 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
818
819
820
821 /**
822  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
823  * The fields are organized by holder/counterparty.
824  *
825  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
826  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
827  */
828 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
829    /**
830     * A pointer to the opaque Rust object.
831     * Nearly everywhere, inner must be non-null, however in places where
832     * the Rust equivalent takes an Option, it may be set to null to indicate None.
833     */
834    LDKnativeChannelTransactionParameters *inner;
835    /**
836     * Indicates that this is the only struct which contains the same pointer.
837     * Rust functions which take ownership of an object provided via an argument require
838     * this to be true and invalidate the object pointed to by inner.
839     */
840    bool is_owned;
841 } LDKChannelTransactionParameters;
842
843 /**
844  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
845  */
846 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
847    /**
848     * A pointer to the contents in the success state.
849     * Reading from this pointer when `result_ok` is not set is undefined.
850     */
851    struct LDKChannelTransactionParameters *result;
852    /**
853     * A pointer to the contents in the error state.
854     * Reading from this pointer when `result_ok` is set is undefined.
855     */
856    struct LDKDecodeError *err;
857 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
858
859 /**
860  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
861  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
862  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
863  */
864 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
865    /**
866     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
867     * `err` or `result` depending on the state of `result_ok`.
868     */
869    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
870    /**
871     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
872     */
873    bool result_ok;
874 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
875
876 /**
877  * Represents a secp256k1 signature serialized as two 32-byte numbers
878  */
879 typedef struct LDKSignature {
880    /**
881     * The bytes of the signature in "compact" form
882     */
883    uint8_t compact_form[64];
884 } LDKSignature;
885
886 /**
887  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
888  * This corresponds to std::vector in C++
889  */
890 typedef struct LDKCVec_SignatureZ {
891    /**
892     * The elements in the array.
893     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
894     */
895    struct LDKSignature *data;
896    /**
897     * The number of elements pointed to by `data`.
898     */
899    uintptr_t datalen;
900 } LDKCVec_SignatureZ;
901
902
903
904 /**
905  * Information needed to build and sign a holder's commitment transaction.
906  *
907  * The transaction is only signed once we are ready to broadcast.
908  */
909 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
910    /**
911     * A pointer to the opaque Rust object.
912     * Nearly everywhere, inner must be non-null, however in places where
913     * the Rust equivalent takes an Option, it may be set to null to indicate None.
914     */
915    LDKnativeHolderCommitmentTransaction *inner;
916    /**
917     * Indicates that this is the only struct which contains the same pointer.
918     * Rust functions which take ownership of an object provided via an argument require
919     * this to be true and invalidate the object pointed to by inner.
920     */
921    bool is_owned;
922 } LDKHolderCommitmentTransaction;
923
924 /**
925  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
926  */
927 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
928    /**
929     * A pointer to the contents in the success state.
930     * Reading from this pointer when `result_ok` is not set is undefined.
931     */
932    struct LDKHolderCommitmentTransaction *result;
933    /**
934     * A pointer to the contents in the error state.
935     * Reading from this pointer when `result_ok` is set is undefined.
936     */
937    struct LDKDecodeError *err;
938 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
939
940 /**
941  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
942  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
943  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
944  */
945 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
946    /**
947     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
948     * `err` or `result` depending on the state of `result_ok`.
949     */
950    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
951    /**
952     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
953     */
954    bool result_ok;
955 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
956
957
958
959 /**
960  * A pre-built Bitcoin commitment transaction and its txid.
961  */
962 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
963    /**
964     * A pointer to the opaque Rust object.
965     * Nearly everywhere, inner must be non-null, however in places where
966     * the Rust equivalent takes an Option, it may be set to null to indicate None.
967     */
968    LDKnativeBuiltCommitmentTransaction *inner;
969    /**
970     * Indicates that this is the only struct which contains the same pointer.
971     * Rust functions which take ownership of an object provided via an argument require
972     * this to be true and invalidate the object pointed to by inner.
973     */
974    bool is_owned;
975 } LDKBuiltCommitmentTransaction;
976
977 /**
978  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
979  */
980 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
981    /**
982     * A pointer to the contents in the success state.
983     * Reading from this pointer when `result_ok` is not set is undefined.
984     */
985    struct LDKBuiltCommitmentTransaction *result;
986    /**
987     * A pointer to the contents in the error state.
988     * Reading from this pointer when `result_ok` is set is undefined.
989     */
990    struct LDKDecodeError *err;
991 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
992
993 /**
994  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
995  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
996  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
997  */
998 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
999    /**
1000     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1001     * `err` or `result` depending on the state of `result_ok`.
1002     */
1003    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1004    /**
1005     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1006     */
1007    bool result_ok;
1008 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1009
1010
1011
1012 /**
1013  * This class tracks the per-transaction information needed to build a commitment transaction and to
1014  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1015  * and for transactions we sign for the counterparty.
1016  *
1017  * This class can be used inside a signer implementation to generate a signature given the relevant
1018  * secret key.
1019  */
1020 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1021    /**
1022     * A pointer to the opaque Rust object.
1023     * Nearly everywhere, inner must be non-null, however in places where
1024     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1025     */
1026    LDKnativeCommitmentTransaction *inner;
1027    /**
1028     * Indicates that this is the only struct which contains the same pointer.
1029     * Rust functions which take ownership of an object provided via an argument require
1030     * this to be true and invalidate the object pointed to by inner.
1031     */
1032    bool is_owned;
1033 } LDKCommitmentTransaction;
1034
1035 /**
1036  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1037  */
1038 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1039    /**
1040     * A pointer to the contents in the success state.
1041     * Reading from this pointer when `result_ok` is not set is undefined.
1042     */
1043    struct LDKCommitmentTransaction *result;
1044    /**
1045     * A pointer to the contents in the error state.
1046     * Reading from this pointer when `result_ok` is set is undefined.
1047     */
1048    struct LDKDecodeError *err;
1049 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1050
1051 /**
1052  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1053  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1054  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1055  */
1056 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1057    /**
1058     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1059     * `err` or `result` depending on the state of `result_ok`.
1060     */
1061    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1062    /**
1063     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1064     */
1065    bool result_ok;
1066 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1067
1068
1069
1070 /**
1071  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1072  * transaction and the transaction creation keys) are trusted.
1073  *
1074  * See trust() and verify() functions on CommitmentTransaction.
1075  *
1076  * This structure implements Deref.
1077  */
1078 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1079    /**
1080     * A pointer to the opaque Rust object.
1081     * Nearly everywhere, inner must be non-null, however in places where
1082     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1083     */
1084    LDKnativeTrustedCommitmentTransaction *inner;
1085    /**
1086     * Indicates that this is the only struct which contains the same pointer.
1087     * Rust functions which take ownership of an object provided via an argument require
1088     * this to be true and invalidate the object pointed to by inner.
1089     */
1090    bool is_owned;
1091 } LDKTrustedCommitmentTransaction;
1092
1093 /**
1094  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1095  */
1096 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1097    /**
1098     * A pointer to the contents in the success state.
1099     * Reading from this pointer when `result_ok` is not set is undefined.
1100     */
1101    struct LDKTrustedCommitmentTransaction *result;
1102    /**
1103     * Note that this value is always NULL, as there are no contents in the Err variant
1104     */
1105    void *err;
1106 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1107
1108 /**
1109  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1110  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1111  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1112  */
1113 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1114    /**
1115     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1116     * `err` or `result` depending on the state of `result_ok`.
1117     */
1118    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1119    /**
1120     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1121     */
1122    bool result_ok;
1123 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1124
1125 /**
1126  * The contents of CResult_CVec_SignatureZNoneZ
1127  */
1128 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1129    /**
1130     * A pointer to the contents in the success state.
1131     * Reading from this pointer when `result_ok` is not set is undefined.
1132     */
1133    struct LDKCVec_SignatureZ *result;
1134    /**
1135     * Note that this value is always NULL, as there are no contents in the Err variant
1136     */
1137    void *err;
1138 } LDKCResult_CVec_SignatureZNoneZPtr;
1139
1140 /**
1141  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1142  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1143  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1144  */
1145 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1146    /**
1147     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1148     * `err` or `result` depending on the state of `result_ok`.
1149     */
1150    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1151    /**
1152     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1153     */
1154    bool result_ok;
1155 } LDKCResult_CVec_SignatureZNoneZ;
1156
1157 /**
1158  * The contents of CResult_StringErrorZ
1159  */
1160 typedef union LDKCResult_StringErrorZPtr {
1161    /**
1162     * A pointer to the contents in the success state.
1163     * Reading from this pointer when `result_ok` is not set is undefined.
1164     */
1165    struct LDKCVec_u8Z *result;
1166    /**
1167     * A pointer to the contents in the error state.
1168     * Reading from this pointer when `result_ok` is set is undefined.
1169     */
1170    enum LDKSecp256k1Error *err;
1171 } LDKCResult_StringErrorZPtr;
1172
1173 /**
1174  * A CResult_StringErrorZ represents the result of a fallible operation,
1175  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::Secp256k1Error on failure.
1176  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1177  */
1178 typedef struct LDKCResult_StringErrorZ {
1179    /**
1180     * The contents of this CResult_StringErrorZ, accessible via either
1181     * `err` or `result` depending on the state of `result_ok`.
1182     */
1183    union LDKCResult_StringErrorZPtr contents;
1184    /**
1185     * Whether this CResult_StringErrorZ represents a success state.
1186     */
1187    bool result_ok;
1188 } LDKCResult_StringErrorZ;
1189
1190
1191
1192 /**
1193  * An update generated by the underlying Channel itself which contains some new information the
1194  * ChannelMonitor should be made aware of.
1195  */
1196 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1197    /**
1198     * A pointer to the opaque Rust object.
1199     * Nearly everywhere, inner must be non-null, however in places where
1200     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1201     */
1202    LDKnativeChannelMonitorUpdate *inner;
1203    /**
1204     * Indicates that this is the only struct which contains the same pointer.
1205     * Rust functions which take ownership of an object provided via an argument require
1206     * this to be true and invalidate the object pointed to by inner.
1207     */
1208    bool is_owned;
1209 } LDKChannelMonitorUpdate;
1210
1211 /**
1212  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
1213  */
1214 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
1215    /**
1216     * A pointer to the contents in the success state.
1217     * Reading from this pointer when `result_ok` is not set is undefined.
1218     */
1219    struct LDKChannelMonitorUpdate *result;
1220    /**
1221     * A pointer to the contents in the error state.
1222     * Reading from this pointer when `result_ok` is set is undefined.
1223     */
1224    struct LDKDecodeError *err;
1225 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
1226
1227 /**
1228  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
1229  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
1230  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1231  */
1232 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
1233    /**
1234     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
1235     * `err` or `result` depending on the state of `result_ok`.
1236     */
1237    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
1238    /**
1239     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
1240     */
1241    bool result_ok;
1242 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
1243
1244
1245
1246 /**
1247  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
1248  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
1249  * preimage claim backward will lead to loss of funds.
1250  */
1251 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
1252    /**
1253     * A pointer to the opaque Rust object.
1254     * Nearly everywhere, inner must be non-null, however in places where
1255     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1256     */
1257    LDKnativeHTLCUpdate *inner;
1258    /**
1259     * Indicates that this is the only struct which contains the same pointer.
1260     * Rust functions which take ownership of an object provided via an argument require
1261     * this to be true and invalidate the object pointed to by inner.
1262     */
1263    bool is_owned;
1264 } LDKHTLCUpdate;
1265
1266 /**
1267  * The contents of CResult_HTLCUpdateDecodeErrorZ
1268  */
1269 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
1270    /**
1271     * A pointer to the contents in the success state.
1272     * Reading from this pointer when `result_ok` is not set is undefined.
1273     */
1274    struct LDKHTLCUpdate *result;
1275    /**
1276     * A pointer to the contents in the error state.
1277     * Reading from this pointer when `result_ok` is set is undefined.
1278     */
1279    struct LDKDecodeError *err;
1280 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
1281
1282 /**
1283  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
1284  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
1285  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1286  */
1287 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
1288    /**
1289     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
1290     * `err` or `result` depending on the state of `result_ok`.
1291     */
1292    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
1293    /**
1294     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
1295     */
1296    bool result_ok;
1297 } LDKCResult_HTLCUpdateDecodeErrorZ;
1298
1299
1300
1301 /**
1302  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
1303  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
1304  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
1305  * corrupted.
1306  * Contains a developer-readable error message.
1307  */
1308 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
1309    /**
1310     * A pointer to the opaque Rust object.
1311     * Nearly everywhere, inner must be non-null, however in places where
1312     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1313     */
1314    LDKnativeMonitorUpdateError *inner;
1315    /**
1316     * Indicates that this is the only struct which contains the same pointer.
1317     * Rust functions which take ownership of an object provided via an argument require
1318     * this to be true and invalidate the object pointed to by inner.
1319     */
1320    bool is_owned;
1321 } LDKMonitorUpdateError;
1322
1323 /**
1324  * The contents of CResult_NoneMonitorUpdateErrorZ
1325  */
1326 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
1327    /**
1328     * Note that this value is always NULL, as there are no contents in the OK variant
1329     */
1330    void *result;
1331    /**
1332     * A pointer to the contents in the error state.
1333     * Reading from this pointer when `result_ok` is set is undefined.
1334     */
1335    struct LDKMonitorUpdateError *err;
1336 } LDKCResult_NoneMonitorUpdateErrorZPtr;
1337
1338 /**
1339  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
1340  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
1341  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1342  */
1343 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
1344    /**
1345     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
1346     * `err` or `result` depending on the state of `result_ok`.
1347     */
1348    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
1349    /**
1350     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
1351     */
1352    bool result_ok;
1353 } LDKCResult_NoneMonitorUpdateErrorZ;
1354
1355 /**
1356  * A tuple of 2 elements. See the individual fields for the types contained.
1357  */
1358 typedef struct LDKC2Tuple_OutPointScriptZ {
1359    /**
1360     * The element at position 0
1361     */
1362    struct LDKOutPoint a;
1363    /**
1364     * The element at position 1
1365     */
1366    struct LDKCVec_u8Z b;
1367 } LDKC2Tuple_OutPointScriptZ;
1368
1369 /**
1370  * A tuple of 2 elements. See the individual fields for the types contained.
1371  */
1372 typedef struct LDKC2Tuple_u32ScriptZ {
1373    /**
1374     * The element at position 0
1375     */
1376    uint32_t a;
1377    /**
1378     * The element at position 1
1379     */
1380    struct LDKCVec_u8Z b;
1381 } LDKC2Tuple_u32ScriptZ;
1382
1383 /**
1384  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
1385  * This corresponds to std::vector in C++
1386  */
1387 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
1388    /**
1389     * The elements in the array.
1390     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1391     */
1392    struct LDKC2Tuple_u32ScriptZ *data;
1393    /**
1394     * The number of elements pointed to by `data`.
1395     */
1396    uintptr_t datalen;
1397 } LDKCVec_C2Tuple_u32ScriptZZ;
1398
1399 /**
1400  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1401  * look up the corresponding function in rust-lightning's docs.
1402  */
1403 typedef struct LDKThirtyTwoBytes {
1404    /**
1405     * The thirty-two bytes
1406     */
1407    uint8_t data[32];
1408 } LDKThirtyTwoBytes;
1409
1410 /**
1411  * A tuple of 2 elements. See the individual fields for the types contained.
1412  */
1413 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
1414    /**
1415     * The element at position 0
1416     */
1417    struct LDKThirtyTwoBytes a;
1418    /**
1419     * The element at position 1
1420     */
1421    struct LDKCVec_C2Tuple_u32ScriptZZ b;
1422 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
1423
1424 /**
1425  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
1426  * This corresponds to std::vector in C++
1427  */
1428 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1429    /**
1430     * The elements in the array.
1431     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1432     */
1433    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
1434    /**
1435     * The number of elements pointed to by `data`.
1436     */
1437    uintptr_t datalen;
1438 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
1439
1440 /**
1441  * An event to be processed by the ChannelManager.
1442  */
1443 typedef enum LDKMonitorEvent_Tag {
1444    /**
1445     * A monitor event containing an HTLCUpdate.
1446     */
1447    LDKMonitorEvent_HTLCEvent,
1448    /**
1449     * A monitor event that the Channel's commitment transaction was broadcasted.
1450     */
1451    LDKMonitorEvent_CommitmentTxBroadcasted,
1452    /**
1453     * Must be last for serialization purposes
1454     */
1455    LDKMonitorEvent_Sentinel,
1456 } LDKMonitorEvent_Tag;
1457
1458 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1459    LDKMonitorEvent_Tag tag;
1460    union {
1461       struct {
1462          struct LDKHTLCUpdate htlc_event;
1463       };
1464       struct {
1465          struct LDKOutPoint commitment_tx_broadcasted;
1466       };
1467    };
1468 } LDKMonitorEvent;
1469
1470 /**
1471  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
1472  * This corresponds to std::vector in C++
1473  */
1474 typedef struct LDKCVec_MonitorEventZ {
1475    /**
1476     * The elements in the array.
1477     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1478     */
1479    struct LDKMonitorEvent *data;
1480    /**
1481     * The number of elements pointed to by `data`.
1482     */
1483    uintptr_t datalen;
1484 } LDKCVec_MonitorEventZ;
1485
1486
1487
1488 /**
1489  * Information about a spendable output to a P2WSH script. See
1490  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
1491  */
1492 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
1493    /**
1494     * A pointer to the opaque Rust object.
1495     * Nearly everywhere, inner must be non-null, however in places where
1496     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1497     */
1498    LDKnativeDelayedPaymentOutputDescriptor *inner;
1499    /**
1500     * Indicates that this is the only struct which contains the same pointer.
1501     * Rust functions which take ownership of an object provided via an argument require
1502     * this to be true and invalidate the object pointed to by inner.
1503     */
1504    bool is_owned;
1505 } LDKDelayedPaymentOutputDescriptor;
1506
1507
1508
1509 /**
1510  * Information about a spendable output to our \"payment key\". See
1511  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
1512  */
1513 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
1514    /**
1515     * A pointer to the opaque Rust object.
1516     * Nearly everywhere, inner must be non-null, however in places where
1517     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1518     */
1519    LDKnativeStaticPaymentOutputDescriptor *inner;
1520    /**
1521     * Indicates that this is the only struct which contains the same pointer.
1522     * Rust functions which take ownership of an object provided via an argument require
1523     * this to be true and invalidate the object pointed to by inner.
1524     */
1525    bool is_owned;
1526 } LDKStaticPaymentOutputDescriptor;
1527
1528 /**
1529  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
1530  * claim at any point in the future) an event is generated which you must track and be able to
1531  * spend on-chain. The information needed to do this is provided in this enum, including the
1532  * outpoint describing which txid and output index is available, the full output which exists at
1533  * that txid/index, and any keys or other information required to sign.
1534  */
1535 typedef enum LDKSpendableOutputDescriptor_Tag {
1536    /**
1537     * An output to a script which was provided via KeysInterface directly, either from
1538     * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
1539     * spend it. No secret keys are provided as rust-lightning was never given any key.
1540     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
1541     * on-chain using the payment preimage or after it has timed out.
1542     */
1543    LDKSpendableOutputDescriptor_StaticOutput,
1544    /**
1545     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
1546     *
1547     * The witness in the spending input should be:
1548     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
1549     *
1550     * Note that the nSequence field in the spending input must be set to to_self_delay
1551     * (which means the transaction is not broadcastable until at least to_self_delay
1552     * blocks after the outpoint confirms).
1553     *
1554     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
1555     * it is an output from an old state which we broadcast (which should never happen).
1556     *
1557     * To derive the delayed_payment key which is used to sign for this input, you must pass the
1558     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
1559     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
1560     * chan_utils::derive_private_key. The public key can be generated without the secret key
1561     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
1562     * Sign::pubkeys().
1563     *
1564     * To derive the revocation_pubkey provided here (which is used in the witness
1565     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
1566     * call to Sign::ready_channel) and the provided per_commitment point
1567     * to chan_utils::derive_public_revocation_key.
1568     *
1569     * The witness script which is hashed and included in the output script_pubkey may be
1570     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
1571     * (derived as above), and the to_self_delay contained here to
1572     * chan_utils::get_revokeable_redeemscript.
1573     */
1574    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
1575    /**
1576     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
1577     * corresponds to the public key in Sign::pubkeys().payment_point).
1578     * The witness in the spending input, is, thus, simply:
1579     * <BIP 143 signature> <payment key>
1580     *
1581     * These are generally the result of our counterparty having broadcast the current state,
1582     * allowing us to claim the non-HTLC-encumbered outputs immediately.
1583     */
1584    LDKSpendableOutputDescriptor_StaticPaymentOutput,
1585    /**
1586     * Must be last for serialization purposes
1587     */
1588    LDKSpendableOutputDescriptor_Sentinel,
1589 } LDKSpendableOutputDescriptor_Tag;
1590
1591 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
1592    /**
1593     * The outpoint which is spendable
1594     */
1595    struct LDKOutPoint outpoint;
1596    /**
1597     * The output which is referenced by the given outpoint.
1598     */
1599    struct LDKTxOut output;
1600 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
1601
1602 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
1603    LDKSpendableOutputDescriptor_Tag tag;
1604    union {
1605       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
1606       struct {
1607          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
1608       };
1609       struct {
1610          struct LDKStaticPaymentOutputDescriptor static_payment_output;
1611       };
1612    };
1613 } LDKSpendableOutputDescriptor;
1614
1615 /**
1616  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
1617  * This corresponds to std::vector in C++
1618  */
1619 typedef struct LDKCVec_SpendableOutputDescriptorZ {
1620    /**
1621     * The elements in the array.
1622     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1623     */
1624    struct LDKSpendableOutputDescriptor *data;
1625    /**
1626     * The number of elements pointed to by `data`.
1627     */
1628    uintptr_t datalen;
1629 } LDKCVec_SpendableOutputDescriptorZ;
1630
1631 /**
1632  * An Event which you should probably take some action in response to.
1633  *
1634  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
1635  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
1636  * written as it makes no sense to respond to it after reconnecting to peers).
1637  */
1638 typedef enum LDKEvent_Tag {
1639    /**
1640     * Used to indicate that the client should generate a funding transaction with the given
1641     * parameters and then call ChannelManager::funding_transaction_generated.
1642     * Generated in ChannelManager message handling.
1643     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
1644     * counterparty can steal your funds!
1645     */
1646    LDKEvent_FundingGenerationReady,
1647    /**
1648     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
1649     * ChannelManager::claim_funds to get it....
1650     * Note that if the preimage is not known or the amount paid is incorrect, you should call
1651     * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
1652     * network congestion.
1653     * The amount paid should be considered 'incorrect' when it is less than or more than twice
1654     * the amount expected.
1655     * If you fail to call either ChannelManager::claim_funds or
1656     * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
1657     * automatically failed.
1658     */
1659    LDKEvent_PaymentReceived,
1660    /**
1661     * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
1662     * and we got back the payment preimage for it).
1663     * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
1664     * deduplicate them by payment_preimage (which MUST be unique)!
1665     */
1666    LDKEvent_PaymentSent,
1667    /**
1668     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
1669     * something. You may wish to retry with a different route.
1670     * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
1671     * deduplicate them by payment_hash (which MUST be unique)!
1672     */
1673    LDKEvent_PaymentFailed,
1674    /**
1675     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
1676     * time in the future.
1677     */
1678    LDKEvent_PendingHTLCsForwardable,
1679    /**
1680     * Used to indicate that an output was generated on-chain which you should know how to spend.
1681     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
1682     * counterparty spending them due to some kind of timeout. Thus, you need to store them
1683     * somewhere and spend them when you create on-chain transactions.
1684     */
1685    LDKEvent_SpendableOutputs,
1686    /**
1687     * Must be last for serialization purposes
1688     */
1689    LDKEvent_Sentinel,
1690 } LDKEvent_Tag;
1691
1692 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
1693    /**
1694     * The random channel_id we picked which you'll need to pass into
1695     * ChannelManager::funding_transaction_generated.
1696     */
1697    struct LDKThirtyTwoBytes temporary_channel_id;
1698    /**
1699     * The value, in satoshis, that the output should have.
1700     */
1701    uint64_t channel_value_satoshis;
1702    /**
1703     * The script which should be used in the transaction output.
1704     */
1705    struct LDKCVec_u8Z output_script;
1706    /**
1707     * The value passed in to ChannelManager::create_channel
1708     */
1709    uint64_t user_channel_id;
1710 } LDKEvent_LDKFundingGenerationReady_Body;
1711
1712 typedef struct LDKEvent_LDKPaymentReceived_Body {
1713    /**
1714     * The hash for which the preimage should be handed to the ChannelManager.
1715     */
1716    struct LDKThirtyTwoBytes payment_hash;
1717    /**
1718     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
1719     * number of deanonymization attacks during the routing process.
1720     * As nodes upgrade, the invoices you provide should likely migrate to setting the
1721     * payment_secret feature to required, at which point you should fail_backwards any HTLCs
1722     * which have a None here.
1723     * Until then, however, values of None should be ignored, and only incorrect Some values
1724     * should result in an HTLC fail_backwards.
1725     * Note that, in any case, this value must be passed as-is to any fail or claim calls as
1726     * the HTLC index includes this value.
1727     */
1728    struct LDKThirtyTwoBytes payment_secret;
1729    /**
1730     * The value, in thousandths of a satoshi, that this payment is for. Note that you must
1731     * compare this to the expected value before accepting the payment (as otherwise you are
1732     * providing proof-of-payment for less than the value you expected!).
1733     */
1734    uint64_t amt;
1735 } LDKEvent_LDKPaymentReceived_Body;
1736
1737 typedef struct LDKEvent_LDKPaymentSent_Body {
1738    /**
1739     * The preimage to the hash given to ChannelManager::send_payment.
1740     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
1741     * store it somehow!
1742     */
1743    struct LDKThirtyTwoBytes payment_preimage;
1744 } LDKEvent_LDKPaymentSent_Body;
1745
1746 typedef struct LDKEvent_LDKPaymentFailed_Body {
1747    /**
1748     * The hash which was given to ChannelManager::send_payment.
1749     */
1750    struct LDKThirtyTwoBytes payment_hash;
1751    /**
1752     * Indicates the payment was rejected for some reason by the recipient. This implies that
1753     * the payment has failed, not just the route in question. If this is not set, you may
1754     * retry the payment via a different route.
1755     */
1756    bool rejected_by_dest;
1757 } LDKEvent_LDKPaymentFailed_Body;
1758
1759 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
1760    /**
1761     * The minimum amount of time that should be waited prior to calling
1762     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
1763     * you should wait a random amount of time in roughly the range (now + time_forwardable,
1764     * now + 5*time_forwardable).
1765     */
1766    uint64_t time_forwardable;
1767 } LDKEvent_LDKPendingHTLCsForwardable_Body;
1768
1769 typedef struct LDKEvent_LDKSpendableOutputs_Body {
1770    /**
1771     * The outputs which you should store as spendable by you.
1772     */
1773    struct LDKCVec_SpendableOutputDescriptorZ outputs;
1774 } LDKEvent_LDKSpendableOutputs_Body;
1775
1776 typedef struct MUST_USE_STRUCT LDKEvent {
1777    LDKEvent_Tag tag;
1778    union {
1779       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
1780       LDKEvent_LDKPaymentReceived_Body payment_received;
1781       LDKEvent_LDKPaymentSent_Body payment_sent;
1782       LDKEvent_LDKPaymentFailed_Body payment_failed;
1783       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
1784       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
1785    };
1786 } LDKEvent;
1787
1788 /**
1789  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
1790  * This corresponds to std::vector in C++
1791  */
1792 typedef struct LDKCVec_EventZ {
1793    /**
1794     * The elements in the array.
1795     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1796     */
1797    struct LDKEvent *data;
1798    /**
1799     * The number of elements pointed to by `data`.
1800     */
1801    uintptr_t datalen;
1802 } LDKCVec_EventZ;
1803
1804 /**
1805  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
1806  * This corresponds to std::vector in C++
1807  */
1808 typedef struct LDKCVec_TransactionZ {
1809    /**
1810     * The elements in the array.
1811     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1812     */
1813    struct LDKTransaction *data;
1814    /**
1815     * The number of elements pointed to by `data`.
1816     */
1817    uintptr_t datalen;
1818 } LDKCVec_TransactionZ;
1819
1820 /**
1821  * A tuple of 2 elements. See the individual fields for the types contained.
1822  */
1823 typedef struct LDKC2Tuple_usizeTransactionZ {
1824    /**
1825     * The element at position 0
1826     */
1827    uintptr_t a;
1828    /**
1829     * The element at position 1
1830     */
1831    struct LDKTransaction b;
1832 } LDKC2Tuple_usizeTransactionZ;
1833
1834 /**
1835  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
1836  * This corresponds to std::vector in C++
1837  */
1838 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
1839    /**
1840     * The elements in the array.
1841     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1842     */
1843    struct LDKC2Tuple_usizeTransactionZ *data;
1844    /**
1845     * The number of elements pointed to by `data`.
1846     */
1847    uintptr_t datalen;
1848 } LDKCVec_C2Tuple_usizeTransactionZZ;
1849
1850 /**
1851  * A tuple of 2 elements. See the individual fields for the types contained.
1852  */
1853 typedef struct LDKC2Tuple_u32TxOutZ {
1854    /**
1855     * The element at position 0
1856     */
1857    uint32_t a;
1858    /**
1859     * The element at position 1
1860     */
1861    struct LDKTxOut b;
1862 } LDKC2Tuple_u32TxOutZ;
1863
1864 /**
1865  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
1866  * This corresponds to std::vector in C++
1867  */
1868 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
1869    /**
1870     * The elements in the array.
1871     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1872     */
1873    struct LDKC2Tuple_u32TxOutZ *data;
1874    /**
1875     * The number of elements pointed to by `data`.
1876     */
1877    uintptr_t datalen;
1878 } LDKCVec_C2Tuple_u32TxOutZZ;
1879
1880 /**
1881  * A tuple of 2 elements. See the individual fields for the types contained.
1882  */
1883 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
1884    /**
1885     * The element at position 0
1886     */
1887    struct LDKThirtyTwoBytes a;
1888    /**
1889     * The element at position 1
1890     */
1891    struct LDKCVec_C2Tuple_u32TxOutZZ b;
1892 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
1893
1894 /**
1895  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
1896  * This corresponds to std::vector in C++
1897  */
1898 typedef struct LDKCVec_TransactionOutputsZ {
1899    /**
1900     * The elements in the array.
1901     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1902     */
1903    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
1904    /**
1905     * The number of elements pointed to by `data`.
1906     */
1907    uintptr_t datalen;
1908 } LDKCVec_TransactionOutputsZ;
1909
1910 /**
1911  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1912  * This corresponds to std::vector in C++
1913  */
1914 typedef struct LDKCVec_TxidZ {
1915    /**
1916     * The elements in the array.
1917     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1918     */
1919    struct LDKThirtyTwoBytes *data;
1920    /**
1921     * The number of elements pointed to by `data`.
1922     */
1923    uintptr_t datalen;
1924 } LDKCVec_TxidZ;
1925
1926 /**
1927  * The contents of CResult_NoneChannelMonitorUpdateErrZ
1928  */
1929 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
1930    /**
1931     * Note that this value is always NULL, as there are no contents in the OK variant
1932     */
1933    void *result;
1934    /**
1935     * A pointer to the contents in the error state.
1936     * Reading from this pointer when `result_ok` is set is undefined.
1937     */
1938    enum LDKChannelMonitorUpdateErr *err;
1939 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
1940
1941 /**
1942  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
1943  * containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
1944  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1945  */
1946 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
1947    /**
1948     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
1949     * `err` or `result` depending on the state of `result_ok`.
1950     */
1951    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
1952    /**
1953     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
1954     */
1955    bool result_ok;
1956 } LDKCResult_NoneChannelMonitorUpdateErrZ;
1957
1958 /**
1959  * A tuple of 2 elements. See the individual fields for the types contained.
1960  */
1961 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
1962    /**
1963     * The element at position 0
1964     */
1965    struct LDKSignature a;
1966    /**
1967     * The element at position 1
1968     */
1969    struct LDKCVec_SignatureZ b;
1970 } LDKC2Tuple_SignatureCVec_SignatureZZ;
1971
1972 /**
1973  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
1974  */
1975 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1976    /**
1977     * A pointer to the contents in the success state.
1978     * Reading from this pointer when `result_ok` is not set is undefined.
1979     */
1980    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
1981    /**
1982     * Note that this value is always NULL, as there are no contents in the Err variant
1983     */
1984    void *err;
1985 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
1986
1987 /**
1988  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
1989  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
1990  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1991  */
1992 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1993    /**
1994     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
1995     * `err` or `result` depending on the state of `result_ok`.
1996     */
1997    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
1998    /**
1999     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
2000     */
2001    bool result_ok;
2002 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
2003
2004 /**
2005  * The contents of CResult_SignatureNoneZ
2006  */
2007 typedef union LDKCResult_SignatureNoneZPtr {
2008    /**
2009     * A pointer to the contents in the success state.
2010     * Reading from this pointer when `result_ok` is not set is undefined.
2011     */
2012    struct LDKSignature *result;
2013    /**
2014     * Note that this value is always NULL, as there are no contents in the Err variant
2015     */
2016    void *err;
2017 } LDKCResult_SignatureNoneZPtr;
2018
2019 /**
2020  * A CResult_SignatureNoneZ represents the result of a fallible operation,
2021  * containing a crate::c_types::Signature on success and a () on failure.
2022  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2023  */
2024 typedef struct LDKCResult_SignatureNoneZ {
2025    /**
2026     * The contents of this CResult_SignatureNoneZ, accessible via either
2027     * `err` or `result` depending on the state of `result_ok`.
2028     */
2029    union LDKCResult_SignatureNoneZPtr contents;
2030    /**
2031     * Whether this CResult_SignatureNoneZ represents a success state.
2032     */
2033    bool result_ok;
2034 } LDKCResult_SignatureNoneZ;
2035
2036
2037
2038 /**
2039  * The unsigned part of a channel_announcement
2040  */
2041 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
2042    /**
2043     * A pointer to the opaque Rust object.
2044     * Nearly everywhere, inner must be non-null, however in places where
2045     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2046     */
2047    LDKnativeUnsignedChannelAnnouncement *inner;
2048    /**
2049     * Indicates that this is the only struct which contains the same pointer.
2050     * Rust functions which take ownership of an object provided via an argument require
2051     * this to be true and invalidate the object pointed to by inner.
2052     */
2053    bool is_owned;
2054 } LDKUnsignedChannelAnnouncement;
2055
2056 /**
2057  * A trait to sign lightning channel transactions as described in BOLT 3.
2058  *
2059  * Signing services could be implemented on a hardware wallet. In this case,
2060  * the current Sign would be a front-end on top of a communication
2061  * channel connected to your secure device and lightning key material wouldn't
2062  * reside on a hot server. Nevertheless, a this deployment would still need
2063  * to trust the ChannelManager to avoid loss of funds as this latest component
2064  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
2065  *
2066  * A more secure iteration would be to use hashlock (or payment points) to pair
2067  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
2068  * at the price of more state and computation on the hardware wallet side. In the future,
2069  * we are looking forward to design such interface.
2070  *
2071  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
2072  * to act, as liveness and breach reply correctness are always going to be hard requirements
2073  * of LN security model, orthogonal of key management issues.
2074  */
2075 typedef struct LDKBaseSign {
2076    /**
2077     * An opaque pointer which is passed to your function implementations as an argument.
2078     * This has no meaning in the LDK, and can be NULL or any other value.
2079     */
2080    void *this_arg;
2081    /**
2082     * Gets the per-commitment point for a specific commitment number
2083     *
2084     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
2085     */
2086    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
2087    /**
2088     * Gets the commitment secret for a specific commitment number as part of the revocation process
2089     *
2090     * An external signer implementation should error here if the commitment was already signed
2091     * and should refuse to sign it in the future.
2092     *
2093     * May be called more than once for the same index.
2094     *
2095     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
2096     */
2097    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
2098    /**
2099     * Gets the holder's channel public keys and basepoints
2100     */
2101    struct LDKChannelPublicKeys pubkeys;
2102    /**
2103     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
2104     * Note that this takes a pointer to this object, not the this_ptr like other methods do
2105     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
2106     */
2107    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
2108    /**
2109     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
2110     * some SpendableOutputDescriptor types. This should be sufficient to identify this
2111     * Sign object uniquely and lookup or re-derive its keys.
2112     */
2113    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
2114    /**
2115     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
2116     *
2117     * Note that if signing fails or is rejected, the channel will be force-closed.
2118     */
2119    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
2120    /**
2121     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
2122     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
2123     * latest commitment_tx when we initiate a force-close.
2124     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
2125     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
2126     * the latest.
2127     * This may be called multiple times for the same transaction.
2128     *
2129     * An external signer implementation should check that the commitment has not been revoked.
2130     *
2131     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
2132     */
2133    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
2134    /**
2135     * Create a signature for the given input in a transaction spending an HTLC or commitment
2136     * transaction output when our counterparty broadcasts an old state.
2137     *
2138     * A justice transaction may claim multiples outputs at the same time if timelocks are
2139     * similar, but only a signature for the input at index `input` should be signed for here.
2140     * It may be called multiples time for same output(s) if a fee-bump is needed with regards
2141     * to an upcoming timelock expiration.
2142     *
2143     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2144     *
2145     * per_commitment_key is revocation secret which was provided by our counterparty when they
2146     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
2147     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
2148     * so).
2149     *
2150     * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
2151     * changing the format of the witness script (which is committed to in the BIP 143
2152     * signatures).
2153     */
2154    struct LDKCResult_SignatureNoneZ (*sign_justice_transaction)(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);
2155    /**
2156     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
2157     * transaction, either offered or received.
2158     *
2159     * Such a transaction may claim multiples offered outputs at same time if we know the
2160     * preimage for each when we create it, but only the input at index `input` should be
2161     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
2162     * needed with regards to an upcoming timelock expiration.
2163     *
2164     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
2165     * outputs.
2166     *
2167     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2168     *
2169     * Per_commitment_point is the dynamic point corresponding to the channel state
2170     * detected onchain. It has been generated by our counterparty and is used to derive
2171     * channel state keys, which are then included in the witness script and committed to in the
2172     * BIP 143 signature.
2173     */
2174    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);
2175    /**
2176     * Create a signature for a (proposed) closing transaction.
2177     *
2178     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
2179     * chosen to forgo their output as dust.
2180     */
2181    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
2182    /**
2183     * Signs a channel announcement message with our funding key, proving it comes from one
2184     * of the channel participants.
2185     *
2186     * Note that if this fails or is rejected, the channel will not be publicly announced and
2187     * our counterparty may (though likely will not) close the channel on us for violating the
2188     * protocol.
2189     */
2190    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
2191    /**
2192     * Set the counterparty static channel data, including basepoints,
2193     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
2194     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
2195     * they MUST NOT be allowed to change to different values once set.
2196     *
2197     * channel_parameters.is_populated() MUST be true.
2198     *
2199     * We bind holder_selected_contest_delay late here for API convenience.
2200     *
2201     * Will be called before any signatures are applied.
2202     */
2203    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
2204    /**
2205     * Frees any resources associated with this object given its this_arg pointer.
2206     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2207     */
2208    void (*free)(void *this_arg);
2209 } LDKBaseSign;
2210
2211 /**
2212  * A cloneable signer.
2213  *
2214  * Although we require signers to be cloneable, it may be useful for developers to be able to use
2215  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
2216  * which implies Sized, into this derived trait.
2217  */
2218 typedef struct LDKSign {
2219    /**
2220     * An opaque pointer which is passed to your function implementations as an argument.
2221     * This has no meaning in the LDK, and can be NULL or any other value.
2222     */
2223    void *this_arg;
2224    /**
2225     * Implementation of BaseSign for this object.
2226     */
2227    struct LDKBaseSign BaseSign;
2228    /**
2229     * Creates a copy of the BaseSign, for a copy of this Sign.
2230     * Because BaseSign doesn't natively support copying itself, you have to provide a full copy implementation here.
2231     */
2232    struct LDKBaseSign (*BaseSign_clone)(const struct LDKBaseSign *NONNULL_PTR orig_BaseSign);
2233    /**
2234     * Serialize the object into a byte array
2235     */
2236    struct LDKCVec_u8Z (*write)(const void *this_arg);
2237    /**
2238     * Creates a copy of the object pointed to by this_arg, for a copy of this Sign.
2239     * Note that the ultimate copy of the Sign will have all function pointers the same as the original.
2240     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new Sign.
2241     */
2242    void *(*clone)(const void *this_arg);
2243    /**
2244     * Frees any resources associated with this object given its this_arg pointer.
2245     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2246     */
2247    void (*free)(void *this_arg);
2248 } LDKSign;
2249
2250
2251
2252 /**
2253  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
2254  * on-chain transactions to ensure no loss of funds occurs.
2255  *
2256  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
2257  * information and are actively monitoring the chain.
2258  *
2259  * Pending Events or updated HTLCs which have not yet been read out by
2260  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
2261  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
2262  * gotten are fully handled before re-serializing the new state.
2263  *
2264  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
2265  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
2266  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
2267  * returned block hash and the the current chain and then reconnecting blocks to get to the
2268  * best chain) upon deserializing the object!
2269  */
2270 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
2271    /**
2272     * A pointer to the opaque Rust object.
2273     * Nearly everywhere, inner must be non-null, however in places where
2274     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2275     */
2276    LDKnativeChannelMonitor *inner;
2277    /**
2278     * Indicates that this is the only struct which contains the same pointer.
2279     * Rust functions which take ownership of an object provided via an argument require
2280     * this to be true and invalidate the object pointed to by inner.
2281     */
2282    bool is_owned;
2283 } LDKChannelMonitor;
2284
2285 /**
2286  * A tuple of 2 elements. See the individual fields for the types contained.
2287  */
2288 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
2289    /**
2290     * The element at position 0
2291     */
2292    struct LDKThirtyTwoBytes a;
2293    /**
2294     * The element at position 1
2295     */
2296    struct LDKChannelMonitor b;
2297 } LDKC2Tuple_BlockHashChannelMonitorZ;
2298
2299 /**
2300  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
2301  */
2302 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2303    /**
2304     * A pointer to the contents in the success state.
2305     * Reading from this pointer when `result_ok` is not set is undefined.
2306     */
2307    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
2308    /**
2309     * A pointer to the contents in the error state.
2310     * Reading from this pointer when `result_ok` is set is undefined.
2311     */
2312    struct LDKDecodeError *err;
2313 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
2314
2315 /**
2316  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
2317  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2318  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2319  */
2320 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2321    /**
2322     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
2323     * `err` or `result` depending on the state of `result_ok`.
2324     */
2325    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
2326    /**
2327     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
2328     */
2329    bool result_ok;
2330 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
2331
2332
2333
2334 /**
2335  * A hop in a route
2336  */
2337 typedef struct MUST_USE_STRUCT LDKRouteHop {
2338    /**
2339     * A pointer to the opaque Rust object.
2340     * Nearly everywhere, inner must be non-null, however in places where
2341     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2342     */
2343    LDKnativeRouteHop *inner;
2344    /**
2345     * Indicates that this is the only struct which contains the same pointer.
2346     * Rust functions which take ownership of an object provided via an argument require
2347     * this to be true and invalidate the object pointed to by inner.
2348     */
2349    bool is_owned;
2350 } LDKRouteHop;
2351
2352 /**
2353  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2354  * This corresponds to std::vector in C++
2355  */
2356 typedef struct LDKCVec_RouteHopZ {
2357    /**
2358     * The elements in the array.
2359     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2360     */
2361    struct LDKRouteHop *data;
2362    /**
2363     * The number of elements pointed to by `data`.
2364     */
2365    uintptr_t datalen;
2366 } LDKCVec_RouteHopZ;
2367
2368 /**
2369  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2370  * This corresponds to std::vector in C++
2371  */
2372 typedef struct LDKCVec_CVec_RouteHopZZ {
2373    /**
2374     * The elements in the array.
2375     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2376     */
2377    struct LDKCVec_RouteHopZ *data;
2378    /**
2379     * The number of elements pointed to by `data`.
2380     */
2381    uintptr_t datalen;
2382 } LDKCVec_CVec_RouteHopZZ;
2383
2384
2385
2386 /**
2387  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2388  * it can take multiple paths. Each path is composed of one or more hops through the network.
2389  */
2390 typedef struct MUST_USE_STRUCT LDKRoute {
2391    /**
2392     * A pointer to the opaque Rust object.
2393     * Nearly everywhere, inner must be non-null, however in places where
2394     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2395     */
2396    LDKnativeRoute *inner;
2397    /**
2398     * Indicates that this is the only struct which contains the same pointer.
2399     * Rust functions which take ownership of an object provided via an argument require
2400     * this to be true and invalidate the object pointed to by inner.
2401     */
2402    bool is_owned;
2403 } LDKRoute;
2404
2405 /**
2406  * The contents of CResult_RouteDecodeErrorZ
2407  */
2408 typedef union LDKCResult_RouteDecodeErrorZPtr {
2409    /**
2410     * A pointer to the contents in the success state.
2411     * Reading from this pointer when `result_ok` is not set is undefined.
2412     */
2413    struct LDKRoute *result;
2414    /**
2415     * A pointer to the contents in the error state.
2416     * Reading from this pointer when `result_ok` is set is undefined.
2417     */
2418    struct LDKDecodeError *err;
2419 } LDKCResult_RouteDecodeErrorZPtr;
2420
2421 /**
2422  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2423  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2424  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2425  */
2426 typedef struct LDKCResult_RouteDecodeErrorZ {
2427    /**
2428     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
2429     * `err` or `result` depending on the state of `result_ok`.
2430     */
2431    union LDKCResult_RouteDecodeErrorZPtr contents;
2432    /**
2433     * Whether this CResult_RouteDecodeErrorZ represents a success state.
2434     */
2435    bool result_ok;
2436 } LDKCResult_RouteDecodeErrorZ;
2437
2438 /**
2439  * An enum which can either contain a u64 or not
2440  */
2441 typedef enum LDKCOption_u64Z_Tag {
2442    /**
2443     * When we're in this state, this COption_u64Z contains a u64
2444     */
2445    LDKCOption_u64Z_Some,
2446    /**
2447     * When we're in this state, this COption_u64Z contains nothing
2448     */
2449    LDKCOption_u64Z_None,
2450    /**
2451     * Must be last for serialization purposes
2452     */
2453    LDKCOption_u64Z_Sentinel,
2454 } LDKCOption_u64Z_Tag;
2455
2456 typedef struct LDKCOption_u64Z {
2457    LDKCOption_u64Z_Tag tag;
2458    union {
2459       struct {
2460          uint64_t some;
2461       };
2462    };
2463 } LDKCOption_u64Z;
2464
2465
2466
2467 /**
2468  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2469  */
2470 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2471    /**
2472     * A pointer to the opaque Rust object.
2473     * Nearly everywhere, inner must be non-null, however in places where
2474     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2475     */
2476    LDKnativeChannelDetails *inner;
2477    /**
2478     * Indicates that this is the only struct which contains the same pointer.
2479     * Rust functions which take ownership of an object provided via an argument require
2480     * this to be true and invalidate the object pointed to by inner.
2481     */
2482    bool is_owned;
2483 } LDKChannelDetails;
2484
2485 /**
2486  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2487  * This corresponds to std::vector in C++
2488  */
2489 typedef struct LDKCVec_ChannelDetailsZ {
2490    /**
2491     * The elements in the array.
2492     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2493     */
2494    struct LDKChannelDetails *data;
2495    /**
2496     * The number of elements pointed to by `data`.
2497     */
2498    uintptr_t datalen;
2499 } LDKCVec_ChannelDetailsZ;
2500
2501
2502
2503 /**
2504  * A channel descriptor which provides a last-hop route to get_route
2505  */
2506 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
2507    /**
2508     * A pointer to the opaque Rust object.
2509     * Nearly everywhere, inner must be non-null, however in places where
2510     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2511     */
2512    LDKnativeRouteHintHop *inner;
2513    /**
2514     * Indicates that this is the only struct which contains the same pointer.
2515     * Rust functions which take ownership of an object provided via an argument require
2516     * this to be true and invalidate the object pointed to by inner.
2517     */
2518    bool is_owned;
2519 } LDKRouteHintHop;
2520
2521 /**
2522  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2523  * This corresponds to std::vector in C++
2524  */
2525 typedef struct LDKCVec_RouteHintHopZ {
2526    /**
2527     * The elements in the array.
2528     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2529     */
2530    struct LDKRouteHintHop *data;
2531    /**
2532     * The number of elements pointed to by `data`.
2533     */
2534    uintptr_t datalen;
2535 } LDKCVec_RouteHintHopZ;
2536
2537
2538
2539 /**
2540  * An Err type for failure to process messages.
2541  */
2542 typedef struct MUST_USE_STRUCT LDKLightningError {
2543    /**
2544     * A pointer to the opaque Rust object.
2545     * Nearly everywhere, inner must be non-null, however in places where
2546     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2547     */
2548    LDKnativeLightningError *inner;
2549    /**
2550     * Indicates that this is the only struct which contains the same pointer.
2551     * Rust functions which take ownership of an object provided via an argument require
2552     * this to be true and invalidate the object pointed to by inner.
2553     */
2554    bool is_owned;
2555 } LDKLightningError;
2556
2557 /**
2558  * The contents of CResult_RouteLightningErrorZ
2559  */
2560 typedef union LDKCResult_RouteLightningErrorZPtr {
2561    /**
2562     * A pointer to the contents in the success state.
2563     * Reading from this pointer when `result_ok` is not set is undefined.
2564     */
2565    struct LDKRoute *result;
2566    /**
2567     * A pointer to the contents in the error state.
2568     * Reading from this pointer when `result_ok` is set is undefined.
2569     */
2570    struct LDKLightningError *err;
2571 } LDKCResult_RouteLightningErrorZPtr;
2572
2573 /**
2574  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2575  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2576  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2577  */
2578 typedef struct LDKCResult_RouteLightningErrorZ {
2579    /**
2580     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2581     * `err` or `result` depending on the state of `result_ok`.
2582     */
2583    union LDKCResult_RouteLightningErrorZPtr contents;
2584    /**
2585     * Whether this CResult_RouteLightningErrorZ represents a success state.
2586     */
2587    bool result_ok;
2588 } LDKCResult_RouteLightningErrorZ;
2589
2590
2591
2592 /**
2593  * An accept_channel message to be sent or received from a peer
2594  */
2595 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
2596    /**
2597     * A pointer to the opaque Rust object.
2598     * Nearly everywhere, inner must be non-null, however in places where
2599     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2600     */
2601    LDKnativeAcceptChannel *inner;
2602    /**
2603     * Indicates that this is the only struct which contains the same pointer.
2604     * Rust functions which take ownership of an object provided via an argument require
2605     * this to be true and invalidate the object pointed to by inner.
2606     */
2607    bool is_owned;
2608 } LDKAcceptChannel;
2609
2610
2611
2612 /**
2613  * An open_channel message to be sent or received from a peer
2614  */
2615 typedef struct MUST_USE_STRUCT LDKOpenChannel {
2616    /**
2617     * A pointer to the opaque Rust object.
2618     * Nearly everywhere, inner must be non-null, however in places where
2619     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2620     */
2621    LDKnativeOpenChannel *inner;
2622    /**
2623     * Indicates that this is the only struct which contains the same pointer.
2624     * Rust functions which take ownership of an object provided via an argument require
2625     * this to be true and invalidate the object pointed to by inner.
2626     */
2627    bool is_owned;
2628 } LDKOpenChannel;
2629
2630
2631
2632 /**
2633  * A funding_created message to be sent or received from a peer
2634  */
2635 typedef struct MUST_USE_STRUCT LDKFundingCreated {
2636    /**
2637     * A pointer to the opaque Rust object.
2638     * Nearly everywhere, inner must be non-null, however in places where
2639     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2640     */
2641    LDKnativeFundingCreated *inner;
2642    /**
2643     * Indicates that this is the only struct which contains the same pointer.
2644     * Rust functions which take ownership of an object provided via an argument require
2645     * this to be true and invalidate the object pointed to by inner.
2646     */
2647    bool is_owned;
2648 } LDKFundingCreated;
2649
2650
2651
2652 /**
2653  * A funding_signed message to be sent or received from a peer
2654  */
2655 typedef struct MUST_USE_STRUCT LDKFundingSigned {
2656    /**
2657     * A pointer to the opaque Rust object.
2658     * Nearly everywhere, inner must be non-null, however in places where
2659     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2660     */
2661    LDKnativeFundingSigned *inner;
2662    /**
2663     * Indicates that this is the only struct which contains the same pointer.
2664     * Rust functions which take ownership of an object provided via an argument require
2665     * this to be true and invalidate the object pointed to by inner.
2666     */
2667    bool is_owned;
2668 } LDKFundingSigned;
2669
2670
2671
2672 /**
2673  * A funding_locked message to be sent or received from a peer
2674  */
2675 typedef struct MUST_USE_STRUCT LDKFundingLocked {
2676    /**
2677     * A pointer to the opaque Rust object.
2678     * Nearly everywhere, inner must be non-null, however in places where
2679     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2680     */
2681    LDKnativeFundingLocked *inner;
2682    /**
2683     * Indicates that this is the only struct which contains the same pointer.
2684     * Rust functions which take ownership of an object provided via an argument require
2685     * this to be true and invalidate the object pointed to by inner.
2686     */
2687    bool is_owned;
2688 } LDKFundingLocked;
2689
2690
2691
2692 /**
2693  * An announcement_signatures message to be sent or received from a peer
2694  */
2695 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
2696    /**
2697     * A pointer to the opaque Rust object.
2698     * Nearly everywhere, inner must be non-null, however in places where
2699     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2700     */
2701    LDKnativeAnnouncementSignatures *inner;
2702    /**
2703     * Indicates that this is the only struct which contains the same pointer.
2704     * Rust functions which take ownership of an object provided via an argument require
2705     * this to be true and invalidate the object pointed to by inner.
2706     */
2707    bool is_owned;
2708 } LDKAnnouncementSignatures;
2709
2710
2711
2712 /**
2713  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
2714  * transaction updates if they were pending.
2715  */
2716 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
2717    /**
2718     * A pointer to the opaque Rust object.
2719     * Nearly everywhere, inner must be non-null, however in places where
2720     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2721     */
2722    LDKnativeCommitmentUpdate *inner;
2723    /**
2724     * Indicates that this is the only struct which contains the same pointer.
2725     * Rust functions which take ownership of an object provided via an argument require
2726     * this to be true and invalidate the object pointed to by inner.
2727     */
2728    bool is_owned;
2729 } LDKCommitmentUpdate;
2730
2731
2732
2733 /**
2734  * A revoke_and_ack message to be sent or received from a peer
2735  */
2736 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
2737    /**
2738     * A pointer to the opaque Rust object.
2739     * Nearly everywhere, inner must be non-null, however in places where
2740     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2741     */
2742    LDKnativeRevokeAndACK *inner;
2743    /**
2744     * Indicates that this is the only struct which contains the same pointer.
2745     * Rust functions which take ownership of an object provided via an argument require
2746     * this to be true and invalidate the object pointed to by inner.
2747     */
2748    bool is_owned;
2749 } LDKRevokeAndACK;
2750
2751
2752
2753 /**
2754  * A closing_signed message to be sent or received from a peer
2755  */
2756 typedef struct MUST_USE_STRUCT LDKClosingSigned {
2757    /**
2758     * A pointer to the opaque Rust object.
2759     * Nearly everywhere, inner must be non-null, however in places where
2760     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2761     */
2762    LDKnativeClosingSigned *inner;
2763    /**
2764     * Indicates that this is the only struct which contains the same pointer.
2765     * Rust functions which take ownership of an object provided via an argument require
2766     * this to be true and invalidate the object pointed to by inner.
2767     */
2768    bool is_owned;
2769 } LDKClosingSigned;
2770
2771
2772
2773 /**
2774  * A shutdown message to be sent or received from a peer
2775  */
2776 typedef struct MUST_USE_STRUCT LDKShutdown {
2777    /**
2778     * A pointer to the opaque Rust object.
2779     * Nearly everywhere, inner must be non-null, however in places where
2780     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2781     */
2782    LDKnativeShutdown *inner;
2783    /**
2784     * Indicates that this is the only struct which contains the same pointer.
2785     * Rust functions which take ownership of an object provided via an argument require
2786     * this to be true and invalidate the object pointed to by inner.
2787     */
2788    bool is_owned;
2789 } LDKShutdown;
2790
2791
2792
2793 /**
2794  * A channel_reestablish message to be sent or received from a peer
2795  */
2796 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
2797    /**
2798     * A pointer to the opaque Rust object.
2799     * Nearly everywhere, inner must be non-null, however in places where
2800     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2801     */
2802    LDKnativeChannelReestablish *inner;
2803    /**
2804     * Indicates that this is the only struct which contains the same pointer.
2805     * Rust functions which take ownership of an object provided via an argument require
2806     * this to be true and invalidate the object pointed to by inner.
2807     */
2808    bool is_owned;
2809 } LDKChannelReestablish;
2810
2811
2812
2813 /**
2814  * A channel_announcement message to be sent or received from a peer
2815  */
2816 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
2817    /**
2818     * A pointer to the opaque Rust object.
2819     * Nearly everywhere, inner must be non-null, however in places where
2820     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2821     */
2822    LDKnativeChannelAnnouncement *inner;
2823    /**
2824     * Indicates that this is the only struct which contains the same pointer.
2825     * Rust functions which take ownership of an object provided via an argument require
2826     * this to be true and invalidate the object pointed to by inner.
2827     */
2828    bool is_owned;
2829 } LDKChannelAnnouncement;
2830
2831
2832
2833 /**
2834  * A channel_update message to be sent or received from a peer
2835  */
2836 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2837    /**
2838     * A pointer to the opaque Rust object.
2839     * Nearly everywhere, inner must be non-null, however in places where
2840     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2841     */
2842    LDKnativeChannelUpdate *inner;
2843    /**
2844     * Indicates that this is the only struct which contains the same pointer.
2845     * Rust functions which take ownership of an object provided via an argument require
2846     * this to be true and invalidate the object pointed to by inner.
2847     */
2848    bool is_owned;
2849 } LDKChannelUpdate;
2850
2851
2852
2853 /**
2854  * A node_announcement message to be sent or received from a peer
2855  */
2856 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
2857    /**
2858     * A pointer to the opaque Rust object.
2859     * Nearly everywhere, inner must be non-null, however in places where
2860     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2861     */
2862    LDKnativeNodeAnnouncement *inner;
2863    /**
2864     * Indicates that this is the only struct which contains the same pointer.
2865     * Rust functions which take ownership of an object provided via an argument require
2866     * this to be true and invalidate the object pointed to by inner.
2867     */
2868    bool is_owned;
2869 } LDKNodeAnnouncement;
2870
2871
2872
2873 /**
2874  * An error message to be sent or received from a peer
2875  */
2876 typedef struct MUST_USE_STRUCT LDKErrorMessage {
2877    /**
2878     * A pointer to the opaque Rust object.
2879     * Nearly everywhere, inner must be non-null, however in places where
2880     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2881     */
2882    LDKnativeErrorMessage *inner;
2883    /**
2884     * Indicates that this is the only struct which contains the same pointer.
2885     * Rust functions which take ownership of an object provided via an argument require
2886     * this to be true and invalidate the object pointed to by inner.
2887     */
2888    bool is_owned;
2889 } LDKErrorMessage;
2890
2891 /**
2892  * Used to put an error message in a LightningError
2893  */
2894 typedef enum LDKErrorAction_Tag {
2895    /**
2896     * The peer took some action which made us think they were useless. Disconnect them.
2897     */
2898    LDKErrorAction_DisconnectPeer,
2899    /**
2900     * The peer did something harmless that we weren't able to process, just log and ignore
2901     */
2902    LDKErrorAction_IgnoreError,
2903    /**
2904     * The peer did something incorrect. Tell them.
2905     */
2906    LDKErrorAction_SendErrorMessage,
2907    /**
2908     * Must be last for serialization purposes
2909     */
2910    LDKErrorAction_Sentinel,
2911 } LDKErrorAction_Tag;
2912
2913 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
2914    /**
2915     * An error message which we should make an effort to send before we disconnect.
2916     */
2917    struct LDKErrorMessage msg;
2918 } LDKErrorAction_LDKDisconnectPeer_Body;
2919
2920 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
2921    /**
2922     * The message to send.
2923     */
2924    struct LDKErrorMessage msg;
2925 } LDKErrorAction_LDKSendErrorMessage_Body;
2926
2927 typedef struct MUST_USE_STRUCT LDKErrorAction {
2928    LDKErrorAction_Tag tag;
2929    union {
2930       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
2931       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
2932    };
2933 } LDKErrorAction;
2934
2935 /**
2936  * The information we received from a peer along the route of a payment we originated. This is
2937  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
2938  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
2939  */
2940 typedef enum LDKHTLCFailChannelUpdate_Tag {
2941    /**
2942     * We received an error which included a full ChannelUpdate message.
2943     */
2944    LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
2945    /**
2946     * We received an error which indicated only that a channel has been closed
2947     */
2948    LDKHTLCFailChannelUpdate_ChannelClosed,
2949    /**
2950     * We received an error which indicated only that a node has failed
2951     */
2952    LDKHTLCFailChannelUpdate_NodeFailure,
2953    /**
2954     * Must be last for serialization purposes
2955     */
2956    LDKHTLCFailChannelUpdate_Sentinel,
2957 } LDKHTLCFailChannelUpdate_Tag;
2958
2959 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
2960    /**
2961     * The unwrapped message we received
2962     */
2963    struct LDKChannelUpdate msg;
2964 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
2965
2966 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
2967    /**
2968     * The short_channel_id which has now closed.
2969     */
2970    uint64_t short_channel_id;
2971    /**
2972     * when this true, this channel should be permanently removed from the
2973     * consideration. Otherwise, this channel can be restored as new channel_update is received
2974     */
2975    bool is_permanent;
2976 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
2977
2978 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
2979    /**
2980     * The node_id that has failed.
2981     */
2982    struct LDKPublicKey node_id;
2983    /**
2984     * when this true, node should be permanently removed from the
2985     * consideration. Otherwise, the channels connected to this node can be
2986     * restored as new channel_update is received
2987     */
2988    bool is_permanent;
2989 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
2990
2991 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
2992    LDKHTLCFailChannelUpdate_Tag tag;
2993    union {
2994       LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2995       LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
2996       LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
2997    };
2998 } LDKHTLCFailChannelUpdate;
2999
3000
3001
3002 /**
3003  * A query_channel_range message is used to query a peer for channel
3004  * UTXOs in a range of blocks. The recipient of a query makes a best
3005  * effort to reply to the query using one or more reply_channel_range
3006  * messages.
3007  */
3008 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3009    /**
3010     * A pointer to the opaque Rust object.
3011     * Nearly everywhere, inner must be non-null, however in places where
3012     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3013     */
3014    LDKnativeQueryChannelRange *inner;
3015    /**
3016     * Indicates that this is the only struct which contains the same pointer.
3017     * Rust functions which take ownership of an object provided via an argument require
3018     * this to be true and invalidate the object pointed to by inner.
3019     */
3020    bool is_owned;
3021 } LDKQueryChannelRange;
3022
3023
3024
3025 /**
3026  * A query_short_channel_ids message is used to query a peer for
3027  * routing gossip messages related to one or more short_channel_ids.
3028  * The query recipient will reply with the latest, if available,
3029  * channel_announcement, channel_update and node_announcement messages
3030  * it maintains for the requested short_channel_ids followed by a
3031  * reply_short_channel_ids_end message. The short_channel_ids sent in
3032  * this query are encoded. We only support encoding_type=0 uncompressed
3033  * serialization and do not support encoding_type=1 zlib serialization.
3034  */
3035 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3036    /**
3037     * A pointer to the opaque Rust object.
3038     * Nearly everywhere, inner must be non-null, however in places where
3039     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3040     */
3041    LDKnativeQueryShortChannelIds *inner;
3042    /**
3043     * Indicates that this is the only struct which contains the same pointer.
3044     * Rust functions which take ownership of an object provided via an argument require
3045     * this to be true and invalidate the object pointed to by inner.
3046     */
3047    bool is_owned;
3048 } LDKQueryShortChannelIds;
3049
3050
3051
3052 /**
3053  * A reply_channel_range message is a reply to a query_channel_range
3054  * message. Multiple reply_channel_range messages can be sent in reply
3055  * to a single query_channel_range message. The query recipient makes a
3056  * best effort to respond based on their local network view which may
3057  * not be a perfect view of the network. The short_channel_ids in the
3058  * reply are encoded. We only support encoding_type=0 uncompressed
3059  * serialization and do not support encoding_type=1 zlib serialization.
3060  */
3061 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3062    /**
3063     * A pointer to the opaque Rust object.
3064     * Nearly everywhere, inner must be non-null, however in places where
3065     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3066     */
3067    LDKnativeReplyChannelRange *inner;
3068    /**
3069     * Indicates that this is the only struct which contains the same pointer.
3070     * Rust functions which take ownership of an object provided via an argument require
3071     * this to be true and invalidate the object pointed to by inner.
3072     */
3073    bool is_owned;
3074 } LDKReplyChannelRange;
3075
3076 /**
3077  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3078  * broadcast to most peers).
3079  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3080  */
3081 typedef enum LDKMessageSendEvent_Tag {
3082    /**
3083     * Used to indicate that we've accepted a channel open and should send the accept_channel
3084     * message provided to the given peer.
3085     */
3086    LDKMessageSendEvent_SendAcceptChannel,
3087    /**
3088     * Used to indicate that we've initiated a channel open and should send the open_channel
3089     * message provided to the given peer.
3090     */
3091    LDKMessageSendEvent_SendOpenChannel,
3092    /**
3093     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3094     */
3095    LDKMessageSendEvent_SendFundingCreated,
3096    /**
3097     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3098     */
3099    LDKMessageSendEvent_SendFundingSigned,
3100    /**
3101     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
3102     */
3103    LDKMessageSendEvent_SendFundingLocked,
3104    /**
3105     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3106     */
3107    LDKMessageSendEvent_SendAnnouncementSignatures,
3108    /**
3109     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3110     * message should be sent to the peer with the given node_id.
3111     */
3112    LDKMessageSendEvent_UpdateHTLCs,
3113    /**
3114     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3115     */
3116    LDKMessageSendEvent_SendRevokeAndACK,
3117    /**
3118     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3119     */
3120    LDKMessageSendEvent_SendClosingSigned,
3121    /**
3122     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3123     */
3124    LDKMessageSendEvent_SendShutdown,
3125    /**
3126     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3127     */
3128    LDKMessageSendEvent_SendChannelReestablish,
3129    /**
3130     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3131     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3132     *
3133     * Note that after doing so, you very likely (unless you did so very recently) want to call
3134     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3135     * This ensures that any nodes which see our channel_announcement also have a relevant
3136     * node_announcement, including relevant feature flags which may be important for routing
3137     * through or to us.
3138     */
3139    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3140    /**
3141     * Used to indicate that a node_announcement should be broadcast to all peers.
3142     */
3143    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3144    /**
3145     * Used to indicate that a channel_update should be broadcast to all peers.
3146     */
3147    LDKMessageSendEvent_BroadcastChannelUpdate,
3148    /**
3149     * Broadcast an error downstream to be handled
3150     */
3151    LDKMessageSendEvent_HandleError,
3152    /**
3153     * When a payment fails we may receive updates back from the hop where it failed. In such
3154     * cases this event is generated so that we can inform the network graph of this information.
3155     */
3156    LDKMessageSendEvent_PaymentFailureNetworkUpdate,
3157    /**
3158     * Query a peer for channels with funding transaction UTXOs in a block range.
3159     */
3160    LDKMessageSendEvent_SendChannelRangeQuery,
3161    /**
3162     * Request routing gossip messages from a peer for a list of channels identified by
3163     * their short_channel_ids.
3164     */
3165    LDKMessageSendEvent_SendShortIdsQuery,
3166    /**
3167     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3168     * emitted during processing of the query.
3169     */
3170    LDKMessageSendEvent_SendReplyChannelRange,
3171    /**
3172     * Must be last for serialization purposes
3173     */
3174    LDKMessageSendEvent_Sentinel,
3175 } LDKMessageSendEvent_Tag;
3176
3177 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3178    /**
3179     * The node_id of the node which should receive this message
3180     */
3181    struct LDKPublicKey node_id;
3182    /**
3183     * The message which should be sent.
3184     */
3185    struct LDKAcceptChannel msg;
3186 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3187
3188 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3189    /**
3190     * The node_id of the node which should receive this message
3191     */
3192    struct LDKPublicKey node_id;
3193    /**
3194     * The message which should be sent.
3195     */
3196    struct LDKOpenChannel msg;
3197 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3198
3199 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3200    /**
3201     * The node_id of the node which should receive this message
3202     */
3203    struct LDKPublicKey node_id;
3204    /**
3205     * The message which should be sent.
3206     */
3207    struct LDKFundingCreated msg;
3208 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3209
3210 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
3211    /**
3212     * The node_id of the node which should receive this message
3213     */
3214    struct LDKPublicKey node_id;
3215    /**
3216     * The message which should be sent.
3217     */
3218    struct LDKFundingSigned msg;
3219 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3220
3221 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
3222    /**
3223     * The node_id of the node which should receive these message(s)
3224     */
3225    struct LDKPublicKey node_id;
3226    /**
3227     * The funding_locked message which should be sent.
3228     */
3229    struct LDKFundingLocked msg;
3230 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
3231
3232 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
3233    /**
3234     * The node_id of the node which should receive these message(s)
3235     */
3236    struct LDKPublicKey node_id;
3237    /**
3238     * The announcement_signatures message which should be sent.
3239     */
3240    struct LDKAnnouncementSignatures msg;
3241 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
3242
3243 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
3244    /**
3245     * The node_id of the node which should receive these message(s)
3246     */
3247    struct LDKPublicKey node_id;
3248    /**
3249     * The update messages which should be sent. ALL messages in the struct should be sent!
3250     */
3251    struct LDKCommitmentUpdate updates;
3252 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
3253
3254 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
3255    /**
3256     * The node_id of the node which should receive this message
3257     */
3258    struct LDKPublicKey node_id;
3259    /**
3260     * The message which should be sent.
3261     */
3262    struct LDKRevokeAndACK msg;
3263 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
3264
3265 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
3266    /**
3267     * The node_id of the node which should receive this message
3268     */
3269    struct LDKPublicKey node_id;
3270    /**
3271     * The message which should be sent.
3272     */
3273    struct LDKClosingSigned msg;
3274 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
3275
3276 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
3277    /**
3278     * The node_id of the node which should receive this message
3279     */
3280    struct LDKPublicKey node_id;
3281    /**
3282     * The message which should be sent.
3283     */
3284    struct LDKShutdown msg;
3285 } LDKMessageSendEvent_LDKSendShutdown_Body;
3286
3287 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
3288    /**
3289     * The node_id of the node which should receive this message
3290     */
3291    struct LDKPublicKey node_id;
3292    /**
3293     * The message which should be sent.
3294     */
3295    struct LDKChannelReestablish msg;
3296 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
3297
3298 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
3299    /**
3300     * The channel_announcement which should be sent.
3301     */
3302    struct LDKChannelAnnouncement msg;
3303    /**
3304     * The followup channel_update which should be sent.
3305     */
3306    struct LDKChannelUpdate update_msg;
3307 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
3308
3309 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
3310    /**
3311     * The node_announcement which should be sent.
3312     */
3313    struct LDKNodeAnnouncement msg;
3314 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
3315
3316 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
3317    /**
3318     * The channel_update which should be sent.
3319     */
3320    struct LDKChannelUpdate msg;
3321 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
3322
3323 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
3324    /**
3325     * The node_id of the node which should receive this message
3326     */
3327    struct LDKPublicKey node_id;
3328    /**
3329     * The action which should be taken.
3330     */
3331    struct LDKErrorAction action;
3332 } LDKMessageSendEvent_LDKHandleError_Body;
3333
3334 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
3335    /**
3336     * The channel/node update which should be sent to NetGraphMsgHandler
3337     */
3338    struct LDKHTLCFailChannelUpdate update;
3339 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
3340
3341 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
3342    /**
3343     * The node_id of this message recipient
3344     */
3345    struct LDKPublicKey node_id;
3346    /**
3347     * The query_channel_range which should be sent.
3348     */
3349    struct LDKQueryChannelRange msg;
3350 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
3351
3352 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
3353    /**
3354     * The node_id of this message recipient
3355     */
3356    struct LDKPublicKey node_id;
3357    /**
3358     * The query_short_channel_ids which should be sent.
3359     */
3360    struct LDKQueryShortChannelIds msg;
3361 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
3362
3363 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
3364    /**
3365     * The node_id of this message recipient
3366     */
3367    struct LDKPublicKey node_id;
3368    /**
3369     * The reply_channel_range which should be sent.
3370     */
3371    struct LDKReplyChannelRange msg;
3372 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
3373
3374 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
3375    LDKMessageSendEvent_Tag tag;
3376    union {
3377       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
3378       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
3379       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
3380       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
3381       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
3382       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
3383       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
3384       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
3385       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
3386       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
3387       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
3388       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
3389       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
3390       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
3391       LDKMessageSendEvent_LDKHandleError_Body handle_error;
3392       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
3393       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
3394       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
3395       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
3396    };
3397 } LDKMessageSendEvent;
3398
3399 /**
3400  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3401  * This corresponds to std::vector in C++
3402  */
3403 typedef struct LDKCVec_MessageSendEventZ {
3404    /**
3405     * The elements in the array.
3406     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3407     */
3408    struct LDKMessageSendEvent *data;
3409    /**
3410     * The number of elements pointed to by `data`.
3411     */
3412    uintptr_t datalen;
3413 } LDKCVec_MessageSendEventZ;
3414
3415 /**
3416  * The contents of CResult_boolLightningErrorZ
3417  */
3418 typedef union LDKCResult_boolLightningErrorZPtr {
3419    /**
3420     * A pointer to the contents in the success state.
3421     * Reading from this pointer when `result_ok` is not set is undefined.
3422     */
3423    bool *result;
3424    /**
3425     * A pointer to the contents in the error state.
3426     * Reading from this pointer when `result_ok` is set is undefined.
3427     */
3428    struct LDKLightningError *err;
3429 } LDKCResult_boolLightningErrorZPtr;
3430
3431 /**
3432  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
3433  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
3434  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3435  */
3436 typedef struct LDKCResult_boolLightningErrorZ {
3437    /**
3438     * The contents of this CResult_boolLightningErrorZ, accessible via either
3439     * `err` or `result` depending on the state of `result_ok`.
3440     */
3441    union LDKCResult_boolLightningErrorZPtr contents;
3442    /**
3443     * Whether this CResult_boolLightningErrorZ represents a success state.
3444     */
3445    bool result_ok;
3446 } LDKCResult_boolLightningErrorZ;
3447
3448 /**
3449  * A tuple of 3 elements. See the individual fields for the types contained.
3450  */
3451 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3452    /**
3453     * The element at position 0
3454     */
3455    struct LDKChannelAnnouncement a;
3456    /**
3457     * The element at position 1
3458     */
3459    struct LDKChannelUpdate b;
3460    /**
3461     * The element at position 2
3462     */
3463    struct LDKChannelUpdate c;
3464 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
3465
3466 /**
3467  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
3468  * This corresponds to std::vector in C++
3469  */
3470 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3471    /**
3472     * The elements in the array.
3473     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3474     */
3475    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
3476    /**
3477     * The number of elements pointed to by `data`.
3478     */
3479    uintptr_t datalen;
3480 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
3481
3482 /**
3483  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
3484  * This corresponds to std::vector in C++
3485  */
3486 typedef struct LDKCVec_NodeAnnouncementZ {
3487    /**
3488     * The elements in the array.
3489     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3490     */
3491    struct LDKNodeAnnouncement *data;
3492    /**
3493     * The number of elements pointed to by `data`.
3494     */
3495    uintptr_t datalen;
3496 } LDKCVec_NodeAnnouncementZ;
3497
3498 /**
3499  * The contents of CResult_NoneLightningErrorZ
3500  */
3501 typedef union LDKCResult_NoneLightningErrorZPtr {
3502    /**
3503     * Note that this value is always NULL, as there are no contents in the OK variant
3504     */
3505    void *result;
3506    /**
3507     * A pointer to the contents in the error state.
3508     * Reading from this pointer when `result_ok` is set is undefined.
3509     */
3510    struct LDKLightningError *err;
3511 } LDKCResult_NoneLightningErrorZPtr;
3512
3513 /**
3514  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
3515  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
3516  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3517  */
3518 typedef struct LDKCResult_NoneLightningErrorZ {
3519    /**
3520     * The contents of this CResult_NoneLightningErrorZ, accessible via either
3521     * `err` or `result` depending on the state of `result_ok`.
3522     */
3523    union LDKCResult_NoneLightningErrorZPtr contents;
3524    /**
3525     * Whether this CResult_NoneLightningErrorZ represents a success state.
3526     */
3527    bool result_ok;
3528 } LDKCResult_NoneLightningErrorZ;
3529
3530 /**
3531  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
3532  * This corresponds to std::vector in C++
3533  */
3534 typedef struct LDKCVec_PublicKeyZ {
3535    /**
3536     * The elements in the array.
3537     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3538     */
3539    struct LDKPublicKey *data;
3540    /**
3541     * The number of elements pointed to by `data`.
3542     */
3543    uintptr_t datalen;
3544 } LDKCVec_PublicKeyZ;
3545
3546
3547
3548 /**
3549  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
3550  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
3551  * descriptor.
3552  */
3553 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
3554    /**
3555     * A pointer to the opaque Rust object.
3556     * Nearly everywhere, inner must be non-null, however in places where
3557     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3558     */
3559    LDKnativePeerHandleError *inner;
3560    /**
3561     * Indicates that this is the only struct which contains the same pointer.
3562     * Rust functions which take ownership of an object provided via an argument require
3563     * this to be true and invalidate the object pointed to by inner.
3564     */
3565    bool is_owned;
3566 } LDKPeerHandleError;
3567
3568 /**
3569  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
3570  */
3571 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
3572    /**
3573     * A pointer to the contents in the success state.
3574     * Reading from this pointer when `result_ok` is not set is undefined.
3575     */
3576    struct LDKCVec_u8Z *result;
3577    /**
3578     * A pointer to the contents in the error state.
3579     * Reading from this pointer when `result_ok` is set is undefined.
3580     */
3581    struct LDKPeerHandleError *err;
3582 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
3583
3584 /**
3585  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
3586  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3587  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3588  */
3589 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
3590    /**
3591     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
3592     * `err` or `result` depending on the state of `result_ok`.
3593     */
3594    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
3595    /**
3596     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
3597     */
3598    bool result_ok;
3599 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
3600
3601 /**
3602  * The contents of CResult_NonePeerHandleErrorZ
3603  */
3604 typedef union LDKCResult_NonePeerHandleErrorZPtr {
3605    /**
3606     * Note that this value is always NULL, as there are no contents in the OK variant
3607     */
3608    void *result;
3609    /**
3610     * A pointer to the contents in the error state.
3611     * Reading from this pointer when `result_ok` is set is undefined.
3612     */
3613    struct LDKPeerHandleError *err;
3614 } LDKCResult_NonePeerHandleErrorZPtr;
3615
3616 /**
3617  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
3618  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3619  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3620  */
3621 typedef struct LDKCResult_NonePeerHandleErrorZ {
3622    /**
3623     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
3624     * `err` or `result` depending on the state of `result_ok`.
3625     */
3626    union LDKCResult_NonePeerHandleErrorZPtr contents;
3627    /**
3628     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
3629     */
3630    bool result_ok;
3631 } LDKCResult_NonePeerHandleErrorZ;
3632
3633 /**
3634  * The contents of CResult_boolPeerHandleErrorZ
3635  */
3636 typedef union LDKCResult_boolPeerHandleErrorZPtr {
3637    /**
3638     * A pointer to the contents in the success state.
3639     * Reading from this pointer when `result_ok` is not set is undefined.
3640     */
3641    bool *result;
3642    /**
3643     * A pointer to the contents in the error state.
3644     * Reading from this pointer when `result_ok` is set is undefined.
3645     */
3646    struct LDKPeerHandleError *err;
3647 } LDKCResult_boolPeerHandleErrorZPtr;
3648
3649 /**
3650  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
3651  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3652  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3653  */
3654 typedef struct LDKCResult_boolPeerHandleErrorZ {
3655    /**
3656     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
3657     * `err` or `result` depending on the state of `result_ok`.
3658     */
3659    union LDKCResult_boolPeerHandleErrorZPtr contents;
3660    /**
3661     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
3662     */
3663    bool result_ok;
3664 } LDKCResult_boolPeerHandleErrorZ;
3665
3666 /**
3667  * The contents of CResult_TxOutAccessErrorZ
3668  */
3669 typedef union LDKCResult_TxOutAccessErrorZPtr {
3670    /**
3671     * A pointer to the contents in the success state.
3672     * Reading from this pointer when `result_ok` is not set is undefined.
3673     */
3674    struct LDKTxOut *result;
3675    /**
3676     * A pointer to the contents in the error state.
3677     * Reading from this pointer when `result_ok` is set is undefined.
3678     */
3679    enum LDKAccessError *err;
3680 } LDKCResult_TxOutAccessErrorZPtr;
3681
3682 /**
3683  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3684  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3685  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3686  */
3687 typedef struct LDKCResult_TxOutAccessErrorZ {
3688    /**
3689     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
3690     * `err` or `result` depending on the state of `result_ok`.
3691     */
3692    union LDKCResult_TxOutAccessErrorZPtr contents;
3693    /**
3694     * Whether this CResult_TxOutAccessErrorZ represents a success state.
3695     */
3696    bool result_ok;
3697 } LDKCResult_TxOutAccessErrorZ;
3698
3699 /**
3700  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3701  */
3702 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
3703    /**
3704     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3705     */
3706    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
3707    /**
3708     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3709     */
3710    LDKCOption_C2Tuple_usizeTransactionZZ_None,
3711    /**
3712     * Must be last for serialization purposes
3713     */
3714    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
3715 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
3716
3717 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
3718    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
3719    union {
3720       struct {
3721          struct LDKC2Tuple_usizeTransactionZ some;
3722       };
3723    };
3724 } LDKCOption_C2Tuple_usizeTransactionZZ;
3725
3726
3727
3728 /**
3729  * Details about one direction of a channel. Received
3730  * within a channel update.
3731  */
3732 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
3733    /**
3734     * A pointer to the opaque Rust object.
3735     * Nearly everywhere, inner must be non-null, however in places where
3736     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3737     */
3738    LDKnativeDirectionalChannelInfo *inner;
3739    /**
3740     * Indicates that this is the only struct which contains the same pointer.
3741     * Rust functions which take ownership of an object provided via an argument require
3742     * this to be true and invalidate the object pointed to by inner.
3743     */
3744    bool is_owned;
3745 } LDKDirectionalChannelInfo;
3746
3747 /**
3748  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
3749  */
3750 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
3751    /**
3752     * A pointer to the contents in the success state.
3753     * Reading from this pointer when `result_ok` is not set is undefined.
3754     */
3755    struct LDKDirectionalChannelInfo *result;
3756    /**
3757     * A pointer to the contents in the error state.
3758     * Reading from this pointer when `result_ok` is set is undefined.
3759     */
3760    struct LDKDecodeError *err;
3761 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
3762
3763 /**
3764  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
3765  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
3766  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3767  */
3768 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
3769    /**
3770     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
3771     * `err` or `result` depending on the state of `result_ok`.
3772     */
3773    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
3774    /**
3775     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
3776     */
3777    bool result_ok;
3778 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
3779
3780
3781
3782 /**
3783  * Details about a channel (both directions).
3784  * Received within a channel announcement.
3785  */
3786 typedef struct MUST_USE_STRUCT LDKChannelInfo {
3787    /**
3788     * A pointer to the opaque Rust object.
3789     * Nearly everywhere, inner must be non-null, however in places where
3790     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3791     */
3792    LDKnativeChannelInfo *inner;
3793    /**
3794     * Indicates that this is the only struct which contains the same pointer.
3795     * Rust functions which take ownership of an object provided via an argument require
3796     * this to be true and invalidate the object pointed to by inner.
3797     */
3798    bool is_owned;
3799 } LDKChannelInfo;
3800
3801 /**
3802  * The contents of CResult_ChannelInfoDecodeErrorZ
3803  */
3804 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
3805    /**
3806     * A pointer to the contents in the success state.
3807     * Reading from this pointer when `result_ok` is not set is undefined.
3808     */
3809    struct LDKChannelInfo *result;
3810    /**
3811     * A pointer to the contents in the error state.
3812     * Reading from this pointer when `result_ok` is set is undefined.
3813     */
3814    struct LDKDecodeError *err;
3815 } LDKCResult_ChannelInfoDecodeErrorZPtr;
3816
3817 /**
3818  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
3819  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
3820  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3821  */
3822 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
3823    /**
3824     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
3825     * `err` or `result` depending on the state of `result_ok`.
3826     */
3827    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
3828    /**
3829     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
3830     */
3831    bool result_ok;
3832 } LDKCResult_ChannelInfoDecodeErrorZ;
3833
3834
3835
3836 /**
3837  * Fees for routing via a given channel or a node
3838  */
3839 typedef struct MUST_USE_STRUCT LDKRoutingFees {
3840    /**
3841     * A pointer to the opaque Rust object.
3842     * Nearly everywhere, inner must be non-null, however in places where
3843     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3844     */
3845    LDKnativeRoutingFees *inner;
3846    /**
3847     * Indicates that this is the only struct which contains the same pointer.
3848     * Rust functions which take ownership of an object provided via an argument require
3849     * this to be true and invalidate the object pointed to by inner.
3850     */
3851    bool is_owned;
3852 } LDKRoutingFees;
3853
3854 /**
3855  * The contents of CResult_RoutingFeesDecodeErrorZ
3856  */
3857 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
3858    /**
3859     * A pointer to the contents in the success state.
3860     * Reading from this pointer when `result_ok` is not set is undefined.
3861     */
3862    struct LDKRoutingFees *result;
3863    /**
3864     * A pointer to the contents in the error state.
3865     * Reading from this pointer when `result_ok` is set is undefined.
3866     */
3867    struct LDKDecodeError *err;
3868 } LDKCResult_RoutingFeesDecodeErrorZPtr;
3869
3870 /**
3871  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
3872  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
3873  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3874  */
3875 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
3876    /**
3877     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
3878     * `err` or `result` depending on the state of `result_ok`.
3879     */
3880    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
3881    /**
3882     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
3883     */
3884    bool result_ok;
3885 } LDKCResult_RoutingFeesDecodeErrorZ;
3886
3887 /**
3888  * A 4-byte byte array.
3889  */
3890 typedef struct LDKFourBytes {
3891    /**
3892     * The four bytes
3893     */
3894    uint8_t data[4];
3895 } LDKFourBytes;
3896
3897 /**
3898  * A 16-byte byte array.
3899  */
3900 typedef struct LDKSixteenBytes {
3901    /**
3902     * The sixteen bytes
3903     */
3904    uint8_t data[16];
3905 } LDKSixteenBytes;
3906
3907 /**
3908  * A 10-byte byte array.
3909  */
3910 typedef struct LDKTenBytes {
3911    /**
3912     * The ten bytes
3913     */
3914    uint8_t data[10];
3915 } LDKTenBytes;
3916
3917 /**
3918  * An address which can be used to connect to a remote peer
3919  */
3920 typedef enum LDKNetAddress_Tag {
3921    /**
3922     * An IPv4 address/port on which the peer is listening.
3923     */
3924    LDKNetAddress_IPv4,
3925    /**
3926     * An IPv6 address/port on which the peer is listening.
3927     */
3928    LDKNetAddress_IPv6,
3929    /**
3930     * An old-style Tor onion address/port on which the peer is listening.
3931     */
3932    LDKNetAddress_OnionV2,
3933    /**
3934     * A new-style Tor onion address/port on which the peer is listening.
3935     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
3936     * wrap as base32 and append \".onion\".
3937     */
3938    LDKNetAddress_OnionV3,
3939    /**
3940     * Must be last for serialization purposes
3941     */
3942    LDKNetAddress_Sentinel,
3943 } LDKNetAddress_Tag;
3944
3945 typedef struct LDKNetAddress_LDKIPv4_Body {
3946    /**
3947     * The 4-byte IPv4 address
3948     */
3949    struct LDKFourBytes addr;
3950    /**
3951     * The port on which the node is listening
3952     */
3953    uint16_t port;
3954 } LDKNetAddress_LDKIPv4_Body;
3955
3956 typedef struct LDKNetAddress_LDKIPv6_Body {
3957    /**
3958     * The 16-byte IPv6 address
3959     */
3960    struct LDKSixteenBytes addr;
3961    /**
3962     * The port on which the node is listening
3963     */
3964    uint16_t port;
3965 } LDKNetAddress_LDKIPv6_Body;
3966
3967 typedef struct LDKNetAddress_LDKOnionV2_Body {
3968    /**
3969     * The bytes (usually encoded in base32 with \".onion\" appended)
3970     */
3971    struct LDKTenBytes addr;
3972    /**
3973     * The port on which the node is listening
3974     */
3975    uint16_t port;
3976 } LDKNetAddress_LDKOnionV2_Body;
3977
3978 typedef struct LDKNetAddress_LDKOnionV3_Body {
3979    /**
3980     * The ed25519 long-term public key of the peer
3981     */
3982    struct LDKThirtyTwoBytes ed25519_pubkey;
3983    /**
3984     * The checksum of the pubkey and version, as included in the onion address
3985     */
3986    uint16_t checksum;
3987    /**
3988     * The version byte, as defined by the Tor Onion v3 spec.
3989     */
3990    uint8_t version;
3991    /**
3992     * The port on which the node is listening
3993     */
3994    uint16_t port;
3995 } LDKNetAddress_LDKOnionV3_Body;
3996
3997 typedef struct MUST_USE_STRUCT LDKNetAddress {
3998    LDKNetAddress_Tag tag;
3999    union {
4000       LDKNetAddress_LDKIPv4_Body i_pv4;
4001       LDKNetAddress_LDKIPv6_Body i_pv6;
4002       LDKNetAddress_LDKOnionV2_Body onion_v2;
4003       LDKNetAddress_LDKOnionV3_Body onion_v3;
4004    };
4005 } LDKNetAddress;
4006
4007 /**
4008  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4009  * This corresponds to std::vector in C++
4010  */
4011 typedef struct LDKCVec_NetAddressZ {
4012    /**
4013     * The elements in the array.
4014     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4015     */
4016    struct LDKNetAddress *data;
4017    /**
4018     * The number of elements pointed to by `data`.
4019     */
4020    uintptr_t datalen;
4021 } LDKCVec_NetAddressZ;
4022
4023
4024
4025 /**
4026  * Information received in the latest node_announcement from this node.
4027  */
4028 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
4029    /**
4030     * A pointer to the opaque Rust object.
4031     * Nearly everywhere, inner must be non-null, however in places where
4032     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4033     */
4034    LDKnativeNodeAnnouncementInfo *inner;
4035    /**
4036     * Indicates that this is the only struct which contains the same pointer.
4037     * Rust functions which take ownership of an object provided via an argument require
4038     * this to be true and invalidate the object pointed to by inner.
4039     */
4040    bool is_owned;
4041 } LDKNodeAnnouncementInfo;
4042
4043 /**
4044  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
4045  */
4046 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
4047    /**
4048     * A pointer to the contents in the success state.
4049     * Reading from this pointer when `result_ok` is not set is undefined.
4050     */
4051    struct LDKNodeAnnouncementInfo *result;
4052    /**
4053     * A pointer to the contents in the error state.
4054     * Reading from this pointer when `result_ok` is set is undefined.
4055     */
4056    struct LDKDecodeError *err;
4057 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
4058
4059 /**
4060  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
4061  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4062  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4063  */
4064 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
4065    /**
4066     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
4067     * `err` or `result` depending on the state of `result_ok`.
4068     */
4069    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
4070    /**
4071     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
4072     */
4073    bool result_ok;
4074 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
4075
4076 /**
4077  * A dynamically-allocated array of u64s of arbitrary size.
4078  * This corresponds to std::vector in C++
4079  */
4080 typedef struct LDKCVec_u64Z {
4081    /**
4082     * The elements in the array.
4083     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4084     */
4085    uint64_t *data;
4086    /**
4087     * The number of elements pointed to by `data`.
4088     */
4089    uintptr_t datalen;
4090 } LDKCVec_u64Z;
4091
4092
4093
4094 /**
4095  * Details about a node in the network, known from the network announcement.
4096  */
4097 typedef struct MUST_USE_STRUCT LDKNodeInfo {
4098    /**
4099     * A pointer to the opaque Rust object.
4100     * Nearly everywhere, inner must be non-null, however in places where
4101     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4102     */
4103    LDKnativeNodeInfo *inner;
4104    /**
4105     * Indicates that this is the only struct which contains the same pointer.
4106     * Rust functions which take ownership of an object provided via an argument require
4107     * this to be true and invalidate the object pointed to by inner.
4108     */
4109    bool is_owned;
4110 } LDKNodeInfo;
4111
4112 /**
4113  * The contents of CResult_NodeInfoDecodeErrorZ
4114  */
4115 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
4116    /**
4117     * A pointer to the contents in the success state.
4118     * Reading from this pointer when `result_ok` is not set is undefined.
4119     */
4120    struct LDKNodeInfo *result;
4121    /**
4122     * A pointer to the contents in the error state.
4123     * Reading from this pointer when `result_ok` is set is undefined.
4124     */
4125    struct LDKDecodeError *err;
4126 } LDKCResult_NodeInfoDecodeErrorZPtr;
4127
4128 /**
4129  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
4130  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4131  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4132  */
4133 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
4134    /**
4135     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
4136     * `err` or `result` depending on the state of `result_ok`.
4137     */
4138    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
4139    /**
4140     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
4141     */
4142    bool result_ok;
4143 } LDKCResult_NodeInfoDecodeErrorZ;
4144
4145
4146
4147 /**
4148  * Represents the network as nodes and channels between them
4149  */
4150 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4151    /**
4152     * A pointer to the opaque Rust object.
4153     * Nearly everywhere, inner must be non-null, however in places where
4154     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4155     */
4156    LDKnativeNetworkGraph *inner;
4157    /**
4158     * Indicates that this is the only struct which contains the same pointer.
4159     * Rust functions which take ownership of an object provided via an argument require
4160     * this to be true and invalidate the object pointed to by inner.
4161     */
4162    bool is_owned;
4163 } LDKNetworkGraph;
4164
4165 /**
4166  * The contents of CResult_NetworkGraphDecodeErrorZ
4167  */
4168 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
4169    /**
4170     * A pointer to the contents in the success state.
4171     * Reading from this pointer when `result_ok` is not set is undefined.
4172     */
4173    struct LDKNetworkGraph *result;
4174    /**
4175     * A pointer to the contents in the error state.
4176     * Reading from this pointer when `result_ok` is set is undefined.
4177     */
4178    struct LDKDecodeError *err;
4179 } LDKCResult_NetworkGraphDecodeErrorZPtr;
4180
4181 /**
4182  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
4183  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
4184  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4185  */
4186 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
4187    /**
4188     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
4189     * `err` or `result` depending on the state of `result_ok`.
4190     */
4191    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
4192    /**
4193     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
4194     */
4195    bool result_ok;
4196 } LDKCResult_NetworkGraphDecodeErrorZ;
4197
4198
4199
4200 /**
4201  * Features used within an `init` message.
4202  */
4203 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4204    /**
4205     * A pointer to the opaque Rust object.
4206     * Nearly everywhere, inner must be non-null, however in places where
4207     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4208     */
4209    LDKnativeInitFeatures *inner;
4210    /**
4211     * Indicates that this is the only struct which contains the same pointer.
4212     * Rust functions which take ownership of an object provided via an argument require
4213     * this to be true and invalidate the object pointed to by inner.
4214     */
4215    bool is_owned;
4216 } LDKInitFeatures;
4217
4218 /**
4219  * The contents of CResult_InitFeaturesDecodeErrorZ
4220  */
4221 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4222    /**
4223     * A pointer to the contents in the success state.
4224     * Reading from this pointer when `result_ok` is not set is undefined.
4225     */
4226    struct LDKInitFeatures *result;
4227    /**
4228     * A pointer to the contents in the error state.
4229     * Reading from this pointer when `result_ok` is set is undefined.
4230     */
4231    struct LDKDecodeError *err;
4232 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4233
4234 /**
4235  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4236  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4237  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4238  */
4239 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4240    /**
4241     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4242     * `err` or `result` depending on the state of `result_ok`.
4243     */
4244    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4245    /**
4246     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4247     */
4248    bool result_ok;
4249 } LDKCResult_InitFeaturesDecodeErrorZ;
4250
4251
4252
4253 /**
4254  * Features used within a `node_announcement` message.
4255  */
4256 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4257    /**
4258     * A pointer to the opaque Rust object.
4259     * Nearly everywhere, inner must be non-null, however in places where
4260     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4261     */
4262    LDKnativeNodeFeatures *inner;
4263    /**
4264     * Indicates that this is the only struct which contains the same pointer.
4265     * Rust functions which take ownership of an object provided via an argument require
4266     * this to be true and invalidate the object pointed to by inner.
4267     */
4268    bool is_owned;
4269 } LDKNodeFeatures;
4270
4271 /**
4272  * The contents of CResult_NodeFeaturesDecodeErrorZ
4273  */
4274 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4275    /**
4276     * A pointer to the contents in the success state.
4277     * Reading from this pointer when `result_ok` is not set is undefined.
4278     */
4279    struct LDKNodeFeatures *result;
4280    /**
4281     * A pointer to the contents in the error state.
4282     * Reading from this pointer when `result_ok` is set is undefined.
4283     */
4284    struct LDKDecodeError *err;
4285 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
4286
4287 /**
4288  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4289  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4290  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4291  */
4292 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
4293    /**
4294     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4295     * `err` or `result` depending on the state of `result_ok`.
4296     */
4297    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
4298    /**
4299     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4300     */
4301    bool result_ok;
4302 } LDKCResult_NodeFeaturesDecodeErrorZ;
4303
4304
4305
4306 /**
4307  * Features used within a `channel_announcement` message.
4308  */
4309 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
4310    /**
4311     * A pointer to the opaque Rust object.
4312     * Nearly everywhere, inner must be non-null, however in places where
4313     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4314     */
4315    LDKnativeChannelFeatures *inner;
4316    /**
4317     * Indicates that this is the only struct which contains the same pointer.
4318     * Rust functions which take ownership of an object provided via an argument require
4319     * this to be true and invalidate the object pointed to by inner.
4320     */
4321    bool is_owned;
4322 } LDKChannelFeatures;
4323
4324 /**
4325  * The contents of CResult_ChannelFeaturesDecodeErrorZ
4326  */
4327 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
4328    /**
4329     * A pointer to the contents in the success state.
4330     * Reading from this pointer when `result_ok` is not set is undefined.
4331     */
4332    struct LDKChannelFeatures *result;
4333    /**
4334     * A pointer to the contents in the error state.
4335     * Reading from this pointer when `result_ok` is set is undefined.
4336     */
4337    struct LDKDecodeError *err;
4338 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
4339
4340 /**
4341  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4342  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4343  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4344  */
4345 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
4346    /**
4347     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4348     * `err` or `result` depending on the state of `result_ok`.
4349     */
4350    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
4351    /**
4352     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4353     */
4354    bool result_ok;
4355 } LDKCResult_ChannelFeaturesDecodeErrorZ;
4356
4357
4358
4359 /**
4360  * Features used within an invoice.
4361  */
4362 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
4363    /**
4364     * A pointer to the opaque Rust object.
4365     * Nearly everywhere, inner must be non-null, however in places where
4366     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4367     */
4368    LDKnativeInvoiceFeatures *inner;
4369    /**
4370     * Indicates that this is the only struct which contains the same pointer.
4371     * Rust functions which take ownership of an object provided via an argument require
4372     * this to be true and invalidate the object pointed to by inner.
4373     */
4374    bool is_owned;
4375 } LDKInvoiceFeatures;
4376
4377 /**
4378  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
4379  */
4380 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
4381    /**
4382     * A pointer to the contents in the success state.
4383     * Reading from this pointer when `result_ok` is not set is undefined.
4384     */
4385    struct LDKInvoiceFeatures *result;
4386    /**
4387     * A pointer to the contents in the error state.
4388     * Reading from this pointer when `result_ok` is set is undefined.
4389     */
4390    struct LDKDecodeError *err;
4391 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
4392
4393 /**
4394  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4395  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4396  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4397  */
4398 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
4399    /**
4400     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4401     * `err` or `result` depending on the state of `result_ok`.
4402     */
4403    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
4404    /**
4405     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4406     */
4407    bool result_ok;
4408 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
4409
4410 /**
4411  * The contents of CResult_NetAddressu8Z
4412  */
4413 typedef union LDKCResult_NetAddressu8ZPtr {
4414    /**
4415     * A pointer to the contents in the success state.
4416     * Reading from this pointer when `result_ok` is not set is undefined.
4417     */
4418    struct LDKNetAddress *result;
4419    /**
4420     * A pointer to the contents in the error state.
4421     * Reading from this pointer when `result_ok` is set is undefined.
4422     */
4423    uint8_t *err;
4424 } LDKCResult_NetAddressu8ZPtr;
4425
4426 /**
4427  * A CResult_NetAddressu8Z represents the result of a fallible operation,
4428  * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
4429  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4430  */
4431 typedef struct LDKCResult_NetAddressu8Z {
4432    /**
4433     * The contents of this CResult_NetAddressu8Z, accessible via either
4434     * `err` or `result` depending on the state of `result_ok`.
4435     */
4436    union LDKCResult_NetAddressu8ZPtr contents;
4437    /**
4438     * Whether this CResult_NetAddressu8Z represents a success state.
4439     */
4440    bool result_ok;
4441 } LDKCResult_NetAddressu8Z;
4442
4443 /**
4444  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
4445  */
4446 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4447    /**
4448     * A pointer to the contents in the success state.
4449     * Reading from this pointer when `result_ok` is not set is undefined.
4450     */
4451    struct LDKCResult_NetAddressu8Z *result;
4452    /**
4453     * A pointer to the contents in the error state.
4454     * Reading from this pointer when `result_ok` is set is undefined.
4455     */
4456    struct LDKDecodeError *err;
4457 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
4458
4459 /**
4460  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
4461  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
4462  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4463  */
4464 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
4465    /**
4466     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
4467     * `err` or `result` depending on the state of `result_ok`.
4468     */
4469    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
4470    /**
4471     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
4472     */
4473    bool result_ok;
4474 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
4475
4476
4477
4478 /**
4479  * An update_add_htlc message to be sent or received from a peer
4480  */
4481 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
4482    /**
4483     * A pointer to the opaque Rust object.
4484     * Nearly everywhere, inner must be non-null, however in places where
4485     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4486     */
4487    LDKnativeUpdateAddHTLC *inner;
4488    /**
4489     * Indicates that this is the only struct which contains the same pointer.
4490     * Rust functions which take ownership of an object provided via an argument require
4491     * this to be true and invalidate the object pointed to by inner.
4492     */
4493    bool is_owned;
4494 } LDKUpdateAddHTLC;
4495
4496 /**
4497  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
4498  * This corresponds to std::vector in C++
4499  */
4500 typedef struct LDKCVec_UpdateAddHTLCZ {
4501    /**
4502     * The elements in the array.
4503     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4504     */
4505    struct LDKUpdateAddHTLC *data;
4506    /**
4507     * The number of elements pointed to by `data`.
4508     */
4509    uintptr_t datalen;
4510 } LDKCVec_UpdateAddHTLCZ;
4511
4512
4513
4514 /**
4515  * An update_fulfill_htlc message to be sent or received from a peer
4516  */
4517 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
4518    /**
4519     * A pointer to the opaque Rust object.
4520     * Nearly everywhere, inner must be non-null, however in places where
4521     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4522     */
4523    LDKnativeUpdateFulfillHTLC *inner;
4524    /**
4525     * Indicates that this is the only struct which contains the same pointer.
4526     * Rust functions which take ownership of an object provided via an argument require
4527     * this to be true and invalidate the object pointed to by inner.
4528     */
4529    bool is_owned;
4530 } LDKUpdateFulfillHTLC;
4531
4532 /**
4533  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
4534  * This corresponds to std::vector in C++
4535  */
4536 typedef struct LDKCVec_UpdateFulfillHTLCZ {
4537    /**
4538     * The elements in the array.
4539     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4540     */
4541    struct LDKUpdateFulfillHTLC *data;
4542    /**
4543     * The number of elements pointed to by `data`.
4544     */
4545    uintptr_t datalen;
4546 } LDKCVec_UpdateFulfillHTLCZ;
4547
4548
4549
4550 /**
4551  * An update_fail_htlc message to be sent or received from a peer
4552  */
4553 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
4554    /**
4555     * A pointer to the opaque Rust object.
4556     * Nearly everywhere, inner must be non-null, however in places where
4557     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4558     */
4559    LDKnativeUpdateFailHTLC *inner;
4560    /**
4561     * Indicates that this is the only struct which contains the same pointer.
4562     * Rust functions which take ownership of an object provided via an argument require
4563     * this to be true and invalidate the object pointed to by inner.
4564     */
4565    bool is_owned;
4566 } LDKUpdateFailHTLC;
4567
4568 /**
4569  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
4570  * This corresponds to std::vector in C++
4571  */
4572 typedef struct LDKCVec_UpdateFailHTLCZ {
4573    /**
4574     * The elements in the array.
4575     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4576     */
4577    struct LDKUpdateFailHTLC *data;
4578    /**
4579     * The number of elements pointed to by `data`.
4580     */
4581    uintptr_t datalen;
4582 } LDKCVec_UpdateFailHTLCZ;
4583
4584
4585
4586 /**
4587  * An update_fail_malformed_htlc message to be sent or received from a peer
4588  */
4589 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
4590    /**
4591     * A pointer to the opaque Rust object.
4592     * Nearly everywhere, inner must be non-null, however in places where
4593     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4594     */
4595    LDKnativeUpdateFailMalformedHTLC *inner;
4596    /**
4597     * Indicates that this is the only struct which contains the same pointer.
4598     * Rust functions which take ownership of an object provided via an argument require
4599     * this to be true and invalidate the object pointed to by inner.
4600     */
4601    bool is_owned;
4602 } LDKUpdateFailMalformedHTLC;
4603
4604 /**
4605  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
4606  * This corresponds to std::vector in C++
4607  */
4608 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
4609    /**
4610     * The elements in the array.
4611     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4612     */
4613    struct LDKUpdateFailMalformedHTLC *data;
4614    /**
4615     * The number of elements pointed to by `data`.
4616     */
4617    uintptr_t datalen;
4618 } LDKCVec_UpdateFailMalformedHTLCZ;
4619
4620 /**
4621  * The contents of CResult_AcceptChannelDecodeErrorZ
4622  */
4623 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
4624    /**
4625     * A pointer to the contents in the success state.
4626     * Reading from this pointer when `result_ok` is not set is undefined.
4627     */
4628    struct LDKAcceptChannel *result;
4629    /**
4630     * A pointer to the contents in the error state.
4631     * Reading from this pointer when `result_ok` is set is undefined.
4632     */
4633    struct LDKDecodeError *err;
4634 } LDKCResult_AcceptChannelDecodeErrorZPtr;
4635
4636 /**
4637  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
4638  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
4639  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4640  */
4641 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
4642    /**
4643     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
4644     * `err` or `result` depending on the state of `result_ok`.
4645     */
4646    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
4647    /**
4648     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
4649     */
4650    bool result_ok;
4651 } LDKCResult_AcceptChannelDecodeErrorZ;
4652
4653 /**
4654  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
4655  */
4656 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
4657    /**
4658     * A pointer to the contents in the success state.
4659     * Reading from this pointer when `result_ok` is not set is undefined.
4660     */
4661    struct LDKAnnouncementSignatures *result;
4662    /**
4663     * A pointer to the contents in the error state.
4664     * Reading from this pointer when `result_ok` is set is undefined.
4665     */
4666    struct LDKDecodeError *err;
4667 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
4668
4669 /**
4670  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
4671  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4672  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4673  */
4674 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
4675    /**
4676     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
4677     * `err` or `result` depending on the state of `result_ok`.
4678     */
4679    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
4680    /**
4681     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
4682     */
4683    bool result_ok;
4684 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
4685
4686 /**
4687  * The contents of CResult_ChannelReestablishDecodeErrorZ
4688  */
4689 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
4690    /**
4691     * A pointer to the contents in the success state.
4692     * Reading from this pointer when `result_ok` is not set is undefined.
4693     */
4694    struct LDKChannelReestablish *result;
4695    /**
4696     * A pointer to the contents in the error state.
4697     * Reading from this pointer when `result_ok` is set is undefined.
4698     */
4699    struct LDKDecodeError *err;
4700 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
4701
4702 /**
4703  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
4704  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
4705  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4706  */
4707 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
4708    /**
4709     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
4710     * `err` or `result` depending on the state of `result_ok`.
4711     */
4712    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
4713    /**
4714     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
4715     */
4716    bool result_ok;
4717 } LDKCResult_ChannelReestablishDecodeErrorZ;
4718
4719 /**
4720  * The contents of CResult_ClosingSignedDecodeErrorZ
4721  */
4722 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
4723    /**
4724     * A pointer to the contents in the success state.
4725     * Reading from this pointer when `result_ok` is not set is undefined.
4726     */
4727    struct LDKClosingSigned *result;
4728    /**
4729     * A pointer to the contents in the error state.
4730     * Reading from this pointer when `result_ok` is set is undefined.
4731     */
4732    struct LDKDecodeError *err;
4733 } LDKCResult_ClosingSignedDecodeErrorZPtr;
4734
4735 /**
4736  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
4737  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
4738  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4739  */
4740 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
4741    /**
4742     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
4743     * `err` or `result` depending on the state of `result_ok`.
4744     */
4745    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
4746    /**
4747     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
4748     */
4749    bool result_ok;
4750 } LDKCResult_ClosingSignedDecodeErrorZ;
4751
4752
4753
4754 /**
4755  * A commitment_signed message to be sent or received from a peer
4756  */
4757 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
4758    /**
4759     * A pointer to the opaque Rust object.
4760     * Nearly everywhere, inner must be non-null, however in places where
4761     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4762     */
4763    LDKnativeCommitmentSigned *inner;
4764    /**
4765     * Indicates that this is the only struct which contains the same pointer.
4766     * Rust functions which take ownership of an object provided via an argument require
4767     * this to be true and invalidate the object pointed to by inner.
4768     */
4769    bool is_owned;
4770 } LDKCommitmentSigned;
4771
4772 /**
4773  * The contents of CResult_CommitmentSignedDecodeErrorZ
4774  */
4775 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
4776    /**
4777     * A pointer to the contents in the success state.
4778     * Reading from this pointer when `result_ok` is not set is undefined.
4779     */
4780    struct LDKCommitmentSigned *result;
4781    /**
4782     * A pointer to the contents in the error state.
4783     * Reading from this pointer when `result_ok` is set is undefined.
4784     */
4785    struct LDKDecodeError *err;
4786 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
4787
4788 /**
4789  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
4790  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
4791  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4792  */
4793 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
4794    /**
4795     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
4796     * `err` or `result` depending on the state of `result_ok`.
4797     */
4798    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
4799    /**
4800     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
4801     */
4802    bool result_ok;
4803 } LDKCResult_CommitmentSignedDecodeErrorZ;
4804
4805 /**
4806  * The contents of CResult_FundingCreatedDecodeErrorZ
4807  */
4808 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
4809    /**
4810     * A pointer to the contents in the success state.
4811     * Reading from this pointer when `result_ok` is not set is undefined.
4812     */
4813    struct LDKFundingCreated *result;
4814    /**
4815     * A pointer to the contents in the error state.
4816     * Reading from this pointer when `result_ok` is set is undefined.
4817     */
4818    struct LDKDecodeError *err;
4819 } LDKCResult_FundingCreatedDecodeErrorZPtr;
4820
4821 /**
4822  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
4823  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
4824  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4825  */
4826 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
4827    /**
4828     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
4829     * `err` or `result` depending on the state of `result_ok`.
4830     */
4831    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
4832    /**
4833     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
4834     */
4835    bool result_ok;
4836 } LDKCResult_FundingCreatedDecodeErrorZ;
4837
4838 /**
4839  * The contents of CResult_FundingSignedDecodeErrorZ
4840  */
4841 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
4842    /**
4843     * A pointer to the contents in the success state.
4844     * Reading from this pointer when `result_ok` is not set is undefined.
4845     */
4846    struct LDKFundingSigned *result;
4847    /**
4848     * A pointer to the contents in the error state.
4849     * Reading from this pointer when `result_ok` is set is undefined.
4850     */
4851    struct LDKDecodeError *err;
4852 } LDKCResult_FundingSignedDecodeErrorZPtr;
4853
4854 /**
4855  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
4856  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
4857  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4858  */
4859 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
4860    /**
4861     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
4862     * `err` or `result` depending on the state of `result_ok`.
4863     */
4864    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
4865    /**
4866     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
4867     */
4868    bool result_ok;
4869 } LDKCResult_FundingSignedDecodeErrorZ;
4870
4871 /**
4872  * The contents of CResult_FundingLockedDecodeErrorZ
4873  */
4874 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
4875    /**
4876     * A pointer to the contents in the success state.
4877     * Reading from this pointer when `result_ok` is not set is undefined.
4878     */
4879    struct LDKFundingLocked *result;
4880    /**
4881     * A pointer to the contents in the error state.
4882     * Reading from this pointer when `result_ok` is set is undefined.
4883     */
4884    struct LDKDecodeError *err;
4885 } LDKCResult_FundingLockedDecodeErrorZPtr;
4886
4887 /**
4888  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
4889  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
4890  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4891  */
4892 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
4893    /**
4894     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
4895     * `err` or `result` depending on the state of `result_ok`.
4896     */
4897    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
4898    /**
4899     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
4900     */
4901    bool result_ok;
4902 } LDKCResult_FundingLockedDecodeErrorZ;
4903
4904
4905
4906 /**
4907  * An init message to be sent or received from a peer
4908  */
4909 typedef struct MUST_USE_STRUCT LDKInit {
4910    /**
4911     * A pointer to the opaque Rust object.
4912     * Nearly everywhere, inner must be non-null, however in places where
4913     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4914     */
4915    LDKnativeInit *inner;
4916    /**
4917     * Indicates that this is the only struct which contains the same pointer.
4918     * Rust functions which take ownership of an object provided via an argument require
4919     * this to be true and invalidate the object pointed to by inner.
4920     */
4921    bool is_owned;
4922 } LDKInit;
4923
4924 /**
4925  * The contents of CResult_InitDecodeErrorZ
4926  */
4927 typedef union LDKCResult_InitDecodeErrorZPtr {
4928    /**
4929     * A pointer to the contents in the success state.
4930     * Reading from this pointer when `result_ok` is not set is undefined.
4931     */
4932    struct LDKInit *result;
4933    /**
4934     * A pointer to the contents in the error state.
4935     * Reading from this pointer when `result_ok` is set is undefined.
4936     */
4937    struct LDKDecodeError *err;
4938 } LDKCResult_InitDecodeErrorZPtr;
4939
4940 /**
4941  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
4942  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
4943  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4944  */
4945 typedef struct LDKCResult_InitDecodeErrorZ {
4946    /**
4947     * The contents of this CResult_InitDecodeErrorZ, accessible via either
4948     * `err` or `result` depending on the state of `result_ok`.
4949     */
4950    union LDKCResult_InitDecodeErrorZPtr contents;
4951    /**
4952     * Whether this CResult_InitDecodeErrorZ represents a success state.
4953     */
4954    bool result_ok;
4955 } LDKCResult_InitDecodeErrorZ;
4956
4957 /**
4958  * The contents of CResult_OpenChannelDecodeErrorZ
4959  */
4960 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
4961    /**
4962     * A pointer to the contents in the success state.
4963     * Reading from this pointer when `result_ok` is not set is undefined.
4964     */
4965    struct LDKOpenChannel *result;
4966    /**
4967     * A pointer to the contents in the error state.
4968     * Reading from this pointer when `result_ok` is set is undefined.
4969     */
4970    struct LDKDecodeError *err;
4971 } LDKCResult_OpenChannelDecodeErrorZPtr;
4972
4973 /**
4974  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
4975  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
4976  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4977  */
4978 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
4979    /**
4980     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
4981     * `err` or `result` depending on the state of `result_ok`.
4982     */
4983    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
4984    /**
4985     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
4986     */
4987    bool result_ok;
4988 } LDKCResult_OpenChannelDecodeErrorZ;
4989
4990 /**
4991  * The contents of CResult_RevokeAndACKDecodeErrorZ
4992  */
4993 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
4994    /**
4995     * A pointer to the contents in the success state.
4996     * Reading from this pointer when `result_ok` is not set is undefined.
4997     */
4998    struct LDKRevokeAndACK *result;
4999    /**
5000     * A pointer to the contents in the error state.
5001     * Reading from this pointer when `result_ok` is set is undefined.
5002     */
5003    struct LDKDecodeError *err;
5004 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
5005
5006 /**
5007  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
5008  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
5009  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5010  */
5011 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
5012    /**
5013     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
5014     * `err` or `result` depending on the state of `result_ok`.
5015     */
5016    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
5017    /**
5018     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
5019     */
5020    bool result_ok;
5021 } LDKCResult_RevokeAndACKDecodeErrorZ;
5022
5023 /**
5024  * The contents of CResult_ShutdownDecodeErrorZ
5025  */
5026 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
5027    /**
5028     * A pointer to the contents in the success state.
5029     * Reading from this pointer when `result_ok` is not set is undefined.
5030     */
5031    struct LDKShutdown *result;
5032    /**
5033     * A pointer to the contents in the error state.
5034     * Reading from this pointer when `result_ok` is set is undefined.
5035     */
5036    struct LDKDecodeError *err;
5037 } LDKCResult_ShutdownDecodeErrorZPtr;
5038
5039 /**
5040  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
5041  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
5042  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5043  */
5044 typedef struct LDKCResult_ShutdownDecodeErrorZ {
5045    /**
5046     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
5047     * `err` or `result` depending on the state of `result_ok`.
5048     */
5049    union LDKCResult_ShutdownDecodeErrorZPtr contents;
5050    /**
5051     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
5052     */
5053    bool result_ok;
5054 } LDKCResult_ShutdownDecodeErrorZ;
5055
5056 /**
5057  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
5058  */
5059 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
5060    /**
5061     * A pointer to the contents in the success state.
5062     * Reading from this pointer when `result_ok` is not set is undefined.
5063     */
5064    struct LDKUpdateFailHTLC *result;
5065    /**
5066     * A pointer to the contents in the error state.
5067     * Reading from this pointer when `result_ok` is set is undefined.
5068     */
5069    struct LDKDecodeError *err;
5070 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
5071
5072 /**
5073  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
5074  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5075  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5076  */
5077 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
5078    /**
5079     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
5080     * `err` or `result` depending on the state of `result_ok`.
5081     */
5082    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
5083    /**
5084     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
5085     */
5086    bool result_ok;
5087 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
5088
5089 /**
5090  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
5091  */
5092 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5093    /**
5094     * A pointer to the contents in the success state.
5095     * Reading from this pointer when `result_ok` is not set is undefined.
5096     */
5097    struct LDKUpdateFailMalformedHTLC *result;
5098    /**
5099     * A pointer to the contents in the error state.
5100     * Reading from this pointer when `result_ok` is set is undefined.
5101     */
5102    struct LDKDecodeError *err;
5103 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
5104
5105 /**
5106  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
5107  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5108  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5109  */
5110 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
5111    /**
5112     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
5113     * `err` or `result` depending on the state of `result_ok`.
5114     */
5115    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
5116    /**
5117     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
5118     */
5119    bool result_ok;
5120 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
5121
5122
5123
5124 /**
5125  * An update_fee message to be sent or received from a peer
5126  */
5127 typedef struct MUST_USE_STRUCT LDKUpdateFee {
5128    /**
5129     * A pointer to the opaque Rust object.
5130     * Nearly everywhere, inner must be non-null, however in places where
5131     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5132     */
5133    LDKnativeUpdateFee *inner;
5134    /**
5135     * Indicates that this is the only struct which contains the same pointer.
5136     * Rust functions which take ownership of an object provided via an argument require
5137     * this to be true and invalidate the object pointed to by inner.
5138     */
5139    bool is_owned;
5140 } LDKUpdateFee;
5141
5142 /**
5143  * The contents of CResult_UpdateFeeDecodeErrorZ
5144  */
5145 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
5146    /**
5147     * A pointer to the contents in the success state.
5148     * Reading from this pointer when `result_ok` is not set is undefined.
5149     */
5150    struct LDKUpdateFee *result;
5151    /**
5152     * A pointer to the contents in the error state.
5153     * Reading from this pointer when `result_ok` is set is undefined.
5154     */
5155    struct LDKDecodeError *err;
5156 } LDKCResult_UpdateFeeDecodeErrorZPtr;
5157
5158 /**
5159  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
5160  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
5161  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5162  */
5163 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
5164    /**
5165     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
5166     * `err` or `result` depending on the state of `result_ok`.
5167     */
5168    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
5169    /**
5170     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
5171     */
5172    bool result_ok;
5173 } LDKCResult_UpdateFeeDecodeErrorZ;
5174
5175 /**
5176  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
5177  */
5178 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
5179    /**
5180     * A pointer to the contents in the success state.
5181     * Reading from this pointer when `result_ok` is not set is undefined.
5182     */
5183    struct LDKUpdateFulfillHTLC *result;
5184    /**
5185     * A pointer to the contents in the error state.
5186     * Reading from this pointer when `result_ok` is set is undefined.
5187     */
5188    struct LDKDecodeError *err;
5189 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
5190
5191 /**
5192  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
5193  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5194  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5195  */
5196 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
5197    /**
5198     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
5199     * `err` or `result` depending on the state of `result_ok`.
5200     */
5201    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
5202    /**
5203     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
5204     */
5205    bool result_ok;
5206 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
5207
5208 /**
5209  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
5210  */
5211 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
5212    /**
5213     * A pointer to the contents in the success state.
5214     * Reading from this pointer when `result_ok` is not set is undefined.
5215     */
5216    struct LDKUpdateAddHTLC *result;
5217    /**
5218     * A pointer to the contents in the error state.
5219     * Reading from this pointer when `result_ok` is set is undefined.
5220     */
5221    struct LDKDecodeError *err;
5222 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
5223
5224 /**
5225  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
5226  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5227  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5228  */
5229 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
5230    /**
5231     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
5232     * `err` or `result` depending on the state of `result_ok`.
5233     */
5234    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
5235    /**
5236     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
5237     */
5238    bool result_ok;
5239 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
5240
5241
5242
5243 /**
5244  * A ping message to be sent or received from a peer
5245  */
5246 typedef struct MUST_USE_STRUCT LDKPing {
5247    /**
5248     * A pointer to the opaque Rust object.
5249     * Nearly everywhere, inner must be non-null, however in places where
5250     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5251     */
5252    LDKnativePing *inner;
5253    /**
5254     * Indicates that this is the only struct which contains the same pointer.
5255     * Rust functions which take ownership of an object provided via an argument require
5256     * this to be true and invalidate the object pointed to by inner.
5257     */
5258    bool is_owned;
5259 } LDKPing;
5260
5261 /**
5262  * The contents of CResult_PingDecodeErrorZ
5263  */
5264 typedef union LDKCResult_PingDecodeErrorZPtr {
5265    /**
5266     * A pointer to the contents in the success state.
5267     * Reading from this pointer when `result_ok` is not set is undefined.
5268     */
5269    struct LDKPing *result;
5270    /**
5271     * A pointer to the contents in the error state.
5272     * Reading from this pointer when `result_ok` is set is undefined.
5273     */
5274    struct LDKDecodeError *err;
5275 } LDKCResult_PingDecodeErrorZPtr;
5276
5277 /**
5278  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
5279  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
5280  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5281  */
5282 typedef struct LDKCResult_PingDecodeErrorZ {
5283    /**
5284     * The contents of this CResult_PingDecodeErrorZ, accessible via either
5285     * `err` or `result` depending on the state of `result_ok`.
5286     */
5287    union LDKCResult_PingDecodeErrorZPtr contents;
5288    /**
5289     * Whether this CResult_PingDecodeErrorZ represents a success state.
5290     */
5291    bool result_ok;
5292 } LDKCResult_PingDecodeErrorZ;
5293
5294
5295
5296 /**
5297  * A pong message to be sent or received from a peer
5298  */
5299 typedef struct MUST_USE_STRUCT LDKPong {
5300    /**
5301     * A pointer to the opaque Rust object.
5302     * Nearly everywhere, inner must be non-null, however in places where
5303     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5304     */
5305    LDKnativePong *inner;
5306    /**
5307     * Indicates that this is the only struct which contains the same pointer.
5308     * Rust functions which take ownership of an object provided via an argument require
5309     * this to be true and invalidate the object pointed to by inner.
5310     */
5311    bool is_owned;
5312 } LDKPong;
5313
5314 /**
5315  * The contents of CResult_PongDecodeErrorZ
5316  */
5317 typedef union LDKCResult_PongDecodeErrorZPtr {
5318    /**
5319     * A pointer to the contents in the success state.
5320     * Reading from this pointer when `result_ok` is not set is undefined.
5321     */
5322    struct LDKPong *result;
5323    /**
5324     * A pointer to the contents in the error state.
5325     * Reading from this pointer when `result_ok` is set is undefined.
5326     */
5327    struct LDKDecodeError *err;
5328 } LDKCResult_PongDecodeErrorZPtr;
5329
5330 /**
5331  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
5332  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
5333  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5334  */
5335 typedef struct LDKCResult_PongDecodeErrorZ {
5336    /**
5337     * The contents of this CResult_PongDecodeErrorZ, accessible via either
5338     * `err` or `result` depending on the state of `result_ok`.
5339     */
5340    union LDKCResult_PongDecodeErrorZPtr contents;
5341    /**
5342     * Whether this CResult_PongDecodeErrorZ represents a success state.
5343     */
5344    bool result_ok;
5345 } LDKCResult_PongDecodeErrorZ;
5346
5347 /**
5348  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
5349  */
5350 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
5351    /**
5352     * A pointer to the contents in the success state.
5353     * Reading from this pointer when `result_ok` is not set is undefined.
5354     */
5355    struct LDKUnsignedChannelAnnouncement *result;
5356    /**
5357     * A pointer to the contents in the error state.
5358     * Reading from this pointer when `result_ok` is set is undefined.
5359     */
5360    struct LDKDecodeError *err;
5361 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
5362
5363 /**
5364  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
5365  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
5366  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5367  */
5368 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
5369    /**
5370     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
5371     * `err` or `result` depending on the state of `result_ok`.
5372     */
5373    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
5374    /**
5375     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
5376     */
5377    bool result_ok;
5378 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
5379
5380 /**
5381  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
5382  */
5383 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
5384    /**
5385     * A pointer to the contents in the success state.
5386     * Reading from this pointer when `result_ok` is not set is undefined.
5387     */
5388    struct LDKChannelAnnouncement *result;
5389    /**
5390     * A pointer to the contents in the error state.
5391     * Reading from this pointer when `result_ok` is set is undefined.
5392     */
5393    struct LDKDecodeError *err;
5394 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
5395
5396 /**
5397  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
5398  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
5399  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5400  */
5401 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
5402    /**
5403     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
5404     * `err` or `result` depending on the state of `result_ok`.
5405     */
5406    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
5407    /**
5408     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
5409     */
5410    bool result_ok;
5411 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
5412
5413
5414
5415 /**
5416  * The unsigned part of a channel_update
5417  */
5418 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
5419    /**
5420     * A pointer to the opaque Rust object.
5421     * Nearly everywhere, inner must be non-null, however in places where
5422     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5423     */
5424    LDKnativeUnsignedChannelUpdate *inner;
5425    /**
5426     * Indicates that this is the only struct which contains the same pointer.
5427     * Rust functions which take ownership of an object provided via an argument require
5428     * this to be true and invalidate the object pointed to by inner.
5429     */
5430    bool is_owned;
5431 } LDKUnsignedChannelUpdate;
5432
5433 /**
5434  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
5435  */
5436 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
5437    /**
5438     * A pointer to the contents in the success state.
5439     * Reading from this pointer when `result_ok` is not set is undefined.
5440     */
5441    struct LDKUnsignedChannelUpdate *result;
5442    /**
5443     * A pointer to the contents in the error state.
5444     * Reading from this pointer when `result_ok` is set is undefined.
5445     */
5446    struct LDKDecodeError *err;
5447 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
5448
5449 /**
5450  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
5451  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5452  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5453  */
5454 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
5455    /**
5456     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
5457     * `err` or `result` depending on the state of `result_ok`.
5458     */
5459    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
5460    /**
5461     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
5462     */
5463    bool result_ok;
5464 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
5465
5466 /**
5467  * The contents of CResult_ChannelUpdateDecodeErrorZ
5468  */
5469 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
5470    /**
5471     * A pointer to the contents in the success state.
5472     * Reading from this pointer when `result_ok` is not set is undefined.
5473     */
5474    struct LDKChannelUpdate *result;
5475    /**
5476     * A pointer to the contents in the error state.
5477     * Reading from this pointer when `result_ok` is set is undefined.
5478     */
5479    struct LDKDecodeError *err;
5480 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
5481
5482 /**
5483  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
5484  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5485  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5486  */
5487 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
5488    /**
5489     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
5490     * `err` or `result` depending on the state of `result_ok`.
5491     */
5492    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
5493    /**
5494     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
5495     */
5496    bool result_ok;
5497 } LDKCResult_ChannelUpdateDecodeErrorZ;
5498
5499 /**
5500  * The contents of CResult_ErrorMessageDecodeErrorZ
5501  */
5502 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
5503    /**
5504     * A pointer to the contents in the success state.
5505     * Reading from this pointer when `result_ok` is not set is undefined.
5506     */
5507    struct LDKErrorMessage *result;
5508    /**
5509     * A pointer to the contents in the error state.
5510     * Reading from this pointer when `result_ok` is set is undefined.
5511     */
5512    struct LDKDecodeError *err;
5513 } LDKCResult_ErrorMessageDecodeErrorZPtr;
5514
5515 /**
5516  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
5517  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
5518  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5519  */
5520 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
5521    /**
5522     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
5523     * `err` or `result` depending on the state of `result_ok`.
5524     */
5525    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
5526    /**
5527     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
5528     */
5529    bool result_ok;
5530 } LDKCResult_ErrorMessageDecodeErrorZ;
5531
5532
5533
5534 /**
5535  * The unsigned part of a node_announcement
5536  */
5537 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
5538    /**
5539     * A pointer to the opaque Rust object.
5540     * Nearly everywhere, inner must be non-null, however in places where
5541     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5542     */
5543    LDKnativeUnsignedNodeAnnouncement *inner;
5544    /**
5545     * Indicates that this is the only struct which contains the same pointer.
5546     * Rust functions which take ownership of an object provided via an argument require
5547     * this to be true and invalidate the object pointed to by inner.
5548     */
5549    bool is_owned;
5550 } LDKUnsignedNodeAnnouncement;
5551
5552 /**
5553  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
5554  */
5555 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
5556    /**
5557     * A pointer to the contents in the success state.
5558     * Reading from this pointer when `result_ok` is not set is undefined.
5559     */
5560    struct LDKUnsignedNodeAnnouncement *result;
5561    /**
5562     * A pointer to the contents in the error state.
5563     * Reading from this pointer when `result_ok` is set is undefined.
5564     */
5565    struct LDKDecodeError *err;
5566 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
5567
5568 /**
5569  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
5570  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
5571  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5572  */
5573 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
5574    /**
5575     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
5576     * `err` or `result` depending on the state of `result_ok`.
5577     */
5578    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
5579    /**
5580     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
5581     */
5582    bool result_ok;
5583 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
5584
5585 /**
5586  * The contents of CResult_NodeAnnouncementDecodeErrorZ
5587  */
5588 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
5589    /**
5590     * A pointer to the contents in the success state.
5591     * Reading from this pointer when `result_ok` is not set is undefined.
5592     */
5593    struct LDKNodeAnnouncement *result;
5594    /**
5595     * A pointer to the contents in the error state.
5596     * Reading from this pointer when `result_ok` is set is undefined.
5597     */
5598    struct LDKDecodeError *err;
5599 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
5600
5601 /**
5602  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
5603  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
5604  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5605  */
5606 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
5607    /**
5608     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
5609     * `err` or `result` depending on the state of `result_ok`.
5610     */
5611    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
5612    /**
5613     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
5614     */
5615    bool result_ok;
5616 } LDKCResult_NodeAnnouncementDecodeErrorZ;
5617
5618 /**
5619  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
5620  */
5621 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
5622    /**
5623     * A pointer to the contents in the success state.
5624     * Reading from this pointer when `result_ok` is not set is undefined.
5625     */
5626    struct LDKQueryShortChannelIds *result;
5627    /**
5628     * A pointer to the contents in the error state.
5629     * Reading from this pointer when `result_ok` is set is undefined.
5630     */
5631    struct LDKDecodeError *err;
5632 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
5633
5634 /**
5635  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
5636  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
5637  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5638  */
5639 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
5640    /**
5641     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
5642     * `err` or `result` depending on the state of `result_ok`.
5643     */
5644    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
5645    /**
5646     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
5647     */
5648    bool result_ok;
5649 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
5650
5651
5652
5653 /**
5654  * A reply_short_channel_ids_end message is sent as a reply to a
5655  * query_short_channel_ids message. The query recipient makes a best
5656  * effort to respond based on their local network view which may not be
5657  * a perfect view of the network.
5658  */
5659 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
5660    /**
5661     * A pointer to the opaque Rust object.
5662     * Nearly everywhere, inner must be non-null, however in places where
5663     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5664     */
5665    LDKnativeReplyShortChannelIdsEnd *inner;
5666    /**
5667     * Indicates that this is the only struct which contains the same pointer.
5668     * Rust functions which take ownership of an object provided via an argument require
5669     * this to be true and invalidate the object pointed to by inner.
5670     */
5671    bool is_owned;
5672 } LDKReplyShortChannelIdsEnd;
5673
5674 /**
5675  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
5676  */
5677 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
5678    /**
5679     * A pointer to the contents in the success state.
5680     * Reading from this pointer when `result_ok` is not set is undefined.
5681     */
5682    struct LDKReplyShortChannelIdsEnd *result;
5683    /**
5684     * A pointer to the contents in the error state.
5685     * Reading from this pointer when `result_ok` is set is undefined.
5686     */
5687    struct LDKDecodeError *err;
5688 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
5689
5690 /**
5691  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
5692  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
5693  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5694  */
5695 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
5696    /**
5697     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
5698     * `err` or `result` depending on the state of `result_ok`.
5699     */
5700    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
5701    /**
5702     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
5703     */
5704    bool result_ok;
5705 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
5706
5707 /**
5708  * The contents of CResult_QueryChannelRangeDecodeErrorZ
5709  */
5710 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
5711    /**
5712     * A pointer to the contents in the success state.
5713     * Reading from this pointer when `result_ok` is not set is undefined.
5714     */
5715    struct LDKQueryChannelRange *result;
5716    /**
5717     * A pointer to the contents in the error state.
5718     * Reading from this pointer when `result_ok` is set is undefined.
5719     */
5720    struct LDKDecodeError *err;
5721 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
5722
5723 /**
5724  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
5725  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
5726  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5727  */
5728 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
5729    /**
5730     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
5731     * `err` or `result` depending on the state of `result_ok`.
5732     */
5733    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
5734    /**
5735     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
5736     */
5737    bool result_ok;
5738 } LDKCResult_QueryChannelRangeDecodeErrorZ;
5739
5740 /**
5741  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
5742  */
5743 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
5744    /**
5745     * A pointer to the contents in the success state.
5746     * Reading from this pointer when `result_ok` is not set is undefined.
5747     */
5748    struct LDKReplyChannelRange *result;
5749    /**
5750     * A pointer to the contents in the error state.
5751     * Reading from this pointer when `result_ok` is set is undefined.
5752     */
5753    struct LDKDecodeError *err;
5754 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
5755
5756 /**
5757  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
5758  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
5759  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5760  */
5761 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
5762    /**
5763     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
5764     * `err` or `result` depending on the state of `result_ok`.
5765     */
5766    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
5767    /**
5768     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
5769     */
5770    bool result_ok;
5771 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
5772
5773
5774
5775 /**
5776  * A gossip_timestamp_filter message is used by a node to request
5777  * gossip relay for messages in the requested time range when the
5778  * gossip_queries feature has been negotiated.
5779  */
5780 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
5781    /**
5782     * A pointer to the opaque Rust object.
5783     * Nearly everywhere, inner must be non-null, however in places where
5784     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5785     */
5786    LDKnativeGossipTimestampFilter *inner;
5787    /**
5788     * Indicates that this is the only struct which contains the same pointer.
5789     * Rust functions which take ownership of an object provided via an argument require
5790     * this to be true and invalidate the object pointed to by inner.
5791     */
5792    bool is_owned;
5793 } LDKGossipTimestampFilter;
5794
5795 /**
5796  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
5797  */
5798 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
5799    /**
5800     * A pointer to the contents in the success state.
5801     * Reading from this pointer when `result_ok` is not set is undefined.
5802     */
5803    struct LDKGossipTimestampFilter *result;
5804    /**
5805     * A pointer to the contents in the error state.
5806     * Reading from this pointer when `result_ok` is set is undefined.
5807     */
5808    struct LDKDecodeError *err;
5809 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
5810
5811 /**
5812  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
5813  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
5814  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5815  */
5816 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
5817    /**
5818     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
5819     * `err` or `result` depending on the state of `result_ok`.
5820     */
5821    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
5822    /**
5823     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
5824     */
5825    bool result_ok;
5826 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
5827
5828 /**
5829  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
5830  */
5831 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
5832    /**
5833     * A pointer to the contents in the success state.
5834     * Reading from this pointer when `result_ok` is not set is undefined.
5835     */
5836    struct LDKSpendableOutputDescriptor *result;
5837    /**
5838     * A pointer to the contents in the error state.
5839     * Reading from this pointer when `result_ok` is set is undefined.
5840     */
5841    struct LDKDecodeError *err;
5842 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
5843
5844 /**
5845  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5846  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5847  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5848  */
5849 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
5850    /**
5851     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
5852     * `err` or `result` depending on the state of `result_ok`.
5853     */
5854    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
5855    /**
5856     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
5857     */
5858    bool result_ok;
5859 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
5860
5861 /**
5862  * The contents of CResult_SignDecodeErrorZ
5863  */
5864 typedef union LDKCResult_SignDecodeErrorZPtr {
5865    /**
5866     * A pointer to the contents in the success state.
5867     * Reading from this pointer when `result_ok` is not set is undefined.
5868     */
5869    struct LDKSign *result;
5870    /**
5871     * A pointer to the contents in the error state.
5872     * Reading from this pointer when `result_ok` is set is undefined.
5873     */
5874    struct LDKDecodeError *err;
5875 } LDKCResult_SignDecodeErrorZPtr;
5876
5877 /**
5878  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5879  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5880  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5881  */
5882 typedef struct LDKCResult_SignDecodeErrorZ {
5883    /**
5884     * The contents of this CResult_SignDecodeErrorZ, accessible via either
5885     * `err` or `result` depending on the state of `result_ok`.
5886     */
5887    union LDKCResult_SignDecodeErrorZPtr contents;
5888    /**
5889     * Whether this CResult_SignDecodeErrorZ represents a success state.
5890     */
5891    bool result_ok;
5892 } LDKCResult_SignDecodeErrorZ;
5893
5894 /**
5895  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5896  * This corresponds to std::vector in C++
5897  */
5898 typedef struct LDKCVec_CVec_u8ZZ {
5899    /**
5900     * The elements in the array.
5901     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5902     */
5903    struct LDKCVec_u8Z *data;
5904    /**
5905     * The number of elements pointed to by `data`.
5906     */
5907    uintptr_t datalen;
5908 } LDKCVec_CVec_u8ZZ;
5909
5910 /**
5911  * The contents of CResult_CVec_CVec_u8ZZNoneZ
5912  */
5913 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
5914    /**
5915     * A pointer to the contents in the success state.
5916     * Reading from this pointer when `result_ok` is not set is undefined.
5917     */
5918    struct LDKCVec_CVec_u8ZZ *result;
5919    /**
5920     * Note that this value is always NULL, as there are no contents in the Err variant
5921     */
5922    void *err;
5923 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
5924
5925 /**
5926  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5927  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5928  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5929  */
5930 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
5931    /**
5932     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5933     * `err` or `result` depending on the state of `result_ok`.
5934     */
5935    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
5936    /**
5937     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5938     */
5939    bool result_ok;
5940 } LDKCResult_CVec_CVec_u8ZZNoneZ;
5941
5942
5943
5944 /**
5945  * A simple implementation of Sign that just keeps the private keys in memory.
5946  *
5947  * This implementation performs no policy checks and is insufficient by itself as
5948  * a secure external signer.
5949  */
5950 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
5951    /**
5952     * A pointer to the opaque Rust object.
5953     * Nearly everywhere, inner must be non-null, however in places where
5954     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5955     */
5956    LDKnativeInMemorySigner *inner;
5957    /**
5958     * Indicates that this is the only struct which contains the same pointer.
5959     * Rust functions which take ownership of an object provided via an argument require
5960     * this to be true and invalidate the object pointed to by inner.
5961     */
5962    bool is_owned;
5963 } LDKInMemorySigner;
5964
5965 /**
5966  * The contents of CResult_InMemorySignerDecodeErrorZ
5967  */
5968 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
5969    /**
5970     * A pointer to the contents in the success state.
5971     * Reading from this pointer when `result_ok` is not set is undefined.
5972     */
5973    struct LDKInMemorySigner *result;
5974    /**
5975     * A pointer to the contents in the error state.
5976     * Reading from this pointer when `result_ok` is set is undefined.
5977     */
5978    struct LDKDecodeError *err;
5979 } LDKCResult_InMemorySignerDecodeErrorZPtr;
5980
5981 /**
5982  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5983  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5984  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5985  */
5986 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
5987    /**
5988     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5989     * `err` or `result` depending on the state of `result_ok`.
5990     */
5991    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
5992    /**
5993     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5994     */
5995    bool result_ok;
5996 } LDKCResult_InMemorySignerDecodeErrorZ;
5997
5998 /**
5999  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
6000  * This corresponds to std::vector in C++
6001  */
6002 typedef struct LDKCVec_TxOutZ {
6003    /**
6004     * The elements in the array.
6005     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6006     */
6007    struct LDKTxOut *data;
6008    /**
6009     * The number of elements pointed to by `data`.
6010     */
6011    uintptr_t datalen;
6012 } LDKCVec_TxOutZ;
6013
6014 /**
6015  * The contents of CResult_TransactionNoneZ
6016  */
6017 typedef union LDKCResult_TransactionNoneZPtr {
6018    /**
6019     * A pointer to the contents in the success state.
6020     * Reading from this pointer when `result_ok` is not set is undefined.
6021     */
6022    struct LDKTransaction *result;
6023    /**
6024     * Note that this value is always NULL, as there are no contents in the Err variant
6025     */
6026    void *err;
6027 } LDKCResult_TransactionNoneZPtr;
6028
6029 /**
6030  * A CResult_TransactionNoneZ represents the result of a fallible operation,
6031  * containing a crate::c_types::Transaction on success and a () on failure.
6032  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6033  */
6034 typedef struct LDKCResult_TransactionNoneZ {
6035    /**
6036     * The contents of this CResult_TransactionNoneZ, accessible via either
6037     * `err` or `result` depending on the state of `result_ok`.
6038     */
6039    union LDKCResult_TransactionNoneZPtr contents;
6040    /**
6041     * Whether this CResult_TransactionNoneZ represents a success state.
6042     */
6043    bool result_ok;
6044 } LDKCResult_TransactionNoneZ;
6045
6046 /**
6047  * The contents of CResult_NoneErrorZ
6048  */
6049 typedef union LDKCResult_NoneErrorZPtr {
6050    /**
6051     * Note that this value is always NULL, as there are no contents in the OK variant
6052     */
6053    void *result;
6054    /**
6055     * A pointer to the contents in the error state.
6056     * Reading from this pointer when `result_ok` is set is undefined.
6057     */
6058    enum LDKIOError *err;
6059 } LDKCResult_NoneErrorZPtr;
6060
6061 /**
6062  * A CResult_NoneErrorZ represents the result of a fallible operation,
6063  * containing a () on success and a crate::c_types::IOError on failure.
6064  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6065  */
6066 typedef struct LDKCResult_NoneErrorZ {
6067    /**
6068     * The contents of this CResult_NoneErrorZ, accessible via either
6069     * `err` or `result` depending on the state of `result_ok`.
6070     */
6071    union LDKCResult_NoneErrorZPtr contents;
6072    /**
6073     * Whether this CResult_NoneErrorZ represents a success state.
6074     */
6075    bool result_ok;
6076 } LDKCResult_NoneErrorZ;
6077
6078 /**
6079  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
6080  * This corresponds to std::vector in C++
6081  */
6082 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
6083    /**
6084     * The elements in the array.
6085     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6086     */
6087    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
6088    /**
6089     * The number of elements pointed to by `data`.
6090     */
6091    uintptr_t datalen;
6092 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
6093
6094 /**
6095  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
6096  */
6097 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6098    /**
6099     * A pointer to the contents in the success state.
6100     * Reading from this pointer when `result_ok` is not set is undefined.
6101     */
6102    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
6103    /**
6104     * A pointer to the contents in the error state.
6105     * Reading from this pointer when `result_ok` is set is undefined.
6106     */
6107    enum LDKIOError *err;
6108 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
6109
6110 /**
6111  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
6112  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
6113  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6114  */
6115 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6116    /**
6117     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
6118     * `err` or `result` depending on the state of `result_ok`.
6119     */
6120    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
6121    /**
6122     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
6123     */
6124    bool result_ok;
6125 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
6126
6127 /**
6128  * A Rust str object, ie a reference to a UTF8-valid string.
6129  * This is *not* null-terminated so cannot be used directly as a C string!
6130  */
6131 typedef struct LDKStr {
6132    /**
6133     * A pointer to the string's bytes, in UTF8 encoding
6134     */
6135    const uint8_t *chars;
6136    /**
6137     * The number of bytes (not characters!) pointed to by `chars`
6138     */
6139    uintptr_t len;
6140 } LDKStr;
6141
6142 /**
6143  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
6144  * too-high values)
6145  */
6146 typedef enum LDKAPIError_Tag {
6147    /**
6148     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
6149     * are documented, but generally indicates some precondition of a function was violated.
6150     */
6151    LDKAPIError_APIMisuseError,
6152    /**
6153     * Due to a high feerate, we were unable to complete the request.
6154     * For example, this may be returned if the feerate implies we cannot open a channel at the
6155     * requested value, but opening a larger channel would succeed.
6156     */
6157    LDKAPIError_FeeRateTooHigh,
6158    /**
6159     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
6160     * too-many-hops, etc).
6161     */
6162    LDKAPIError_RouteError,
6163    /**
6164     * We were unable to complete the request as the Channel required to do so is unable to
6165     * complete the request (or was not found). This can take many forms, including disconnected
6166     * peer, channel at capacity, channel shutting down, etc.
6167     */
6168    LDKAPIError_ChannelUnavailable,
6169    /**
6170     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
6171     * attempted action to fail.
6172     */
6173    LDKAPIError_MonitorUpdateFailed,
6174    /**
6175     * Must be last for serialization purposes
6176     */
6177    LDKAPIError_Sentinel,
6178 } LDKAPIError_Tag;
6179
6180 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
6181    /**
6182     * A human-readable error message
6183     */
6184    struct LDKCVec_u8Z err;
6185 } LDKAPIError_LDKAPIMisuseError_Body;
6186
6187 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
6188    /**
6189     * A human-readable error message
6190     */
6191    struct LDKCVec_u8Z err;
6192    /**
6193     * The feerate which was too high.
6194     */
6195    uint32_t feerate;
6196 } LDKAPIError_LDKFeeRateTooHigh_Body;
6197
6198 typedef struct LDKAPIError_LDKRouteError_Body {
6199    /**
6200     * A human-readable error message
6201     */
6202    struct LDKStr err;
6203 } LDKAPIError_LDKRouteError_Body;
6204
6205 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
6206    /**
6207     * A human-readable error message
6208     */
6209    struct LDKCVec_u8Z err;
6210 } LDKAPIError_LDKChannelUnavailable_Body;
6211
6212 typedef struct MUST_USE_STRUCT LDKAPIError {
6213    LDKAPIError_Tag tag;
6214    union {
6215       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
6216       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
6217       LDKAPIError_LDKRouteError_Body route_error;
6218       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
6219    };
6220 } LDKAPIError;
6221
6222 /**
6223  * The contents of CResult_NoneAPIErrorZ
6224  */
6225 typedef union LDKCResult_NoneAPIErrorZPtr {
6226    /**
6227     * Note that this value is always NULL, as there are no contents in the OK variant
6228     */
6229    void *result;
6230    /**
6231     * A pointer to the contents in the error state.
6232     * Reading from this pointer when `result_ok` is set is undefined.
6233     */
6234    struct LDKAPIError *err;
6235 } LDKCResult_NoneAPIErrorZPtr;
6236
6237 /**
6238  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6239  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
6240  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6241  */
6242 typedef struct LDKCResult_NoneAPIErrorZ {
6243    /**
6244     * The contents of this CResult_NoneAPIErrorZ, accessible via either
6245     * `err` or `result` depending on the state of `result_ok`.
6246     */
6247    union LDKCResult_NoneAPIErrorZPtr contents;
6248    /**
6249     * Whether this CResult_NoneAPIErrorZ represents a success state.
6250     */
6251    bool result_ok;
6252 } LDKCResult_NoneAPIErrorZ;
6253
6254 /**
6255  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6256  * This corresponds to std::vector in C++
6257  */
6258 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
6259    /**
6260     * The elements in the array.
6261     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6262     */
6263    struct LDKCResult_NoneAPIErrorZ *data;
6264    /**
6265     * The number of elements pointed to by `data`.
6266     */
6267    uintptr_t datalen;
6268 } LDKCVec_CResult_NoneAPIErrorZZ;
6269
6270 /**
6271  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6272  * This corresponds to std::vector in C++
6273  */
6274 typedef struct LDKCVec_APIErrorZ {
6275    /**
6276     * The elements in the array.
6277     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6278     */
6279    struct LDKAPIError *data;
6280    /**
6281     * The number of elements pointed to by `data`.
6282     */
6283    uintptr_t datalen;
6284 } LDKCVec_APIErrorZ;
6285
6286 /**
6287  * If a payment fails to send, it can be in one of several states. This enum is returned as the
6288  * Err() type describing which state the payment is in, see the description of individual enum
6289  * states for more.
6290  */
6291 typedef enum LDKPaymentSendFailure_Tag {
6292    /**
6293     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
6294     * send the payment at all. No channel state has been changed or messages sent to peers, and
6295     * once you've changed the parameter at error, you can freely retry the payment in full.
6296     */
6297    LDKPaymentSendFailure_ParameterError,
6298    /**
6299     * A parameter in a single path which was passed to send_payment was invalid, preventing us
6300     * from attempting to send the payment at all. No channel state has been changed or messages
6301     * sent to peers, and once you've changed the parameter at error, you can freely retry the
6302     * payment in full.
6303     *
6304     * The results here are ordered the same as the paths in the route object which was passed to
6305     * send_payment.
6306     */
6307    LDKPaymentSendFailure_PathParameterError,
6308    /**
6309     * All paths which were attempted failed to send, with no channel state change taking place.
6310     * You can freely retry the payment in full (though you probably want to do so over different
6311     * paths than the ones selected).
6312     */
6313    LDKPaymentSendFailure_AllFailedRetrySafe,
6314    /**
6315     * Some paths which were attempted failed to send, though possibly not all. At least some
6316     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
6317     * in over-/re-payment.
6318     *
6319     * The results here are ordered the same as the paths in the route object which was passed to
6320     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
6321     * retried (though there is currently no API with which to do so).
6322     *
6323     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
6324     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
6325     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
6326     * with the latest update_id.
6327     */
6328    LDKPaymentSendFailure_PartialFailure,
6329    /**
6330     * Must be last for serialization purposes
6331     */
6332    LDKPaymentSendFailure_Sentinel,
6333 } LDKPaymentSendFailure_Tag;
6334
6335 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
6336    LDKPaymentSendFailure_Tag tag;
6337    union {
6338       struct {
6339          struct LDKAPIError parameter_error;
6340       };
6341       struct {
6342          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
6343       };
6344       struct {
6345          struct LDKCVec_APIErrorZ all_failed_retry_safe;
6346       };
6347       struct {
6348          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
6349       };
6350    };
6351 } LDKPaymentSendFailure;
6352
6353 /**
6354  * The contents of CResult_NonePaymentSendFailureZ
6355  */
6356 typedef union LDKCResult_NonePaymentSendFailureZPtr {
6357    /**
6358     * Note that this value is always NULL, as there are no contents in the OK variant
6359     */
6360    void *result;
6361    /**
6362     * A pointer to the contents in the error state.
6363     * Reading from this pointer when `result_ok` is set is undefined.
6364     */
6365    struct LDKPaymentSendFailure *err;
6366 } LDKCResult_NonePaymentSendFailureZPtr;
6367
6368 /**
6369  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6370  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6371  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6372  */
6373 typedef struct LDKCResult_NonePaymentSendFailureZ {
6374    /**
6375     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6376     * `err` or `result` depending on the state of `result_ok`.
6377     */
6378    union LDKCResult_NonePaymentSendFailureZPtr contents;
6379    /**
6380     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
6381     */
6382    bool result_ok;
6383 } LDKCResult_NonePaymentSendFailureZ;
6384
6385 /**
6386  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
6387  * This corresponds to std::vector in C++
6388  */
6389 typedef struct LDKCVec_ChannelMonitorZ {
6390    /**
6391     * The elements in the array.
6392     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6393     */
6394    struct LDKChannelMonitor *data;
6395    /**
6396     * The number of elements pointed to by `data`.
6397     */
6398    uintptr_t datalen;
6399 } LDKCVec_ChannelMonitorZ;
6400
6401 /**
6402  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
6403  * blocks are connected and disconnected.
6404  *
6405  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
6406  * responsible for maintaining a set of monitors such that they can be updated accordingly as
6407  * channel state changes and HTLCs are resolved. See method documentation for specific
6408  * requirements.
6409  *
6410  * Implementations **must** ensure that updates are successfully applied and persisted upon method
6411  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
6412  * without taking any further action such as persisting the current state.
6413  *
6414  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
6415  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
6416  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
6417  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
6418  * multiple instances.
6419  *
6420  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
6421  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
6422  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
6423  */
6424 typedef struct LDKWatch {
6425    /**
6426     * An opaque pointer which is passed to your function implementations as an argument.
6427     * This has no meaning in the LDK, and can be NULL or any other value.
6428     */
6429    void *this_arg;
6430    /**
6431     * Watches a channel identified by `funding_txo` using `monitor`.
6432     *
6433     * Implementations are responsible for watching the chain for the funding transaction along
6434     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
6435     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
6436     *
6437     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
6438     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
6439     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
6440     */
6441    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
6442    /**
6443     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
6444     *
6445     * Implementations must call [`update_monitor`] with the given update. See
6446     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
6447     *
6448     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
6449     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
6450     */
6451    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
6452    /**
6453     * Returns any monitor events since the last call. Subsequent calls must only return new
6454     * events.
6455     */
6456    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
6457    /**
6458     * Frees any resources associated with this object given its this_arg pointer.
6459     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6460     */
6461    void (*free)(void *this_arg);
6462 } LDKWatch;
6463
6464 /**
6465  * An interface to send a transaction to the Bitcoin network.
6466  */
6467 typedef struct LDKBroadcasterInterface {
6468    /**
6469     * An opaque pointer which is passed to your function implementations as an argument.
6470     * This has no meaning in the LDK, and can be NULL or any other value.
6471     */
6472    void *this_arg;
6473    /**
6474     * Sends a transaction out to (hopefully) be mined.
6475     */
6476    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
6477    /**
6478     * Frees any resources associated with this object given its this_arg pointer.
6479     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6480     */
6481    void (*free)(void *this_arg);
6482 } LDKBroadcasterInterface;
6483
6484 /**
6485  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
6486  * own the memory pointed to by data.
6487  */
6488 typedef struct LDKu8slice {
6489    /**
6490     * A pointer to the byte buffer
6491     */
6492    const uint8_t *data;
6493    /**
6494     * The number of bytes pointed to by `data`.
6495     */
6496    uintptr_t datalen;
6497 } LDKu8slice;
6498
6499 /**
6500  * A trait to describe an object which can get user secrets and key material.
6501  */
6502 typedef struct LDKKeysInterface {
6503    /**
6504     * An opaque pointer which is passed to your function implementations as an argument.
6505     * This has no meaning in the LDK, and can be NULL or any other value.
6506     */
6507    void *this_arg;
6508    /**
6509     * Get node secret key (aka node_id or network_key).
6510     *
6511     * This method must return the same value each time it is called.
6512     */
6513    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
6514    /**
6515     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
6516     *
6517     * This method should return a different value each time it is called, to avoid linking
6518     * on-chain funds across channels as controlled to the same user.
6519     */
6520    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
6521    /**
6522     * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
6523     * a channel.
6524     *
6525     * This method should return a different value each time it is called, to avoid linking
6526     * on-chain funds across channels as controlled to the same user.
6527     */
6528    struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
6529    /**
6530     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
6531     * restarted with some stale data!
6532     *
6533     * This method must return a different value each time it is called.
6534     */
6535    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
6536    /**
6537     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
6538     * onion packets and for temporary channel IDs. There is no requirement that these be
6539     * persisted anywhere, though they must be unique across restarts.
6540     *
6541     * This method must return a different value each time it is called.
6542     */
6543    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
6544    /**
6545     * Reads a `Signer` for this `KeysInterface` from the given input stream.
6546     * This is only called during deserialization of other objects which contain
6547     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
6548     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
6549     * contain no versioning scheme. You may wish to include your own version prefix and ensure
6550     * you've read all of the provided bytes to ensure no corruption occurred.
6551     */
6552    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
6553    /**
6554     * Frees any resources associated with this object given its this_arg pointer.
6555     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6556     */
6557    void (*free)(void *this_arg);
6558 } LDKKeysInterface;
6559
6560 /**
6561  * A trait which should be implemented to provide feerate information on a number of time
6562  * horizons.
6563  *
6564  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
6565  * called from inside the library in response to chain events, P2P events, or timer events).
6566  */
6567 typedef struct LDKFeeEstimator {
6568    /**
6569     * An opaque pointer which is passed to your function implementations as an argument.
6570     * This has no meaning in the LDK, and can be NULL or any other value.
6571     */
6572    void *this_arg;
6573    /**
6574     * Gets estimated satoshis of fee required per 1000 Weight-Units.
6575     *
6576     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
6577     * don't put us below 1 satoshi-per-byte).
6578     *
6579     * This translates to:
6580     *  * satoshis-per-byte * 250
6581     *  * ceil(satoshis-per-kbyte / 4)
6582     */
6583    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
6584    /**
6585     * Frees any resources associated with this object given its this_arg pointer.
6586     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6587     */
6588    void (*free)(void *this_arg);
6589 } LDKFeeEstimator;
6590
6591 /**
6592  * A trait encapsulating the operations required of a logger
6593  */
6594 typedef struct LDKLogger {
6595    /**
6596     * An opaque pointer which is passed to your function implementations as an argument.
6597     * This has no meaning in the LDK, and can be NULL or any other value.
6598     */
6599    void *this_arg;
6600    /**
6601     * Logs the `Record`
6602     */
6603    void (*log)(const void *this_arg, const char *record);
6604    /**
6605     * Frees any resources associated with this object given its this_arg pointer.
6606     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6607     */
6608    void (*free)(void *this_arg);
6609 } LDKLogger;
6610
6611
6612
6613 /**
6614  * Manager which keeps track of a number of channels and sends messages to the appropriate
6615  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
6616  *
6617  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
6618  * to individual Channels.
6619  *
6620  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
6621  * all peers during write/read (though does not modify this instance, only the instance being
6622  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
6623  * called funding_transaction_generated for outbound channels).
6624  *
6625  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
6626  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
6627  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
6628  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
6629  * the serialization process). If the deserialized version is out-of-date compared to the
6630  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
6631  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
6632  *
6633  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
6634  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
6635  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
6636  * block_connected() to step towards your best block) upon deserialization before using the
6637  * object!
6638  *
6639  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
6640  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
6641  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
6642  * offline for a full minute. In order to track this, you must call
6643  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
6644  *
6645  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
6646  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
6647  * essentially you should default to using a SimpleRefChannelManager, and use a
6648  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
6649  * you're using lightning-net-tokio.
6650  */
6651 typedef struct MUST_USE_STRUCT LDKChannelManager {
6652    /**
6653     * A pointer to the opaque Rust object.
6654     * Nearly everywhere, inner must be non-null, however in places where
6655     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6656     */
6657    LDKnativeChannelManager *inner;
6658    /**
6659     * Indicates that this is the only struct which contains the same pointer.
6660     * Rust functions which take ownership of an object provided via an argument require
6661     * this to be true and invalidate the object pointed to by inner.
6662     */
6663    bool is_owned;
6664 } LDKChannelManager;
6665
6666 /**
6667  * A tuple of 2 elements. See the individual fields for the types contained.
6668  */
6669 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
6670    /**
6671     * The element at position 0
6672     */
6673    struct LDKThirtyTwoBytes a;
6674    /**
6675     * The element at position 1
6676     */
6677    struct LDKChannelManager b;
6678 } LDKC2Tuple_BlockHashChannelManagerZ;
6679
6680 /**
6681  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
6682  */
6683 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6684    /**
6685     * A pointer to the contents in the success state.
6686     * Reading from this pointer when `result_ok` is not set is undefined.
6687     */
6688    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
6689    /**
6690     * A pointer to the contents in the error state.
6691     * Reading from this pointer when `result_ok` is set is undefined.
6692     */
6693    struct LDKDecodeError *err;
6694 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
6695
6696 /**
6697  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
6698  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6699  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6700  */
6701 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6702    /**
6703     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
6704     * `err` or `result` depending on the state of `result_ok`.
6705     */
6706    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
6707    /**
6708     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
6709     */
6710    bool result_ok;
6711 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
6712
6713 /**
6714  * A trait indicating an object may generate message send events
6715  */
6716 typedef struct LDKMessageSendEventsProvider {
6717    /**
6718     * An opaque pointer which is passed to your function implementations as an argument.
6719     * This has no meaning in the LDK, and can be NULL or any other value.
6720     */
6721    void *this_arg;
6722    /**
6723     * Gets the list of pending events which were generated by previous actions, clearing the list
6724     * in the process.
6725     */
6726    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
6727    /**
6728     * Frees any resources associated with this object given its this_arg pointer.
6729     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6730     */
6731    void (*free)(void *this_arg);
6732 } LDKMessageSendEventsProvider;
6733
6734 /**
6735  * A trait indicating an object may generate events
6736  */
6737 typedef struct LDKEventsProvider {
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     * Gets the list of pending events which were generated by previous actions, clearing the list
6745     * in the process.
6746     */
6747    struct LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
6748    /**
6749     * Frees any resources associated with this object given its this_arg pointer.
6750     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6751     */
6752    void (*free)(void *this_arg);
6753 } LDKEventsProvider;
6754
6755
6756
6757 /**
6758  * Configuration we set when applicable.
6759  *
6760  * Default::default() provides sane defaults.
6761  */
6762 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
6763    /**
6764     * A pointer to the opaque Rust object.
6765     * Nearly everywhere, inner must be non-null, however in places where
6766     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6767     */
6768    LDKnativeChannelHandshakeConfig *inner;
6769    /**
6770     * Indicates that this is the only struct which contains the same pointer.
6771     * Rust functions which take ownership of an object provided via an argument require
6772     * this to be true and invalidate the object pointed to by inner.
6773     */
6774    bool is_owned;
6775 } LDKChannelHandshakeConfig;
6776
6777
6778
6779 /**
6780  * Optional channel limits which are applied during channel creation.
6781  *
6782  * These limits are only applied to our counterparty's limits, not our own.
6783  *
6784  * Use 0/<type>::max_value() as appropriate to skip checking.
6785  *
6786  * Provides sane defaults for most configurations.
6787  *
6788  * Most additional limits are disabled except those with which specify a default in individual
6789  * field documentation. Note that this may result in barely-usable channels, but since they
6790  * are applied mostly only to incoming channels that's not much of a problem.
6791  */
6792 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
6793    /**
6794     * A pointer to the opaque Rust object.
6795     * Nearly everywhere, inner must be non-null, however in places where
6796     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6797     */
6798    LDKnativeChannelHandshakeLimits *inner;
6799    /**
6800     * Indicates that this is the only struct which contains the same pointer.
6801     * Rust functions which take ownership of an object provided via an argument require
6802     * this to be true and invalidate the object pointed to by inner.
6803     */
6804    bool is_owned;
6805 } LDKChannelHandshakeLimits;
6806
6807
6808
6809 /**
6810  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
6811  *
6812  * Default::default() provides sane defaults for most configurations
6813  * (but currently with 0 relay fees!)
6814  */
6815 typedef struct MUST_USE_STRUCT LDKUserConfig {
6816    /**
6817     * A pointer to the opaque Rust object.
6818     * Nearly everywhere, inner must be non-null, however in places where
6819     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6820     */
6821    LDKnativeUserConfig *inner;
6822    /**
6823     * Indicates that this is the only struct which contains the same pointer.
6824     * Rust functions which take ownership of an object provided via an argument require
6825     * this to be true and invalidate the object pointed to by inner.
6826     */
6827    bool is_owned;
6828 } LDKUserConfig;
6829
6830 /**
6831  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
6832  * UTXOs.
6833  */
6834 typedef struct LDKAccess {
6835    /**
6836     * An opaque pointer which is passed to your function implementations as an argument.
6837     * This has no meaning in the LDK, and can be NULL or any other value.
6838     */
6839    void *this_arg;
6840    /**
6841     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
6842     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
6843     * is unknown.
6844     *
6845     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
6846     */
6847    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
6848    /**
6849     * Frees any resources associated with this object given its this_arg pointer.
6850     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6851     */
6852    void (*free)(void *this_arg);
6853 } LDKAccess;
6854
6855 /**
6856  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
6857  * chain.
6858  *
6859  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
6860  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
6861  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
6862  * when needed.
6863  */
6864 typedef struct LDKListen {
6865    /**
6866     * An opaque pointer which is passed to your function implementations as an argument.
6867     * This has no meaning in the LDK, and can be NULL or any other value.
6868     */
6869    void *this_arg;
6870    /**
6871     * Notifies the listener that a block was added at the given height.
6872     */
6873    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
6874    /**
6875     * Notifies the listener that a block was removed at the given height.
6876     */
6877    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
6878    /**
6879     * Frees any resources associated with this object given its this_arg pointer.
6880     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6881     */
6882    void (*free)(void *this_arg);
6883 } LDKListen;
6884
6885 /**
6886  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
6887  * unconfirmed during a chain reorganization.
6888  *
6889  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
6890  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
6891  * related to registered transactions and outputs. Upon notification, it would pass along the
6892  * matching transactions using this interface.
6893  *
6894  * # Use
6895  *
6896  * The intended use is as follows:
6897  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
6898  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
6899  *   that has been reorganized out of the chain.
6900  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
6901  *
6902  * # Order
6903  *
6904  * Clients must call these methods in chain order. Specifically:
6905  * - Transactions confirmed in a block must be given before transactions confirmed in a later
6906  *   block.
6907  * - Dependent transactions within the same block must be given in topological order, possibly in
6908  *   separate calls.
6909  * - Unconfirmed transactions must be given after the original confirmations and before any
6910  *   reconfirmation.
6911  *
6912  * See individual method documentation for further details.
6913  *
6914  * [`transactions_confirmed`]: Self::transactions_confirmed
6915  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
6916  * [`best_block_updated`]: Self::best_block_updated
6917  * [`get_relevant_txids`]: Self::get_relevant_txids
6918  */
6919 typedef struct LDKConfirm {
6920    /**
6921     * An opaque pointer which is passed to your function implementations as an argument.
6922     * This has no meaning in the LDK, and can be NULL or any other value.
6923     */
6924    void *this_arg;
6925    /**
6926     * Processes transactions confirmed in a block with a given header and height.
6927     *
6928     * Should be called for any transactions registered by [`Filter::register_tx`] or any
6929     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
6930     * appearing in the same block do not need to be included in the same call; instead, multiple
6931     * calls with additional transactions may be made so long as they are made in [chain order].
6932     *
6933     * May be called before or after [`best_block_updated`] for the corresponding block. However,
6934     * in the event of a chain reorganization, it must not be called with a `header` that is no
6935     * longer in the chain as of the last call to [`best_block_updated`].
6936     *
6937     * [chain order]: Self#order
6938     * [`best_block_updated`]: Self::best_block_updated
6939     */
6940    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
6941    /**
6942     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
6943     *
6944     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
6945     * reorganized out of the best chain. Once called, the given transaction should not be returned
6946     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
6947     *
6948     * [`get_relevant_txids`]: Self::get_relevant_txids
6949     * [`transactions_confirmed`]: Self::transactions_confirmed
6950     */
6951    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
6952    /**
6953     * Processes an update to the best header connected at the given height.
6954     *
6955     * Should be called when a new header is available but may be skipped for intermediary blocks
6956     * if they become available at the same time.
6957     */
6958    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
6959    /**
6960     * Returns transactions that should be monitored for reorganization out of the chain.
6961     *
6962     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
6963     * confirmations to be safe from a chain reorganization. Should not include any transactions
6964     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
6965     *
6966     * May be called to determine the subset of transactions that must still be monitored for
6967     * reorganization. Will be idempotent between calls but may change as a result of calls to the
6968     * other interface methods. Thus, this is useful to determine which transactions may need to be
6969     * given to [`transaction_unconfirmed`].
6970     *
6971     * [`transactions_confirmed`]: Self::transactions_confirmed
6972     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
6973     */
6974    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
6975    /**
6976     * Frees any resources associated with this object given its this_arg pointer.
6977     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6978     */
6979    void (*free)(void *this_arg);
6980 } LDKConfirm;
6981
6982
6983
6984 /**
6985  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
6986  *
6987  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
6988  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
6989  * the return value of [`Filter::register_output`].
6990  *
6991  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
6992  * may have been spent there. See [`Filter::register_output`] for details.
6993  *
6994  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
6995  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
6996  */
6997 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
6998    /**
6999     * A pointer to the opaque Rust object.
7000     * Nearly everywhere, inner must be non-null, however in places where
7001     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7002     */
7003    LDKnativeWatchedOutput *inner;
7004    /**
7005     * Indicates that this is the only struct which contains the same pointer.
7006     * Rust functions which take ownership of an object provided via an argument require
7007     * this to be true and invalidate the object pointed to by inner.
7008     */
7009    bool is_owned;
7010 } LDKWatchedOutput;
7011
7012 /**
7013  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
7014  * channels.
7015  *
7016  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
7017  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
7018  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
7019  * receiving full blocks from a chain source, any further filtering is unnecessary.
7020  *
7021  * After an output has been registered, subsequent block retrievals from the chain source must not
7022  * exclude any transactions matching the new criteria nor any in-block descendants of such
7023  * transactions.
7024  *
7025  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
7026  * should not block on I/O. Implementations should instead queue the newly monitored data to be
7027  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
7028  * invocation that has called the `Filter` must return [`TemporaryFailure`].
7029  *
7030  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
7031  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
7032  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
7033  */
7034 typedef struct LDKFilter {
7035    /**
7036     * An opaque pointer which is passed to your function implementations as an argument.
7037     * This has no meaning in the LDK, and can be NULL or any other value.
7038     */
7039    void *this_arg;
7040    /**
7041     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
7042     * a spending condition.
7043     */
7044    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
7045    /**
7046     * Registers interest in spends of a transaction output.
7047     *
7048     * Optionally, when `output.block_hash` is set, should return any transaction spending the
7049     * output that is found in the corresponding block along with its index.
7050     *
7051     * This return value is useful for Electrum clients in order to supply in-block descendant
7052     * transactions which otherwise were not included. This is not necessary for other clients if
7053     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
7054     * full block).
7055     */
7056    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
7057    /**
7058     * Frees any resources associated with this object given its this_arg pointer.
7059     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7060     */
7061    void (*free)(void *this_arg);
7062 } LDKFilter;
7063
7064 /**
7065  * `Persist` defines behavior for persisting channel monitors: this could mean
7066  * writing once to disk, and/or uploading to one or more backup services.
7067  *
7068  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
7069  * to disk/backups. And, on every update, you **must** persist either the
7070  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
7071  * of situations such as revoking a transaction, then crashing before this
7072  * revocation can be persisted, then unintentionally broadcasting a revoked
7073  * transaction and losing money. This is a risk because previous channel states
7074  * are toxic, so it's important that whatever channel state is persisted is
7075  * kept up-to-date.
7076  */
7077 typedef struct LDKPersist {
7078    /**
7079     * An opaque pointer which is passed to your function implementations as an argument.
7080     * This has no meaning in the LDK, and can be NULL or any other value.
7081     */
7082    void *this_arg;
7083    /**
7084     * Persist a new channel's data. The data can be stored any way you want, but
7085     * the identifier provided by Rust-Lightning is the channel's outpoint (and
7086     * it is up to you to maintain a correct mapping between the outpoint and the
7087     * stored channel data). Note that you **must** persist every new monitor to
7088     * disk. See the `Persist` trait documentation for more details.
7089     *
7090     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
7091     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
7092     */
7093    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
7094    /**
7095     * Update one channel's data. The provided `ChannelMonitor` has already
7096     * applied the given update.
7097     *
7098     * Note that on every update, you **must** persist either the
7099     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
7100     * the `Persist` trait documentation for more details.
7101     *
7102     * If an implementer chooses to persist the updates only, they need to make
7103     * sure that all the updates are applied to the `ChannelMonitors` *before*
7104     * the set of channel monitors is given to the `ChannelManager`
7105     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
7106     * applying a monitor update to a monitor. If full `ChannelMonitors` are
7107     * persisted, then there is no need to persist individual updates.
7108     *
7109     * Note that there could be a performance tradeoff between persisting complete
7110     * channel monitors on every update vs. persisting only updates and applying
7111     * them in batches. The size of each monitor grows `O(number of state updates)`
7112     * whereas updates are small and `O(1)`.
7113     *
7114     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
7115     * [`ChannelMonitorUpdate::write`] for writing out an update, and
7116     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
7117     */
7118    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data);
7119    /**
7120     * Frees any resources associated with this object given its this_arg pointer.
7121     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7122     */
7123    void (*free)(void *this_arg);
7124 } LDKPersist;
7125
7126
7127
7128 /**
7129  * An implementation of [`chain::Watch`] for monitoring channels.
7130  *
7131  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
7132  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
7133  * or used independently to monitor channels remotely. See the [module-level documentation] for
7134  * details.
7135  *
7136  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
7137  * [module-level documentation]: crate::chain::chainmonitor
7138  */
7139 typedef struct MUST_USE_STRUCT LDKChainMonitor {
7140    /**
7141     * A pointer to the opaque Rust object.
7142     * Nearly everywhere, inner must be non-null, however in places where
7143     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7144     */
7145    LDKnativeChainMonitor *inner;
7146    /**
7147     * Indicates that this is the only struct which contains the same pointer.
7148     * Rust functions which take ownership of an object provided via an argument require
7149     * this to be true and invalidate the object pointed to by inner.
7150     */
7151    bool is_owned;
7152 } LDKChainMonitor;
7153
7154
7155
7156 /**
7157  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
7158  * and derives keys from that.
7159  *
7160  * Your node_id is seed/0'
7161  * ChannelMonitor closes may use seed/1'
7162  * Cooperative closes may use seed/2'
7163  * The two close keys may be needed to claim on-chain funds!
7164  */
7165 typedef struct MUST_USE_STRUCT LDKKeysManager {
7166    /**
7167     * A pointer to the opaque Rust object.
7168     * Nearly everywhere, inner must be non-null, however in places where
7169     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7170     */
7171    LDKnativeKeysManager *inner;
7172    /**
7173     * Indicates that this is the only struct which contains the same pointer.
7174     * Rust functions which take ownership of an object provided via an argument require
7175     * this to be true and invalidate the object pointed to by inner.
7176     */
7177    bool is_owned;
7178 } LDKKeysManager;
7179
7180
7181
7182 /**
7183  * Chain-related parameters used to construct a new `ChannelManager`.
7184  *
7185  * Typically, the block-specific parameters are derived from the best block hash for the network,
7186  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
7187  * are not needed when deserializing a previously constructed `ChannelManager`.
7188  */
7189 typedef struct MUST_USE_STRUCT LDKChainParameters {
7190    /**
7191     * A pointer to the opaque Rust object.
7192     * Nearly everywhere, inner must be non-null, however in places where
7193     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7194     */
7195    LDKnativeChainParameters *inner;
7196    /**
7197     * Indicates that this is the only struct which contains the same pointer.
7198     * Rust functions which take ownership of an object provided via an argument require
7199     * this to be true and invalidate the object pointed to by inner.
7200     */
7201    bool is_owned;
7202 } LDKChainParameters;
7203
7204
7205
7206 /**
7207  * The best known block as identified by its hash and height.
7208  */
7209 typedef struct MUST_USE_STRUCT LDKBestBlock {
7210    /**
7211     * A pointer to the opaque Rust object.
7212     * Nearly everywhere, inner must be non-null, however in places where
7213     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7214     */
7215    LDKnativeBestBlock *inner;
7216    /**
7217     * Indicates that this is the only struct which contains the same pointer.
7218     * Rust functions which take ownership of an object provided via an argument require
7219     * this to be true and invalidate the object pointed to by inner.
7220     */
7221    bool is_owned;
7222 } LDKBestBlock;
7223
7224 /**
7225  * A 3-byte byte array.
7226  */
7227 typedef struct LDKThreeBytes {
7228    /**
7229     * The three bytes
7230     */
7231    uint8_t data[3];
7232 } LDKThreeBytes;
7233
7234 /**
7235  * A trait to describe an object which can receive channel messages.
7236  *
7237  * Messages MAY be called in parallel when they originate from different their_node_ids, however
7238  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
7239  */
7240 typedef struct LDKChannelMessageHandler {
7241    /**
7242     * An opaque pointer which is passed to your function implementations as an argument.
7243     * This has no meaning in the LDK, and can be NULL or any other value.
7244     */
7245    void *this_arg;
7246    /**
7247     * Handle an incoming open_channel message from the given peer.
7248     */
7249    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
7250    /**
7251     * Handle an incoming accept_channel message from the given peer.
7252     */
7253    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
7254    /**
7255     * Handle an incoming funding_created message from the given peer.
7256     */
7257    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
7258    /**
7259     * Handle an incoming funding_signed message from the given peer.
7260     */
7261    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
7262    /**
7263     * Handle an incoming funding_locked message from the given peer.
7264     */
7265    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
7266    /**
7267     * Handle an incoming shutdown message from the given peer.
7268     */
7269    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);
7270    /**
7271     * Handle an incoming closing_signed message from the given peer.
7272     */
7273    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
7274    /**
7275     * Handle an incoming update_add_htlc message from the given peer.
7276     */
7277    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
7278    /**
7279     * Handle an incoming update_fulfill_htlc message from the given peer.
7280     */
7281    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
7282    /**
7283     * Handle an incoming update_fail_htlc message from the given peer.
7284     */
7285    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
7286    /**
7287     * Handle an incoming update_fail_malformed_htlc message from the given peer.
7288     */
7289    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
7290    /**
7291     * Handle an incoming commitment_signed message from the given peer.
7292     */
7293    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
7294    /**
7295     * Handle an incoming revoke_and_ack message from the given peer.
7296     */
7297    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
7298    /**
7299     * Handle an incoming update_fee message from the given peer.
7300     */
7301    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
7302    /**
7303     * Handle an incoming announcement_signatures message from the given peer.
7304     */
7305    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
7306    /**
7307     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
7308     * is believed to be possible in the future (eg they're sending us messages we don't
7309     * understand or indicate they require unknown feature bits), no_connection_possible is set
7310     * and any outstanding channels should be failed.
7311     */
7312    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
7313    /**
7314     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
7315     */
7316    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
7317    /**
7318     * Handle an incoming channel_reestablish message from the given peer.
7319     */
7320    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
7321    /**
7322     * Handle an incoming channel update from the given peer.
7323     */
7324    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
7325    /**
7326     * Handle an incoming error message from the given peer.
7327     */
7328    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
7329    /**
7330     * Implementation of MessageSendEventsProvider for this object.
7331     */
7332    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
7333    /**
7334     * Frees any resources associated with this object given its this_arg pointer.
7335     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7336     */
7337    void (*free)(void *this_arg);
7338 } LDKChannelMessageHandler;
7339
7340
7341
7342 /**
7343  * Arguments for the creation of a ChannelManager that are not deserialized.
7344  *
7345  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
7346  * is:
7347  * 1) Deserialize all stored ChannelMonitors.
7348  * 2) Deserialize the ChannelManager by filling in this struct and calling:
7349  *    <(BlockHash, ChannelManager)>::read(reader, args)
7350  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
7351  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
7352  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
7353  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
7354  *    ChannelMonitor::get_funding_txo().
7355  * 4) Reconnect blocks on your ChannelMonitors.
7356  * 5) Disconnect/connect blocks on the ChannelManager.
7357  * 6) Move the ChannelMonitors into your local chain::Watch.
7358  *
7359  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
7360  * call any other methods on the newly-deserialized ChannelManager.
7361  *
7362  * Note that because some channels may be closed during deserialization, it is critical that you
7363  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
7364  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
7365  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
7366  * not force-close the same channels but consider them live), you may end up revoking a state for
7367  * which you've already broadcasted the transaction.
7368  */
7369 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
7370    /**
7371     * A pointer to the opaque Rust object.
7372     * Nearly everywhere, inner must be non-null, however in places where
7373     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7374     */
7375    LDKnativeChannelManagerReadArgs *inner;
7376    /**
7377     * Indicates that this is the only struct which contains the same pointer.
7378     * Rust functions which take ownership of an object provided via an argument require
7379     * this to be true and invalidate the object pointed to by inner.
7380     */
7381    bool is_owned;
7382 } LDKChannelManagerReadArgs;
7383
7384
7385
7386 /**
7387  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
7388  * This is used to convince the recipient that the channel is at a certain commitment
7389  * number even if they lost that data due to a local failure.  Of course, the peer may lie
7390  * and even later commitments may have been revoked.
7391  */
7392 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
7393    /**
7394     * A pointer to the opaque Rust object.
7395     * Nearly everywhere, inner must be non-null, however in places where
7396     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7397     */
7398    LDKnativeDataLossProtect *inner;
7399    /**
7400     * Indicates that this is the only struct which contains the same pointer.
7401     * Rust functions which take ownership of an object provided via an argument require
7402     * this to be true and invalidate the object pointed to by inner.
7403     */
7404    bool is_owned;
7405 } LDKDataLossProtect;
7406
7407 /**
7408  * A trait to describe an object which can receive routing messages.
7409  *
7410  * # Implementor DoS Warnings
7411  *
7412  * For `gossip_queries` messages there are potential DoS vectors when handling
7413  * inbound queries. Implementors using an on-disk network graph should be aware of
7414  * repeated disk I/O for queries accessing different parts of the network graph.
7415  */
7416 typedef struct LDKRoutingMessageHandler {
7417    /**
7418     * An opaque pointer which is passed to your function implementations as an argument.
7419     * This has no meaning in the LDK, and can be NULL or any other value.
7420     */
7421    void *this_arg;
7422    /**
7423     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
7424     * false or returning an Err otherwise.
7425     */
7426    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
7427    /**
7428     * Handle a channel_announcement message, returning true if it should be forwarded on, false
7429     * or returning an Err otherwise.
7430     */
7431    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
7432    /**
7433     * Handle an incoming channel_update message, returning true if it should be forwarded on,
7434     * false or returning an Err otherwise.
7435     */
7436    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
7437    /**
7438     * Handle some updates to the route graph that we learned due to an outbound failed payment.
7439     */
7440    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
7441    /**
7442     * Gets a subset of the channel announcements and updates required to dump our routing table
7443     * to a remote node, starting at the short_channel_id indicated by starting_point and
7444     * including the batch_amount entries immediately higher in numerical value than starting_point.
7445     */
7446    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
7447    /**
7448     * Gets a subset of the node announcements required to dump our routing table to a remote node,
7449     * starting at the node *after* the provided publickey and including batch_amount entries
7450     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
7451     * If None is provided for starting_point, we start at the first node.
7452     */
7453    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
7454    /**
7455     * Called when a connection is established with a peer. This can be used to
7456     * perform routing table synchronization using a strategy defined by the
7457     * implementor.
7458     */
7459    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
7460    /**
7461     * Handles the reply of a query we initiated to learn about channels
7462     * for a given range of blocks. We can expect to receive one or more
7463     * replies to a single query.
7464     */
7465    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
7466    /**
7467     * Handles the reply of a query we initiated asking for routing gossip
7468     * messages for a list of channels. We should receive this message when
7469     * a node has completed its best effort to send us the pertaining routing
7470     * gossip messages.
7471     */
7472    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
7473    /**
7474     * Handles when a peer asks us to send a list of short_channel_ids
7475     * for the requested range of blocks.
7476     */
7477    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
7478    /**
7479     * Handles when a peer asks us to send routing gossip messages for a
7480     * list of short_channel_ids.
7481     */
7482    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
7483    /**
7484     * Implementation of MessageSendEventsProvider for this object.
7485     */
7486    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
7487    /**
7488     * Frees any resources associated with this object given its this_arg pointer.
7489     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7490     */
7491    void (*free)(void *this_arg);
7492 } LDKRoutingMessageHandler;
7493
7494
7495
7496 /**
7497  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
7498  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
7499  */
7500 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
7501    /**
7502     * A pointer to the opaque Rust object.
7503     * Nearly everywhere, inner must be non-null, however in places where
7504     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7505     */
7506    LDKnativeIgnoringMessageHandler *inner;
7507    /**
7508     * Indicates that this is the only struct which contains the same pointer.
7509     * Rust functions which take ownership of an object provided via an argument require
7510     * this to be true and invalidate the object pointed to by inner.
7511     */
7512    bool is_owned;
7513 } LDKIgnoringMessageHandler;
7514
7515
7516
7517 /**
7518  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
7519  * You can provide one of these as the route_handler in a MessageHandler.
7520  */
7521 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
7522    /**
7523     * A pointer to the opaque Rust object.
7524     * Nearly everywhere, inner must be non-null, however in places where
7525     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7526     */
7527    LDKnativeErroringMessageHandler *inner;
7528    /**
7529     * Indicates that this is the only struct which contains the same pointer.
7530     * Rust functions which take ownership of an object provided via an argument require
7531     * this to be true and invalidate the object pointed to by inner.
7532     */
7533    bool is_owned;
7534 } LDKErroringMessageHandler;
7535
7536
7537
7538 /**
7539  * Provides references to trait impls which handle different types of messages.
7540  */
7541 typedef struct MUST_USE_STRUCT LDKMessageHandler {
7542    /**
7543     * A pointer to the opaque Rust object.
7544     * Nearly everywhere, inner must be non-null, however in places where
7545     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7546     */
7547    LDKnativeMessageHandler *inner;
7548    /**
7549     * Indicates that this is the only struct which contains the same pointer.
7550     * Rust functions which take ownership of an object provided via an argument require
7551     * this to be true and invalidate the object pointed to by inner.
7552     */
7553    bool is_owned;
7554 } LDKMessageHandler;
7555
7556 /**
7557  * Provides an object which can be used to send data to and which uniquely identifies a connection
7558  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
7559  * implement Hash to meet the PeerManager API.
7560  *
7561  * For efficiency, Clone should be relatively cheap for this type.
7562  *
7563  * You probably want to just extend an int and put a file descriptor in a struct and implement
7564  * send_data. Note that if you are using a higher-level net library that may call close() itself,
7565  * be careful to ensure you don't have races whereby you might register a new connection with an
7566  * fd which is the same as a previous one which has yet to be removed via
7567  * PeerManager::socket_disconnected().
7568  */
7569 typedef struct LDKSocketDescriptor {
7570    /**
7571     * An opaque pointer which is passed to your function implementations as an argument.
7572     * This has no meaning in the LDK, and can be NULL or any other value.
7573     */
7574    void *this_arg;
7575    /**
7576     * Attempts to send some data from the given slice to the peer.
7577     *
7578     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
7579     * Note that in the disconnected case, socket_disconnected must still fire and further write
7580     * attempts may occur until that time.
7581     *
7582     * If the returned size is smaller than data.len(), a write_available event must
7583     * trigger the next time more data can be written. Additionally, until the a send_data event
7584     * completes fully, no further read_events should trigger on the same peer!
7585     *
7586     * If a read_event on this descriptor had previously returned true (indicating that read
7587     * events should be paused to prevent DoS in the send buffer), resume_read may be set
7588     * indicating that read events on this descriptor should resume. A resume_read of false does
7589     * *not* imply that further read events should be paused.
7590     */
7591    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
7592    /**
7593     * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
7594     * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
7595     * this descriptor. No socket_disconnected call should be generated as a result of this call,
7596     * though races may occur whereby disconnect_socket is called after a call to
7597     * socket_disconnected but prior to socket_disconnected returning.
7598     */
7599    void (*disconnect_socket)(void *this_arg);
7600    /**
7601     * Checks if two objects are equal given this object's this_arg pointer and another object.
7602     */
7603    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
7604    /**
7605     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
7606     * This is used, for example, for inclusion of this object in a hash map.
7607     */
7608    uint64_t (*hash)(const void *this_arg);
7609    /**
7610     * Creates a copy of the object pointed to by this_arg, for a copy of this SocketDescriptor.
7611     * Note that the ultimate copy of the SocketDescriptor will have all function pointers the same as the original.
7612     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new SocketDescriptor.
7613     */
7614    void *(*clone)(const void *this_arg);
7615    /**
7616     * Frees any resources associated with this object given its this_arg pointer.
7617     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7618     */
7619    void (*free)(void *this_arg);
7620 } LDKSocketDescriptor;
7621
7622
7623
7624 /**
7625  * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
7626  * events into messages which it passes on to its MessageHandlers.
7627  *
7628  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
7629  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
7630  * essentially you should default to using a SimpleRefPeerManager, and use a
7631  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
7632  * you're using lightning-net-tokio.
7633  */
7634 typedef struct MUST_USE_STRUCT LDKPeerManager {
7635    /**
7636     * A pointer to the opaque Rust object.
7637     * Nearly everywhere, inner must be non-null, however in places where
7638     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7639     */
7640    LDKnativePeerManager *inner;
7641    /**
7642     * Indicates that this is the only struct which contains the same pointer.
7643     * Rust functions which take ownership of an object provided via an argument require
7644     * this to be true and invalidate the object pointed to by inner.
7645     */
7646    bool is_owned;
7647 } LDKPeerManager;
7648
7649
7650
7651 /**
7652  * Static channel fields used to build transactions given per-commitment fields, organized by
7653  * broadcaster/countersignatory.
7654  *
7655  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
7656  * as_holder_broadcastable and as_counterparty_broadcastable functions.
7657  */
7658 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
7659    /**
7660     * A pointer to the opaque Rust object.
7661     * Nearly everywhere, inner must be non-null, however in places where
7662     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7663     */
7664    LDKnativeDirectedChannelTransactionParameters *inner;
7665    /**
7666     * Indicates that this is the only struct which contains the same pointer.
7667     * Rust functions which take ownership of an object provided via an argument require
7668     * this to be true and invalidate the object pointed to by inner.
7669     */
7670    bool is_owned;
7671 } LDKDirectedChannelTransactionParameters;
7672
7673
7674
7675 /**
7676  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
7677  * This exists only to make accessing a RwLock<NetworkGraph> possible from
7678  * the C bindings, as it can be done directly in Rust code.
7679  */
7680 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
7681    /**
7682     * A pointer to the opaque Rust object.
7683     * Nearly everywhere, inner must be non-null, however in places where
7684     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7685     */
7686    LDKnativeLockedNetworkGraph *inner;
7687    /**
7688     * Indicates that this is the only struct which contains the same pointer.
7689     * Rust functions which take ownership of an object provided via an argument require
7690     * this to be true and invalidate the object pointed to by inner.
7691     */
7692    bool is_owned;
7693 } LDKLockedNetworkGraph;
7694
7695
7696
7697 /**
7698  * Receives and validates network updates from peers,
7699  * stores authentic and relevant data as a network graph.
7700  * This network graph is then used for routing payments.
7701  * Provides interface to help with initial routing sync by
7702  * serving historical announcements.
7703  */
7704 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
7705    /**
7706     * A pointer to the opaque Rust object.
7707     * Nearly everywhere, inner must be non-null, however in places where
7708     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7709     */
7710    LDKnativeNetGraphMsgHandler *inner;
7711    /**
7712     * Indicates that this is the only struct which contains the same pointer.
7713     * Rust functions which take ownership of an object provided via an argument require
7714     * this to be true and invalidate the object pointed to by inner.
7715     */
7716    bool is_owned;
7717 } LDKNetGraphMsgHandler;
7718
7719
7720
7721 /**
7722  * FilesystemPersister persists channel data on disk, where each channel's
7723  * data is stored in a file named after its funding outpoint.
7724  *
7725  * Warning: this module does the best it can with calls to persist data, but it
7726  * can only guarantee that the data is passed to the drive. It is up to the
7727  * drive manufacturers to do the actual persistence properly, which they often
7728  * don't (especially on consumer-grade hardware). Therefore, it is up to the
7729  * user to validate their entire storage stack, to ensure the writes are
7730  * persistent.
7731  * Corollary: especially when dealing with larger amounts of money, it is best
7732  * practice to have multiple channel data backups and not rely only on one
7733  * FilesystemPersister.
7734  */
7735 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
7736    /**
7737     * A pointer to the opaque Rust object.
7738     * Nearly everywhere, inner must be non-null, however in places where
7739     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7740     */
7741    LDKnativeFilesystemPersister *inner;
7742    /**
7743     * Indicates that this is the only struct which contains the same pointer.
7744     * Rust functions which take ownership of an object provided via an argument require
7745     * this to be true and invalidate the object pointed to by inner.
7746     */
7747    bool is_owned;
7748 } LDKFilesystemPersister;
7749
7750 extern const uintptr_t MAX_BUF_SIZE;
7751
7752 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
7753
7754 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
7755
7756 extern const uint16_t BREAKDOWN_TIMEOUT;
7757
7758 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
7759
7760 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
7761
7762 /**
7763  * Frees the data buffer, if data_is_owned is set and datalen > 0.
7764  */
7765 void Transaction_free(struct LDKTransaction _res);
7766
7767 /**
7768  * Frees the data pointed to by script_pubkey.
7769  */
7770 void TxOut_free(struct LDKTxOut _res);
7771
7772 /**
7773  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
7774  */
7775 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
7776
7777 /**
7778  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7779  */
7780 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
7781
7782 /**
7783  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7784  */
7785 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
7786
7787 /**
7788  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7789  */
7790 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
7791
7792 /**
7793  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7794  * but with all dynamically-allocated buffers duplicated in new buffers.
7795  */
7796 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
7797
7798 /**
7799  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
7800  */
7801 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
7802
7803 /**
7804  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
7805  */
7806 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
7807
7808 /**
7809  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
7810  */
7811 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
7812
7813 /**
7814  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7815  * but with all dynamically-allocated buffers duplicated in new buffers.
7816  */
7817 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
7818
7819 /**
7820  * Creates a new CResult_SecretKeyErrorZ in the success state.
7821  */
7822 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
7823
7824 /**
7825  * Creates a new CResult_SecretKeyErrorZ in the error state.
7826  */
7827 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
7828
7829 /**
7830  * Frees any resources used by the CResult_SecretKeyErrorZ.
7831  */
7832 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
7833
7834 /**
7835  * Creates a new CResult_PublicKeyErrorZ in the success state.
7836  */
7837 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
7838
7839 /**
7840  * Creates a new CResult_PublicKeyErrorZ in the error state.
7841  */
7842 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
7843
7844 /**
7845  * Frees any resources used by the CResult_PublicKeyErrorZ.
7846  */
7847 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
7848
7849 /**
7850  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
7851  */
7852 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
7853
7854 /**
7855  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
7856  */
7857 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
7858
7859 /**
7860  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
7861  */
7862 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
7863
7864 /**
7865  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
7866  * but with all dynamically-allocated buffers duplicated in new buffers.
7867  */
7868 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
7869
7870 /**
7871  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
7872  */
7873 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
7874
7875 /**
7876  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
7877  */
7878 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
7879
7880 /**
7881  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
7882  */
7883 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
7884
7885 /**
7886  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
7887  * but with all dynamically-allocated buffers duplicated in new buffers.
7888  */
7889 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
7890
7891 /**
7892  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
7893  */
7894 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
7895
7896 /**
7897  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
7898  */
7899 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
7900
7901 /**
7902  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
7903  */
7904 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
7905
7906 /**
7907  * Constructs a new COption_u32Z containing a u32
7908  */
7909 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
7910
7911 /**
7912  * Constructs a new COption_u32Z containing nothing
7913  */
7914 struct LDKCOption_u32Z COption_u32Z_none(void);
7915
7916 /**
7917  * Frees any resources associated with the u32, if we are in the Some state
7918  */
7919 void COption_u32Z_free(struct LDKCOption_u32Z _res);
7920
7921 /**
7922  * Creates a new COption_u32Z which has the same data as `orig`
7923  * but with all dynamically-allocated buffers duplicated in new buffers.
7924  */
7925 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
7926
7927 /**
7928  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
7929  */
7930 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
7931
7932 /**
7933  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
7934  */
7935 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
7936
7937 /**
7938  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
7939  */
7940 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
7941
7942 /**
7943  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
7944  * but with all dynamically-allocated buffers duplicated in new buffers.
7945  */
7946 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
7947
7948 /**
7949  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
7950  */
7951 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
7952
7953 /**
7954  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
7955  */
7956 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
7957
7958 /**
7959  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
7960  */
7961 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
7962
7963 /**
7964  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
7965  * but with all dynamically-allocated buffers duplicated in new buffers.
7966  */
7967 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
7968
7969 /**
7970  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
7971  */
7972 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
7973
7974 /**
7975  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
7976  */
7977 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
7978
7979 /**
7980  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
7981  */
7982 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
7983
7984 /**
7985  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
7986  * but with all dynamically-allocated buffers duplicated in new buffers.
7987  */
7988 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
7989
7990 /**
7991  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7992  */
7993 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
7994
7995 /**
7996  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
7997  */
7998 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
7999
8000 /**
8001  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
8002  */
8003 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
8004
8005 /**
8006  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
8007  */
8008 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
8009
8010 /**
8011  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
8012  * but with all dynamically-allocated buffers duplicated in new buffers.
8013  */
8014 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
8015
8016 /**
8017  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
8018  */
8019 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
8020
8021 /**
8022  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
8023  */
8024 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
8025
8026 /**
8027  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
8028  */
8029 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
8030
8031 /**
8032  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
8033  * but with all dynamically-allocated buffers duplicated in new buffers.
8034  */
8035 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
8036
8037 /**
8038  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
8039  */
8040 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
8041
8042 /**
8043  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
8044  */
8045 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
8046
8047 /**
8048  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
8049  */
8050 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
8051
8052 /**
8053  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
8054  * but with all dynamically-allocated buffers duplicated in new buffers.
8055  */
8056 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
8057
8058 /**
8059  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
8060  */
8061 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
8062
8063 /**
8064  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
8065  */
8066 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
8067
8068 /**
8069  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
8070  */
8071 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
8072
8073 /**
8074  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
8075  */
8076 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
8077
8078 /**
8079  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
8080  */
8081 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
8082
8083 /**
8084  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
8085  */
8086 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
8087
8088 /**
8089  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
8090  * but with all dynamically-allocated buffers duplicated in new buffers.
8091  */
8092 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
8093
8094 /**
8095  * Creates a new CResult_StringErrorZ in the success state.
8096  */
8097 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKCVec_u8Z o);
8098
8099 /**
8100  * Creates a new CResult_StringErrorZ in the error state.
8101  */
8102 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
8103
8104 /**
8105  * Frees any resources used by the CResult_StringErrorZ.
8106  */
8107 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
8108
8109 /**
8110  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
8111  */
8112 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
8113
8114 /**
8115  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
8116  */
8117 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
8118
8119 /**
8120  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
8121  */
8122 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
8123
8124 /**
8125  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
8126  * but with all dynamically-allocated buffers duplicated in new buffers.
8127  */
8128 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
8129
8130 /**
8131  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
8132  */
8133 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
8134
8135 /**
8136  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
8137  */
8138 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
8139
8140 /**
8141  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
8142  */
8143 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
8144
8145 /**
8146  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
8147  * but with all dynamically-allocated buffers duplicated in new buffers.
8148  */
8149 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
8150
8151 /**
8152  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
8153  */
8154 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
8155
8156 /**
8157  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
8158  */
8159 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
8160
8161 /**
8162  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
8163  */
8164 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
8165
8166 /**
8167  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
8168  * but with all dynamically-allocated buffers duplicated in new buffers.
8169  */
8170 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
8171
8172 /**
8173  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
8174  */
8175 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
8176
8177 /**
8178  * Frees any resources used by the C2Tuple_OutPointScriptZ.
8179  */
8180 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
8181
8182 /**
8183  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
8184  */
8185 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
8186
8187 /**
8188  * Frees any resources used by the C2Tuple_u32ScriptZ.
8189  */
8190 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
8191
8192 /**
8193  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8194  */
8195 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
8196
8197 /**
8198  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
8199  */
8200 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
8201
8202 /**
8203  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
8204  */
8205 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
8206
8207 /**
8208  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8209  */
8210 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
8211
8212 /**
8213  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8214  */
8215 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
8216
8217 /**
8218  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8219  */
8220 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
8221
8222 /**
8223  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8224  */
8225 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
8226
8227 /**
8228  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
8229  */
8230 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
8231
8232 /**
8233  * Frees any resources used by the C2Tuple_usizeTransactionZ.
8234  */
8235 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
8236
8237 /**
8238  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8239  */
8240 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
8241
8242 /**
8243  * Creates a new tuple which has the same data as `orig`
8244  * but with all dynamically-allocated buffers duplicated in new buffers.
8245  */
8246 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
8247
8248 /**
8249  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
8250  */
8251 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
8252
8253 /**
8254  * Frees any resources used by the C2Tuple_u32TxOutZ.
8255  */
8256 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
8257
8258 /**
8259  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8260  */
8261 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
8262
8263 /**
8264  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
8265  */
8266 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
8267
8268 /**
8269  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
8270  */
8271 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
8272
8273 /**
8274  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8275  */
8276 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
8277
8278 /**
8279  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8280  */
8281 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
8282
8283 /**
8284  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
8285  */
8286 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
8287
8288 /**
8289  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
8290  */
8291 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
8292
8293 /**
8294  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
8295  */
8296 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
8297
8298 /**
8299  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
8300  * but with all dynamically-allocated buffers duplicated in new buffers.
8301  */
8302 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
8303
8304 /**
8305  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
8306  */
8307 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
8308
8309 /**
8310  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
8311  */
8312 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
8313
8314 /**
8315  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
8316  */
8317 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
8318
8319 /**
8320  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
8321  */
8322 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
8323
8324 /**
8325  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
8326  */
8327 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
8328
8329 /**
8330  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8331  */
8332 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
8333
8334 /**
8335  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8336  */
8337 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
8338
8339 /**
8340  * Creates a new CResult_RouteDecodeErrorZ in the success state.
8341  */
8342 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
8343
8344 /**
8345  * Creates a new CResult_RouteDecodeErrorZ in the error state.
8346  */
8347 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
8348
8349 /**
8350  * Frees any resources used by the CResult_RouteDecodeErrorZ.
8351  */
8352 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
8353
8354 /**
8355  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
8356  * but with all dynamically-allocated buffers duplicated in new buffers.
8357  */
8358 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
8359
8360 /**
8361  * Constructs a new COption_u64Z containing a u64
8362  */
8363 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
8364
8365 /**
8366  * Constructs a new COption_u64Z containing nothing
8367  */
8368 struct LDKCOption_u64Z COption_u64Z_none(void);
8369
8370 /**
8371  * Frees any resources associated with the u64, if we are in the Some state
8372  */
8373 void COption_u64Z_free(struct LDKCOption_u64Z _res);
8374
8375 /**
8376  * Creates a new COption_u64Z which has the same data as `orig`
8377  * but with all dynamically-allocated buffers duplicated in new buffers.
8378  */
8379 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
8380
8381 /**
8382  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8383  */
8384 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
8385
8386 /**
8387  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8388  */
8389 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
8390
8391 /**
8392  * Creates a new CResult_RouteLightningErrorZ in the success state.
8393  */
8394 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
8395
8396 /**
8397  * Creates a new CResult_RouteLightningErrorZ in the error state.
8398  */
8399 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
8400
8401 /**
8402  * Frees any resources used by the CResult_RouteLightningErrorZ.
8403  */
8404 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
8405
8406 /**
8407  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
8408  * but with all dynamically-allocated buffers duplicated in new buffers.
8409  */
8410 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
8411
8412 /**
8413  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8414  */
8415 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
8416
8417 /**
8418  * Creates a new CResult_boolLightningErrorZ in the success state.
8419  */
8420 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
8421
8422 /**
8423  * Creates a new CResult_boolLightningErrorZ in the error state.
8424  */
8425 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
8426
8427 /**
8428  * Frees any resources used by the CResult_boolLightningErrorZ.
8429  */
8430 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
8431
8432 /**
8433  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
8434  * but with all dynamically-allocated buffers duplicated in new buffers.
8435  */
8436 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
8437
8438 /**
8439  * Creates a new tuple which has the same data as `orig`
8440  * but with all dynamically-allocated buffers duplicated in new buffers.
8441  */
8442 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
8443
8444 /**
8445  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
8446  */
8447 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
8448
8449 /**
8450  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
8451  */
8452 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
8453
8454 /**
8455  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8456  */
8457 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
8458
8459 /**
8460  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8461  */
8462 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
8463
8464 /**
8465  * Creates a new CResult_NoneLightningErrorZ in the success state.
8466  */
8467 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
8468
8469 /**
8470  * Creates a new CResult_NoneLightningErrorZ in the error state.
8471  */
8472 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
8473
8474 /**
8475  * Frees any resources used by the CResult_NoneLightningErrorZ.
8476  */
8477 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
8478
8479 /**
8480  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
8481  * but with all dynamically-allocated buffers duplicated in new buffers.
8482  */
8483 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
8484
8485 /**
8486  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8487  */
8488 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
8489
8490 /**
8491  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8492  */
8493 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
8494
8495 /**
8496  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
8497  */
8498 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
8499
8500 /**
8501  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
8502  */
8503 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
8504
8505 /**
8506  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
8507  */
8508 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
8509
8510 /**
8511  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
8512  * but with all dynamically-allocated buffers duplicated in new buffers.
8513  */
8514 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
8515
8516 /**
8517  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
8518  */
8519 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
8520
8521 /**
8522  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
8523  */
8524 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
8525
8526 /**
8527  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
8528  */
8529 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
8530
8531 /**
8532  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
8533  * but with all dynamically-allocated buffers duplicated in new buffers.
8534  */
8535 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
8536
8537 /**
8538  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
8539  */
8540 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
8541
8542 /**
8543  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
8544  */
8545 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
8546
8547 /**
8548  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
8549  */
8550 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
8551
8552 /**
8553  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
8554  * but with all dynamically-allocated buffers duplicated in new buffers.
8555  */
8556 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
8557
8558 /**
8559  * Creates a new CResult_TxOutAccessErrorZ in the success state.
8560  */
8561 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
8562
8563 /**
8564  * Creates a new CResult_TxOutAccessErrorZ in the error state.
8565  */
8566 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
8567
8568 /**
8569  * Frees any resources used by the CResult_TxOutAccessErrorZ.
8570  */
8571 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
8572
8573 /**
8574  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
8575  * but with all dynamically-allocated buffers duplicated in new buffers.
8576  */
8577 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
8578
8579 /**
8580  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
8581  */
8582 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
8583
8584 /**
8585  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
8586  */
8587 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
8588
8589 /**
8590  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
8591  */
8592 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
8593
8594 /**
8595  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8596  */
8597 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
8598
8599 /**
8600  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
8601  */
8602 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
8603
8604 /**
8605  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
8606  */
8607 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
8608
8609 /**
8610  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
8611  */
8612 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
8613
8614 /**
8615  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
8616  * but with all dynamically-allocated buffers duplicated in new buffers.
8617  */
8618 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
8619
8620 /**
8621  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8622  */
8623 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
8624
8625 /**
8626  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8627  */
8628 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
8629
8630 /**
8631  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8632  */
8633 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
8634
8635 /**
8636  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8637  * but with all dynamically-allocated buffers duplicated in new buffers.
8638  */
8639 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
8640
8641 /**
8642  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8643  */
8644 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
8645
8646 /**
8647  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8648  */
8649 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
8650
8651 /**
8652  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8653  */
8654 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
8655
8656 /**
8657  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8658  * but with all dynamically-allocated buffers duplicated in new buffers.
8659  */
8660 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
8661
8662 /**
8663  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8664  */
8665 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
8666
8667 /**
8668  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8669  */
8670 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
8671
8672 /**
8673  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8674  */
8675 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
8676
8677 /**
8678  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8679  */
8680 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
8681
8682 /**
8683  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
8684  * but with all dynamically-allocated buffers duplicated in new buffers.
8685  */
8686 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
8687
8688 /**
8689  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8690  */
8691 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
8692
8693 /**
8694  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
8695  */
8696 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
8697
8698 /**
8699  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
8700  */
8701 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
8702
8703 /**
8704  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
8705  */
8706 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
8707
8708 /**
8709  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
8710  * but with all dynamically-allocated buffers duplicated in new buffers.
8711  */
8712 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
8713
8714 /**
8715  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
8716  */
8717 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
8718
8719 /**
8720  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
8721  */
8722 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
8723
8724 /**
8725  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
8726  */
8727 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
8728
8729 /**
8730  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
8731  * but with all dynamically-allocated buffers duplicated in new buffers.
8732  */
8733 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
8734
8735 /**
8736  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
8737  */
8738 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
8739
8740 /**
8741  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
8742  */
8743 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8744
8745 /**
8746  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
8747  */
8748 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
8749
8750 /**
8751  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
8752  */
8753 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
8754
8755 /**
8756  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
8757  */
8758 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8759
8760 /**
8761  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
8762  */
8763 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
8764
8765 /**
8766  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
8767  */
8768 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
8769
8770 /**
8771  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
8772  */
8773 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8774
8775 /**
8776  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
8777  */
8778 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
8779
8780 /**
8781  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
8782  */
8783 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
8784
8785 /**
8786  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
8787  */
8788 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8789
8790 /**
8791  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
8792  */
8793 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
8794
8795 /**
8796  * Creates a new CResult_NetAddressu8Z in the success state.
8797  */
8798 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
8799
8800 /**
8801  * Creates a new CResult_NetAddressu8Z in the error state.
8802  */
8803 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
8804
8805 /**
8806  * Frees any resources used by the CResult_NetAddressu8Z.
8807  */
8808 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
8809
8810 /**
8811  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
8812  * but with all dynamically-allocated buffers duplicated in new buffers.
8813  */
8814 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
8815
8816 /**
8817  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
8818  */
8819 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
8820
8821 /**
8822  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
8823  */
8824 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
8825
8826 /**
8827  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
8828  */
8829 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
8830
8831 /**
8832  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
8833  * but with all dynamically-allocated buffers duplicated in new buffers.
8834  */
8835 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
8836
8837 /**
8838  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8839  */
8840 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
8841
8842 /**
8843  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8844  */
8845 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
8846
8847 /**
8848  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8849  */
8850 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
8851
8852 /**
8853  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8854  */
8855 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
8856
8857 /**
8858  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8859  */
8860 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
8861
8862 /**
8863  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8864  */
8865 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
8866
8867 /**
8868  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8869  */
8870 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
8871
8872 /**
8873  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8874  * but with all dynamically-allocated buffers duplicated in new buffers.
8875  */
8876 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
8877
8878 /**
8879  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8880  */
8881 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
8882
8883 /**
8884  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8885  */
8886 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
8887
8888 /**
8889  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
8890  */
8891 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
8892
8893 /**
8894  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
8895  * but with all dynamically-allocated buffers duplicated in new buffers.
8896  */
8897 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
8898
8899 /**
8900  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
8901  */
8902 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
8903
8904 /**
8905  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
8906  */
8907 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
8908
8909 /**
8910  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
8911  */
8912 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
8913
8914 /**
8915  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
8916  * but with all dynamically-allocated buffers duplicated in new buffers.
8917  */
8918 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
8919
8920 /**
8921  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
8922  */
8923 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
8924
8925 /**
8926  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
8927  */
8928 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
8929
8930 /**
8931  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
8932  */
8933 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
8934
8935 /**
8936  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
8937  * but with all dynamically-allocated buffers duplicated in new buffers.
8938  */
8939 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
8940
8941 /**
8942  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
8943  */
8944 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
8945
8946 /**
8947  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
8948  */
8949 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
8950
8951 /**
8952  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
8953  */
8954 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
8955
8956 /**
8957  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
8958  * but with all dynamically-allocated buffers duplicated in new buffers.
8959  */
8960 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
8961
8962 /**
8963  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
8964  */
8965 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
8966
8967 /**
8968  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
8969  */
8970 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
8971
8972 /**
8973  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
8974  */
8975 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
8976
8977 /**
8978  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
8979  * but with all dynamically-allocated buffers duplicated in new buffers.
8980  */
8981 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
8982
8983 /**
8984  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
8985  */
8986 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
8987
8988 /**
8989  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
8990  */
8991 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
8992
8993 /**
8994  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
8995  */
8996 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
8997
8998 /**
8999  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
9000  * but with all dynamically-allocated buffers duplicated in new buffers.
9001  */
9002 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
9003
9004 /**
9005  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
9006  */
9007 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
9008
9009 /**
9010  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
9011  */
9012 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
9013
9014 /**
9015  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
9016  */
9017 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
9018
9019 /**
9020  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
9021  * but with all dynamically-allocated buffers duplicated in new buffers.
9022  */
9023 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
9024
9025 /**
9026  * Creates a new CResult_InitDecodeErrorZ in the success state.
9027  */
9028 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
9029
9030 /**
9031  * Creates a new CResult_InitDecodeErrorZ in the error state.
9032  */
9033 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
9034
9035 /**
9036  * Frees any resources used by the CResult_InitDecodeErrorZ.
9037  */
9038 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
9039
9040 /**
9041  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
9042  * but with all dynamically-allocated buffers duplicated in new buffers.
9043  */
9044 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
9045
9046 /**
9047  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
9048  */
9049 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
9050
9051 /**
9052  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
9053  */
9054 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
9055
9056 /**
9057  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
9058  */
9059 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
9060
9061 /**
9062  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
9063  * but with all dynamically-allocated buffers duplicated in new buffers.
9064  */
9065 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
9066
9067 /**
9068  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
9069  */
9070 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
9071
9072 /**
9073  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
9074  */
9075 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
9076
9077 /**
9078  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
9079  */
9080 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
9081
9082 /**
9083  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
9084  * but with all dynamically-allocated buffers duplicated in new buffers.
9085  */
9086 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
9087
9088 /**
9089  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
9090  */
9091 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
9092
9093 /**
9094  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
9095  */
9096 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
9097
9098 /**
9099  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
9100  */
9101 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
9102
9103 /**
9104  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
9105  * but with all dynamically-allocated buffers duplicated in new buffers.
9106  */
9107 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
9108
9109 /**
9110  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
9111  */
9112 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
9113
9114 /**
9115  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
9116  */
9117 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
9118
9119 /**
9120  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
9121  */
9122 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
9123
9124 /**
9125  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
9126  * but with all dynamically-allocated buffers duplicated in new buffers.
9127  */
9128 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
9129
9130 /**
9131  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
9132  */
9133 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
9134
9135 /**
9136  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
9137  */
9138 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
9139
9140 /**
9141  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
9142  */
9143 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
9144
9145 /**
9146  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
9147  * but with all dynamically-allocated buffers duplicated in new buffers.
9148  */
9149 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
9150
9151 /**
9152  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
9153  */
9154 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
9155
9156 /**
9157  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
9158  */
9159 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
9160
9161 /**
9162  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
9163  */
9164 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
9165
9166 /**
9167  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
9168  * but with all dynamically-allocated buffers duplicated in new buffers.
9169  */
9170 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
9171
9172 /**
9173  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
9174  */
9175 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
9176
9177 /**
9178  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
9179  */
9180 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
9181
9182 /**
9183  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
9184  */
9185 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
9186
9187 /**
9188  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
9189  * but with all dynamically-allocated buffers duplicated in new buffers.
9190  */
9191 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
9192
9193 /**
9194  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
9195  */
9196 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
9197
9198 /**
9199  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
9200  */
9201 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
9202
9203 /**
9204  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
9205  */
9206 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
9207
9208 /**
9209  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
9210  * but with all dynamically-allocated buffers duplicated in new buffers.
9211  */
9212 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
9213
9214 /**
9215  * Creates a new CResult_PingDecodeErrorZ in the success state.
9216  */
9217 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
9218
9219 /**
9220  * Creates a new CResult_PingDecodeErrorZ in the error state.
9221  */
9222 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
9223
9224 /**
9225  * Frees any resources used by the CResult_PingDecodeErrorZ.
9226  */
9227 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
9228
9229 /**
9230  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
9231  * but with all dynamically-allocated buffers duplicated in new buffers.
9232  */
9233 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
9234
9235 /**
9236  * Creates a new CResult_PongDecodeErrorZ in the success state.
9237  */
9238 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
9239
9240 /**
9241  * Creates a new CResult_PongDecodeErrorZ in the error state.
9242  */
9243 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
9244
9245 /**
9246  * Frees any resources used by the CResult_PongDecodeErrorZ.
9247  */
9248 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
9249
9250 /**
9251  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
9252  * but with all dynamically-allocated buffers duplicated in new buffers.
9253  */
9254 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
9255
9256 /**
9257  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
9258  */
9259 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
9260
9261 /**
9262  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
9263  */
9264 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9265
9266 /**
9267  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
9268  */
9269 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
9270
9271 /**
9272  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
9273  * but with all dynamically-allocated buffers duplicated in new buffers.
9274  */
9275 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9276
9277 /**
9278  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
9279  */
9280 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
9281
9282 /**
9283  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
9284  */
9285 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9286
9287 /**
9288  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
9289  */
9290 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
9291
9292 /**
9293  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
9294  * but with all dynamically-allocated buffers duplicated in new buffers.
9295  */
9296 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9297
9298 /**
9299  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
9300  */
9301 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
9302
9303 /**
9304  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
9305  */
9306 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9307
9308 /**
9309  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
9310  */
9311 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
9312
9313 /**
9314  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
9315  * but with all dynamically-allocated buffers duplicated in new buffers.
9316  */
9317 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
9318
9319 /**
9320  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
9321  */
9322 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
9323
9324 /**
9325  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
9326  */
9327 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9328
9329 /**
9330  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
9331  */
9332 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
9333
9334 /**
9335  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
9336  * but with all dynamically-allocated buffers duplicated in new buffers.
9337  */
9338 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
9339
9340 /**
9341  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
9342  */
9343 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
9344
9345 /**
9346  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
9347  */
9348 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
9349
9350 /**
9351  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
9352  */
9353 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
9354
9355 /**
9356  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
9357  * but with all dynamically-allocated buffers duplicated in new buffers.
9358  */
9359 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
9360
9361 /**
9362  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
9363  */
9364 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
9365
9366 /**
9367  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
9368  */
9369 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9370
9371 /**
9372  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
9373  */
9374 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
9375
9376 /**
9377  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
9378  * but with all dynamically-allocated buffers duplicated in new buffers.
9379  */
9380 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9381
9382 /**
9383  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
9384  */
9385 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
9386
9387 /**
9388  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
9389  */
9390 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9391
9392 /**
9393  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
9394  */
9395 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
9396
9397 /**
9398  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
9399  * but with all dynamically-allocated buffers duplicated in new buffers.
9400  */
9401 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9402
9403 /**
9404  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
9405  */
9406 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
9407
9408 /**
9409  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
9410  */
9411 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
9412
9413 /**
9414  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
9415  */
9416 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
9417
9418 /**
9419  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
9420  * but with all dynamically-allocated buffers duplicated in new buffers.
9421  */
9422 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
9423
9424 /**
9425  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
9426  */
9427 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
9428
9429 /**
9430  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
9431  */
9432 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
9433
9434 /**
9435  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
9436  */
9437 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
9438
9439 /**
9440  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
9441  * but with all dynamically-allocated buffers duplicated in new buffers.
9442  */
9443 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
9444
9445 /**
9446  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
9447  */
9448 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
9449
9450 /**
9451  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
9452  */
9453 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
9454
9455 /**
9456  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
9457  */
9458 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
9459
9460 /**
9461  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
9462  * but with all dynamically-allocated buffers duplicated in new buffers.
9463  */
9464 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
9465
9466 /**
9467  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
9468  */
9469 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
9470
9471 /**
9472  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
9473  */
9474 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
9475
9476 /**
9477  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
9478  */
9479 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
9480
9481 /**
9482  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
9483  * but with all dynamically-allocated buffers duplicated in new buffers.
9484  */
9485 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
9486
9487 /**
9488  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
9489  */
9490 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
9491
9492 /**
9493  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
9494  */
9495 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
9496
9497 /**
9498  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
9499  */
9500 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
9501
9502 /**
9503  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
9504  * but with all dynamically-allocated buffers duplicated in new buffers.
9505  */
9506 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
9507
9508 /**
9509  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
9510  */
9511 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
9512
9513 /**
9514  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
9515  */
9516 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9517
9518 /**
9519  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
9520  */
9521 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
9522
9523 /**
9524  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
9525  * but with all dynamically-allocated buffers duplicated in new buffers.
9526  */
9527 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9528
9529 /**
9530  * Creates a new tuple which has the same data as `orig`
9531  * but with all dynamically-allocated buffers duplicated in new buffers.
9532  */
9533 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
9534
9535 /**
9536  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
9537  */
9538 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
9539
9540 /**
9541  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
9542  */
9543 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
9544
9545 /**
9546  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
9547  */
9548 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
9549
9550 /**
9551  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
9552  */
9553 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
9554
9555 /**
9556  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
9557  */
9558 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
9559
9560 /**
9561  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
9562  * but with all dynamically-allocated buffers duplicated in new buffers.
9563  */
9564 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
9565
9566 /**
9567  * Creates a new CResult_SignatureNoneZ in the success state.
9568  */
9569 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
9570
9571 /**
9572  * Creates a new CResult_SignatureNoneZ in the error state.
9573  */
9574 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
9575
9576 /**
9577  * Frees any resources used by the CResult_SignatureNoneZ.
9578  */
9579 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
9580
9581 /**
9582  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
9583  * but with all dynamically-allocated buffers duplicated in new buffers.
9584  */
9585 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
9586
9587 /**
9588  * Creates a new CResult_SignDecodeErrorZ in the success state.
9589  */
9590 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
9591
9592 /**
9593  * Creates a new CResult_SignDecodeErrorZ in the error state.
9594  */
9595 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
9596
9597 /**
9598  * Frees any resources used by the CResult_SignDecodeErrorZ.
9599  */
9600 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
9601
9602 /**
9603  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
9604  * but with all dynamically-allocated buffers duplicated in new buffers.
9605  */
9606 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
9607
9608 /**
9609  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9610  */
9611 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
9612
9613 /**
9614  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
9615  */
9616 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
9617
9618 /**
9619  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
9620  */
9621 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
9622
9623 /**
9624  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
9625  */
9626 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
9627
9628 /**
9629  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
9630  * but with all dynamically-allocated buffers duplicated in new buffers.
9631  */
9632 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
9633
9634 /**
9635  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
9636  */
9637 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
9638
9639 /**
9640  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
9641  */
9642 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
9643
9644 /**
9645  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
9646  */
9647 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
9648
9649 /**
9650  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
9651  * but with all dynamically-allocated buffers duplicated in new buffers.
9652  */
9653 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
9654
9655 /**
9656  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9657  */
9658 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
9659
9660 /**
9661  * Creates a new CResult_TransactionNoneZ in the success state.
9662  */
9663 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
9664
9665 /**
9666  * Creates a new CResult_TransactionNoneZ in the error state.
9667  */
9668 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
9669
9670 /**
9671  * Frees any resources used by the CResult_TransactionNoneZ.
9672  */
9673 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
9674
9675 /**
9676  * Creates a new CResult_NoneErrorZ in the success state.
9677  */
9678 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
9679
9680 /**
9681  * Creates a new CResult_NoneErrorZ in the error state.
9682  */
9683 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
9684
9685 /**
9686  * Frees any resources used by the CResult_NoneErrorZ.
9687  */
9688 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
9689
9690 /**
9691  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9692  */
9693 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
9694
9695 /**
9696  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
9697  */
9698 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
9699
9700 /**
9701  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
9702  */
9703 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
9704
9705 /**
9706  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
9707  */
9708 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
9709
9710 /**
9711  * Creates a new CResult_NoneAPIErrorZ in the success state.
9712  */
9713 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
9714
9715 /**
9716  * Creates a new CResult_NoneAPIErrorZ in the error state.
9717  */
9718 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
9719
9720 /**
9721  * Frees any resources used by the CResult_NoneAPIErrorZ.
9722  */
9723 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
9724
9725 /**
9726  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
9727  * but with all dynamically-allocated buffers duplicated in new buffers.
9728  */
9729 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
9730
9731 /**
9732  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9733  */
9734 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
9735
9736 /**
9737  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9738  */
9739 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
9740
9741 /**
9742  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
9743  */
9744 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
9745
9746 /**
9747  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
9748  */
9749 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
9750
9751 /**
9752  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
9753  */
9754 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
9755
9756 /**
9757  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9758  * but with all dynamically-allocated buffers duplicated in new buffers.
9759  */
9760 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
9761
9762 /**
9763  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9764  */
9765 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
9766
9767 /**
9768  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9769  */
9770 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
9771
9772 /**
9773  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9774  */
9775 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
9776
9777 /**
9778  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9779  */
9780 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
9781
9782 /**
9783  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9784  */
9785 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
9786
9787 /**
9788  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9789  */
9790 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
9791
9792 /**
9793  * Frees any resources used by the Event
9794  */
9795 void Event_free(struct LDKEvent this_ptr);
9796
9797 /**
9798  * Creates a copy of the Event
9799  */
9800 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
9801
9802 /**
9803  * Serialize the Event object into a byte array which can be read by Event_read
9804  */
9805 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
9806
9807 /**
9808  * Frees any resources used by the MessageSendEvent
9809  */
9810 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
9811
9812 /**
9813  * Creates a copy of the MessageSendEvent
9814  */
9815 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
9816
9817 /**
9818  * Calls the free function if one is set
9819  */
9820 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
9821
9822 /**
9823  * Calls the free function if one is set
9824  */
9825 void EventsProvider_free(struct LDKEventsProvider this_ptr);
9826
9827 /**
9828  * Frees any resources used by the APIError
9829  */
9830 void APIError_free(struct LDKAPIError this_ptr);
9831
9832 /**
9833  * Creates a copy of the APIError
9834  */
9835 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
9836
9837 /**
9838  * Creates a digital signature of a message given a SecretKey, like the node's secret.
9839  * 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.
9840  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
9841  */
9842 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, struct LDKSecretKey sk);
9843
9844 /**
9845  * Recovers the PublicKey of the signer of the message given the message and the signature.
9846  */
9847 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
9848
9849 /**
9850  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
9851  * and the PublicKey.
9852  */
9853 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
9854
9855 /**
9856  * Creates a copy of the Level
9857  */
9858 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
9859
9860 /**
9861  * Returns the most verbose logging level.
9862  */
9863 MUST_USE_RES enum LDKLevel Level_max(void);
9864
9865 /**
9866  * Calls the free function if one is set
9867  */
9868 void Logger_free(struct LDKLogger this_ptr);
9869
9870 /**
9871  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
9872  */
9873 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
9874
9875 /**
9876  * Confirmations we will wait for before considering the channel locked in.
9877  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
9878  * equivalent limit applied to outbound channels).
9879  *
9880  * Default value: 6.
9881  */
9882 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9883
9884 /**
9885  * Confirmations we will wait for before considering the channel locked in.
9886  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
9887  * equivalent limit applied to outbound channels).
9888  *
9889  * Default value: 6.
9890  */
9891 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
9892
9893 /**
9894  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
9895  * the number of blocks we have to punish our counterparty if they broadcast a revoked
9896  * transaction).
9897  *
9898  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
9899  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
9900  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
9901  * possibly with time in between to RBF the spending transaction).
9902  *
9903  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
9904  * case of an honest unilateral channel close, which implicitly decrease the economic value of
9905  * our channel.
9906  *
9907  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
9908  * can tweak config to ask for more security, not less.
9909  */
9910 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9911
9912 /**
9913  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
9914  * the number of blocks we have to punish our counterparty if they broadcast a revoked
9915  * transaction).
9916  *
9917  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
9918  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
9919  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
9920  * possibly with time in between to RBF the spending transaction).
9921  *
9922  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
9923  * case of an honest unilateral channel close, which implicitly decrease the economic value of
9924  * our channel.
9925  *
9926  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
9927  * can tweak config to ask for more security, not less.
9928  */
9929 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
9930
9931 /**
9932  * Set to the smallest value HTLC we will accept to process.
9933  *
9934  * This value is sent to our counterparty on channel-open and we close the channel any time
9935  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
9936  *
9937  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
9938  * by the protocol.
9939  */
9940 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9941
9942 /**
9943  * Set to the smallest value HTLC we will accept to process.
9944  *
9945  * This value is sent to our counterparty on channel-open and we close the channel any time
9946  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
9947  *
9948  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
9949  * by the protocol.
9950  */
9951 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
9952
9953 /**
9954  * Constructs a new ChannelHandshakeConfig given each field
9955  */
9956 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);
9957
9958 /**
9959  * Creates a copy of the ChannelHandshakeConfig
9960  */
9961 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
9962
9963 /**
9964  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
9965  */
9966 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
9967
9968 /**
9969  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
9970  */
9971 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
9972
9973 /**
9974  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
9975  * only applies to inbound channels.
9976  *
9977  * Default value: 0.
9978  */
9979 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9980
9981 /**
9982  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
9983  * only applies to inbound channels.
9984  *
9985  * Default value: 0.
9986  */
9987 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9988
9989 /**
9990  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
9991  * you to limit the maximum minimum-size they can require.
9992  *
9993  * Default value: u64::max_value.
9994  */
9995 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9996
9997 /**
9998  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
9999  * you to limit the maximum minimum-size they can require.
10000  *
10001  * Default value: u64::max_value.
10002  */
10003 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
10004
10005 /**
10006  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
10007  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
10008  *
10009  * Default value: 0.
10010  */
10011 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
10012
10013 /**
10014  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
10015  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
10016  *
10017  * Default value: 0.
10018  */
10019 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
10020
10021 /**
10022  * The remote node will require we keep a certain amount in direct payment to ourselves at all
10023  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
10024  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
10025  *
10026  * Default value: u64::max_value.
10027  */
10028 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
10029
10030 /**
10031  * The remote node will require we keep a certain amount in direct payment to ourselves at all
10032  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
10033  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
10034  *
10035  * Default value: u64::max_value.
10036  */
10037 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
10038
10039 /**
10040  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
10041  * time. This allows you to set a minimum such value.
10042  *
10043  * Default value: 0.
10044  */
10045 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
10046
10047 /**
10048  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
10049  * time. This allows you to set a minimum such value.
10050  *
10051  * Default value: 0.
10052  */
10053 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
10054
10055 /**
10056  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
10057  * required to always be higher than this value so this only applies to HTLC outputs (and
10058  * potentially to-self outputs before any payments have been made).
10059  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
10060  * This setting allows you to set a minimum dust limit for their commitment transactions,
10061  * reflecting the reality that tiny outputs are not considered standard transactions and will
10062  * not propagate through the Bitcoin network.
10063  *
10064  * Default value: 546, the current dust limit on the Bitcoin network.
10065  */
10066 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
10067
10068 /**
10069  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
10070  * required to always be higher than this value so this only applies to HTLC outputs (and
10071  * potentially to-self outputs before any payments have been made).
10072  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
10073  * This setting allows you to set a minimum dust limit for their commitment transactions,
10074  * reflecting the reality that tiny outputs are not considered standard transactions and will
10075  * not propagate through the Bitcoin network.
10076  *
10077  * Default value: 546, the current dust limit on the Bitcoin network.
10078  */
10079 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
10080
10081 /**
10082  * Maximum allowed threshold above which outputs will not be generated in their commitment
10083  * transactions.
10084  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
10085  *
10086  * Default value: u64::max_value.
10087  */
10088 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
10089
10090 /**
10091  * Maximum allowed threshold above which outputs will not be generated in their commitment
10092  * transactions.
10093  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
10094  *
10095  * Default value: u64::max_value.
10096  */
10097 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
10098
10099 /**
10100  * Before a channel is usable the funding transaction will need to be confirmed by at least a
10101  * certain number of blocks, specified by the node which is not the funder (as the funder can
10102  * assume they aren't going to double-spend themselves).
10103  * This config allows you to set a limit on the maximum amount of time to wait.
10104  *
10105  * Default value: 144, or roughly one day and only applies to outbound channels.
10106  */
10107 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
10108
10109 /**
10110  * Before a channel is usable the funding transaction will need to be confirmed by at least a
10111  * certain number of blocks, specified by the node which is not the funder (as the funder can
10112  * assume they aren't going to double-spend themselves).
10113  * This config allows you to set a limit on the maximum amount of time to wait.
10114  *
10115  * Default value: 144, or roughly one day and only applies to outbound channels.
10116  */
10117 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
10118
10119 /**
10120  * Set to force the incoming channel to match our announced channel preference in
10121  * ChannelConfig.
10122  *
10123  * Default value: true, to make the default that no announced channels are possible (which is
10124  * appropriate for any nodes which are not online very reliably).
10125  */
10126 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
10127
10128 /**
10129  * Set to force the incoming channel to match our announced channel preference in
10130  * ChannelConfig.
10131  *
10132  * Default value: true, to make the default that no announced channels are possible (which is
10133  * appropriate for any nodes which are not online very reliably).
10134  */
10135 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
10136
10137 /**
10138  * Set to the amount of time we're willing to wait to claim money back to us.
10139  *
10140  * Not checking this value would be a security issue, as our peer would be able to set it to
10141  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
10142  *
10143  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
10144  * reduce the loss of having useless locked funds (if your peer accepts)
10145  */
10146 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
10147
10148 /**
10149  * Set to the amount of time we're willing to wait to claim money back to us.
10150  *
10151  * Not checking this value would be a security issue, as our peer would be able to set it to
10152  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
10153  *
10154  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
10155  * reduce the loss of having useless locked funds (if your peer accepts)
10156  */
10157 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
10158
10159 /**
10160  * Constructs a new ChannelHandshakeLimits given each field
10161  */
10162 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_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, uint64_t min_dust_limit_satoshis_arg, uint64_t max_dust_limit_satoshis_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
10163
10164 /**
10165  * Creates a copy of the ChannelHandshakeLimits
10166  */
10167 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
10168
10169 /**
10170  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
10171  */
10172 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
10173
10174 /**
10175  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
10176  */
10177 void ChannelConfig_free(struct LDKChannelConfig this_obj);
10178
10179 /**
10180  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
10181  * This may be allowed to change at runtime in a later update, however doing so must result in
10182  * update messages sent to notify all nodes of our updated relay fee.
10183  *
10184  * Default value: 0.
10185  */
10186 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
10187
10188 /**
10189  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
10190  * This may be allowed to change at runtime in a later update, however doing so must result in
10191  * update messages sent to notify all nodes of our updated relay fee.
10192  *
10193  * Default value: 0.
10194  */
10195 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
10196
10197 /**
10198  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
10199  * the channel this config applies to.
10200  *
10201  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
10202  * HTLC balance when a channel appears on-chain whereas
10203  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
10204  * (non-HTLC-encumbered) balance.
10205  *
10206  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
10207  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
10208  * commitment transaction at least once per this many blocks (minus some margin to allow us
10209  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
10210  * the spending transaction).
10211  *
10212  * Default value: 72 (12 hours at an average of 6 blocks/hour).
10213  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
10214  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
10215  *
10216  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
10217  */
10218 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
10219
10220 /**
10221  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
10222  * the channel this config applies to.
10223  *
10224  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
10225  * HTLC balance when a channel appears on-chain whereas
10226  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
10227  * (non-HTLC-encumbered) balance.
10228  *
10229  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
10230  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
10231  * commitment transaction at least once per this many blocks (minus some margin to allow us
10232  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
10233  * the spending transaction).
10234  *
10235  * Default value: 72 (12 hours at an average of 6 blocks/hour).
10236  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
10237  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
10238  *
10239  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
10240  */
10241 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
10242
10243 /**
10244  * Set to announce the channel publicly and notify all nodes that they can route via this
10245  * channel.
10246  *
10247  * This should only be set to true for nodes which expect to be online reliably.
10248  *
10249  * As the node which funds a channel picks this value this will only apply for new outbound
10250  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
10251  *
10252  * This cannot be changed after the initial channel handshake.
10253  *
10254  * Default value: false.
10255  */
10256 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
10257
10258 /**
10259  * Set to announce the channel publicly and notify all nodes that they can route via this
10260  * channel.
10261  *
10262  * This should only be set to true for nodes which expect to be online reliably.
10263  *
10264  * As the node which funds a channel picks this value this will only apply for new outbound
10265  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
10266  *
10267  * This cannot be changed after the initial channel handshake.
10268  *
10269  * Default value: false.
10270  */
10271 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
10272
10273 /**
10274  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
10275  * supports it, they will then enforce the mutual-close output to us matches what we provided
10276  * at intialization, preventing us from closing to an alternate pubkey.
10277  *
10278  * This is set to true by default to provide a slight increase in security, though ultimately
10279  * any attacker who is able to take control of a channel can just as easily send the funds via
10280  * lightning payments, so we never require that our counterparties support this option.
10281  *
10282  * This cannot be changed after a channel has been initialized.
10283  *
10284  * Default value: true.
10285  */
10286 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
10287
10288 /**
10289  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
10290  * supports it, they will then enforce the mutual-close output to us matches what we provided
10291  * at intialization, preventing us from closing to an alternate pubkey.
10292  *
10293  * This is set to true by default to provide a slight increase in security, though ultimately
10294  * any attacker who is able to take control of a channel can just as easily send the funds via
10295  * lightning payments, so we never require that our counterparties support this option.
10296  *
10297  * This cannot be changed after a channel has been initialized.
10298  *
10299  * Default value: true.
10300  */
10301 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
10302
10303 /**
10304  * Constructs a new ChannelConfig given each field
10305  */
10306 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
10307
10308 /**
10309  * Creates a copy of the ChannelConfig
10310  */
10311 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
10312
10313 /**
10314  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
10315  */
10316 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
10317
10318 /**
10319  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
10320  */
10321 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
10322
10323 /**
10324  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
10325  */
10326 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
10327
10328 /**
10329  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
10330  */
10331 void UserConfig_free(struct LDKUserConfig this_obj);
10332
10333 /**
10334  * Channel config that we propose to our counterparty.
10335  */
10336 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
10337
10338 /**
10339  * Channel config that we propose to our counterparty.
10340  */
10341 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
10342
10343 /**
10344  * Limits applied to our counterparty's proposed channel config settings.
10345  */
10346 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
10347
10348 /**
10349  * Limits applied to our counterparty's proposed channel config settings.
10350  */
10351 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
10352
10353 /**
10354  * Channel config which affects behavior during channel lifetime.
10355  */
10356 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
10357
10358 /**
10359  * Channel config which affects behavior during channel lifetime.
10360  */
10361 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
10362
10363 /**
10364  * Constructs a new UserConfig given each field
10365  */
10366 MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg);
10367
10368 /**
10369  * Creates a copy of the UserConfig
10370  */
10371 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
10372
10373 /**
10374  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
10375  */
10376 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
10377
10378 /**
10379  * Creates a copy of the AccessError
10380  */
10381 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
10382
10383 /**
10384  * Calls the free function if one is set
10385  */
10386 void Access_free(struct LDKAccess this_ptr);
10387
10388 /**
10389  * Calls the free function if one is set
10390  */
10391 void Listen_free(struct LDKListen this_ptr);
10392
10393 /**
10394  * Calls the free function if one is set
10395  */
10396 void Confirm_free(struct LDKConfirm this_ptr);
10397
10398 /**
10399  * Calls the free function if one is set
10400  */
10401 void Watch_free(struct LDKWatch this_ptr);
10402
10403 /**
10404  * Calls the free function if one is set
10405  */
10406 void Filter_free(struct LDKFilter this_ptr);
10407
10408 /**
10409  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
10410  */
10411 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
10412
10413 /**
10414  * First block where the transaction output may have been spent.
10415  */
10416 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10417
10418 /**
10419  * First block where the transaction output may have been spent.
10420  */
10421 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10422
10423 /**
10424  * Outpoint identifying the transaction output.
10425  */
10426 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10427
10428 /**
10429  * Outpoint identifying the transaction output.
10430  */
10431 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10432
10433 /**
10434  * Spending condition of the transaction output.
10435  */
10436 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10437
10438 /**
10439  * Spending condition of the transaction output.
10440  */
10441 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
10442
10443 /**
10444  * Constructs a new WatchedOutput given each field
10445  */
10446 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
10447
10448 /**
10449  * Calls the free function if one is set
10450  */
10451 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
10452
10453 /**
10454  * Creates a copy of the ConfirmationTarget
10455  */
10456 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
10457
10458 /**
10459  * Calls the free function if one is set
10460  */
10461 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
10462
10463 /**
10464  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
10465  */
10466 void ChainMonitor_free(struct LDKChainMonitor this_obj);
10467
10468 /**
10469  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
10470  *
10471  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
10472  * will call back to it indicating transactions and outputs of interest. This allows clients to
10473  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
10474  * always need to fetch full blocks absent another means for determining which blocks contain
10475  * transactions relevant to the watched channels.
10476  */
10477 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
10478
10479 /**
10480  * Constructs a new Watch which calls the relevant methods on this_arg.
10481  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
10482  */
10483 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
10484
10485 /**
10486  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
10487  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
10488  */
10489 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
10490
10491 /**
10492  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
10493  */
10494 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
10495
10496 /**
10497  * The sequence number of this update. Updates *must* be replayed in-order according to this
10498  * sequence number (and updates may panic if they are not). The update_id values are strictly
10499  * increasing and increase by one for each new update, with one exception specified below.
10500  *
10501  * This sequence number is also used to track up to which points updates which returned
10502  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
10503  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
10504  *
10505  * The only instance where update_id values are not strictly increasing is the case where we
10506  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
10507  * its docs for more details.
10508  */
10509 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
10510
10511 /**
10512  * The sequence number of this update. Updates *must* be replayed in-order according to this
10513  * sequence number (and updates may panic if they are not). The update_id values are strictly
10514  * increasing and increase by one for each new update, with one exception specified below.
10515  *
10516  * This sequence number is also used to track up to which points updates which returned
10517  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
10518  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
10519  *
10520  * The only instance where update_id values are not strictly increasing is the case where we
10521  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
10522  * its docs for more details.
10523  */
10524 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
10525
10526 /**
10527  * Creates a copy of the ChannelMonitorUpdate
10528  */
10529 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
10530
10531 /**
10532  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
10533  */
10534 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
10535
10536 /**
10537  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
10538  */
10539 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
10540
10541 /**
10542  * Creates a copy of the ChannelMonitorUpdateErr
10543  */
10544 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
10545
10546 /**
10547  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
10548  */
10549 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
10550
10551 /**
10552  * Creates a copy of the MonitorUpdateError
10553  */
10554 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
10555
10556 /**
10557  * Frees any resources used by the MonitorEvent
10558  */
10559 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
10560
10561 /**
10562  * Creates a copy of the MonitorEvent
10563  */
10564 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
10565
10566 /**
10567  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
10568  */
10569 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
10570
10571 /**
10572  * Creates a copy of the HTLCUpdate
10573  */
10574 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
10575
10576 /**
10577  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
10578  */
10579 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
10580
10581 /**
10582  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
10583  */
10584 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
10585
10586 /**
10587  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
10588  */
10589 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
10590
10591 /**
10592  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
10593  */
10594 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
10595
10596 /**
10597  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
10598  * itself.
10599  *
10600  * panics if the given update is not the next update by update_id.
10601  */
10602 MUST_USE_RES struct LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
10603
10604 /**
10605  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
10606  * ChannelMonitor.
10607  */
10608 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10609
10610 /**
10611  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
10612  */
10613 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10614
10615 /**
10616  * Gets a list of txids, with their output scripts (in the order they appear in the
10617  * transaction), which we must learn about spends of via block_connected().
10618  */
10619 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10620
10621 /**
10622  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
10623  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
10624  * have been registered.
10625  */
10626 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
10627
10628 /**
10629  * Get the list of HTLCs who's status has been updated on chain. This should be called by
10630  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
10631  */
10632 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10633
10634 /**
10635  * Gets the list of pending events which were generated by previous actions, clearing the list
10636  * in the process.
10637  *
10638  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
10639  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
10640  * no internal locking in ChannelMonitors.
10641  */
10642 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10643
10644 /**
10645  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
10646  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
10647  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
10648  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
10649  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
10650  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
10651  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
10652  * out-of-band the other node operator to coordinate with him if option is available to you.
10653  * In any-case, choice is up to the user.
10654  */
10655 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);
10656
10657 /**
10658  * Processes transactions in a newly connected block, which may result in any of the following:
10659  * - update the monitor's state against resolved HTLCs
10660  * - punish the counterparty in the case of seeing a revoked commitment transaction
10661  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
10662  * - detect settled outputs for later spending
10663  * - schedule and bump any in-flight claims
10664  *
10665  * Returns any new outputs to watch from `txdata`; after called, these are also included in
10666  * [`get_outputs_to_watch`].
10667  *
10668  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
10669  */
10670 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);
10671
10672 /**
10673  * Determines if the disconnected block contained any transactions of interest and updates
10674  * appropriately.
10675  */
10676 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);
10677
10678 /**
10679  * Processes transactions confirmed in a block with the given header and height, returning new
10680  * outputs to watch. See [`block_connected`] for details.
10681  *
10682  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10683  * blocks. See [`chain::Confirm`] for calling expectations.
10684  *
10685  * [`block_connected`]: Self::block_connected
10686  */
10687 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);
10688
10689 /**
10690  * Processes a transaction that was reorganized out of the chain.
10691  *
10692  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
10693  * than blocks. See [`chain::Confirm`] for calling expectations.
10694  *
10695  * [`block_disconnected`]: Self::block_disconnected
10696  */
10697 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);
10698
10699 /**
10700  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
10701  * [`block_connected`] for details.
10702  *
10703  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10704  * blocks. See [`chain::Confirm`] for calling expectations.
10705  *
10706  * [`block_connected`]: Self::block_connected
10707  */
10708 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);
10709
10710 /**
10711  * Returns the set of txids that should be monitored for re-organization out of the chain.
10712  */
10713 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10714
10715 /**
10716  * Calls the free function if one is set
10717  */
10718 void Persist_free(struct LDKPersist this_ptr);
10719
10720 /**
10721  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
10722  */
10723 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
10724
10725 /**
10726  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
10727  */
10728 void OutPoint_free(struct LDKOutPoint this_obj);
10729
10730 /**
10731  * The referenced transaction's txid.
10732  */
10733 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
10734
10735 /**
10736  * The referenced transaction's txid.
10737  */
10738 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10739
10740 /**
10741  * The index of the referenced output in its transaction's vout.
10742  */
10743 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
10744
10745 /**
10746  * The index of the referenced output in its transaction's vout.
10747  */
10748 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
10749
10750 /**
10751  * Constructs a new OutPoint given each field
10752  */
10753 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
10754
10755 /**
10756  * Creates a copy of the OutPoint
10757  */
10758 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
10759
10760 /**
10761  * Convert an `OutPoint` to a lightning channel id.
10762  */
10763 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
10764
10765 /**
10766  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
10767  */
10768 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
10769
10770 /**
10771  * Read a OutPoint from a byte array, created by OutPoint_write
10772  */
10773 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
10774
10775 /**
10776  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
10777  */
10778 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
10779
10780 /**
10781  * The outpoint which is spendable
10782  */
10783 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10784
10785 /**
10786  * The outpoint which is spendable
10787  */
10788 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10789
10790 /**
10791  * Per commitment point to derive delayed_payment_key by key holder
10792  */
10793 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10794
10795 /**
10796  * Per commitment point to derive delayed_payment_key by key holder
10797  */
10798 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10799
10800 /**
10801  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
10802  * the witness_script.
10803  */
10804 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10805
10806 /**
10807  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
10808  * the witness_script.
10809  */
10810 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
10811
10812 /**
10813  * The output which is referenced by the given outpoint
10814  */
10815 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
10816
10817 /**
10818  * The revocation point specific to the commitment transaction which was broadcast. Used to
10819  * derive the witnessScript for this output.
10820  */
10821 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10822
10823 /**
10824  * The revocation point specific to the commitment transaction which was broadcast. Used to
10825  * derive the witnessScript for this output.
10826  */
10827 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10828
10829 /**
10830  * Arbitrary identification information returned by a call to
10831  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10832  * the channel to spend the output.
10833  */
10834 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
10835
10836 /**
10837  * Arbitrary identification information returned by a call to
10838  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10839  * the channel to spend the output.
10840  */
10841 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10842
10843 /**
10844  * The value of the channel which this output originated from, possibly indirectly.
10845  */
10846 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10847
10848 /**
10849  * The value of the channel which this output originated from, possibly indirectly.
10850  */
10851 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
10852
10853 /**
10854  * Constructs a new DelayedPaymentOutputDescriptor given each field
10855  */
10856 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);
10857
10858 /**
10859  * Creates a copy of the DelayedPaymentOutputDescriptor
10860  */
10861 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
10862
10863 /**
10864  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
10865  */
10866 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
10867
10868 /**
10869  * The outpoint which is spendable
10870  */
10871 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10872
10873 /**
10874  * The outpoint which is spendable
10875  */
10876 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10877
10878 /**
10879  * The output which is referenced by the given outpoint
10880  */
10881 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
10882
10883 /**
10884  * Arbitrary identification information returned by a call to
10885  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10886  * the channel to spend the output.
10887  */
10888 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
10889
10890 /**
10891  * Arbitrary identification information returned by a call to
10892  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10893  * the channel to spend the output.
10894  */
10895 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10896
10897 /**
10898  * The value of the channel which this transactions spends.
10899  */
10900 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10901
10902 /**
10903  * The value of the channel which this transactions spends.
10904  */
10905 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
10906
10907 /**
10908  * Constructs a new StaticPaymentOutputDescriptor given each field
10909  */
10910 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);
10911
10912 /**
10913  * Creates a copy of the StaticPaymentOutputDescriptor
10914  */
10915 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
10916
10917 /**
10918  * Frees any resources used by the SpendableOutputDescriptor
10919  */
10920 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
10921
10922 /**
10923  * Creates a copy of the SpendableOutputDescriptor
10924  */
10925 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
10926
10927 /**
10928  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
10929  */
10930 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
10931
10932 /**
10933  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
10934  */
10935 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
10936
10937 /**
10938  * Calls the free function if one is set
10939  */
10940 void BaseSign_free(struct LDKBaseSign this_ptr);
10941
10942 /**
10943  * Creates a copy of a Sign
10944  */
10945 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
10946
10947 /**
10948  * Calls the free function if one is set
10949  */
10950 void Sign_free(struct LDKSign this_ptr);
10951
10952 /**
10953  * Calls the free function if one is set
10954  */
10955 void KeysInterface_free(struct LDKKeysInterface this_ptr);
10956
10957 /**
10958  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
10959  */
10960 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
10961
10962 /**
10963  * Private key of anchor tx
10964  */
10965 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10966
10967 /**
10968  * Private key of anchor tx
10969  */
10970 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10971
10972 /**
10973  * Holder secret key for blinded revocation pubkey
10974  */
10975 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10976
10977 /**
10978  * Holder secret key for blinded revocation pubkey
10979  */
10980 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10981
10982 /**
10983  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
10984  */
10985 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10986
10987 /**
10988  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
10989  */
10990 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10991
10992 /**
10993  * Holder secret key used in HTLC tx
10994  */
10995 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10996
10997 /**
10998  * Holder secret key used in HTLC tx
10999  */
11000 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
11001
11002 /**
11003  * Holder htlc secret key used in commitment tx htlc outputs
11004  */
11005 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
11006
11007 /**
11008  * Holder htlc secret key used in commitment tx htlc outputs
11009  */
11010 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
11011
11012 /**
11013  * Commitment seed
11014  */
11015 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
11016
11017 /**
11018  * Commitment seed
11019  */
11020 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11021
11022 /**
11023  * Creates a copy of the InMemorySigner
11024  */
11025 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
11026
11027 /**
11028  * Create a new InMemorySigner
11029  */
11030 MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(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);
11031
11032 /**
11033  * Counterparty pubkeys.
11034  * Will panic if ready_channel wasn't called.
11035  */
11036 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11037
11038 /**
11039  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
11040  * transactions, ie the amount of time that we have to wait to recover our funds if we
11041  * broadcast a transaction.
11042  * Will panic if ready_channel wasn't called.
11043  */
11044 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11045
11046 /**
11047  * The contest_delay value specified by us and applied on transactions broadcastable
11048  * by our counterparty, ie the amount of time that they have to wait to recover their funds
11049  * if they broadcast a transaction.
11050  * Will panic if ready_channel wasn't called.
11051  */
11052 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11053
11054 /**
11055  * Whether the holder is the initiator
11056  * Will panic if ready_channel wasn't called.
11057  */
11058 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11059
11060 /**
11061  * Funding outpoint
11062  * Will panic if ready_channel wasn't called.
11063  */
11064 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11065
11066 /**
11067  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
11068  * building transactions.
11069  *
11070  * Will panic if ready_channel wasn't called.
11071  */
11072 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11073
11074 /**
11075  * Sign the single input of spend_tx at index `input_idx` which spends the output
11076  * described by descriptor, returning the witness stack for the input.
11077  *
11078  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
11079  * or is not spending the outpoint described by `descriptor.outpoint`.
11080  */
11081 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);
11082
11083 /**
11084  * Sign the single input of spend_tx at index `input_idx` which spends the output
11085  * described by descriptor, returning the witness stack for the input.
11086  *
11087  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
11088  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
11089  * sequence set to `descriptor.to_self_delay`.
11090  */
11091 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);
11092
11093 /**
11094  * Constructs a new BaseSign which calls the relevant methods on this_arg.
11095  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
11096  */
11097 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11098
11099 /**
11100  * Constructs a new Sign which calls the relevant methods on this_arg.
11101  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
11102  */
11103 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11104
11105 /**
11106  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
11107  */
11108 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
11109
11110 /**
11111  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
11112  */
11113 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
11114
11115 /**
11116  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
11117  */
11118 void KeysManager_free(struct LDKKeysManager this_obj);
11119
11120 /**
11121  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
11122  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
11123  * starting_time isn't strictly required to actually be a time, but it must absolutely,
11124  * without a doubt, be unique to this instance. ie if you start multiple times with the same
11125  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
11126  * simply use the current time (with very high precision).
11127  *
11128  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
11129  * obviously, starting_time should be unique every time you reload the library - it is only
11130  * used to generate new ephemeral key data (which will be stored by the individual channel if
11131  * necessary).
11132  *
11133  * Note that the seed is required to recover certain on-chain funds independent of
11134  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
11135  * channel, and some on-chain during-closing funds.
11136  *
11137  * Note that until the 0.1 release there is no guarantee of backward compatibility between
11138  * versions. Once the library is more fully supported, the docs will be updated to include a
11139  * detailed description of the guarantee.
11140  */
11141 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
11142
11143 /**
11144  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
11145  *
11146  * Key derivation parameters are accessible through a per-channel secrets
11147  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
11148  * onchain output detection for which a corresponding delayed_payment_key must be derived.
11149  */
11150 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]);
11151
11152 /**
11153  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
11154  * output to the given change destination (if sufficient change value remains). The
11155  * transaction will have a feerate, at least, of the given value.
11156  *
11157  * Returns `Err(())` if the output value is greater than the input value minus required fee or
11158  * if a descriptor was duplicated.
11159  *
11160  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
11161  *
11162  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
11163  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
11164  */
11165 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);
11166
11167 /**
11168  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
11169  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
11170  */
11171 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
11172
11173 /**
11174  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
11175  */
11176 void ChannelManager_free(struct LDKChannelManager this_obj);
11177
11178 /**
11179  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
11180  */
11181 void ChainParameters_free(struct LDKChainParameters this_obj);
11182
11183 /**
11184  * The network for determining the `chain_hash` in Lightning messages.
11185  */
11186 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
11187
11188 /**
11189  * The network for determining the `chain_hash` in Lightning messages.
11190  */
11191 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
11192
11193 /**
11194  * The hash and height of the latest block successfully connected.
11195  *
11196  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
11197  */
11198 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
11199
11200 /**
11201  * The hash and height of the latest block successfully connected.
11202  *
11203  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
11204  */
11205 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
11206
11207 /**
11208  * Constructs a new ChainParameters given each field
11209  */
11210 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
11211
11212 /**
11213  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
11214  */
11215 void BestBlock_free(struct LDKBestBlock this_obj);
11216
11217 /**
11218  * Creates a copy of the BestBlock
11219  */
11220 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
11221
11222 /**
11223  * Returns the best block from the genesis of the given network.
11224  */
11225 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
11226
11227 /**
11228  * Returns the best block as identified by the given block hash and height.
11229  */
11230 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
11231
11232 /**
11233  * Returns the best block hash.
11234  */
11235 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
11236
11237 /**
11238  * Returns the best block height.
11239  */
11240 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
11241
11242 /**
11243  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
11244  */
11245 void ChannelDetails_free(struct LDKChannelDetails this_obj);
11246
11247 /**
11248  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
11249  * thereafter this is the txid of the funding transaction xor the funding transaction output).
11250  * Note that this means this value is *not* persistent - it can change once during the
11251  * lifetime of the channel.
11252  */
11253 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
11254
11255 /**
11256  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
11257  * thereafter this is the txid of the funding transaction xor the funding transaction output).
11258  * Note that this means this value is *not* persistent - it can change once during the
11259  * lifetime of the channel.
11260  */
11261 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11262
11263 /**
11264  * The position of the funding transaction in the chain. None if the funding transaction has
11265  * not yet been confirmed and the channel fully opened.
11266  */
11267 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11268
11269 /**
11270  * The position of the funding transaction in the chain. None if the funding transaction has
11271  * not yet been confirmed and the channel fully opened.
11272  */
11273 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
11274
11275 /**
11276  * The node_id of our counterparty
11277  */
11278 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11279
11280 /**
11281  * The node_id of our counterparty
11282  */
11283 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11284
11285 /**
11286  * The Features the channel counterparty provided upon last connection.
11287  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
11288  * many routing-relevant features are present in the init context.
11289  */
11290 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11291
11292 /**
11293  * The Features the channel counterparty provided upon last connection.
11294  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
11295  * many routing-relevant features are present in the init context.
11296  */
11297 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
11298
11299 /**
11300  * The value, in satoshis, of this channel as appears in the funding output
11301  */
11302 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11303
11304 /**
11305  * The value, in satoshis, of this channel as appears in the funding output
11306  */
11307 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11308
11309 /**
11310  * The user_id passed in to create_channel, or 0 if the channel was inbound.
11311  */
11312 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11313
11314 /**
11315  * The user_id passed in to create_channel, or 0 if the channel was inbound.
11316  */
11317 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11318
11319 /**
11320  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
11321  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11322  * available for inclusion in new outbound HTLCs). This further does not include any pending
11323  * outgoing HTLCs which are awaiting some other resolution to be sent.
11324  */
11325 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11326
11327 /**
11328  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
11329  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11330  * available for inclusion in new outbound HTLCs). This further does not include any pending
11331  * outgoing HTLCs which are awaiting some other resolution to be sent.
11332  */
11333 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11334
11335 /**
11336  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
11337  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11338  * available for inclusion in new inbound HTLCs).
11339  * Note that there are some corner cases not fully handled here, so the actual available
11340  * inbound capacity may be slightly higher than this.
11341  */
11342 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11343
11344 /**
11345  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
11346  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11347  * available for inclusion in new inbound HTLCs).
11348  * Note that there are some corner cases not fully handled here, so the actual available
11349  * inbound capacity may be slightly higher than this.
11350  */
11351 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11352
11353 /**
11354  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
11355  * the peer is connected, and (c) no monitor update failure is pending resolution.
11356  */
11357 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11358
11359 /**
11360  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
11361  * the peer is connected, and (c) no monitor update failure is pending resolution.
11362  */
11363 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
11364
11365 /**
11366  * Creates a copy of the ChannelDetails
11367  */
11368 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
11369
11370 /**
11371  * Frees any resources used by the PaymentSendFailure
11372  */
11373 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
11374
11375 /**
11376  * Creates a copy of the PaymentSendFailure
11377  */
11378 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
11379
11380 /**
11381  * Constructs a new ChannelManager to hold several channels and route between them.
11382  *
11383  * This is the main \"logic hub\" for all channel-related actions, and implements
11384  * ChannelMessageHandler.
11385  *
11386  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
11387  *
11388  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
11389  *
11390  * Users need to notify the new ChannelManager when a new block is connected or
11391  * disconnected using its `block_connected` and `block_disconnected` methods, starting
11392  * from after `params.latest_hash`.
11393  */
11394 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);
11395
11396 /**
11397  * Gets the current configuration applied to all new channels,  as
11398  */
11399 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
11400
11401 /**
11402  * Creates a new outbound channel to the given remote node and with the given value.
11403  *
11404  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
11405  * tracking of which events correspond with which create_channel call. Note that the
11406  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
11407  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
11408  * otherwise ignored.
11409  *
11410  * If successful, will generate a SendOpenChannel message event, so you should probably poll
11411  * PeerManager::process_events afterwards.
11412  *
11413  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
11414  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
11415  */
11416 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ 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_id, struct LDKUserConfig override_config);
11417
11418 /**
11419  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
11420  * more information.
11421  */
11422 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11423
11424 /**
11425  * Gets the list of usable channels, in random order. Useful as an argument to
11426  * get_route to ensure non-announced channels are used.
11427  *
11428  * These are guaranteed to have their is_live value set to true, see the documentation for
11429  * ChannelDetails::is_live for more info on exactly what the criteria are.
11430  */
11431 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11432
11433 /**
11434  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
11435  * will be accepted on the given channel, and after additional timeout/the closing of all
11436  * pending HTLCs, the channel will be closed on chain.
11437  *
11438  * May generate a SendShutdown message event on success, which should be relayed.
11439  */
11440 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
11441
11442 /**
11443  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
11444  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
11445  */
11446 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
11447
11448 /**
11449  * Force close all channels, immediately broadcasting the latest local commitment transaction
11450  * for each to the chain and rejecting new HTLCs on each.
11451  */
11452 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11453
11454 /**
11455  * Sends a payment along a given route.
11456  *
11457  * Value parameters are provided via the last hop in route, see documentation for RouteHop
11458  * fields for more info.
11459  *
11460  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
11461  * payment), we don't do anything to stop you! We always try to ensure that if the provided
11462  * next hop knows the preimage to payment_hash they can claim an additional amount as
11463  * specified in the last hop in the route! Thus, you should probably do your own
11464  * payment_preimage tracking (which you should already be doing as they represent \"proof of
11465  * payment\") and prevent double-sends yourself.
11466  *
11467  * May generate SendHTLCs message(s) event on success, which should be relayed.
11468  *
11469  * Each path may have a different return value, and PaymentSendValue may return a Vec with
11470  * each entry matching the corresponding-index entry in the route paths, see
11471  * PaymentSendFailure for more info.
11472  *
11473  * In general, a path may raise:
11474  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
11475  *    node public key) is specified.
11476  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
11477  *    (including due to previous monitor update failure or new permanent monitor update
11478  *    failure).
11479  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
11480  *    relevant updates.
11481  *
11482  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
11483  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
11484  * different route unless you intend to pay twice!
11485  *
11486  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
11487  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
11488  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
11489  * must not contain multiple paths as multi-path payments require a recipient-provided
11490  * payment_secret.
11491  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
11492  * bit set (either as required or as available). If multiple paths are present in the Route,
11493  * we assume the invoice had the basic_mpp feature set.
11494  */
11495 MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
11496
11497 /**
11498  * Call this upon creation of a funding transaction for the given channel.
11499  *
11500  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
11501  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
11502  *
11503  * Panics if a funding transaction has already been provided for this channel.
11504  *
11505  * May panic if the output found in the funding transaction is duplicative with some other
11506  * channel (note that this should be trivially prevented by using unique funding transaction
11507  * keys per-channel).
11508  *
11509  * Do NOT broadcast the funding transaction yourself. When we have safely received our
11510  * counterparty's signature the funding transaction will automatically be broadcast via the
11511  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
11512  *
11513  * Note that this includes RBF or similar transaction replacement strategies - lightning does
11514  * not currently support replacing a funding transaction on an existing channel. Instead,
11515  * create a new channel with a conflicting funding transaction.
11516  */
11517 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 LDKTransaction funding_transaction);
11518
11519 /**
11520  * Generates a signed node_announcement from the given arguments and creates a
11521  * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
11522  * seen a channel_announcement from us (ie unless we have public channels open).
11523  *
11524  * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
11525  * to humans. They carry no in-protocol meaning.
11526  *
11527  * addresses represent the set (possibly empty) of socket addresses on which this node accepts
11528  * incoming connections. These will be broadcast to the network, publicly tying these
11529  * addresses together. If you wish to preserve user privacy, addresses should likely contain
11530  * only Tor Onion addresses.
11531  *
11532  * Panics if addresses is absurdly large (more than 500).
11533  */
11534 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
11535
11536 /**
11537  * Processes HTLCs which are pending waiting on random forward delay.
11538  *
11539  * Should only really ever be called in response to a PendingHTLCsForwardable event.
11540  * Will likely generate further events.
11541  */
11542 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
11543
11544 /**
11545  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
11546  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
11547  * to inform the network about the uselessness of these channels.
11548  *
11549  * This method handles all the details, and must be called roughly once per minute.
11550  *
11551  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
11552  */
11553 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
11554
11555 /**
11556  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
11557  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
11558  * along the path (including in our own channel on which we received it).
11559  * Returns false if no payment was found to fail backwards, true if the process of failing the
11560  * HTLC backwards has been started.
11561  */
11562 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKThirtyTwoBytes payment_secret);
11563
11564 /**
11565  * Provides a payment preimage in response to a PaymentReceived event, returning true and
11566  * generating message events for the net layer to claim the payment, if possible. Thus, you
11567  * should probably kick the net layer to go send messages if this returns true!
11568  *
11569  * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
11570  * available within a few percent of the expected amount. This is critical for several
11571  * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
11572  * payment_preimage without having provided the full value and b) it avoids certain
11573  * privacy-breaking recipient-probing attacks which may reveal payment activity to
11574  * motivated attackers.
11575  *
11576  * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
11577  * set. Thus, for such payments we will claim any payments which do not under-pay.
11578  *
11579  * May panic if called except in response to a PaymentReceived event.
11580  */
11581 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t expected_amount);
11582
11583 /**
11584  * Gets the node_id held by this ChannelManager
11585  */
11586 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
11587
11588 /**
11589  * Restores a single, given channel to normal operation after a
11590  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
11591  * operation.
11592  *
11593  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
11594  * fully committed in every copy of the given channels' ChannelMonitors.
11595  *
11596  * Note that there is no effect to calling with a highest_applied_update_id other than the
11597  * current latest ChannelMonitorUpdate and one call to this function after multiple
11598  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
11599  * exists largely only to prevent races between this and concurrent update_monitor calls.
11600  *
11601  * Thus, the anticipated use is, at a high level:
11602  *  1) You register a chain::Watch with this ChannelManager,
11603  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
11604  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
11605  *     any time it cannot do so instantly,
11606  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
11607  *  4) once all remote copies are updated, you call this function with the update_id that
11608  *     completed, and once it is the latest the Channel will be re-enabled.
11609  */
11610 void ChannelManager_channel_monitor_updated(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOutPoint *NONNULL_PTR funding_txo, uint64_t highest_applied_update_id);
11611
11612 /**
11613  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
11614  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
11615  */
11616 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
11617
11618 /**
11619  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
11620  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
11621  */
11622 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
11623
11624 /**
11625  * Constructs a new Listen which calls the relevant methods on this_arg.
11626  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
11627  */
11628 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
11629
11630 /**
11631  * Constructs a new Confirm which calls the relevant methods on this_arg.
11632  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
11633  */
11634 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
11635
11636 /**
11637  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
11638  * indicating whether persistence is necessary. Only one listener on
11639  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
11640  * up.
11641  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
11642  */
11643 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
11644
11645 /**
11646  * Blocks until ChannelManager needs to be persisted. Only one listener on
11647  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
11648  * up.
11649  */
11650 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
11651
11652 /**
11653  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
11654  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
11655  */
11656 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
11657
11658 /**
11659  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
11660  */
11661 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
11662
11663 /**
11664  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
11665  */
11666 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
11667
11668 /**
11669  * The keys provider which will give us relevant keys. Some keys will be loaded during
11670  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
11671  * signing data.
11672  */
11673 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11674
11675 /**
11676  * The keys provider which will give us relevant keys. Some keys will be loaded during
11677  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
11678  * signing data.
11679  */
11680 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
11681
11682 /**
11683  * The fee_estimator for use in the ChannelManager in the future.
11684  *
11685  * No calls to the FeeEstimator will be made during deserialization.
11686  */
11687 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11688
11689 /**
11690  * The fee_estimator for use in the ChannelManager in the future.
11691  *
11692  * No calls to the FeeEstimator will be made during deserialization.
11693  */
11694 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
11695
11696 /**
11697  * The chain::Watch for use in the ChannelManager in the future.
11698  *
11699  * No calls to the chain::Watch will be made during deserialization. It is assumed that
11700  * you have deserialized ChannelMonitors separately and will add them to your
11701  * chain::Watch after deserializing this ChannelManager.
11702  */
11703 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11704
11705 /**
11706  * The chain::Watch for use in the ChannelManager in the future.
11707  *
11708  * No calls to the chain::Watch will be made during deserialization. It is assumed that
11709  * you have deserialized ChannelMonitors separately and will add them to your
11710  * chain::Watch after deserializing this ChannelManager.
11711  */
11712 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
11713
11714 /**
11715  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
11716  * used to broadcast the latest local commitment transactions of channels which must be
11717  * force-closed during deserialization.
11718  */
11719 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11720
11721 /**
11722  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
11723  * used to broadcast the latest local commitment transactions of channels which must be
11724  * force-closed during deserialization.
11725  */
11726 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
11727
11728 /**
11729  * The Logger for use in the ChannelManager and which may be used to log information during
11730  * deserialization.
11731  */
11732 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11733
11734 /**
11735  * The Logger for use in the ChannelManager and which may be used to log information during
11736  * deserialization.
11737  */
11738 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
11739
11740 /**
11741  * Default settings used for new channels. Any existing channels will continue to use the
11742  * runtime settings which were stored when the ChannelManager was serialized.
11743  */
11744 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11745
11746 /**
11747  * Default settings used for new channels. Any existing channels will continue to use the
11748  * runtime settings which were stored when the ChannelManager was serialized.
11749  */
11750 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
11751
11752 /**
11753  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
11754  * HashMap for you. This is primarily useful for C bindings where it is not practical to
11755  * populate a HashMap directly from C.
11756  */
11757 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);
11758
11759 /**
11760  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
11761  */
11762 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
11763
11764 /**
11765  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
11766  */
11767 void DecodeError_free(struct LDKDecodeError this_obj);
11768
11769 /**
11770  * Creates a copy of the DecodeError
11771  */
11772 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
11773
11774 /**
11775  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
11776  */
11777 void Init_free(struct LDKInit this_obj);
11778
11779 /**
11780  * The relevant features which the sender supports
11781  */
11782 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
11783
11784 /**
11785  * The relevant features which the sender supports
11786  */
11787 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
11788
11789 /**
11790  * Constructs a new Init given each field
11791  */
11792 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
11793
11794 /**
11795  * Creates a copy of the Init
11796  */
11797 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
11798
11799 /**
11800  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
11801  */
11802 void ErrorMessage_free(struct LDKErrorMessage this_obj);
11803
11804 /**
11805  * The channel ID involved in the error
11806  */
11807 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
11808
11809 /**
11810  * The channel ID involved in the error
11811  */
11812 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11813
11814 /**
11815  * A possibly human-readable error description.
11816  * The string should be sanitized before it is used (e.g. emitted to logs
11817  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
11818  * vulnerability in the terminal emulator or the logging subsystem.
11819  */
11820 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
11821
11822 /**
11823  * A possibly human-readable error description.
11824  * The string should be sanitized before it is used (e.g. emitted to logs
11825  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
11826  * vulnerability in the terminal emulator or the logging subsystem.
11827  */
11828 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
11829
11830 /**
11831  * Constructs a new ErrorMessage given each field
11832  */
11833 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg);
11834
11835 /**
11836  * Creates a copy of the ErrorMessage
11837  */
11838 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
11839
11840 /**
11841  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
11842  */
11843 void Ping_free(struct LDKPing this_obj);
11844
11845 /**
11846  * The desired response length
11847  */
11848 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
11849
11850 /**
11851  * The desired response length
11852  */
11853 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
11854
11855 /**
11856  * The ping packet size.
11857  * This field is not sent on the wire. byteslen zeros are sent.
11858  */
11859 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
11860
11861 /**
11862  * The ping packet size.
11863  * This field is not sent on the wire. byteslen zeros are sent.
11864  */
11865 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
11866
11867 /**
11868  * Constructs a new Ping given each field
11869  */
11870 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
11871
11872 /**
11873  * Creates a copy of the Ping
11874  */
11875 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
11876
11877 /**
11878  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
11879  */
11880 void Pong_free(struct LDKPong this_obj);
11881
11882 /**
11883  * The pong packet size.
11884  * This field is not sent on the wire. byteslen zeros are sent.
11885  */
11886 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
11887
11888 /**
11889  * The pong packet size.
11890  * This field is not sent on the wire. byteslen zeros are sent.
11891  */
11892 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
11893
11894 /**
11895  * Constructs a new Pong given each field
11896  */
11897 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
11898
11899 /**
11900  * Creates a copy of the Pong
11901  */
11902 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
11903
11904 /**
11905  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
11906  */
11907 void OpenChannel_free(struct LDKOpenChannel this_obj);
11908
11909 /**
11910  * The genesis hash of the blockchain where the channel is to be opened
11911  */
11912 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
11913
11914 /**
11915  * The genesis hash of the blockchain where the channel is to be opened
11916  */
11917 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11918
11919 /**
11920  * A temporary channel ID, until the funding outpoint is announced
11921  */
11922 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
11923
11924 /**
11925  * A temporary channel ID, until the funding outpoint is announced
11926  */
11927 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11928
11929 /**
11930  * The channel value
11931  */
11932 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11933
11934 /**
11935  * The channel value
11936  */
11937 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11938
11939 /**
11940  * The amount to push to the counterparty as part of the open, in milli-satoshi
11941  */
11942 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11943
11944 /**
11945  * The amount to push to the counterparty as part of the open, in milli-satoshi
11946  */
11947 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11948
11949 /**
11950  * The threshold below which outputs on transactions broadcast by sender will be omitted
11951  */
11952 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11953
11954 /**
11955  * The threshold below which outputs on transactions broadcast by sender will be omitted
11956  */
11957 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11958
11959 /**
11960  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
11961  */
11962 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11963
11964 /**
11965  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
11966  */
11967 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11968
11969 /**
11970  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
11971  */
11972 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11973
11974 /**
11975  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
11976  */
11977 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11978
11979 /**
11980  * The minimum HTLC size incoming to sender, in milli-satoshi
11981  */
11982 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11983
11984 /**
11985  * The minimum HTLC size incoming to sender, in milli-satoshi
11986  */
11987 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11988
11989 /**
11990  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
11991  */
11992 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11993
11994 /**
11995  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
11996  */
11997 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
11998
11999 /**
12000  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
12001  */
12002 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12003
12004 /**
12005  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
12006  */
12007 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
12008
12009 /**
12010  * The maximum number of inbound HTLCs towards sender
12011  */
12012 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12013
12014 /**
12015  * The maximum number of inbound HTLCs towards sender
12016  */
12017 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
12018
12019 /**
12020  * The sender's key controlling the funding transaction
12021  */
12022 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12023
12024 /**
12025  * The sender's key controlling the funding transaction
12026  */
12027 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12028
12029 /**
12030  * Used to derive a revocation key for transactions broadcast by counterparty
12031  */
12032 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12033
12034 /**
12035  * Used to derive a revocation key for transactions broadcast by counterparty
12036  */
12037 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12038
12039 /**
12040  * A payment key to sender for transactions broadcast by counterparty
12041  */
12042 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12043
12044 /**
12045  * A payment key to sender for transactions broadcast by counterparty
12046  */
12047 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12048
12049 /**
12050  * Used to derive a payment key to sender for transactions broadcast by sender
12051  */
12052 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12053
12054 /**
12055  * Used to derive a payment key to sender for transactions broadcast by sender
12056  */
12057 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12058
12059 /**
12060  * Used to derive an HTLC payment key to sender
12061  */
12062 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12063
12064 /**
12065  * Used to derive an HTLC payment key to sender
12066  */
12067 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12068
12069 /**
12070  * The first to-be-broadcast-by-sender transaction's per commitment point
12071  */
12072 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12073
12074 /**
12075  * The first to-be-broadcast-by-sender transaction's per commitment point
12076  */
12077 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12078
12079 /**
12080  * Channel flags
12081  */
12082 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12083
12084 /**
12085  * Channel flags
12086  */
12087 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
12088
12089 /**
12090  * Creates a copy of the OpenChannel
12091  */
12092 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
12093
12094 /**
12095  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
12096  */
12097 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
12098
12099 /**
12100  * A temporary channel ID, until the funding outpoint is announced
12101  */
12102 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
12103
12104 /**
12105  * A temporary channel ID, until the funding outpoint is announced
12106  */
12107 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12108
12109 /**
12110  * The threshold below which outputs on transactions broadcast by sender will be omitted
12111  */
12112 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12113
12114 /**
12115  * The threshold below which outputs on transactions broadcast by sender will be omitted
12116  */
12117 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
12118
12119 /**
12120  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
12121  */
12122 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12123
12124 /**
12125  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
12126  */
12127 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
12128
12129 /**
12130  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
12131  */
12132 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12133
12134 /**
12135  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
12136  */
12137 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
12138
12139 /**
12140  * The minimum HTLC size incoming to sender, in milli-satoshi
12141  */
12142 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12143
12144 /**
12145  * The minimum HTLC size incoming to sender, in milli-satoshi
12146  */
12147 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
12148
12149 /**
12150  * Minimum depth of the funding transaction before the channel is considered open
12151  */
12152 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12153
12154 /**
12155  * Minimum depth of the funding transaction before the channel is considered open
12156  */
12157 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
12158
12159 /**
12160  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
12161  */
12162 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12163
12164 /**
12165  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
12166  */
12167 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
12168
12169 /**
12170  * The maximum number of inbound HTLCs towards sender
12171  */
12172 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12173
12174 /**
12175  * The maximum number of inbound HTLCs towards sender
12176  */
12177 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
12178
12179 /**
12180  * The sender's key controlling the funding transaction
12181  */
12182 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12183
12184 /**
12185  * The sender's key controlling the funding transaction
12186  */
12187 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12188
12189 /**
12190  * Used to derive a revocation key for transactions broadcast by counterparty
12191  */
12192 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12193
12194 /**
12195  * Used to derive a revocation key for transactions broadcast by counterparty
12196  */
12197 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12198
12199 /**
12200  * A payment key to sender for transactions broadcast by counterparty
12201  */
12202 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12203
12204 /**
12205  * A payment key to sender for transactions broadcast by counterparty
12206  */
12207 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12208
12209 /**
12210  * Used to derive a payment key to sender for transactions broadcast by sender
12211  */
12212 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12213
12214 /**
12215  * Used to derive a payment key to sender for transactions broadcast by sender
12216  */
12217 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12218
12219 /**
12220  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
12221  */
12222 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12223
12224 /**
12225  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
12226  */
12227 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12228
12229 /**
12230  * The first to-be-broadcast-by-sender transaction's per commitment point
12231  */
12232 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12233
12234 /**
12235  * The first to-be-broadcast-by-sender transaction's per commitment point
12236  */
12237 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12238
12239 /**
12240  * Creates a copy of the AcceptChannel
12241  */
12242 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
12243
12244 /**
12245  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
12246  */
12247 void FundingCreated_free(struct LDKFundingCreated this_obj);
12248
12249 /**
12250  * A temporary channel ID, until the funding is established
12251  */
12252 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
12253
12254 /**
12255  * A temporary channel ID, until the funding is established
12256  */
12257 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12258
12259 /**
12260  * The funding transaction ID
12261  */
12262 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
12263
12264 /**
12265  * The funding transaction ID
12266  */
12267 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12268
12269 /**
12270  * The specific output index funding this channel
12271  */
12272 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
12273
12274 /**
12275  * The specific output index funding this channel
12276  */
12277 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
12278
12279 /**
12280  * The signature of the channel initiator (funder) on the funding transaction
12281  */
12282 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
12283
12284 /**
12285  * The signature of the channel initiator (funder) on the funding transaction
12286  */
12287 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
12288
12289 /**
12290  * Constructs a new FundingCreated given each field
12291  */
12292 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);
12293
12294 /**
12295  * Creates a copy of the FundingCreated
12296  */
12297 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
12298
12299 /**
12300  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
12301  */
12302 void FundingSigned_free(struct LDKFundingSigned this_obj);
12303
12304 /**
12305  * The channel ID
12306  */
12307 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
12308
12309 /**
12310  * The channel ID
12311  */
12312 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12313
12314 /**
12315  * The signature of the channel acceptor (fundee) on the funding transaction
12316  */
12317 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
12318
12319 /**
12320  * The signature of the channel acceptor (fundee) on the funding transaction
12321  */
12322 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12323
12324 /**
12325  * Constructs a new FundingSigned given each field
12326  */
12327 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
12328
12329 /**
12330  * Creates a copy of the FundingSigned
12331  */
12332 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
12333
12334 /**
12335  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
12336  */
12337 void FundingLocked_free(struct LDKFundingLocked this_obj);
12338
12339 /**
12340  * The channel ID
12341  */
12342 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
12343
12344 /**
12345  * The channel ID
12346  */
12347 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12348
12349 /**
12350  * The per-commitment point of the second commitment transaction
12351  */
12352 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
12353
12354 /**
12355  * The per-commitment point of the second commitment transaction
12356  */
12357 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12358
12359 /**
12360  * Constructs a new FundingLocked given each field
12361  */
12362 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
12363
12364 /**
12365  * Creates a copy of the FundingLocked
12366  */
12367 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
12368
12369 /**
12370  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
12371  */
12372 void Shutdown_free(struct LDKShutdown this_obj);
12373
12374 /**
12375  * The channel ID
12376  */
12377 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
12378
12379 /**
12380  * The channel ID
12381  */
12382 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12383
12384 /**
12385  * The destination of this peer's funds on closing.
12386  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
12387  */
12388 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
12389
12390 /**
12391  * The destination of this peer's funds on closing.
12392  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
12393  */
12394 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
12395
12396 /**
12397  * Constructs a new Shutdown given each field
12398  */
12399 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
12400
12401 /**
12402  * Creates a copy of the Shutdown
12403  */
12404 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
12405
12406 /**
12407  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
12408  */
12409 void ClosingSigned_free(struct LDKClosingSigned this_obj);
12410
12411 /**
12412  * The channel ID
12413  */
12414 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
12415
12416 /**
12417  * The channel ID
12418  */
12419 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12420
12421 /**
12422  * The proposed total fee for the closing transaction
12423  */
12424 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
12425
12426 /**
12427  * The proposed total fee for the closing transaction
12428  */
12429 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
12430
12431 /**
12432  * A signature on the closing transaction
12433  */
12434 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
12435
12436 /**
12437  * A signature on the closing transaction
12438  */
12439 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12440
12441 /**
12442  * Constructs a new ClosingSigned given each field
12443  */
12444 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
12445
12446 /**
12447  * Creates a copy of the ClosingSigned
12448  */
12449 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
12450
12451 /**
12452  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
12453  */
12454 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
12455
12456 /**
12457  * The channel ID
12458  */
12459 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
12460
12461 /**
12462  * The channel ID
12463  */
12464 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12465
12466 /**
12467  * The HTLC ID
12468  */
12469 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12470
12471 /**
12472  * The HTLC ID
12473  */
12474 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
12475
12476 /**
12477  * The HTLC value in milli-satoshi
12478  */
12479 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12480
12481 /**
12482  * The HTLC value in milli-satoshi
12483  */
12484 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
12485
12486 /**
12487  * The payment hash, the pre-image of which controls HTLC redemption
12488  */
12489 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
12490
12491 /**
12492  * The payment hash, the pre-image of which controls HTLC redemption
12493  */
12494 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12495
12496 /**
12497  * The expiry height of the HTLC
12498  */
12499 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12500
12501 /**
12502  * The expiry height of the HTLC
12503  */
12504 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
12505
12506 /**
12507  * Creates a copy of the UpdateAddHTLC
12508  */
12509 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
12510
12511 /**
12512  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
12513  */
12514 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
12515
12516 /**
12517  * The channel ID
12518  */
12519 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
12520
12521 /**
12522  * The channel ID
12523  */
12524 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12525
12526 /**
12527  * The HTLC ID
12528  */
12529 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
12530
12531 /**
12532  * The HTLC ID
12533  */
12534 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
12535
12536 /**
12537  * The pre-image of the payment hash, allowing HTLC redemption
12538  */
12539 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
12540
12541 /**
12542  * The pre-image of the payment hash, allowing HTLC redemption
12543  */
12544 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12545
12546 /**
12547  * Constructs a new UpdateFulfillHTLC given each field
12548  */
12549 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
12550
12551 /**
12552  * Creates a copy of the UpdateFulfillHTLC
12553  */
12554 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
12555
12556 /**
12557  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
12558  */
12559 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
12560
12561 /**
12562  * The channel ID
12563  */
12564 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
12565
12566 /**
12567  * The channel ID
12568  */
12569 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12570
12571 /**
12572  * The HTLC ID
12573  */
12574 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
12575
12576 /**
12577  * The HTLC ID
12578  */
12579 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
12580
12581 /**
12582  * Creates a copy of the UpdateFailHTLC
12583  */
12584 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
12585
12586 /**
12587  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
12588  */
12589 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
12590
12591 /**
12592  * The channel ID
12593  */
12594 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
12595
12596 /**
12597  * The channel ID
12598  */
12599 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12600
12601 /**
12602  * The HTLC ID
12603  */
12604 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
12605
12606 /**
12607  * The HTLC ID
12608  */
12609 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
12610
12611 /**
12612  * The failure code
12613  */
12614 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
12615
12616 /**
12617  * The failure code
12618  */
12619 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
12620
12621 /**
12622  * Creates a copy of the UpdateFailMalformedHTLC
12623  */
12624 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
12625
12626 /**
12627  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
12628  */
12629 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
12630
12631 /**
12632  * The channel ID
12633  */
12634 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
12635
12636 /**
12637  * The channel ID
12638  */
12639 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12640
12641 /**
12642  * A signature on the commitment transaction
12643  */
12644 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
12645
12646 /**
12647  * A signature on the commitment transaction
12648  */
12649 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12650
12651 /**
12652  * Signatures on the HTLC transactions
12653  */
12654 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
12655
12656 /**
12657  * Constructs a new CommitmentSigned given each field
12658  */
12659 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
12660
12661 /**
12662  * Creates a copy of the CommitmentSigned
12663  */
12664 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
12665
12666 /**
12667  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
12668  */
12669 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
12670
12671 /**
12672  * The channel ID
12673  */
12674 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
12675
12676 /**
12677  * The channel ID
12678  */
12679 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12680
12681 /**
12682  * The secret corresponding to the per-commitment point
12683  */
12684 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
12685
12686 /**
12687  * The secret corresponding to the per-commitment point
12688  */
12689 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12690
12691 /**
12692  * The next sender-broadcast commitment transaction's per-commitment point
12693  */
12694 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
12695
12696 /**
12697  * The next sender-broadcast commitment transaction's per-commitment point
12698  */
12699 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12700
12701 /**
12702  * Constructs a new RevokeAndACK given each field
12703  */
12704 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);
12705
12706 /**
12707  * Creates a copy of the RevokeAndACK
12708  */
12709 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
12710
12711 /**
12712  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
12713  */
12714 void UpdateFee_free(struct LDKUpdateFee this_obj);
12715
12716 /**
12717  * The channel ID
12718  */
12719 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
12720
12721 /**
12722  * The channel ID
12723  */
12724 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12725
12726 /**
12727  * Fee rate per 1000-weight of the transaction
12728  */
12729 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
12730
12731 /**
12732  * Fee rate per 1000-weight of the transaction
12733  */
12734 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
12735
12736 /**
12737  * Constructs a new UpdateFee given each field
12738  */
12739 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
12740
12741 /**
12742  * Creates a copy of the UpdateFee
12743  */
12744 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
12745
12746 /**
12747  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
12748  */
12749 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
12750
12751 /**
12752  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
12753  * belonging to the recipient
12754  */
12755 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
12756
12757 /**
12758  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
12759  * belonging to the recipient
12760  */
12761 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12762
12763 /**
12764  * The sender's per-commitment point for their current commitment transaction
12765  */
12766 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
12767
12768 /**
12769  * The sender's per-commitment point for their current commitment transaction
12770  */
12771 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12772
12773 /**
12774  * Constructs a new DataLossProtect given each field
12775  */
12776 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
12777
12778 /**
12779  * Creates a copy of the DataLossProtect
12780  */
12781 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
12782
12783 /**
12784  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
12785  */
12786 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
12787
12788 /**
12789  * The channel ID
12790  */
12791 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
12792
12793 /**
12794  * The channel ID
12795  */
12796 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12797
12798 /**
12799  * The next commitment number for the sender
12800  */
12801 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
12802
12803 /**
12804  * The next commitment number for the sender
12805  */
12806 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
12807
12808 /**
12809  * The next commitment number for the recipient
12810  */
12811 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
12812
12813 /**
12814  * The next commitment number for the recipient
12815  */
12816 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
12817
12818 /**
12819  * Creates a copy of the ChannelReestablish
12820  */
12821 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
12822
12823 /**
12824  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
12825  */
12826 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
12827
12828 /**
12829  * The channel ID
12830  */
12831 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
12832
12833 /**
12834  * The channel ID
12835  */
12836 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12837
12838 /**
12839  * The short channel ID
12840  */
12841 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12842
12843 /**
12844  * The short channel ID
12845  */
12846 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
12847
12848 /**
12849  * A signature by the node key
12850  */
12851 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12852
12853 /**
12854  * A signature by the node key
12855  */
12856 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
12857
12858 /**
12859  * A signature by the funding key
12860  */
12861 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12862
12863 /**
12864  * A signature by the funding key
12865  */
12866 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
12867
12868 /**
12869  * Constructs a new AnnouncementSignatures given each field
12870  */
12871 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);
12872
12873 /**
12874  * Creates a copy of the AnnouncementSignatures
12875  */
12876 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
12877
12878 /**
12879  * Frees any resources used by the NetAddress
12880  */
12881 void NetAddress_free(struct LDKNetAddress this_ptr);
12882
12883 /**
12884  * Creates a copy of the NetAddress
12885  */
12886 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
12887
12888 /**
12889  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
12890  */
12891 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
12892
12893 /**
12894  * Read a Result from a byte array, created by Result_write
12895  */
12896 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
12897
12898 /**
12899  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
12900  */
12901 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
12902
12903 /**
12904  * The advertised features
12905  */
12906 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12907
12908 /**
12909  * The advertised features
12910  */
12911 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
12912
12913 /**
12914  * A strictly monotonic announcement counter, with gaps allowed
12915  */
12916 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12917
12918 /**
12919  * A strictly monotonic announcement counter, with gaps allowed
12920  */
12921 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
12922
12923 /**
12924  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
12925  * to this node).
12926  */
12927 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12928
12929 /**
12930  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
12931  * to this node).
12932  */
12933 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12934
12935 /**
12936  * An RGB color for UI purposes
12937  */
12938 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
12939
12940 /**
12941  * An RGB color for UI purposes
12942  */
12943 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
12944
12945 /**
12946  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
12947  * of uniqueness.
12948  */
12949 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
12950
12951 /**
12952  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
12953  * of uniqueness.
12954  */
12955 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12956
12957 /**
12958  * List of addresses on which this node is reachable
12959  */
12960 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
12961
12962 /**
12963  * Creates a copy of the UnsignedNodeAnnouncement
12964  */
12965 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
12966
12967 /**
12968  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
12969  */
12970 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
12971
12972 /**
12973  * The signature by the node key
12974  */
12975 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
12976
12977 /**
12978  * The signature by the node key
12979  */
12980 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
12981
12982 /**
12983  * The actual content of the announcement
12984  */
12985 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
12986
12987 /**
12988  * The actual content of the announcement
12989  */
12990 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
12991
12992 /**
12993  * Constructs a new NodeAnnouncement given each field
12994  */
12995 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
12996
12997 /**
12998  * Creates a copy of the NodeAnnouncement
12999  */
13000 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
13001
13002 /**
13003  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
13004  */
13005 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
13006
13007 /**
13008  * The advertised channel features
13009  */
13010 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13011
13012 /**
13013  * The advertised channel features
13014  */
13015 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
13016
13017 /**
13018  * The genesis hash of the blockchain where the channel is to be opened
13019  */
13020 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
13021
13022 /**
13023  * The genesis hash of the blockchain where the channel is to be opened
13024  */
13025 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13026
13027 /**
13028  * The short channel ID
13029  */
13030 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13031
13032 /**
13033  * The short channel ID
13034  */
13035 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
13036
13037 /**
13038  * One of the two node_ids which are endpoints of this channel
13039  */
13040 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13041
13042 /**
13043  * One of the two node_ids which are endpoints of this channel
13044  */
13045 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13046
13047 /**
13048  * The other of the two node_ids which are endpoints of this channel
13049  */
13050 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13051
13052 /**
13053  * The other of the two node_ids which are endpoints of this channel
13054  */
13055 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13056
13057 /**
13058  * The funding key for the first node
13059  */
13060 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13061
13062 /**
13063  * The funding key for the first node
13064  */
13065 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13066
13067 /**
13068  * The funding key for the second node
13069  */
13070 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13071
13072 /**
13073  * The funding key for the second node
13074  */
13075 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13076
13077 /**
13078  * Creates a copy of the UnsignedChannelAnnouncement
13079  */
13080 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
13081
13082 /**
13083  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
13084  */
13085 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
13086
13087 /**
13088  * Authentication of the announcement by the first public node
13089  */
13090 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13091
13092 /**
13093  * Authentication of the announcement by the first public node
13094  */
13095 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
13096
13097 /**
13098  * Authentication of the announcement by the second public node
13099  */
13100 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13101
13102 /**
13103  * Authentication of the announcement by the second public node
13104  */
13105 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
13106
13107 /**
13108  * Proof of funding UTXO ownership by the first public node
13109  */
13110 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13111
13112 /**
13113  * Proof of funding UTXO ownership by the first public node
13114  */
13115 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
13116
13117 /**
13118  * Proof of funding UTXO ownership by the second public node
13119  */
13120 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13121
13122 /**
13123  * Proof of funding UTXO ownership by the second public node
13124  */
13125 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
13126
13127 /**
13128  * The actual announcement
13129  */
13130 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13131
13132 /**
13133  * The actual announcement
13134  */
13135 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
13136
13137 /**
13138  * Constructs a new ChannelAnnouncement given each field
13139  */
13140 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);
13141
13142 /**
13143  * Creates a copy of the ChannelAnnouncement
13144  */
13145 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
13146
13147 /**
13148  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
13149  */
13150 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
13151
13152 /**
13153  * The genesis hash of the blockchain where the channel is to be opened
13154  */
13155 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
13156
13157 /**
13158  * The genesis hash of the blockchain where the channel is to be opened
13159  */
13160 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13161
13162 /**
13163  * The short channel ID
13164  */
13165 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13166
13167 /**
13168  * The short channel ID
13169  */
13170 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
13171
13172 /**
13173  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
13174  */
13175 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13176
13177 /**
13178  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
13179  */
13180 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
13181
13182 /**
13183  * Channel flags
13184  */
13185 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13186
13187 /**
13188  * Channel flags
13189  */
13190 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
13191
13192 /**
13193  * The number of blocks such that if:
13194  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
13195  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
13196  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
13197  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
13198  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
13199  * forwarding. Note that the HTLC sender is the one who originally sets this value when
13200  * constructing the route.
13201  */
13202 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13203
13204 /**
13205  * The number of blocks such that if:
13206  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
13207  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
13208  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
13209  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
13210  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
13211  * forwarding. Note that the HTLC sender is the one who originally sets this value when
13212  * constructing the route.
13213  */
13214 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
13215
13216 /**
13217  * The minimum HTLC size incoming to sender, in milli-satoshi
13218  */
13219 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13220
13221 /**
13222  * The minimum HTLC size incoming to sender, in milli-satoshi
13223  */
13224 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
13225
13226 /**
13227  * The base HTLC fee charged by sender, in milli-satoshi
13228  */
13229 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13230
13231 /**
13232  * The base HTLC fee charged by sender, in milli-satoshi
13233  */
13234 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
13235
13236 /**
13237  * The amount to fee multiplier, in micro-satoshi
13238  */
13239 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13240
13241 /**
13242  * The amount to fee multiplier, in micro-satoshi
13243  */
13244 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
13245
13246 /**
13247  * Creates a copy of the UnsignedChannelUpdate
13248  */
13249 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
13250
13251 /**
13252  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
13253  */
13254 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
13255
13256 /**
13257  * A signature of the channel update
13258  */
13259 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
13260
13261 /**
13262  * A signature of the channel update
13263  */
13264 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
13265
13266 /**
13267  * The actual channel update
13268  */
13269 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
13270
13271 /**
13272  * The actual channel update
13273  */
13274 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
13275
13276 /**
13277  * Constructs a new ChannelUpdate given each field
13278  */
13279 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
13280
13281 /**
13282  * Creates a copy of the ChannelUpdate
13283  */
13284 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
13285
13286 /**
13287  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
13288  */
13289 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
13290
13291 /**
13292  * The genesis hash of the blockchain being queried
13293  */
13294 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
13295
13296 /**
13297  * The genesis hash of the blockchain being queried
13298  */
13299 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13300
13301 /**
13302  * The height of the first block for the channel UTXOs being queried
13303  */
13304 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
13305
13306 /**
13307  * The height of the first block for the channel UTXOs being queried
13308  */
13309 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13310
13311 /**
13312  * The number of blocks to include in the query results
13313  */
13314 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
13315
13316 /**
13317  * The number of blocks to include in the query results
13318  */
13319 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13320
13321 /**
13322  * Constructs a new QueryChannelRange given each field
13323  */
13324 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
13325
13326 /**
13327  * Creates a copy of the QueryChannelRange
13328  */
13329 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
13330
13331 /**
13332  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
13333  */
13334 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
13335
13336 /**
13337  * The genesis hash of the blockchain being queried
13338  */
13339 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
13340
13341 /**
13342  * The genesis hash of the blockchain being queried
13343  */
13344 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13345
13346 /**
13347  * The height of the first block in the range of the reply
13348  */
13349 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13350
13351 /**
13352  * The height of the first block in the range of the reply
13353  */
13354 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13355
13356 /**
13357  * The number of blocks included in the range of the reply
13358  */
13359 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13360
13361 /**
13362  * The number of blocks included in the range of the reply
13363  */
13364 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13365
13366 /**
13367  * True when this is the final reply for a query
13368  */
13369 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13370
13371 /**
13372  * True when this is the final reply for a query
13373  */
13374 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
13375
13376 /**
13377  * The short_channel_ids in the channel range
13378  */
13379 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
13380
13381 /**
13382  * Constructs a new ReplyChannelRange given each field
13383  */
13384 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);
13385
13386 /**
13387  * Creates a copy of the ReplyChannelRange
13388  */
13389 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
13390
13391 /**
13392  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
13393  */
13394 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
13395
13396 /**
13397  * The genesis hash of the blockchain being queried
13398  */
13399 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
13400
13401 /**
13402  * The genesis hash of the blockchain being queried
13403  */
13404 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13405
13406 /**
13407  * The short_channel_ids that are being queried
13408  */
13409 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
13410
13411 /**
13412  * Constructs a new QueryShortChannelIds given each field
13413  */
13414 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
13415
13416 /**
13417  * Creates a copy of the QueryShortChannelIds
13418  */
13419 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
13420
13421 /**
13422  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
13423  */
13424 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
13425
13426 /**
13427  * The genesis hash of the blockchain that was queried
13428  */
13429 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
13430
13431 /**
13432  * The genesis hash of the blockchain that was queried
13433  */
13434 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13435
13436 /**
13437  * Indicates if the query recipient maintains up-to-date channel
13438  * information for the chain_hash
13439  */
13440 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
13441
13442 /**
13443  * Indicates if the query recipient maintains up-to-date channel
13444  * information for the chain_hash
13445  */
13446 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
13447
13448 /**
13449  * Constructs a new ReplyShortChannelIdsEnd given each field
13450  */
13451 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
13452
13453 /**
13454  * Creates a copy of the ReplyShortChannelIdsEnd
13455  */
13456 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
13457
13458 /**
13459  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
13460  */
13461 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
13462
13463 /**
13464  * The genesis hash of the blockchain for channel and node information
13465  */
13466 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
13467
13468 /**
13469  * The genesis hash of the blockchain for channel and node information
13470  */
13471 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13472
13473 /**
13474  * The starting unix timestamp
13475  */
13476 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
13477
13478 /**
13479  * The starting unix timestamp
13480  */
13481 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
13482
13483 /**
13484  * The range of information in seconds
13485  */
13486 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
13487
13488 /**
13489  * The range of information in seconds
13490  */
13491 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
13492
13493 /**
13494  * Constructs a new GossipTimestampFilter given each field
13495  */
13496 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
13497
13498 /**
13499  * Creates a copy of the GossipTimestampFilter
13500  */
13501 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
13502
13503 /**
13504  * Frees any resources used by the ErrorAction
13505  */
13506 void ErrorAction_free(struct LDKErrorAction this_ptr);
13507
13508 /**
13509  * Creates a copy of the ErrorAction
13510  */
13511 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
13512
13513 /**
13514  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
13515  */
13516 void LightningError_free(struct LDKLightningError this_obj);
13517
13518 /**
13519  * A human-readable message describing the error
13520  */
13521 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
13522
13523 /**
13524  * A human-readable message describing the error
13525  */
13526 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
13527
13528 /**
13529  * The action which should be taken against the offending peer.
13530  */
13531 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
13532
13533 /**
13534  * The action which should be taken against the offending peer.
13535  */
13536 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
13537
13538 /**
13539  * Constructs a new LightningError given each field
13540  */
13541 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
13542
13543 /**
13544  * Creates a copy of the LightningError
13545  */
13546 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
13547
13548 /**
13549  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
13550  */
13551 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
13552
13553 /**
13554  * update_add_htlc messages which should be sent
13555  */
13556 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
13557
13558 /**
13559  * update_fulfill_htlc messages which should be sent
13560  */
13561 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
13562
13563 /**
13564  * update_fail_htlc messages which should be sent
13565  */
13566 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
13567
13568 /**
13569  * update_fail_malformed_htlc messages which should be sent
13570  */
13571 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
13572
13573 /**
13574  * An update_fee message which should be sent
13575  */
13576 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
13577
13578 /**
13579  * An update_fee message which should be sent
13580  */
13581 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
13582
13583 /**
13584  * Finally, the commitment_signed message which should be sent
13585  */
13586 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
13587
13588 /**
13589  * Finally, the commitment_signed message which should be sent
13590  */
13591 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
13592
13593 /**
13594  * Constructs a new CommitmentUpdate given each field
13595  */
13596 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);
13597
13598 /**
13599  * Creates a copy of the CommitmentUpdate
13600  */
13601 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
13602
13603 /**
13604  * Frees any resources used by the HTLCFailChannelUpdate
13605  */
13606 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
13607
13608 /**
13609  * Creates a copy of the HTLCFailChannelUpdate
13610  */
13611 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
13612
13613 /**
13614  * Calls the free function if one is set
13615  */
13616 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
13617
13618 /**
13619  * Calls the free function if one is set
13620  */
13621 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
13622
13623 /**
13624  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
13625  */
13626 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
13627
13628 /**
13629  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
13630  */
13631 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
13632
13633 /**
13634  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
13635  */
13636 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
13637
13638 /**
13639  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
13640  */
13641 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
13642
13643 /**
13644  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
13645  */
13646 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
13647
13648 /**
13649  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
13650  */
13651 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
13652
13653 /**
13654  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
13655  */
13656 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
13657
13658 /**
13659  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
13660  */
13661 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
13662
13663 /**
13664  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
13665  */
13666 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
13667
13668 /**
13669  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
13670  */
13671 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
13672
13673 /**
13674  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
13675  */
13676 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
13677
13678 /**
13679  * Read a FundingCreated from a byte array, created by FundingCreated_write
13680  */
13681 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
13682
13683 /**
13684  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
13685  */
13686 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
13687
13688 /**
13689  * Read a FundingSigned from a byte array, created by FundingSigned_write
13690  */
13691 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
13692
13693 /**
13694  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
13695  */
13696 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
13697
13698 /**
13699  * Read a FundingLocked from a byte array, created by FundingLocked_write
13700  */
13701 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
13702
13703 /**
13704  * Serialize the Init object into a byte array which can be read by Init_read
13705  */
13706 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
13707
13708 /**
13709  * Read a Init from a byte array, created by Init_write
13710  */
13711 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
13712
13713 /**
13714  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
13715  */
13716 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
13717
13718 /**
13719  * Read a OpenChannel from a byte array, created by OpenChannel_write
13720  */
13721 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
13722
13723 /**
13724  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
13725  */
13726 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
13727
13728 /**
13729  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
13730  */
13731 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
13732
13733 /**
13734  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
13735  */
13736 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
13737
13738 /**
13739  * Read a Shutdown from a byte array, created by Shutdown_write
13740  */
13741 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
13742
13743 /**
13744  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
13745  */
13746 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
13747
13748 /**
13749  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
13750  */
13751 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
13752
13753 /**
13754  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
13755  */
13756 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
13757
13758 /**
13759  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
13760  */
13761 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
13762
13763 /**
13764  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
13765  */
13766 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
13767
13768 /**
13769  * Read a UpdateFee from a byte array, created by UpdateFee_write
13770  */
13771 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
13772
13773 /**
13774  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
13775  */
13776 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
13777
13778 /**
13779  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
13780  */
13781 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
13782
13783 /**
13784  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
13785  */
13786 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
13787
13788 /**
13789  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
13790  */
13791 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
13792
13793 /**
13794  * Serialize the Ping object into a byte array which can be read by Ping_read
13795  */
13796 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
13797
13798 /**
13799  * Read a Ping from a byte array, created by Ping_write
13800  */
13801 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
13802
13803 /**
13804  * Serialize the Pong object into a byte array which can be read by Pong_read
13805  */
13806 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
13807
13808 /**
13809  * Read a Pong from a byte array, created by Pong_write
13810  */
13811 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
13812
13813 /**
13814  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
13815  */
13816 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
13817
13818 /**
13819  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
13820  */
13821 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
13822
13823 /**
13824  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
13825  */
13826 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
13827
13828 /**
13829  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
13830  */
13831 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
13832
13833 /**
13834  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
13835  */
13836 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
13837
13838 /**
13839  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
13840  */
13841 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
13842
13843 /**
13844  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
13845  */
13846 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
13847
13848 /**
13849  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
13850  */
13851 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
13852
13853 /**
13854  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
13855  */
13856 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
13857
13858 /**
13859  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
13860  */
13861 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
13862
13863 /**
13864  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
13865  */
13866 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
13867
13868 /**
13869  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
13870  */
13871 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
13872
13873 /**
13874  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
13875  */
13876 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
13877
13878 /**
13879  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
13880  */
13881 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
13882
13883 /**
13884  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
13885  */
13886 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
13887
13888 /**
13889  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
13890  */
13891 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
13892
13893 /**
13894  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
13895  */
13896 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
13897
13898 /**
13899  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
13900  */
13901 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
13902
13903 /**
13904  *\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
13905  */
13906 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
13907
13908 /**
13909  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
13910  */
13911 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
13912
13913 /**
13914  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
13915  */
13916 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
13917
13918 /**
13919  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
13920  */
13921 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
13922
13923 /**
13924  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
13925  */
13926 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
13927
13928 /**
13929  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
13930  */
13931 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
13932
13933 /**
13934  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
13935  */
13936 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
13937
13938 /**
13939  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
13940  */
13941 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
13942
13943 /**
13944  * Constructs a new IgnoringMessageHandler given each field
13945  */
13946 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
13947
13948 /**
13949  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
13950  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
13951  */
13952 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
13953
13954 /**
13955  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
13956  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
13957  */
13958 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
13959
13960 /**
13961  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
13962  */
13963 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
13964
13965 /**
13966  * Constructs a new ErroringMessageHandler
13967  */
13968 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
13969
13970 /**
13971  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
13972  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
13973  */
13974 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
13975
13976 /**
13977  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
13978  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
13979  */
13980 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
13981
13982 /**
13983  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
13984  */
13985 void MessageHandler_free(struct LDKMessageHandler this_obj);
13986
13987 /**
13988  * A message handler which handles messages specific to channels. Usually this is just a
13989  * ChannelManager object or a ErroringMessageHandler.
13990  */
13991 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
13992
13993 /**
13994  * A message handler which handles messages specific to channels. Usually this is just a
13995  * ChannelManager object or a ErroringMessageHandler.
13996  */
13997 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
13998
13999 /**
14000  * A message handler which handles messages updating our knowledge of the network channel
14001  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
14002  */
14003 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
14004
14005 /**
14006  * A message handler which handles messages updating our knowledge of the network channel
14007  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
14008  */
14009 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
14010
14011 /**
14012  * Constructs a new MessageHandler given each field
14013  */
14014 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
14015
14016 /**
14017  * Creates a copy of a SocketDescriptor
14018  */
14019 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
14020
14021 /**
14022  * Calls the free function if one is set
14023  */
14024 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
14025
14026 /**
14027  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
14028  */
14029 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
14030
14031 /**
14032  * Used to indicate that we probably can't make any future connections to this peer, implying
14033  * we should go ahead and force-close any channels we have with it.
14034  */
14035 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
14036
14037 /**
14038  * Used to indicate that we probably can't make any future connections to this peer, implying
14039  * we should go ahead and force-close any channels we have with it.
14040  */
14041 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
14042
14043 /**
14044  * Constructs a new PeerHandleError given each field
14045  */
14046 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
14047
14048 /**
14049  * Creates a copy of the PeerHandleError
14050  */
14051 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
14052
14053 /**
14054  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
14055  */
14056 void PeerManager_free(struct LDKPeerManager this_obj);
14057
14058 /**
14059  * Constructs a new PeerManager with the given message handlers and node_id secret key
14060  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
14061  * cryptographically secure random bytes.
14062  */
14063 MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger);
14064
14065 /**
14066  * Get the list of node ids for peers which have completed the initial handshake.
14067  *
14068  * For outbound connections, this will be the same as the their_node_id parameter passed in to
14069  * new_outbound_connection, however entries will only appear once the initial handshake has
14070  * completed and we are sure the remote peer has the private key for the given node_id.
14071  */
14072 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
14073
14074 /**
14075  * Indicates a new outbound connection has been established to a node with the given node_id.
14076  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
14077  * descriptor but must disconnect the connection immediately.
14078  *
14079  * Returns a small number of bytes to send to the remote node (currently always 50).
14080  *
14081  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
14082  * socket_disconnected().
14083  */
14084 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);
14085
14086 /**
14087  * Indicates a new inbound connection has been established.
14088  *
14089  * May refuse the connection by returning an Err, but will never write bytes to the remote end
14090  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
14091  * call socket_disconnected for the new descriptor but must disconnect the connection
14092  * immediately.
14093  *
14094  * Panics if descriptor is duplicative with some other descriptor which has not yet had
14095  * socket_disconnected called.
14096  */
14097 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
14098
14099 /**
14100  * Indicates that there is room to write data to the given socket descriptor.
14101  *
14102  * May return an Err to indicate that the connection should be closed.
14103  *
14104  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
14105  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
14106  * invariants around calling write_buffer_space_avail in case a write did not fully complete
14107  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
14108  * here isn't sufficient! Panics if the descriptor was not previously registered in a
14109  * new_\\*_connection event.
14110  */
14111 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
14112
14113 /**
14114  * Indicates that data was read from the given socket descriptor.
14115  *
14116  * May return an Err to indicate that the connection should be closed.
14117  *
14118  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
14119  * Thus, however, you almost certainly want to call process_events() after any read_event to
14120  * generate send_data calls to handle responses.
14121  *
14122  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
14123  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
14124  *
14125  * Panics if the descriptor was not previously registered in a new_*_connection event.
14126  */
14127 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);
14128
14129 /**
14130  * Checks for any events generated by our handlers and processes them. Includes sending most
14131  * response messages as well as messages generated by calls to handler functions directly (eg
14132  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
14133  */
14134 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
14135
14136 /**
14137  * Indicates that the given socket descriptor's connection is now closed.
14138  *
14139  * This must only be called if the socket has been disconnected by the peer or your own
14140  * decision to disconnect it and must NOT be called in any case where other parts of this
14141  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
14142  * the peer.
14143  *
14144  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
14145  */
14146 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
14147
14148 /**
14149  * Disconnect a peer given its node id.
14150  *
14151  * Set no_connection_possible to true to prevent any further connection with this peer,
14152  * force-closing any channels we have with it.
14153  *
14154  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
14155  * so be careful about reentrancy issues.
14156  */
14157 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
14158
14159 /**
14160  * This function should be called roughly once every 30 seconds.
14161  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
14162  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
14163  */
14164 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
14165
14166 /**
14167  * Build the commitment secret from the seed and the commitment number
14168  */
14169 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
14170
14171 /**
14172  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
14173  * from the base secret and the per_commitment_point.
14174  *
14175  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14176  * generated (ie our own).
14177  */
14178 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
14179
14180 /**
14181  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
14182  * from the base point and the per_commitment_key. This is the public equivalent of
14183  * derive_private_key - using only public keys to derive a public key instead of private keys.
14184  *
14185  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14186  * generated (ie our own).
14187  */
14188 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
14189
14190 /**
14191  * Derives a per-commitment-transaction revocation key from its constituent parts.
14192  *
14193  * Only the cheating participant owns a valid witness to propagate a revoked
14194  * commitment transaction, thus per_commitment_secret always come from cheater
14195  * and revocation_base_secret always come from punisher, which is the broadcaster
14196  * of the transaction spending with this key knowledge.
14197  *
14198  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14199  * generated (ie our own).
14200  */
14201 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
14202
14203 /**
14204  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
14205  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
14206  * public key instead of private keys.
14207  *
14208  * Only the cheating participant owns a valid witness to propagate a revoked
14209  * commitment transaction, thus per_commitment_point always come from cheater
14210  * and revocation_base_point always come from punisher, which is the broadcaster
14211  * of the transaction spending with this key knowledge.
14212  *
14213  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14214  * generated (ie our own).
14215  */
14216 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
14217
14218 /**
14219  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
14220  */
14221 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
14222
14223 /**
14224  * The broadcaster's per-commitment public key which was used to derive the other keys.
14225  */
14226 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14227
14228 /**
14229  * The broadcaster's per-commitment public key which was used to derive the other keys.
14230  */
14231 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14232
14233 /**
14234  * The revocation key which is used to allow the broadcaster of the commitment
14235  * transaction to provide their counterparty the ability to punish them if they broadcast
14236  * an old state.
14237  */
14238 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14239
14240 /**
14241  * The revocation key which is used to allow the broadcaster of the commitment
14242  * transaction to provide their counterparty the ability to punish them if they broadcast
14243  * an old state.
14244  */
14245 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14246
14247 /**
14248  * Broadcaster's HTLC Key
14249  */
14250 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14251
14252 /**
14253  * Broadcaster's HTLC Key
14254  */
14255 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14256
14257 /**
14258  * Countersignatory's HTLC Key
14259  */
14260 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14261
14262 /**
14263  * Countersignatory's HTLC Key
14264  */
14265 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14266
14267 /**
14268  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
14269  */
14270 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14271
14272 /**
14273  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
14274  */
14275 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14276
14277 /**
14278  * Constructs a new TxCreationKeys given each field
14279  */
14280 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);
14281
14282 /**
14283  * Creates a copy of the TxCreationKeys
14284  */
14285 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
14286
14287 /**
14288  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
14289  */
14290 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
14291
14292 /**
14293  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
14294  */
14295 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
14296
14297 /**
14298  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
14299  */
14300 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
14301
14302 /**
14303  * The public key which is used to sign all commitment transactions, as it appears in the
14304  * on-chain channel lock-in 2-of-2 multisig output.
14305  */
14306 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14307
14308 /**
14309  * The public key which is used to sign all commitment transactions, as it appears in the
14310  * on-chain channel lock-in 2-of-2 multisig output.
14311  */
14312 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14313
14314 /**
14315  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
14316  * revocation keys. This is combined with the per-commitment-secret generated by the
14317  * counterparty to create a secret which the counterparty can reveal to revoke previous
14318  * states.
14319  */
14320 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14321
14322 /**
14323  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
14324  * revocation keys. This is combined with the per-commitment-secret generated by the
14325  * counterparty to create a secret which the counterparty can reveal to revoke previous
14326  * states.
14327  */
14328 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14329
14330 /**
14331  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
14332  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
14333  * static across every commitment transaction.
14334  */
14335 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14336
14337 /**
14338  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
14339  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
14340  * static across every commitment transaction.
14341  */
14342 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14343
14344 /**
14345  * The base point which is used (with derive_public_key) to derive a per-commitment payment
14346  * public key which receives non-HTLC-encumbered funds which are only available for spending
14347  * after some delay (or can be claimed via the revocation path).
14348  */
14349 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14350
14351 /**
14352  * The base point which is used (with derive_public_key) to derive a per-commitment payment
14353  * public key which receives non-HTLC-encumbered funds which are only available for spending
14354  * after some delay (or can be claimed via the revocation path).
14355  */
14356 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14357
14358 /**
14359  * The base point which is used (with derive_public_key) to derive a per-commitment public key
14360  * which is used to encumber HTLC-in-flight outputs.
14361  */
14362 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14363
14364 /**
14365  * The base point which is used (with derive_public_key) to derive a per-commitment public key
14366  * which is used to encumber HTLC-in-flight outputs.
14367  */
14368 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14369
14370 /**
14371  * Constructs a new ChannelPublicKeys given each field
14372  */
14373 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);
14374
14375 /**
14376  * Creates a copy of the ChannelPublicKeys
14377  */
14378 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
14379
14380 /**
14381  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
14382  */
14383 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
14384
14385 /**
14386  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
14387  */
14388 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
14389
14390 /**
14391  * Create per-state keys from channel base points and the per-commitment point.
14392  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
14393  */
14394 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);
14395
14396 /**
14397  * Generate per-state keys from channel static keys.
14398  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
14399  */
14400 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);
14401
14402 /**
14403  * A script either spendable by the revocation
14404  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
14405  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
14406  */
14407 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
14408
14409 /**
14410  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
14411  */
14412 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
14413
14414 /**
14415  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
14416  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
14417  * need to compare this value to whether the commitment transaction in question is that of
14418  * the counterparty or our own.
14419  */
14420 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14421
14422 /**
14423  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
14424  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
14425  * need to compare this value to whether the commitment transaction in question is that of
14426  * the counterparty or our own.
14427  */
14428 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
14429
14430 /**
14431  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
14432  * this divided by 1000.
14433  */
14434 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14435
14436 /**
14437  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
14438  * this divided by 1000.
14439  */
14440 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
14441
14442 /**
14443  * The CLTV lock-time at which this HTLC expires.
14444  */
14445 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14446
14447 /**
14448  * The CLTV lock-time at which this HTLC expires.
14449  */
14450 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
14451
14452 /**
14453  * The hash of the preimage which unlocks this HTLC.
14454  */
14455 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
14456
14457 /**
14458  * The hash of the preimage which unlocks this HTLC.
14459  */
14460 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14461
14462 /**
14463  * The position within the commitment transactions' outputs. This may be None if the value is
14464  * below the dust limit (in which case no output appears in the commitment transaction and the
14465  * value is spent to additional transaction fees).
14466  */
14467 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14468
14469 /**
14470  * The position within the commitment transactions' outputs. This may be None if the value is
14471  * below the dust limit (in which case no output appears in the commitment transaction and the
14472  * value is spent to additional transaction fees).
14473  */
14474 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
14475
14476 /**
14477  * Constructs a new HTLCOutputInCommitment given each field
14478  */
14479 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);
14480
14481 /**
14482  * Creates a copy of the HTLCOutputInCommitment
14483  */
14484 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
14485
14486 /**
14487  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
14488  */
14489 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
14490
14491 /**
14492  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
14493  */
14494 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
14495
14496 /**
14497  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
14498  * does not need to have its previous_output_index filled.
14499  */
14500 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
14501
14502 /**
14503  * Gets the redeemscript for a funding output from the two funding public keys.
14504  * Note that the order of funding public keys does not matter.
14505  */
14506 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
14507
14508 /**
14509  * panics if htlc.transaction_output_index.is_none()!
14510  */
14511 struct LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
14512
14513 /**
14514  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14515  */
14516 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
14517
14518 /**
14519  * Holder public keys
14520  */
14521 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14522
14523 /**
14524  * Holder public keys
14525  */
14526 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
14527
14528 /**
14529  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
14530  */
14531 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14532
14533 /**
14534  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
14535  */
14536 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
14537
14538 /**
14539  * Whether the holder is the initiator of this channel.
14540  * This is an input to the commitment number obscure factor computation.
14541  */
14542 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14543
14544 /**
14545  * Whether the holder is the initiator of this channel.
14546  * This is an input to the commitment number obscure factor computation.
14547  */
14548 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
14549
14550 /**
14551  * The late-bound counterparty channel transaction parameters.
14552  * These parameters are populated at the point in the protocol where the counterparty provides them.
14553  */
14554 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14555
14556 /**
14557  * The late-bound counterparty channel transaction parameters.
14558  * These parameters are populated at the point in the protocol where the counterparty provides them.
14559  */
14560 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
14561
14562 /**
14563  * The late-bound funding outpoint
14564  */
14565 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14566
14567 /**
14568  * The late-bound funding outpoint
14569  */
14570 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
14571
14572 /**
14573  * Constructs a new ChannelTransactionParameters given each field
14574  */
14575 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);
14576
14577 /**
14578  * Creates a copy of the ChannelTransactionParameters
14579  */
14580 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
14581
14582 /**
14583  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14584  */
14585 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
14586
14587 /**
14588  * Counter-party public keys
14589  */
14590 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
14591
14592 /**
14593  * Counter-party public keys
14594  */
14595 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
14596
14597 /**
14598  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
14599  */
14600 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
14601
14602 /**
14603  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
14604  */
14605 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
14606
14607 /**
14608  * Constructs a new CounterpartyChannelTransactionParameters given each field
14609  */
14610 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
14611
14612 /**
14613  * Creates a copy of the CounterpartyChannelTransactionParameters
14614  */
14615 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
14616
14617 /**
14618  * Whether the late bound parameters are populated.
14619  */
14620 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14621
14622 /**
14623  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
14624  * given that the holder is the broadcaster.
14625  *
14626  * self.is_populated() must be true before calling this function.
14627  */
14628 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14629
14630 /**
14631  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
14632  * given that the counterparty is the broadcaster.
14633  *
14634  * self.is_populated() must be true before calling this function.
14635  */
14636 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14637
14638 /**
14639  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
14640  */
14641 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
14642
14643 /**
14644  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
14645  */
14646 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
14647
14648 /**
14649  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
14650  */
14651 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
14652
14653 /**
14654  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
14655  */
14656 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
14657
14658 /**
14659  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14660  */
14661 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
14662
14663 /**
14664  * Get the channel pubkeys for the broadcaster
14665  */
14666 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14667
14668 /**
14669  * Get the channel pubkeys for the countersignatory
14670  */
14671 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14672
14673 /**
14674  * Get the contest delay applicable to the transactions.
14675  * Note that the contest delay was selected by the countersignatory.
14676  */
14677 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14678
14679 /**
14680  * Whether the channel is outbound from the broadcaster.
14681  *
14682  * The boolean representing the side that initiated the channel is
14683  * an input to the commitment number obscure factor computation.
14684  */
14685 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14686
14687 /**
14688  * The funding outpoint
14689  */
14690 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14691
14692 /**
14693  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
14694  */
14695 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
14696
14697 /**
14698  * Our counterparty's signature for the transaction
14699  */
14700 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
14701
14702 /**
14703  * Our counterparty's signature for the transaction
14704  */
14705 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
14706
14707 /**
14708  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
14709  */
14710 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
14711
14712 /**
14713  * Creates a copy of the HolderCommitmentTransaction
14714  */
14715 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
14716
14717 /**
14718  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
14719  */
14720 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
14721
14722 /**
14723  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
14724  */
14725 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
14726
14727 /**
14728  * Create a new holder transaction with the given counterparty signatures.
14729  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
14730  */
14731 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);
14732
14733 /**
14734  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
14735  */
14736 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
14737
14738 /**
14739  * The commitment transaction
14740  */
14741 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
14742
14743 /**
14744  * The commitment transaction
14745  */
14746 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
14747
14748 /**
14749  * The txid for the commitment transaction.
14750  *
14751  * This is provided as a performance optimization, instead of calling transaction.txid()
14752  * multiple times.
14753  */
14754 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
14755
14756 /**
14757  * The txid for the commitment transaction.
14758  *
14759  * This is provided as a performance optimization, instead of calling transaction.txid()
14760  * multiple times.
14761  */
14762 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14763
14764 /**
14765  * Constructs a new BuiltCommitmentTransaction given each field
14766  */
14767 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
14768
14769 /**
14770  * Creates a copy of the BuiltCommitmentTransaction
14771  */
14772 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
14773
14774 /**
14775  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
14776  */
14777 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
14778
14779 /**
14780  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
14781  */
14782 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
14783
14784 /**
14785  * Get the SIGHASH_ALL sighash value of the transaction.
14786  *
14787  * This can be used to verify a signature.
14788  */
14789 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);
14790
14791 /**
14792  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
14793  * because we are about to broadcast a holder transaction.
14794  */
14795 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);
14796
14797 /**
14798  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
14799  */
14800 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
14801
14802 /**
14803  * Creates a copy of the CommitmentTransaction
14804  */
14805 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
14806
14807 /**
14808  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
14809  */
14810 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
14811
14812 /**
14813  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
14814  */
14815 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
14816
14817 /**
14818  * The backwards-counting commitment number
14819  */
14820 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14821
14822 /**
14823  * The value to be sent to the broadcaster
14824  */
14825 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14826
14827 /**
14828  * The value to be sent to the counterparty
14829  */
14830 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14831
14832 /**
14833  * The feerate paid per 1000-weight-unit in this commitment transaction.
14834  */
14835 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14836
14837 /**
14838  * Trust our pre-built transaction and derived transaction creation public keys.
14839  *
14840  * Applies a wrapper which allows access to these fields.
14841  *
14842  * This should only be used if you fully trust the builder of this object.  It should not
14843  *\tbe used by an external signer - instead use the verify function.
14844  */
14845 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14846
14847 /**
14848  * Verify our pre-built transaction and derived transaction creation public keys.
14849  *
14850  * Applies a wrapper which allows access to these fields.
14851  *
14852  * An external validating signer must call this method before signing
14853  * or using the built transaction.
14854  */
14855 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);
14856
14857 /**
14858  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
14859  */
14860 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
14861
14862 /**
14863  * The transaction ID of the built Bitcoin transaction
14864  */
14865 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14866
14867 /**
14868  * The pre-built Bitcoin commitment transaction
14869  */
14870 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14871
14872 /**
14873  * The pre-calculated transaction creation public keys.
14874  */
14875 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14876
14877 /**
14878  * Get a signature for each HTLC which was included in the commitment transaction (ie for
14879  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
14880  *
14881  * The returned Vec has one entry for each HTLC, and in the same order.
14882  */
14883 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);
14884
14885 /**
14886  * Get the transaction number obscure factor
14887  */
14888 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
14889
14890 /**
14891  * Creates a copy of the InitFeatures
14892  */
14893 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
14894
14895 /**
14896  * Creates a copy of the NodeFeatures
14897  */
14898 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
14899
14900 /**
14901  * Creates a copy of the ChannelFeatures
14902  */
14903 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
14904
14905 /**
14906  * Creates a copy of the InvoiceFeatures
14907  */
14908 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
14909
14910 /**
14911  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
14912  */
14913 void InitFeatures_free(struct LDKInitFeatures this_obj);
14914
14915 /**
14916  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
14917  */
14918 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
14919
14920 /**
14921  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
14922  */
14923 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
14924
14925 /**
14926  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
14927  */
14928 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
14929
14930 /**
14931  * Create a blank Features with no features set
14932  */
14933 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
14934
14935 /**
14936  * Creates a Features with the bits set which are known by the implementation
14937  */
14938 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
14939
14940 /**
14941  * Create a blank Features with no features set
14942  */
14943 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
14944
14945 /**
14946  * Creates a Features with the bits set which are known by the implementation
14947  */
14948 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
14949
14950 /**
14951  * Create a blank Features with no features set
14952  */
14953 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
14954
14955 /**
14956  * Creates a Features with the bits set which are known by the implementation
14957  */
14958 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
14959
14960 /**
14961  * Create a blank Features with no features set
14962  */
14963 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
14964
14965 /**
14966  * Creates a Features with the bits set which are known by the implementation
14967  */
14968 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
14969
14970 /**
14971  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
14972  */
14973 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
14974
14975 /**
14976  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
14977  */
14978 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
14979
14980 /**
14981  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
14982  */
14983 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
14984
14985 /**
14986  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
14987  */
14988 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
14989
14990 /**
14991  * Read a InitFeatures from a byte array, created by InitFeatures_write
14992  */
14993 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
14994
14995 /**
14996  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
14997  */
14998 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
14999
15000 /**
15001  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
15002  */
15003 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
15004
15005 /**
15006  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
15007  */
15008 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
15009
15010 /**
15011  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
15012  */
15013 void RouteHop_free(struct LDKRouteHop this_obj);
15014
15015 /**
15016  * The node_id of the node at this hop.
15017  */
15018 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15019
15020 /**
15021  * The node_id of the node at this hop.
15022  */
15023 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15024
15025 /**
15026  * The node_announcement features of the node at this hop. For the last hop, these may be
15027  * amended to match the features present in the invoice this node generated.
15028  */
15029 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15030
15031 /**
15032  * The node_announcement features of the node at this hop. For the last hop, these may be
15033  * amended to match the features present in the invoice this node generated.
15034  */
15035 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
15036
15037 /**
15038  * The channel that should be used from the previous hop to reach this node.
15039  */
15040 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15041
15042 /**
15043  * The channel that should be used from the previous hop to reach this node.
15044  */
15045 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
15046
15047 /**
15048  * The channel_announcement features of the channel that should be used from the previous hop
15049  * to reach this node.
15050  */
15051 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15052
15053 /**
15054  * The channel_announcement features of the channel that should be used from the previous hop
15055  * to reach this node.
15056  */
15057 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
15058
15059 /**
15060  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
15061  * For the last hop, this should be the full value of the payment (might be more than
15062  * requested if we had to match htlc_minimum_msat).
15063  */
15064 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15065
15066 /**
15067  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
15068  * For the last hop, this should be the full value of the payment (might be more than
15069  * requested if we had to match htlc_minimum_msat).
15070  */
15071 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
15072
15073 /**
15074  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
15075  * expected at the destination, in excess of the current block height.
15076  */
15077 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15078
15079 /**
15080  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
15081  * expected at the destination, in excess of the current block height.
15082  */
15083 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
15084
15085 /**
15086  * Constructs a new RouteHop given each field
15087  */
15088 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);
15089
15090 /**
15091  * Creates a copy of the RouteHop
15092  */
15093 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
15094
15095 /**
15096  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
15097  */
15098 void Route_free(struct LDKRoute this_obj);
15099
15100 /**
15101  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
15102  * last RouteHop in each path must be the same.
15103  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
15104  * destination. Thus, this must always be at least length one. While the maximum length of any
15105  * given path is variable, keeping the length of any path to less than 20 should currently
15106  * ensure it is viable.
15107  */
15108 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
15109
15110 /**
15111  * Constructs a new Route given each field
15112  */
15113 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
15114
15115 /**
15116  * Creates a copy of the Route
15117  */
15118 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
15119
15120 /**
15121  * Serialize the Route object into a byte array which can be read by Route_read
15122  */
15123 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
15124
15125 /**
15126  * Read a Route from a byte array, created by Route_write
15127  */
15128 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
15129
15130 /**
15131  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
15132  */
15133 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
15134
15135 /**
15136  * The node_id of the non-target end of the route
15137  */
15138 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
15139
15140 /**
15141  * The node_id of the non-target end of the route
15142  */
15143 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15144
15145 /**
15146  * The short_channel_id of this channel
15147  */
15148 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
15149
15150 /**
15151  * The short_channel_id of this channel
15152  */
15153 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
15154
15155 /**
15156  * The fees which must be paid to use this channel
15157  */
15158 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
15159
15160 /**
15161  * The fees which must be paid to use this channel
15162  */
15163 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
15164
15165 /**
15166  * The difference in CLTV values between this node and the next node.
15167  */
15168 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
15169
15170 /**
15171  * The difference in CLTV values between this node and the next node.
15172  */
15173 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
15174
15175 /**
15176  * The minimum value, in msat, which must be relayed to the next hop.
15177  */
15178 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
15179
15180 /**
15181  * The minimum value, in msat, which must be relayed to the next hop.
15182  */
15183 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15184
15185 /**
15186  * The maximum value in msat available for routing with a single HTLC.
15187  */
15188 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
15189
15190 /**
15191  * The maximum value in msat available for routing with a single HTLC.
15192  */
15193 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15194
15195 /**
15196  * Constructs a new RouteHintHop given each field
15197  */
15198 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);
15199
15200 /**
15201  * Creates a copy of the RouteHintHop
15202  */
15203 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
15204
15205 /**
15206  * Gets a route from us (payer) to the given target node (payee).
15207  *
15208  * If the payee provided features in their invoice, they should be provided via payee_features.
15209  * Without this, MPP will only be used if the payee's features are available in the network graph.
15210  *
15211  * Extra routing hops between known nodes and the target will be used if they are included in
15212  * last_hops.
15213  *
15214  * If some channels aren't announced, it may be useful to fill in a first_hops with the
15215  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
15216  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
15217  * in first_hops will be used.
15218  *
15219  * Panics if first_hops contains channels without short_channel_ids
15220  * (ChannelManager::list_usable_channels will never include such channels).
15221  *
15222  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
15223  * equal), however the enabled/disabled bit on such channels as well as the
15224  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
15225  */
15226 struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintHopZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
15227
15228 /**
15229  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
15230  */
15231 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
15232
15233 /**
15234  * Creates a copy of the NetworkGraph
15235  */
15236 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
15237
15238 /**
15239  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
15240  */
15241 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
15242
15243 /**
15244  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
15245  */
15246 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
15247
15248 /**
15249  * Creates a new tracker of the actual state of the network of channels and nodes,
15250  * assuming a fresh network graph.
15251  * Chain monitor is used to make sure announced channels exist on-chain,
15252  * channel data is correct, and that the announcement is signed with
15253  * channel owners' keys.
15254  */
15255 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
15256
15257 /**
15258  * Creates a new tracker of the actual state of the network of channels and nodes,
15259  * assuming an existing Network Graph.
15260  */
15261 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
15262
15263 /**
15264  * Adds a provider used to check new announcements. Does not affect
15265  * existing announcements unless they are updated.
15266  * Add, update or remove the provider would replace the current one.
15267  */
15268 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
15269
15270 /**
15271  * Take a read lock on the network_graph and return it in the C-bindings
15272  * newtype helper. This is likely only useful when called via the C
15273  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
15274  * yourself.
15275  */
15276 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15277
15278 /**
15279  * Get a reference to the NetworkGraph which this read-lock contains.
15280  */
15281 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
15282
15283 /**
15284  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
15285  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
15286  */
15287 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15288
15289 /**
15290  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15291  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15292  */
15293 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15294
15295 /**
15296  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
15297  */
15298 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
15299
15300 /**
15301  * When the last update to the channel direction was issued.
15302  * Value is opaque, as set in the announcement.
15303  */
15304 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15305
15306 /**
15307  * When the last update to the channel direction was issued.
15308  * Value is opaque, as set in the announcement.
15309  */
15310 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
15311
15312 /**
15313  * Whether the channel can be currently used for payments (in this one direction).
15314  */
15315 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15316
15317 /**
15318  * Whether the channel can be currently used for payments (in this one direction).
15319  */
15320 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
15321
15322 /**
15323  * The difference in CLTV values that you must have when routing through this channel.
15324  */
15325 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15326
15327 /**
15328  * The difference in CLTV values that you must have when routing through this channel.
15329  */
15330 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
15331
15332 /**
15333  * The minimum value, which must be relayed to the next hop via the channel
15334  */
15335 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15336
15337 /**
15338  * The minimum value, which must be relayed to the next hop via the channel
15339  */
15340 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
15341
15342 /**
15343  * The maximum value which may be relayed to the next hop via the channel.
15344  */
15345 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15346
15347 /**
15348  * The maximum value which may be relayed to the next hop via the channel.
15349  */
15350 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15351
15352 /**
15353  * Fees charged when the channel is used for routing
15354  */
15355 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15356
15357 /**
15358  * Fees charged when the channel is used for routing
15359  */
15360 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
15361
15362 /**
15363  * Most recent update for the channel received from the network
15364  * Mostly redundant with the data we store in fields explicitly.
15365  * Everything else is useful only for sending out for initial routing sync.
15366  * Not stored if contains excess data to prevent DoS.
15367  */
15368 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15369
15370 /**
15371  * Most recent update for the channel received from the network
15372  * Mostly redundant with the data we store in fields explicitly.
15373  * Everything else is useful only for sending out for initial routing sync.
15374  * Not stored if contains excess data to prevent DoS.
15375  */
15376 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
15377
15378 /**
15379  * Constructs a new DirectionalChannelInfo given each field
15380  */
15381 MUST_USE_RES struct LDKDirectionalChannelInfo DirectionalChannelInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg);
15382
15383 /**
15384  * Creates a copy of the DirectionalChannelInfo
15385  */
15386 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
15387
15388 /**
15389  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
15390  */
15391 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
15392
15393 /**
15394  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
15395  */
15396 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
15397
15398 /**
15399  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
15400  */
15401 void ChannelInfo_free(struct LDKChannelInfo this_obj);
15402
15403 /**
15404  * Protocol features of a channel communicated during its announcement
15405  */
15406 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15407
15408 /**
15409  * Protocol features of a channel communicated during its announcement
15410  */
15411 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
15412
15413 /**
15414  * Source node of the first direction of a channel
15415  */
15416 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15417
15418 /**
15419  * Source node of the first direction of a channel
15420  */
15421 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15422
15423 /**
15424  * Details about the first direction of a channel
15425  */
15426 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15427
15428 /**
15429  * Details about the first direction of a channel
15430  */
15431 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
15432
15433 /**
15434  * Source node of the second direction of a channel
15435  */
15436 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15437
15438 /**
15439  * Source node of the second direction of a channel
15440  */
15441 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15442
15443 /**
15444  * Details about the second direction of a channel
15445  */
15446 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15447
15448 /**
15449  * Details about the second direction of a channel
15450  */
15451 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
15452
15453 /**
15454  * The channel capacity as seen on-chain, if chain lookup is available.
15455  */
15456 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15457
15458 /**
15459  * The channel capacity as seen on-chain, if chain lookup is available.
15460  */
15461 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15462
15463 /**
15464  * An initial announcement of the channel
15465  * Mostly redundant with the data we store in fields explicitly.
15466  * Everything else is useful only for sending out for initial routing sync.
15467  * Not stored if contains excess data to prevent DoS.
15468  */
15469 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15470
15471 /**
15472  * An initial announcement of the channel
15473  * Mostly redundant with the data we store in fields explicitly.
15474  * Everything else is useful only for sending out for initial routing sync.
15475  * Not stored if contains excess data to prevent DoS.
15476  */
15477 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
15478
15479 /**
15480  * Constructs a new ChannelInfo given each field
15481  */
15482 MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKPublicKey node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKPublicKey node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg);
15483
15484 /**
15485  * Creates a copy of the ChannelInfo
15486  */
15487 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
15488
15489 /**
15490  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
15491  */
15492 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
15493
15494 /**
15495  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
15496  */
15497 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
15498
15499 /**
15500  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
15501  */
15502 void RoutingFees_free(struct LDKRoutingFees this_obj);
15503
15504 /**
15505  * Flat routing fee in satoshis
15506  */
15507 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
15508
15509 /**
15510  * Flat routing fee in satoshis
15511  */
15512 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
15513
15514 /**
15515  * Liquidity-based routing fee in millionths of a routed amount.
15516  * In other words, 10000 is 1%.
15517  */
15518 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
15519
15520 /**
15521  * Liquidity-based routing fee in millionths of a routed amount.
15522  * In other words, 10000 is 1%.
15523  */
15524 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
15525
15526 /**
15527  * Constructs a new RoutingFees given each field
15528  */
15529 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
15530
15531 /**
15532  * Creates a copy of the RoutingFees
15533  */
15534 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
15535
15536 /**
15537  * Read a RoutingFees from a byte array, created by RoutingFees_write
15538  */
15539 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
15540
15541 /**
15542  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
15543  */
15544 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
15545
15546 /**
15547  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
15548  */
15549 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
15550
15551 /**
15552  * Protocol features the node announced support for
15553  */
15554 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15555
15556 /**
15557  * Protocol features the node announced support for
15558  */
15559 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
15560
15561 /**
15562  * When the last known update to the node state was issued.
15563  * Value is opaque, as set in the announcement.
15564  */
15565 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15566
15567 /**
15568  * When the last known update to the node state was issued.
15569  * Value is opaque, as set in the announcement.
15570  */
15571 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
15572
15573 /**
15574  * Color assigned to the node
15575  */
15576 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
15577
15578 /**
15579  * Color assigned to the node
15580  */
15581 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
15582
15583 /**
15584  * Moniker assigned to the node.
15585  * May be invalid or malicious (eg control chars),
15586  * should not be exposed to the user.
15587  */
15588 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
15589
15590 /**
15591  * Moniker assigned to the node.
15592  * May be invalid or malicious (eg control chars),
15593  * should not be exposed to the user.
15594  */
15595 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15596
15597 /**
15598  * Internet-level addresses via which one can connect to the node
15599  */
15600 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
15601
15602 /**
15603  * An initial announcement of the node
15604  * Mostly redundant with the data we store in fields explicitly.
15605  * Everything else is useful only for sending out for initial routing sync.
15606  * Not stored if contains excess data to prevent DoS.
15607  */
15608 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15609
15610 /**
15611  * An initial announcement of the node
15612  * Mostly redundant with the data we store in fields explicitly.
15613  * Everything else is useful only for sending out for initial routing sync.
15614  * Not stored if contains excess data to prevent DoS.
15615  */
15616 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
15617
15618 /**
15619  * Constructs a new NodeAnnouncementInfo given each field
15620  */
15621 MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg);
15622
15623 /**
15624  * Creates a copy of the NodeAnnouncementInfo
15625  */
15626 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
15627
15628 /**
15629  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
15630  */
15631 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
15632
15633 /**
15634  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
15635  */
15636 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
15637
15638 /**
15639  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
15640  */
15641 void NodeInfo_free(struct LDKNodeInfo this_obj);
15642
15643 /**
15644  * All valid channels a node has announced
15645  */
15646 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15647
15648 /**
15649  * Lowest fees enabling routing via any of the enabled, known channels to a node.
15650  * The two fields (flat and proportional fee) are independent,
15651  * meaning they don't have to refer to the same channel.
15652  */
15653 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
15654
15655 /**
15656  * Lowest fees enabling routing via any of the enabled, known channels to a node.
15657  * The two fields (flat and proportional fee) are independent,
15658  * meaning they don't have to refer to the same channel.
15659  */
15660 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
15661
15662 /**
15663  * More information about a node from node_announcement.
15664  * Optional because we store a Node entry after learning about it from
15665  * a channel announcement, but before receiving a node announcement.
15666  */
15667 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
15668
15669 /**
15670  * More information about a node from node_announcement.
15671  * Optional because we store a Node entry after learning about it from
15672  * a channel announcement, but before receiving a node announcement.
15673  */
15674 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
15675
15676 /**
15677  * Constructs a new NodeInfo given each field
15678  */
15679 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
15680
15681 /**
15682  * Creates a copy of the NodeInfo
15683  */
15684 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
15685
15686 /**
15687  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
15688  */
15689 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
15690
15691 /**
15692  * Read a NodeInfo from a byte array, created by NodeInfo_write
15693  */
15694 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
15695
15696 /**
15697  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
15698  */
15699 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
15700
15701 /**
15702  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
15703  */
15704 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
15705
15706 /**
15707  * Creates a new, empty, network graph.
15708  */
15709 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
15710
15711 /**
15712  * For an already known node (from channel announcements), update its stored properties from a
15713  * given node announcement.
15714  *
15715  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15716  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15717  * routing messages from a source using a protocol other than the lightning P2P protocol.
15718  */
15719 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
15720
15721 /**
15722  * For an already known node (from channel announcements), update its stored properties from a
15723  * given node announcement without verifying the associated signatures. Because we aren't
15724  * given the associated signatures here we cannot relay the node announcement to any of our
15725  * peers.
15726  */
15727 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
15728
15729 /**
15730  * Store or update channel info from a channel announcement.
15731  *
15732  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15733  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15734  * routing messages from a source using a protocol other than the lightning P2P protocol.
15735  *
15736  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
15737  * the corresponding UTXO exists on chain and is correctly-formatted.
15738  */
15739 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
15740
15741 /**
15742  * Store or update channel info from a channel announcement without verifying the associated
15743  * signatures. Because we aren't given the associated signatures here we cannot relay the
15744  * channel announcement to any of our peers.
15745  *
15746  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
15747  * the corresponding UTXO exists on chain and is correctly-formatted.
15748  */
15749 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
15750
15751 /**
15752  * Close a channel if a corresponding HTLC fail was sent.
15753  * If permanent, removes a channel from the local storage.
15754  * May cause the removal of nodes too, if this was their last channel.
15755  * If not permanent, makes channels unavailable for routing.
15756  */
15757 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
15758
15759 /**
15760  * For an already known (from announcement) channel, update info about one of the directions
15761  * of the channel.
15762  *
15763  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15764  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15765  * routing messages from a source using a protocol other than the lightning P2P protocol.
15766  */
15767 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
15768
15769 /**
15770  * For an already known (from announcement) channel, update info about one of the directions
15771  * of the channel without verifying the associated signatures. Because we aren't given the
15772  * associated signatures here we cannot relay the channel update to any of our peers.
15773  */
15774 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
15775
15776 /**
15777  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
15778  */
15779 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
15780
15781 /**
15782  * Initialize a new FilesystemPersister and set the path to the individual channels'
15783  * files.
15784  */
15785 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKCVec_u8Z path_to_channel_data);
15786
15787 /**
15788  * Get the directory which was provided when this persister was initialized.
15789  */
15790 MUST_USE_RES struct LDKCVec_u8Z FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
15791
15792 /**
15793  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
15794  * initialization, within a file called \"manager\".
15795  */
15796 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKCVec_u8Z data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
15797
15798 /**
15799  * Read `ChannelMonitor`s from disk.
15800  */
15801 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
15802
15803 /**
15804  * Constructs a new Persist which calls the relevant methods on this_arg.
15805  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
15806  */
15807 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
15808
15809 #endif /* LDK_C_BINDINGS_H */