Merge pull request #14 from TheBlueMatt/main
[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 be notified of when blocks have been connected or disconnected
6857  * from the chain.
6858  *
6859  * Useful when needing to replay chain data upon startup or as new chain events occur.
6860  */
6861 typedef struct LDKListen {
6862    /**
6863     * An opaque pointer which is passed to your function implementations as an argument.
6864     * This has no meaning in the LDK, and can be NULL or any other value.
6865     */
6866    void *this_arg;
6867    /**
6868     * Notifies the listener that a block was added at the given height.
6869     */
6870    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
6871    /**
6872     * Notifies the listener that a block was removed at the given height.
6873     */
6874    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
6875    /**
6876     * Frees any resources associated with this object given its this_arg pointer.
6877     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6878     */
6879    void (*free)(void *this_arg);
6880 } LDKListen;
6881
6882
6883
6884 /**
6885  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
6886  *
6887  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
6888  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
6889  * the return value of [`Filter::register_output`].
6890  *
6891  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
6892  * may have been spent there. See [`Filter::register_output`] for details.
6893  *
6894  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
6895  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
6896  */
6897 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
6898    /**
6899     * A pointer to the opaque Rust object.
6900     * Nearly everywhere, inner must be non-null, however in places where
6901     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6902     */
6903    LDKnativeWatchedOutput *inner;
6904    /**
6905     * Indicates that this is the only struct which contains the same pointer.
6906     * Rust functions which take ownership of an object provided via an argument require
6907     * this to be true and invalidate the object pointed to by inner.
6908     */
6909    bool is_owned;
6910 } LDKWatchedOutput;
6911
6912 /**
6913  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
6914  * channels.
6915  *
6916  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
6917  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
6918  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
6919  * receiving full blocks from a chain source, any further filtering is unnecessary.
6920  *
6921  * After an output has been registered, subsequent block retrievals from the chain source must not
6922  * exclude any transactions matching the new criteria nor any in-block descendants of such
6923  * transactions.
6924  *
6925  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
6926  * should not block on I/O. Implementations should instead queue the newly monitored data to be
6927  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
6928  * invocation that has called the `Filter` must return [`TemporaryFailure`].
6929  *
6930  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
6931  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
6932  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
6933  */
6934 typedef struct LDKFilter {
6935    /**
6936     * An opaque pointer which is passed to your function implementations as an argument.
6937     * This has no meaning in the LDK, and can be NULL or any other value.
6938     */
6939    void *this_arg;
6940    /**
6941     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
6942     * a spending condition.
6943     */
6944    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
6945    /**
6946     * Registers interest in spends of a transaction output.
6947     *
6948     * Optionally, when `output.block_hash` is set, should return any transaction spending the
6949     * output that is found in the corresponding block along with its index.
6950     *
6951     * This return value is useful for Electrum clients in order to supply in-block descendant
6952     * transactions which otherwise were not included. This is not necessary for other clients if
6953     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
6954     * full block).
6955     */
6956    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
6957    /**
6958     * Frees any resources associated with this object given its this_arg pointer.
6959     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6960     */
6961    void (*free)(void *this_arg);
6962 } LDKFilter;
6963
6964 /**
6965  * `Persist` defines behavior for persisting channel monitors: this could mean
6966  * writing once to disk, and/or uploading to one or more backup services.
6967  *
6968  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
6969  * to disk/backups. And, on every update, you **must** persist either the
6970  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
6971  * of situations such as revoking a transaction, then crashing before this
6972  * revocation can be persisted, then unintentionally broadcasting a revoked
6973  * transaction and losing money. This is a risk because previous channel states
6974  * are toxic, so it's important that whatever channel state is persisted is
6975  * kept up-to-date.
6976  */
6977 typedef struct LDKPersist {
6978    /**
6979     * An opaque pointer which is passed to your function implementations as an argument.
6980     * This has no meaning in the LDK, and can be NULL or any other value.
6981     */
6982    void *this_arg;
6983    /**
6984     * Persist a new channel's data. The data can be stored any way you want, but
6985     * the identifier provided by Rust-Lightning is the channel's outpoint (and
6986     * it is up to you to maintain a correct mapping between the outpoint and the
6987     * stored channel data). Note that you **must** persist every new monitor to
6988     * disk. See the `Persist` trait documentation for more details.
6989     *
6990     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
6991     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
6992     */
6993    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
6994    /**
6995     * Update one channel's data. The provided `ChannelMonitor` has already
6996     * applied the given update.
6997     *
6998     * Note that on every update, you **must** persist either the
6999     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
7000     * the `Persist` trait documentation for more details.
7001     *
7002     * If an implementer chooses to persist the updates only, they need to make
7003     * sure that all the updates are applied to the `ChannelMonitors` *before*
7004     * the set of channel monitors is given to the `ChannelManager`
7005     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
7006     * applying a monitor update to a monitor. If full `ChannelMonitors` are
7007     * persisted, then there is no need to persist individual updates.
7008     *
7009     * Note that there could be a performance tradeoff between persisting complete
7010     * channel monitors on every update vs. persisting only updates and applying
7011     * them in batches. The size of each monitor grows `O(number of state updates)`
7012     * whereas updates are small and `O(1)`.
7013     *
7014     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
7015     * [`ChannelMonitorUpdate::write`] for writing out an update, and
7016     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
7017     */
7018    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);
7019    /**
7020     * Frees any resources associated with this object given its this_arg pointer.
7021     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7022     */
7023    void (*free)(void *this_arg);
7024 } LDKPersist;
7025
7026
7027
7028 /**
7029  * An implementation of [`chain::Watch`] for monitoring channels.
7030  *
7031  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
7032  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
7033  * or used independently to monitor channels remotely. See the [module-level documentation] for
7034  * details.
7035  *
7036  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
7037  * [module-level documentation]: crate::chain::chainmonitor
7038  */
7039 typedef struct MUST_USE_STRUCT LDKChainMonitor {
7040    /**
7041     * A pointer to the opaque Rust object.
7042     * Nearly everywhere, inner must be non-null, however in places where
7043     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7044     */
7045    LDKnativeChainMonitor *inner;
7046    /**
7047     * Indicates that this is the only struct which contains the same pointer.
7048     * Rust functions which take ownership of an object provided via an argument require
7049     * this to be true and invalidate the object pointed to by inner.
7050     */
7051    bool is_owned;
7052 } LDKChainMonitor;
7053
7054
7055
7056 /**
7057  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
7058  * and derives keys from that.
7059  *
7060  * Your node_id is seed/0'
7061  * ChannelMonitor closes may use seed/1'
7062  * Cooperative closes may use seed/2'
7063  * The two close keys may be needed to claim on-chain funds!
7064  */
7065 typedef struct MUST_USE_STRUCT LDKKeysManager {
7066    /**
7067     * A pointer to the opaque Rust object.
7068     * Nearly everywhere, inner must be non-null, however in places where
7069     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7070     */
7071    LDKnativeKeysManager *inner;
7072    /**
7073     * Indicates that this is the only struct which contains the same pointer.
7074     * Rust functions which take ownership of an object provided via an argument require
7075     * this to be true and invalidate the object pointed to by inner.
7076     */
7077    bool is_owned;
7078 } LDKKeysManager;
7079
7080
7081
7082 /**
7083  * Chain-related parameters used to construct a new `ChannelManager`.
7084  *
7085  * Typically, the block-specific parameters are derived from the best block hash for the network,
7086  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
7087  * are not needed when deserializing a previously constructed `ChannelManager`.
7088  */
7089 typedef struct MUST_USE_STRUCT LDKChainParameters {
7090    /**
7091     * A pointer to the opaque Rust object.
7092     * Nearly everywhere, inner must be non-null, however in places where
7093     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7094     */
7095    LDKnativeChainParameters *inner;
7096    /**
7097     * Indicates that this is the only struct which contains the same pointer.
7098     * Rust functions which take ownership of an object provided via an argument require
7099     * this to be true and invalidate the object pointed to by inner.
7100     */
7101    bool is_owned;
7102 } LDKChainParameters;
7103
7104
7105
7106 /**
7107  * The best known block as identified by its hash and height.
7108  */
7109 typedef struct MUST_USE_STRUCT LDKBestBlock {
7110    /**
7111     * A pointer to the opaque Rust object.
7112     * Nearly everywhere, inner must be non-null, however in places where
7113     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7114     */
7115    LDKnativeBestBlock *inner;
7116    /**
7117     * Indicates that this is the only struct which contains the same pointer.
7118     * Rust functions which take ownership of an object provided via an argument require
7119     * this to be true and invalidate the object pointed to by inner.
7120     */
7121    bool is_owned;
7122 } LDKBestBlock;
7123
7124 /**
7125  * A 3-byte byte array.
7126  */
7127 typedef struct LDKThreeBytes {
7128    /**
7129     * The three bytes
7130     */
7131    uint8_t data[3];
7132 } LDKThreeBytes;
7133
7134 /**
7135  * A trait to describe an object which can receive channel messages.
7136  *
7137  * Messages MAY be called in parallel when they originate from different their_node_ids, however
7138  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
7139  */
7140 typedef struct LDKChannelMessageHandler {
7141    /**
7142     * An opaque pointer which is passed to your function implementations as an argument.
7143     * This has no meaning in the LDK, and can be NULL or any other value.
7144     */
7145    void *this_arg;
7146    /**
7147     * Handle an incoming open_channel message from the given peer.
7148     */
7149    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
7150    /**
7151     * Handle an incoming accept_channel message from the given peer.
7152     */
7153    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
7154    /**
7155     * Handle an incoming funding_created message from the given peer.
7156     */
7157    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
7158    /**
7159     * Handle an incoming funding_signed message from the given peer.
7160     */
7161    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
7162    /**
7163     * Handle an incoming funding_locked message from the given peer.
7164     */
7165    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
7166    /**
7167     * Handle an incoming shutdown message from the given peer.
7168     */
7169    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);
7170    /**
7171     * Handle an incoming closing_signed message from the given peer.
7172     */
7173    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
7174    /**
7175     * Handle an incoming update_add_htlc message from the given peer.
7176     */
7177    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
7178    /**
7179     * Handle an incoming update_fulfill_htlc message from the given peer.
7180     */
7181    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
7182    /**
7183     * Handle an incoming update_fail_htlc message from the given peer.
7184     */
7185    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
7186    /**
7187     * Handle an incoming update_fail_malformed_htlc message from the given peer.
7188     */
7189    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
7190    /**
7191     * Handle an incoming commitment_signed message from the given peer.
7192     */
7193    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
7194    /**
7195     * Handle an incoming revoke_and_ack message from the given peer.
7196     */
7197    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
7198    /**
7199     * Handle an incoming update_fee message from the given peer.
7200     */
7201    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
7202    /**
7203     * Handle an incoming announcement_signatures message from the given peer.
7204     */
7205    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
7206    /**
7207     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
7208     * is believed to be possible in the future (eg they're sending us messages we don't
7209     * understand or indicate they require unknown feature bits), no_connection_possible is set
7210     * and any outstanding channels should be failed.
7211     */
7212    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
7213    /**
7214     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
7215     */
7216    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
7217    /**
7218     * Handle an incoming channel_reestablish message from the given peer.
7219     */
7220    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
7221    /**
7222     * Handle an incoming channel update from the given peer.
7223     */
7224    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
7225    /**
7226     * Handle an incoming error message from the given peer.
7227     */
7228    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
7229    /**
7230     * Implementation of MessageSendEventsProvider for this object.
7231     */
7232    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
7233    /**
7234     * Frees any resources associated with this object given its this_arg pointer.
7235     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7236     */
7237    void (*free)(void *this_arg);
7238 } LDKChannelMessageHandler;
7239
7240
7241
7242 /**
7243  * Arguments for the creation of a ChannelManager that are not deserialized.
7244  *
7245  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
7246  * is:
7247  * 1) Deserialize all stored ChannelMonitors.
7248  * 2) Deserialize the ChannelManager by filling in this struct and calling:
7249  *    <(BlockHash, ChannelManager)>::read(reader, args)
7250  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
7251  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
7252  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
7253  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
7254  *    ChannelMonitor::get_funding_txo().
7255  * 4) Reconnect blocks on your ChannelMonitors.
7256  * 5) Disconnect/connect blocks on the ChannelManager.
7257  * 6) Move the ChannelMonitors into your local chain::Watch.
7258  *
7259  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
7260  * call any other methods on the newly-deserialized ChannelManager.
7261  *
7262  * Note that because some channels may be closed during deserialization, it is critical that you
7263  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
7264  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
7265  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
7266  * not force-close the same channels but consider them live), you may end up revoking a state for
7267  * which you've already broadcasted the transaction.
7268  */
7269 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
7270    /**
7271     * A pointer to the opaque Rust object.
7272     * Nearly everywhere, inner must be non-null, however in places where
7273     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7274     */
7275    LDKnativeChannelManagerReadArgs *inner;
7276    /**
7277     * Indicates that this is the only struct which contains the same pointer.
7278     * Rust functions which take ownership of an object provided via an argument require
7279     * this to be true and invalidate the object pointed to by inner.
7280     */
7281    bool is_owned;
7282 } LDKChannelManagerReadArgs;
7283
7284
7285
7286 /**
7287  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
7288  * This is used to convince the recipient that the channel is at a certain commitment
7289  * number even if they lost that data due to a local failure.  Of course, the peer may lie
7290  * and even later commitments may have been revoked.
7291  */
7292 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
7293    /**
7294     * A pointer to the opaque Rust object.
7295     * Nearly everywhere, inner must be non-null, however in places where
7296     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7297     */
7298    LDKnativeDataLossProtect *inner;
7299    /**
7300     * Indicates that this is the only struct which contains the same pointer.
7301     * Rust functions which take ownership of an object provided via an argument require
7302     * this to be true and invalidate the object pointed to by inner.
7303     */
7304    bool is_owned;
7305 } LDKDataLossProtect;
7306
7307 /**
7308  * A trait to describe an object which can receive routing messages.
7309  *
7310  * # Implementor DoS Warnings
7311  *
7312  * For `gossip_queries` messages there are potential DoS vectors when handling
7313  * inbound queries. Implementors using an on-disk network graph should be aware of
7314  * repeated disk I/O for queries accessing different parts of the network graph.
7315  */
7316 typedef struct LDKRoutingMessageHandler {
7317    /**
7318     * An opaque pointer which is passed to your function implementations as an argument.
7319     * This has no meaning in the LDK, and can be NULL or any other value.
7320     */
7321    void *this_arg;
7322    /**
7323     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
7324     * false or returning an Err otherwise.
7325     */
7326    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
7327    /**
7328     * Handle a channel_announcement message, returning true if it should be forwarded on, false
7329     * or returning an Err otherwise.
7330     */
7331    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
7332    /**
7333     * Handle an incoming channel_update message, returning true if it should be forwarded on,
7334     * false or returning an Err otherwise.
7335     */
7336    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
7337    /**
7338     * Handle some updates to the route graph that we learned due to an outbound failed payment.
7339     */
7340    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
7341    /**
7342     * Gets a subset of the channel announcements and updates required to dump our routing table
7343     * to a remote node, starting at the short_channel_id indicated by starting_point and
7344     * including the batch_amount entries immediately higher in numerical value than starting_point.
7345     */
7346    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
7347    /**
7348     * Gets a subset of the node announcements required to dump our routing table to a remote node,
7349     * starting at the node *after* the provided publickey and including batch_amount entries
7350     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
7351     * If None is provided for starting_point, we start at the first node.
7352     */
7353    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
7354    /**
7355     * Called when a connection is established with a peer. This can be used to
7356     * perform routing table synchronization using a strategy defined by the
7357     * implementor.
7358     */
7359    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
7360    /**
7361     * Handles the reply of a query we initiated to learn about channels
7362     * for a given range of blocks. We can expect to receive one or more
7363     * replies to a single query.
7364     */
7365    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
7366    /**
7367     * Handles the reply of a query we initiated asking for routing gossip
7368     * messages for a list of channels. We should receive this message when
7369     * a node has completed its best effort to send us the pertaining routing
7370     * gossip messages.
7371     */
7372    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
7373    /**
7374     * Handles when a peer asks us to send a list of short_channel_ids
7375     * for the requested range of blocks.
7376     */
7377    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
7378    /**
7379     * Handles when a peer asks us to send routing gossip messages for a
7380     * list of short_channel_ids.
7381     */
7382    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
7383    /**
7384     * Implementation of MessageSendEventsProvider for this object.
7385     */
7386    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
7387    /**
7388     * Frees any resources associated with this object given its this_arg pointer.
7389     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7390     */
7391    void (*free)(void *this_arg);
7392 } LDKRoutingMessageHandler;
7393
7394
7395
7396 /**
7397  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
7398  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
7399  */
7400 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
7401    /**
7402     * A pointer to the opaque Rust object.
7403     * Nearly everywhere, inner must be non-null, however in places where
7404     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7405     */
7406    LDKnativeIgnoringMessageHandler *inner;
7407    /**
7408     * Indicates that this is the only struct which contains the same pointer.
7409     * Rust functions which take ownership of an object provided via an argument require
7410     * this to be true and invalidate the object pointed to by inner.
7411     */
7412    bool is_owned;
7413 } LDKIgnoringMessageHandler;
7414
7415
7416
7417 /**
7418  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
7419  * You can provide one of these as the route_handler in a MessageHandler.
7420  */
7421 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
7422    /**
7423     * A pointer to the opaque Rust object.
7424     * Nearly everywhere, inner must be non-null, however in places where
7425     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7426     */
7427    LDKnativeErroringMessageHandler *inner;
7428    /**
7429     * Indicates that this is the only struct which contains the same pointer.
7430     * Rust functions which take ownership of an object provided via an argument require
7431     * this to be true and invalidate the object pointed to by inner.
7432     */
7433    bool is_owned;
7434 } LDKErroringMessageHandler;
7435
7436
7437
7438 /**
7439  * Provides references to trait impls which handle different types of messages.
7440  */
7441 typedef struct MUST_USE_STRUCT LDKMessageHandler {
7442    /**
7443     * A pointer to the opaque Rust object.
7444     * Nearly everywhere, inner must be non-null, however in places where
7445     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7446     */
7447    LDKnativeMessageHandler *inner;
7448    /**
7449     * Indicates that this is the only struct which contains the same pointer.
7450     * Rust functions which take ownership of an object provided via an argument require
7451     * this to be true and invalidate the object pointed to by inner.
7452     */
7453    bool is_owned;
7454 } LDKMessageHandler;
7455
7456 /**
7457  * Provides an object which can be used to send data to and which uniquely identifies a connection
7458  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
7459  * implement Hash to meet the PeerManager API.
7460  *
7461  * For efficiency, Clone should be relatively cheap for this type.
7462  *
7463  * You probably want to just extend an int and put a file descriptor in a struct and implement
7464  * send_data. Note that if you are using a higher-level net library that may call close() itself,
7465  * be careful to ensure you don't have races whereby you might register a new connection with an
7466  * fd which is the same as a previous one which has yet to be removed via
7467  * PeerManager::socket_disconnected().
7468  */
7469 typedef struct LDKSocketDescriptor {
7470    /**
7471     * An opaque pointer which is passed to your function implementations as an argument.
7472     * This has no meaning in the LDK, and can be NULL or any other value.
7473     */
7474    void *this_arg;
7475    /**
7476     * Attempts to send some data from the given slice to the peer.
7477     *
7478     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
7479     * Note that in the disconnected case, socket_disconnected must still fire and further write
7480     * attempts may occur until that time.
7481     *
7482     * If the returned size is smaller than data.len(), a write_available event must
7483     * trigger the next time more data can be written. Additionally, until the a send_data event
7484     * completes fully, no further read_events should trigger on the same peer!
7485     *
7486     * If a read_event on this descriptor had previously returned true (indicating that read
7487     * events should be paused to prevent DoS in the send buffer), resume_read may be set
7488     * indicating that read events on this descriptor should resume. A resume_read of false does
7489     * *not* imply that further read events should be paused.
7490     */
7491    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
7492    /**
7493     * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
7494     * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
7495     * this descriptor. No socket_disconnected call should be generated as a result of this call,
7496     * though races may occur whereby disconnect_socket is called after a call to
7497     * socket_disconnected but prior to socket_disconnected returning.
7498     */
7499    void (*disconnect_socket)(void *this_arg);
7500    /**
7501     * Checks if two objects are equal given this object's this_arg pointer and another object.
7502     */
7503    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
7504    /**
7505     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
7506     * This is used, for example, for inclusion of this object in a hash map.
7507     */
7508    uint64_t (*hash)(const void *this_arg);
7509    /**
7510     * Creates a copy of the object pointed to by this_arg, for a copy of this SocketDescriptor.
7511     * Note that the ultimate copy of the SocketDescriptor will have all function pointers the same as the original.
7512     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new SocketDescriptor.
7513     */
7514    void *(*clone)(const void *this_arg);
7515    /**
7516     * Frees any resources associated with this object given its this_arg pointer.
7517     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7518     */
7519    void (*free)(void *this_arg);
7520 } LDKSocketDescriptor;
7521
7522
7523
7524 /**
7525  * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
7526  * events into messages which it passes on to its MessageHandlers.
7527  *
7528  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
7529  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
7530  * essentially you should default to using a SimpleRefPeerManager, and use a
7531  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
7532  * you're using lightning-net-tokio.
7533  */
7534 typedef struct MUST_USE_STRUCT LDKPeerManager {
7535    /**
7536     * A pointer to the opaque Rust object.
7537     * Nearly everywhere, inner must be non-null, however in places where
7538     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7539     */
7540    LDKnativePeerManager *inner;
7541    /**
7542     * Indicates that this is the only struct which contains the same pointer.
7543     * Rust functions which take ownership of an object provided via an argument require
7544     * this to be true and invalidate the object pointed to by inner.
7545     */
7546    bool is_owned;
7547 } LDKPeerManager;
7548
7549
7550
7551 /**
7552  * Static channel fields used to build transactions given per-commitment fields, organized by
7553  * broadcaster/countersignatory.
7554  *
7555  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
7556  * as_holder_broadcastable and as_counterparty_broadcastable functions.
7557  */
7558 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
7559    /**
7560     * A pointer to the opaque Rust object.
7561     * Nearly everywhere, inner must be non-null, however in places where
7562     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7563     */
7564    LDKnativeDirectedChannelTransactionParameters *inner;
7565    /**
7566     * Indicates that this is the only struct which contains the same pointer.
7567     * Rust functions which take ownership of an object provided via an argument require
7568     * this to be true and invalidate the object pointed to by inner.
7569     */
7570    bool is_owned;
7571 } LDKDirectedChannelTransactionParameters;
7572
7573
7574
7575 /**
7576  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
7577  * This exists only to make accessing a RwLock<NetworkGraph> possible from
7578  * the C bindings, as it can be done directly in Rust code.
7579  */
7580 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
7581    /**
7582     * A pointer to the opaque Rust object.
7583     * Nearly everywhere, inner must be non-null, however in places where
7584     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7585     */
7586    LDKnativeLockedNetworkGraph *inner;
7587    /**
7588     * Indicates that this is the only struct which contains the same pointer.
7589     * Rust functions which take ownership of an object provided via an argument require
7590     * this to be true and invalidate the object pointed to by inner.
7591     */
7592    bool is_owned;
7593 } LDKLockedNetworkGraph;
7594
7595
7596
7597 /**
7598  * Receives and validates network updates from peers,
7599  * stores authentic and relevant data as a network graph.
7600  * This network graph is then used for routing payments.
7601  * Provides interface to help with initial routing sync by
7602  * serving historical announcements.
7603  */
7604 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
7605    /**
7606     * A pointer to the opaque Rust object.
7607     * Nearly everywhere, inner must be non-null, however in places where
7608     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7609     */
7610    LDKnativeNetGraphMsgHandler *inner;
7611    /**
7612     * Indicates that this is the only struct which contains the same pointer.
7613     * Rust functions which take ownership of an object provided via an argument require
7614     * this to be true and invalidate the object pointed to by inner.
7615     */
7616    bool is_owned;
7617 } LDKNetGraphMsgHandler;
7618
7619
7620
7621 /**
7622  * FilesystemPersister persists channel data on disk, where each channel's
7623  * data is stored in a file named after its funding outpoint.
7624  *
7625  * Warning: this module does the best it can with calls to persist data, but it
7626  * can only guarantee that the data is passed to the drive. It is up to the
7627  * drive manufacturers to do the actual persistence properly, which they often
7628  * don't (especially on consumer-grade hardware). Therefore, it is up to the
7629  * user to validate their entire storage stack, to ensure the writes are
7630  * persistent.
7631  * Corollary: especially when dealing with larger amounts of money, it is best
7632  * practice to have multiple channel data backups and not rely only on one
7633  * FilesystemPersister.
7634  */
7635 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
7636    /**
7637     * A pointer to the opaque Rust object.
7638     * Nearly everywhere, inner must be non-null, however in places where
7639     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7640     */
7641    LDKnativeFilesystemPersister *inner;
7642    /**
7643     * Indicates that this is the only struct which contains the same pointer.
7644     * Rust functions which take ownership of an object provided via an argument require
7645     * this to be true and invalidate the object pointed to by inner.
7646     */
7647    bool is_owned;
7648 } LDKFilesystemPersister;
7649
7650 extern const uintptr_t MAX_BUF_SIZE;
7651
7652 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
7653
7654 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
7655
7656 extern const uint16_t BREAKDOWN_TIMEOUT;
7657
7658 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
7659
7660 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
7661
7662 /**
7663  * Frees the data buffer, if data_is_owned is set and datalen > 0.
7664  */
7665 void Transaction_free(struct LDKTransaction _res);
7666
7667 /**
7668  * Frees the data pointed to by script_pubkey.
7669  */
7670 void TxOut_free(struct LDKTxOut _res);
7671
7672 /**
7673  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
7674  */
7675 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
7676
7677 /**
7678  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7679  */
7680 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
7681
7682 /**
7683  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7684  */
7685 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
7686
7687 /**
7688  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7689  */
7690 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
7691
7692 /**
7693  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7694  * but with all dynamically-allocated buffers duplicated in new buffers.
7695  */
7696 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
7697
7698 /**
7699  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
7700  */
7701 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
7702
7703 /**
7704  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
7705  */
7706 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
7707
7708 /**
7709  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
7710  */
7711 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
7712
7713 /**
7714  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7715  * but with all dynamically-allocated buffers duplicated in new buffers.
7716  */
7717 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
7718
7719 /**
7720  * Creates a new CResult_SecretKeyErrorZ in the success state.
7721  */
7722 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
7723
7724 /**
7725  * Creates a new CResult_SecretKeyErrorZ in the error state.
7726  */
7727 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
7728
7729 /**
7730  * Frees any resources used by the CResult_SecretKeyErrorZ.
7731  */
7732 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
7733
7734 /**
7735  * Creates a new CResult_PublicKeyErrorZ in the success state.
7736  */
7737 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
7738
7739 /**
7740  * Creates a new CResult_PublicKeyErrorZ in the error state.
7741  */
7742 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
7743
7744 /**
7745  * Frees any resources used by the CResult_PublicKeyErrorZ.
7746  */
7747 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
7748
7749 /**
7750  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
7751  */
7752 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
7753
7754 /**
7755  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
7756  */
7757 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
7758
7759 /**
7760  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
7761  */
7762 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
7763
7764 /**
7765  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
7766  * but with all dynamically-allocated buffers duplicated in new buffers.
7767  */
7768 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
7769
7770 /**
7771  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
7772  */
7773 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
7774
7775 /**
7776  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
7777  */
7778 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
7779
7780 /**
7781  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
7782  */
7783 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
7784
7785 /**
7786  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
7787  * but with all dynamically-allocated buffers duplicated in new buffers.
7788  */
7789 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
7790
7791 /**
7792  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
7793  */
7794 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
7795
7796 /**
7797  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
7798  */
7799 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
7800
7801 /**
7802  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
7803  */
7804 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
7805
7806 /**
7807  * Constructs a new COption_u32Z containing a u32
7808  */
7809 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
7810
7811 /**
7812  * Constructs a new COption_u32Z containing nothing
7813  */
7814 struct LDKCOption_u32Z COption_u32Z_none(void);
7815
7816 /**
7817  * Frees any resources associated with the u32, if we are in the Some state
7818  */
7819 void COption_u32Z_free(struct LDKCOption_u32Z _res);
7820
7821 /**
7822  * Creates a new COption_u32Z which has the same data as `orig`
7823  * but with all dynamically-allocated buffers duplicated in new buffers.
7824  */
7825 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
7826
7827 /**
7828  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
7829  */
7830 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
7831
7832 /**
7833  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
7834  */
7835 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
7836
7837 /**
7838  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
7839  */
7840 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
7841
7842 /**
7843  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
7844  * but with all dynamically-allocated buffers duplicated in new buffers.
7845  */
7846 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
7847
7848 /**
7849  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
7850  */
7851 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
7852
7853 /**
7854  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
7855  */
7856 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
7857
7858 /**
7859  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
7860  */
7861 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
7862
7863 /**
7864  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
7865  * but with all dynamically-allocated buffers duplicated in new buffers.
7866  */
7867 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
7868
7869 /**
7870  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
7871  */
7872 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
7873
7874 /**
7875  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
7876  */
7877 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
7878
7879 /**
7880  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
7881  */
7882 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
7883
7884 /**
7885  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
7886  * but with all dynamically-allocated buffers duplicated in new buffers.
7887  */
7888 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
7889
7890 /**
7891  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7892  */
7893 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
7894
7895 /**
7896  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
7897  */
7898 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
7899
7900 /**
7901  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
7902  */
7903 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
7904
7905 /**
7906  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
7907  */
7908 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
7909
7910 /**
7911  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
7912  * but with all dynamically-allocated buffers duplicated in new buffers.
7913  */
7914 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
7915
7916 /**
7917  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
7918  */
7919 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
7920
7921 /**
7922  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
7923  */
7924 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
7925
7926 /**
7927  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
7928  */
7929 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
7930
7931 /**
7932  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
7933  * but with all dynamically-allocated buffers duplicated in new buffers.
7934  */
7935 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
7936
7937 /**
7938  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
7939  */
7940 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
7941
7942 /**
7943  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
7944  */
7945 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
7946
7947 /**
7948  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
7949  */
7950 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
7951
7952 /**
7953  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
7954  * but with all dynamically-allocated buffers duplicated in new buffers.
7955  */
7956 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
7957
7958 /**
7959  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
7960  */
7961 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
7962
7963 /**
7964  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
7965  */
7966 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
7967
7968 /**
7969  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
7970  */
7971 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
7972
7973 /**
7974  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
7975  */
7976 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
7977
7978 /**
7979  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
7980  */
7981 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
7982
7983 /**
7984  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
7985  */
7986 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
7987
7988 /**
7989  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
7990  * but with all dynamically-allocated buffers duplicated in new buffers.
7991  */
7992 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
7993
7994 /**
7995  * Creates a new CResult_StringErrorZ in the success state.
7996  */
7997 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKCVec_u8Z o);
7998
7999 /**
8000  * Creates a new CResult_StringErrorZ in the error state.
8001  */
8002 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
8003
8004 /**
8005  * Frees any resources used by the CResult_StringErrorZ.
8006  */
8007 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
8008
8009 /**
8010  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
8011  */
8012 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
8013
8014 /**
8015  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
8016  */
8017 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
8018
8019 /**
8020  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
8021  */
8022 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
8023
8024 /**
8025  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
8026  * but with all dynamically-allocated buffers duplicated in new buffers.
8027  */
8028 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
8029
8030 /**
8031  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
8032  */
8033 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
8034
8035 /**
8036  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
8037  */
8038 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
8039
8040 /**
8041  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
8042  */
8043 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
8044
8045 /**
8046  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
8047  * but with all dynamically-allocated buffers duplicated in new buffers.
8048  */
8049 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
8050
8051 /**
8052  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
8053  */
8054 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
8055
8056 /**
8057  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
8058  */
8059 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
8060
8061 /**
8062  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
8063  */
8064 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
8065
8066 /**
8067  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
8068  * but with all dynamically-allocated buffers duplicated in new buffers.
8069  */
8070 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
8071
8072 /**
8073  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
8074  */
8075 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
8076
8077 /**
8078  * Frees any resources used by the C2Tuple_OutPointScriptZ.
8079  */
8080 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
8081
8082 /**
8083  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
8084  */
8085 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
8086
8087 /**
8088  * Frees any resources used by the C2Tuple_u32ScriptZ.
8089  */
8090 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
8091
8092 /**
8093  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8094  */
8095 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
8096
8097 /**
8098  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
8099  */
8100 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
8101
8102 /**
8103  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
8104  */
8105 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
8106
8107 /**
8108  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8109  */
8110 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
8111
8112 /**
8113  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8114  */
8115 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
8116
8117 /**
8118  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8119  */
8120 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
8121
8122 /**
8123  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8124  */
8125 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
8126
8127 /**
8128  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
8129  */
8130 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
8131
8132 /**
8133  * Frees any resources used by the C2Tuple_usizeTransactionZ.
8134  */
8135 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
8136
8137 /**
8138  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8139  */
8140 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
8141
8142 /**
8143  * Creates a new tuple which has the same data as `orig`
8144  * but with all dynamically-allocated buffers duplicated in new buffers.
8145  */
8146 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
8147
8148 /**
8149  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
8150  */
8151 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
8152
8153 /**
8154  * Frees any resources used by the C2Tuple_u32TxOutZ.
8155  */
8156 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
8157
8158 /**
8159  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8160  */
8161 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
8162
8163 /**
8164  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
8165  */
8166 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
8167
8168 /**
8169  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
8170  */
8171 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
8172
8173 /**
8174  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8175  */
8176 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
8177
8178 /**
8179  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8180  */
8181 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
8182
8183 /**
8184  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
8185  */
8186 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
8187
8188 /**
8189  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
8190  */
8191 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
8192
8193 /**
8194  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
8195  */
8196 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
8197
8198 /**
8199  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
8200  * but with all dynamically-allocated buffers duplicated in new buffers.
8201  */
8202 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
8203
8204 /**
8205  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
8206  */
8207 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
8208
8209 /**
8210  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
8211  */
8212 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
8213
8214 /**
8215  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
8216  */
8217 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
8218
8219 /**
8220  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
8221  */
8222 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
8223
8224 /**
8225  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
8226  */
8227 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
8228
8229 /**
8230  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8231  */
8232 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
8233
8234 /**
8235  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8236  */
8237 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
8238
8239 /**
8240  * Creates a new CResult_RouteDecodeErrorZ in the success state.
8241  */
8242 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
8243
8244 /**
8245  * Creates a new CResult_RouteDecodeErrorZ in the error state.
8246  */
8247 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
8248
8249 /**
8250  * Frees any resources used by the CResult_RouteDecodeErrorZ.
8251  */
8252 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
8253
8254 /**
8255  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
8256  * but with all dynamically-allocated buffers duplicated in new buffers.
8257  */
8258 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
8259
8260 /**
8261  * Constructs a new COption_u64Z containing a u64
8262  */
8263 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
8264
8265 /**
8266  * Constructs a new COption_u64Z containing nothing
8267  */
8268 struct LDKCOption_u64Z COption_u64Z_none(void);
8269
8270 /**
8271  * Frees any resources associated with the u64, if we are in the Some state
8272  */
8273 void COption_u64Z_free(struct LDKCOption_u64Z _res);
8274
8275 /**
8276  * Creates a new COption_u64Z which has the same data as `orig`
8277  * but with all dynamically-allocated buffers duplicated in new buffers.
8278  */
8279 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
8280
8281 /**
8282  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8283  */
8284 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
8285
8286 /**
8287  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8288  */
8289 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
8290
8291 /**
8292  * Creates a new CResult_RouteLightningErrorZ in the success state.
8293  */
8294 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
8295
8296 /**
8297  * Creates a new CResult_RouteLightningErrorZ in the error state.
8298  */
8299 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
8300
8301 /**
8302  * Frees any resources used by the CResult_RouteLightningErrorZ.
8303  */
8304 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
8305
8306 /**
8307  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
8308  * but with all dynamically-allocated buffers duplicated in new buffers.
8309  */
8310 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
8311
8312 /**
8313  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8314  */
8315 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
8316
8317 /**
8318  * Creates a new CResult_boolLightningErrorZ in the success state.
8319  */
8320 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
8321
8322 /**
8323  * Creates a new CResult_boolLightningErrorZ in the error state.
8324  */
8325 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
8326
8327 /**
8328  * Frees any resources used by the CResult_boolLightningErrorZ.
8329  */
8330 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
8331
8332 /**
8333  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
8334  * but with all dynamically-allocated buffers duplicated in new buffers.
8335  */
8336 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
8337
8338 /**
8339  * Creates a new tuple which has the same data as `orig`
8340  * but with all dynamically-allocated buffers duplicated in new buffers.
8341  */
8342 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
8343
8344 /**
8345  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
8346  */
8347 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
8348
8349 /**
8350  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
8351  */
8352 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
8353
8354 /**
8355  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8356  */
8357 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
8358
8359 /**
8360  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8361  */
8362 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
8363
8364 /**
8365  * Creates a new CResult_NoneLightningErrorZ in the success state.
8366  */
8367 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
8368
8369 /**
8370  * Creates a new CResult_NoneLightningErrorZ in the error state.
8371  */
8372 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
8373
8374 /**
8375  * Frees any resources used by the CResult_NoneLightningErrorZ.
8376  */
8377 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
8378
8379 /**
8380  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
8381  * but with all dynamically-allocated buffers duplicated in new buffers.
8382  */
8383 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
8384
8385 /**
8386  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8387  */
8388 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
8389
8390 /**
8391  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8392  */
8393 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
8394
8395 /**
8396  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
8397  */
8398 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
8399
8400 /**
8401  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
8402  */
8403 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
8404
8405 /**
8406  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
8407  */
8408 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
8409
8410 /**
8411  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
8412  * but with all dynamically-allocated buffers duplicated in new buffers.
8413  */
8414 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
8415
8416 /**
8417  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
8418  */
8419 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
8420
8421 /**
8422  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
8423  */
8424 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
8425
8426 /**
8427  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
8428  */
8429 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
8430
8431 /**
8432  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
8433  * but with all dynamically-allocated buffers duplicated in new buffers.
8434  */
8435 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
8436
8437 /**
8438  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
8439  */
8440 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
8441
8442 /**
8443  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
8444  */
8445 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
8446
8447 /**
8448  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
8449  */
8450 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
8451
8452 /**
8453  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
8454  * but with all dynamically-allocated buffers duplicated in new buffers.
8455  */
8456 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
8457
8458 /**
8459  * Creates a new CResult_TxOutAccessErrorZ in the success state.
8460  */
8461 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
8462
8463 /**
8464  * Creates a new CResult_TxOutAccessErrorZ in the error state.
8465  */
8466 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
8467
8468 /**
8469  * Frees any resources used by the CResult_TxOutAccessErrorZ.
8470  */
8471 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
8472
8473 /**
8474  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
8475  * but with all dynamically-allocated buffers duplicated in new buffers.
8476  */
8477 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
8478
8479 /**
8480  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
8481  */
8482 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
8483
8484 /**
8485  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
8486  */
8487 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
8488
8489 /**
8490  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
8491  */
8492 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
8493
8494 /**
8495  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8496  */
8497 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
8498
8499 /**
8500  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
8501  */
8502 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
8503
8504 /**
8505  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
8506  */
8507 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
8508
8509 /**
8510  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
8511  */
8512 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
8513
8514 /**
8515  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
8516  * but with all dynamically-allocated buffers duplicated in new buffers.
8517  */
8518 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
8519
8520 /**
8521  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8522  */
8523 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
8524
8525 /**
8526  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8527  */
8528 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
8529
8530 /**
8531  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8532  */
8533 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
8534
8535 /**
8536  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8537  * but with all dynamically-allocated buffers duplicated in new buffers.
8538  */
8539 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
8540
8541 /**
8542  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8543  */
8544 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
8545
8546 /**
8547  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8548  */
8549 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
8550
8551 /**
8552  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8553  */
8554 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
8555
8556 /**
8557  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8558  * but with all dynamically-allocated buffers duplicated in new buffers.
8559  */
8560 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
8561
8562 /**
8563  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8564  */
8565 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
8566
8567 /**
8568  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8569  */
8570 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
8571
8572 /**
8573  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8574  */
8575 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
8576
8577 /**
8578  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8579  */
8580 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
8581
8582 /**
8583  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
8584  * but with all dynamically-allocated buffers duplicated in new buffers.
8585  */
8586 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
8587
8588 /**
8589  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8590  */
8591 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
8592
8593 /**
8594  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
8595  */
8596 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
8597
8598 /**
8599  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
8600  */
8601 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
8602
8603 /**
8604  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
8605  */
8606 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
8607
8608 /**
8609  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
8610  * but with all dynamically-allocated buffers duplicated in new buffers.
8611  */
8612 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
8613
8614 /**
8615  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
8616  */
8617 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
8618
8619 /**
8620  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
8621  */
8622 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
8623
8624 /**
8625  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
8626  */
8627 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
8628
8629 /**
8630  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
8631  * but with all dynamically-allocated buffers duplicated in new buffers.
8632  */
8633 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
8634
8635 /**
8636  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
8637  */
8638 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
8639
8640 /**
8641  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
8642  */
8643 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8644
8645 /**
8646  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
8647  */
8648 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
8649
8650 /**
8651  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
8652  */
8653 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
8654
8655 /**
8656  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
8657  */
8658 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8659
8660 /**
8661  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
8662  */
8663 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
8664
8665 /**
8666  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
8667  */
8668 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
8669
8670 /**
8671  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
8672  */
8673 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8674
8675 /**
8676  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
8677  */
8678 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
8679
8680 /**
8681  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
8682  */
8683 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
8684
8685 /**
8686  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
8687  */
8688 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8689
8690 /**
8691  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
8692  */
8693 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
8694
8695 /**
8696  * Creates a new CResult_NetAddressu8Z in the success state.
8697  */
8698 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
8699
8700 /**
8701  * Creates a new CResult_NetAddressu8Z in the error state.
8702  */
8703 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
8704
8705 /**
8706  * Frees any resources used by the CResult_NetAddressu8Z.
8707  */
8708 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
8709
8710 /**
8711  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
8712  * but with all dynamically-allocated buffers duplicated in new buffers.
8713  */
8714 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
8715
8716 /**
8717  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
8718  */
8719 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
8720
8721 /**
8722  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
8723  */
8724 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
8725
8726 /**
8727  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
8728  */
8729 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
8730
8731 /**
8732  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
8733  * but with all dynamically-allocated buffers duplicated in new buffers.
8734  */
8735 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
8736
8737 /**
8738  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8739  */
8740 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
8741
8742 /**
8743  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8744  */
8745 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
8746
8747 /**
8748  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8749  */
8750 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
8751
8752 /**
8753  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8754  */
8755 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
8756
8757 /**
8758  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8759  */
8760 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
8761
8762 /**
8763  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8764  */
8765 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
8766
8767 /**
8768  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8769  */
8770 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
8771
8772 /**
8773  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8774  * but with all dynamically-allocated buffers duplicated in new buffers.
8775  */
8776 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
8777
8778 /**
8779  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8780  */
8781 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
8782
8783 /**
8784  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8785  */
8786 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
8787
8788 /**
8789  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
8790  */
8791 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
8792
8793 /**
8794  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
8795  * but with all dynamically-allocated buffers duplicated in new buffers.
8796  */
8797 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
8798
8799 /**
8800  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
8801  */
8802 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
8803
8804 /**
8805  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
8806  */
8807 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
8808
8809 /**
8810  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
8811  */
8812 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
8813
8814 /**
8815  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
8816  * but with all dynamically-allocated buffers duplicated in new buffers.
8817  */
8818 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
8819
8820 /**
8821  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
8822  */
8823 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
8824
8825 /**
8826  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
8827  */
8828 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
8829
8830 /**
8831  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
8832  */
8833 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
8834
8835 /**
8836  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
8837  * but with all dynamically-allocated buffers duplicated in new buffers.
8838  */
8839 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
8840
8841 /**
8842  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
8843  */
8844 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
8845
8846 /**
8847  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
8848  */
8849 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
8850
8851 /**
8852  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
8853  */
8854 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
8855
8856 /**
8857  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
8858  * but with all dynamically-allocated buffers duplicated in new buffers.
8859  */
8860 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
8861
8862 /**
8863  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
8864  */
8865 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
8866
8867 /**
8868  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
8869  */
8870 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
8871
8872 /**
8873  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
8874  */
8875 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
8876
8877 /**
8878  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
8879  * but with all dynamically-allocated buffers duplicated in new buffers.
8880  */
8881 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
8882
8883 /**
8884  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
8885  */
8886 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
8887
8888 /**
8889  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
8890  */
8891 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
8892
8893 /**
8894  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
8895  */
8896 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
8897
8898 /**
8899  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
8900  * but with all dynamically-allocated buffers duplicated in new buffers.
8901  */
8902 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
8903
8904 /**
8905  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
8906  */
8907 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
8908
8909 /**
8910  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
8911  */
8912 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
8913
8914 /**
8915  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
8916  */
8917 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
8918
8919 /**
8920  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
8921  * but with all dynamically-allocated buffers duplicated in new buffers.
8922  */
8923 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
8924
8925 /**
8926  * Creates a new CResult_InitDecodeErrorZ in the success state.
8927  */
8928 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
8929
8930 /**
8931  * Creates a new CResult_InitDecodeErrorZ in the error state.
8932  */
8933 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
8934
8935 /**
8936  * Frees any resources used by the CResult_InitDecodeErrorZ.
8937  */
8938 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
8939
8940 /**
8941  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
8942  * but with all dynamically-allocated buffers duplicated in new buffers.
8943  */
8944 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
8945
8946 /**
8947  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
8948  */
8949 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
8950
8951 /**
8952  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
8953  */
8954 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
8955
8956 /**
8957  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
8958  */
8959 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
8960
8961 /**
8962  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
8963  * but with all dynamically-allocated buffers duplicated in new buffers.
8964  */
8965 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
8966
8967 /**
8968  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
8969  */
8970 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
8971
8972 /**
8973  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
8974  */
8975 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
8976
8977 /**
8978  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
8979  */
8980 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
8981
8982 /**
8983  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
8984  * but with all dynamically-allocated buffers duplicated in new buffers.
8985  */
8986 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
8987
8988 /**
8989  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
8990  */
8991 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
8992
8993 /**
8994  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
8995  */
8996 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
8997
8998 /**
8999  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
9000  */
9001 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
9002
9003 /**
9004  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
9005  * but with all dynamically-allocated buffers duplicated in new buffers.
9006  */
9007 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
9008
9009 /**
9010  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
9011  */
9012 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
9013
9014 /**
9015  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
9016  */
9017 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
9018
9019 /**
9020  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
9021  */
9022 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
9023
9024 /**
9025  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
9026  * but with all dynamically-allocated buffers duplicated in new buffers.
9027  */
9028 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
9029
9030 /**
9031  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
9032  */
9033 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
9034
9035 /**
9036  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
9037  */
9038 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
9039
9040 /**
9041  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
9042  */
9043 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
9044
9045 /**
9046  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
9047  * but with all dynamically-allocated buffers duplicated in new buffers.
9048  */
9049 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
9050
9051 /**
9052  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
9053  */
9054 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
9055
9056 /**
9057  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
9058  */
9059 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
9060
9061 /**
9062  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
9063  */
9064 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
9065
9066 /**
9067  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
9068  * but with all dynamically-allocated buffers duplicated in new buffers.
9069  */
9070 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
9071
9072 /**
9073  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
9074  */
9075 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
9076
9077 /**
9078  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
9079  */
9080 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
9081
9082 /**
9083  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
9084  */
9085 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
9086
9087 /**
9088  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
9089  * but with all dynamically-allocated buffers duplicated in new buffers.
9090  */
9091 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
9092
9093 /**
9094  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
9095  */
9096 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
9097
9098 /**
9099  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
9100  */
9101 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
9102
9103 /**
9104  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
9105  */
9106 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
9107
9108 /**
9109  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
9110  * but with all dynamically-allocated buffers duplicated in new buffers.
9111  */
9112 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
9113
9114 /**
9115  * Creates a new CResult_PingDecodeErrorZ in the success state.
9116  */
9117 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
9118
9119 /**
9120  * Creates a new CResult_PingDecodeErrorZ in the error state.
9121  */
9122 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
9123
9124 /**
9125  * Frees any resources used by the CResult_PingDecodeErrorZ.
9126  */
9127 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
9128
9129 /**
9130  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
9131  * but with all dynamically-allocated buffers duplicated in new buffers.
9132  */
9133 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
9134
9135 /**
9136  * Creates a new CResult_PongDecodeErrorZ in the success state.
9137  */
9138 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
9139
9140 /**
9141  * Creates a new CResult_PongDecodeErrorZ in the error state.
9142  */
9143 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
9144
9145 /**
9146  * Frees any resources used by the CResult_PongDecodeErrorZ.
9147  */
9148 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
9149
9150 /**
9151  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
9152  * but with all dynamically-allocated buffers duplicated in new buffers.
9153  */
9154 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
9155
9156 /**
9157  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
9158  */
9159 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
9160
9161 /**
9162  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
9163  */
9164 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9165
9166 /**
9167  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
9168  */
9169 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
9170
9171 /**
9172  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
9173  * but with all dynamically-allocated buffers duplicated in new buffers.
9174  */
9175 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9176
9177 /**
9178  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
9179  */
9180 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
9181
9182 /**
9183  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
9184  */
9185 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9186
9187 /**
9188  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
9189  */
9190 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
9191
9192 /**
9193  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
9194  * but with all dynamically-allocated buffers duplicated in new buffers.
9195  */
9196 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9197
9198 /**
9199  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
9200  */
9201 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
9202
9203 /**
9204  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
9205  */
9206 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9207
9208 /**
9209  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
9210  */
9211 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
9212
9213 /**
9214  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
9215  * but with all dynamically-allocated buffers duplicated in new buffers.
9216  */
9217 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
9218
9219 /**
9220  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
9221  */
9222 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
9223
9224 /**
9225  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
9226  */
9227 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9228
9229 /**
9230  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
9231  */
9232 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
9233
9234 /**
9235  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
9236  * but with all dynamically-allocated buffers duplicated in new buffers.
9237  */
9238 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
9239
9240 /**
9241  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
9242  */
9243 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
9244
9245 /**
9246  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
9247  */
9248 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
9249
9250 /**
9251  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
9252  */
9253 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
9254
9255 /**
9256  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
9257  * but with all dynamically-allocated buffers duplicated in new buffers.
9258  */
9259 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
9260
9261 /**
9262  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
9263  */
9264 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
9265
9266 /**
9267  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
9268  */
9269 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9270
9271 /**
9272  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
9273  */
9274 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
9275
9276 /**
9277  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
9278  * but with all dynamically-allocated buffers duplicated in new buffers.
9279  */
9280 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9281
9282 /**
9283  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
9284  */
9285 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
9286
9287 /**
9288  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
9289  */
9290 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9291
9292 /**
9293  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
9294  */
9295 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
9296
9297 /**
9298  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
9299  * but with all dynamically-allocated buffers duplicated in new buffers.
9300  */
9301 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9302
9303 /**
9304  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
9305  */
9306 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
9307
9308 /**
9309  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
9310  */
9311 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
9312
9313 /**
9314  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
9315  */
9316 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
9317
9318 /**
9319  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
9320  * but with all dynamically-allocated buffers duplicated in new buffers.
9321  */
9322 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
9323
9324 /**
9325  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
9326  */
9327 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
9328
9329 /**
9330  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
9331  */
9332 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
9333
9334 /**
9335  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
9336  */
9337 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
9338
9339 /**
9340  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
9341  * but with all dynamically-allocated buffers duplicated in new buffers.
9342  */
9343 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
9344
9345 /**
9346  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
9347  */
9348 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
9349
9350 /**
9351  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
9352  */
9353 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
9354
9355 /**
9356  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
9357  */
9358 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
9359
9360 /**
9361  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
9362  * but with all dynamically-allocated buffers duplicated in new buffers.
9363  */
9364 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
9365
9366 /**
9367  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
9368  */
9369 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
9370
9371 /**
9372  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
9373  */
9374 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
9375
9376 /**
9377  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
9378  */
9379 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
9380
9381 /**
9382  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
9383  * but with all dynamically-allocated buffers duplicated in new buffers.
9384  */
9385 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
9386
9387 /**
9388  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
9389  */
9390 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
9391
9392 /**
9393  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
9394  */
9395 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
9396
9397 /**
9398  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
9399  */
9400 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
9401
9402 /**
9403  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
9404  * but with all dynamically-allocated buffers duplicated in new buffers.
9405  */
9406 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
9407
9408 /**
9409  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
9410  */
9411 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
9412
9413 /**
9414  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
9415  */
9416 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9417
9418 /**
9419  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
9420  */
9421 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
9422
9423 /**
9424  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
9425  * but with all dynamically-allocated buffers duplicated in new buffers.
9426  */
9427 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9428
9429 /**
9430  * Creates a new tuple which has the same data as `orig`
9431  * but with all dynamically-allocated buffers duplicated in new buffers.
9432  */
9433 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
9434
9435 /**
9436  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
9437  */
9438 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
9439
9440 /**
9441  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
9442  */
9443 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
9444
9445 /**
9446  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
9447  */
9448 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
9449
9450 /**
9451  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
9452  */
9453 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
9454
9455 /**
9456  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
9457  */
9458 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
9459
9460 /**
9461  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
9462  * but with all dynamically-allocated buffers duplicated in new buffers.
9463  */
9464 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
9465
9466 /**
9467  * Creates a new CResult_SignatureNoneZ in the success state.
9468  */
9469 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
9470
9471 /**
9472  * Creates a new CResult_SignatureNoneZ in the error state.
9473  */
9474 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
9475
9476 /**
9477  * Frees any resources used by the CResult_SignatureNoneZ.
9478  */
9479 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
9480
9481 /**
9482  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
9483  * but with all dynamically-allocated buffers duplicated in new buffers.
9484  */
9485 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
9486
9487 /**
9488  * Creates a new CResult_SignDecodeErrorZ in the success state.
9489  */
9490 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
9491
9492 /**
9493  * Creates a new CResult_SignDecodeErrorZ in the error state.
9494  */
9495 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
9496
9497 /**
9498  * Frees any resources used by the CResult_SignDecodeErrorZ.
9499  */
9500 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
9501
9502 /**
9503  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
9504  * but with all dynamically-allocated buffers duplicated in new buffers.
9505  */
9506 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
9507
9508 /**
9509  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9510  */
9511 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
9512
9513 /**
9514  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
9515  */
9516 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
9517
9518 /**
9519  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
9520  */
9521 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
9522
9523 /**
9524  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
9525  */
9526 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
9527
9528 /**
9529  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
9530  * but with all dynamically-allocated buffers duplicated in new buffers.
9531  */
9532 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
9533
9534 /**
9535  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
9536  */
9537 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
9538
9539 /**
9540  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
9541  */
9542 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
9543
9544 /**
9545  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
9546  */
9547 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
9548
9549 /**
9550  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
9551  * but with all dynamically-allocated buffers duplicated in new buffers.
9552  */
9553 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
9554
9555 /**
9556  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9557  */
9558 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
9559
9560 /**
9561  * Creates a new CResult_TransactionNoneZ in the success state.
9562  */
9563 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
9564
9565 /**
9566  * Creates a new CResult_TransactionNoneZ in the error state.
9567  */
9568 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
9569
9570 /**
9571  * Frees any resources used by the CResult_TransactionNoneZ.
9572  */
9573 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
9574
9575 /**
9576  * Creates a new CResult_NoneErrorZ in the success state.
9577  */
9578 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
9579
9580 /**
9581  * Creates a new CResult_NoneErrorZ in the error state.
9582  */
9583 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
9584
9585 /**
9586  * Frees any resources used by the CResult_NoneErrorZ.
9587  */
9588 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
9589
9590 /**
9591  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9592  */
9593 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
9594
9595 /**
9596  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
9597  */
9598 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
9599
9600 /**
9601  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
9602  */
9603 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
9604
9605 /**
9606  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
9607  */
9608 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
9609
9610 /**
9611  * Creates a new CResult_NoneAPIErrorZ in the success state.
9612  */
9613 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
9614
9615 /**
9616  * Creates a new CResult_NoneAPIErrorZ in the error state.
9617  */
9618 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
9619
9620 /**
9621  * Frees any resources used by the CResult_NoneAPIErrorZ.
9622  */
9623 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
9624
9625 /**
9626  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
9627  * but with all dynamically-allocated buffers duplicated in new buffers.
9628  */
9629 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
9630
9631 /**
9632  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9633  */
9634 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
9635
9636 /**
9637  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9638  */
9639 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
9640
9641 /**
9642  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
9643  */
9644 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
9645
9646 /**
9647  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
9648  */
9649 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
9650
9651 /**
9652  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
9653  */
9654 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
9655
9656 /**
9657  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9658  * but with all dynamically-allocated buffers duplicated in new buffers.
9659  */
9660 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
9661
9662 /**
9663  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9664  */
9665 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
9666
9667 /**
9668  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9669  */
9670 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
9671
9672 /**
9673  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9674  */
9675 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
9676
9677 /**
9678  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9679  */
9680 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
9681
9682 /**
9683  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9684  */
9685 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
9686
9687 /**
9688  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9689  */
9690 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
9691
9692 /**
9693  * Frees any resources used by the Event
9694  */
9695 void Event_free(struct LDKEvent this_ptr);
9696
9697 /**
9698  * Creates a copy of the Event
9699  */
9700 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
9701
9702 /**
9703  * Serialize the Event object into a byte array which can be read by Event_read
9704  */
9705 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
9706
9707 /**
9708  * Frees any resources used by the MessageSendEvent
9709  */
9710 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
9711
9712 /**
9713  * Creates a copy of the MessageSendEvent
9714  */
9715 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
9716
9717 /**
9718  * Calls the free function if one is set
9719  */
9720 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
9721
9722 /**
9723  * Calls the free function if one is set
9724  */
9725 void EventsProvider_free(struct LDKEventsProvider this_ptr);
9726
9727 /**
9728  * Frees any resources used by the APIError
9729  */
9730 void APIError_free(struct LDKAPIError this_ptr);
9731
9732 /**
9733  * Creates a copy of the APIError
9734  */
9735 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
9736
9737 /**
9738  * Creates a digital signature of a message given a SecretKey, like the node's secret.
9739  * 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.
9740  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
9741  */
9742 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, struct LDKSecretKey sk);
9743
9744 /**
9745  * Recovers the PublicKey of the signer of the message given the message and the signature.
9746  */
9747 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
9748
9749 /**
9750  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
9751  * and the PublicKey.
9752  */
9753 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
9754
9755 /**
9756  * Creates a copy of the Level
9757  */
9758 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
9759
9760 /**
9761  * Returns the most verbose logging level.
9762  */
9763 MUST_USE_RES enum LDKLevel Level_max(void);
9764
9765 /**
9766  * Calls the free function if one is set
9767  */
9768 void Logger_free(struct LDKLogger this_ptr);
9769
9770 /**
9771  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
9772  */
9773 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
9774
9775 /**
9776  * Confirmations we will wait for before considering the channel locked in.
9777  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
9778  * equivalent limit applied to outbound channels).
9779  *
9780  * Default value: 6.
9781  */
9782 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9783
9784 /**
9785  * Confirmations we will wait for before considering the channel locked in.
9786  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
9787  * equivalent limit applied to outbound channels).
9788  *
9789  * Default value: 6.
9790  */
9791 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
9792
9793 /**
9794  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
9795  * the number of blocks we have to punish our counterparty if they broadcast a revoked
9796  * transaction).
9797  *
9798  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
9799  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
9800  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
9801  * possibly with time in between to RBF the spending transaction).
9802  *
9803  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
9804  * case of an honest unilateral channel close, which implicitly decrease the economic value of
9805  * our channel.
9806  *
9807  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
9808  * can tweak config to ask for more security, not less.
9809  */
9810 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9811
9812 /**
9813  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
9814  * the number of blocks we have to punish our counterparty if they broadcast a revoked
9815  * transaction).
9816  *
9817  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
9818  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
9819  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
9820  * possibly with time in between to RBF the spending transaction).
9821  *
9822  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
9823  * case of an honest unilateral channel close, which implicitly decrease the economic value of
9824  * our channel.
9825  *
9826  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
9827  * can tweak config to ask for more security, not less.
9828  */
9829 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
9830
9831 /**
9832  * Set to the smallest value HTLC we will accept to process.
9833  *
9834  * This value is sent to our counterparty on channel-open and we close the channel any time
9835  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
9836  *
9837  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
9838  * by the protocol.
9839  */
9840 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9841
9842 /**
9843  * Set to the smallest value HTLC we will accept to process.
9844  *
9845  * This value is sent to our counterparty on channel-open and we close the channel any time
9846  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
9847  *
9848  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
9849  * by the protocol.
9850  */
9851 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
9852
9853 /**
9854  * Constructs a new ChannelHandshakeConfig given each field
9855  */
9856 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);
9857
9858 /**
9859  * Creates a copy of the ChannelHandshakeConfig
9860  */
9861 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
9862
9863 /**
9864  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
9865  */
9866 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
9867
9868 /**
9869  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
9870  */
9871 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
9872
9873 /**
9874  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
9875  * only applies to inbound channels.
9876  *
9877  * Default value: 0.
9878  */
9879 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9880
9881 /**
9882  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
9883  * only applies to inbound channels.
9884  *
9885  * Default value: 0.
9886  */
9887 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9888
9889 /**
9890  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
9891  * you to limit the maximum minimum-size they can require.
9892  *
9893  * Default value: u64::max_value.
9894  */
9895 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9896
9897 /**
9898  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
9899  * you to limit the maximum minimum-size they can require.
9900  *
9901  * Default value: u64::max_value.
9902  */
9903 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9904
9905 /**
9906  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
9907  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
9908  *
9909  * Default value: 0.
9910  */
9911 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9912
9913 /**
9914  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
9915  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
9916  *
9917  * Default value: 0.
9918  */
9919 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9920
9921 /**
9922  * The remote node will require we keep a certain amount in direct payment to ourselves at all
9923  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
9924  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
9925  *
9926  * Default value: u64::max_value.
9927  */
9928 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9929
9930 /**
9931  * The remote node will require we keep a certain amount in direct payment to ourselves at all
9932  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
9933  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
9934  *
9935  * Default value: u64::max_value.
9936  */
9937 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9938
9939 /**
9940  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
9941  * time. This allows you to set a minimum such value.
9942  *
9943  * Default value: 0.
9944  */
9945 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9946
9947 /**
9948  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
9949  * time. This allows you to set a minimum such value.
9950  *
9951  * Default value: 0.
9952  */
9953 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
9954
9955 /**
9956  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
9957  * required to always be higher than this value so this only applies to HTLC outputs (and
9958  * potentially to-self outputs before any payments have been made).
9959  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9960  * This setting allows you to set a minimum dust limit for their commitment transactions,
9961  * reflecting the reality that tiny outputs are not considered standard transactions and will
9962  * not propagate through the Bitcoin network.
9963  *
9964  * Default value: 546, the current dust limit on the Bitcoin network.
9965  */
9966 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9967
9968 /**
9969  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
9970  * required to always be higher than this value so this only applies to HTLC outputs (and
9971  * potentially to-self outputs before any payments have been made).
9972  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9973  * This setting allows you to set a minimum dust limit for their commitment transactions,
9974  * reflecting the reality that tiny outputs are not considered standard transactions and will
9975  * not propagate through the Bitcoin network.
9976  *
9977  * Default value: 546, the current dust limit on the Bitcoin network.
9978  */
9979 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9980
9981 /**
9982  * Maximum allowed threshold above which outputs will not be generated in their commitment
9983  * transactions.
9984  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9985  *
9986  * Default value: u64::max_value.
9987  */
9988 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9989
9990 /**
9991  * Maximum allowed threshold above which outputs will not be generated in their commitment
9992  * transactions.
9993  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9994  *
9995  * Default value: u64::max_value.
9996  */
9997 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9998
9999 /**
10000  * Before a channel is usable the funding transaction will need to be confirmed by at least a
10001  * certain number of blocks, specified by the node which is not the funder (as the funder can
10002  * assume they aren't going to double-spend themselves).
10003  * This config allows you to set a limit on the maximum amount of time to wait.
10004  *
10005  * Default value: 144, or roughly one day and only applies to outbound channels.
10006  */
10007 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
10008
10009 /**
10010  * Before a channel is usable the funding transaction will need to be confirmed by at least a
10011  * certain number of blocks, specified by the node which is not the funder (as the funder can
10012  * assume they aren't going to double-spend themselves).
10013  * This config allows you to set a limit on the maximum amount of time to wait.
10014  *
10015  * Default value: 144, or roughly one day and only applies to outbound channels.
10016  */
10017 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
10018
10019 /**
10020  * Set to force the incoming channel to match our announced channel preference in
10021  * ChannelConfig.
10022  *
10023  * Default value: true, to make the default that no announced channels are possible (which is
10024  * appropriate for any nodes which are not online very reliably).
10025  */
10026 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
10027
10028 /**
10029  * Set to force the incoming channel to match our announced channel preference in
10030  * ChannelConfig.
10031  *
10032  * Default value: true, to make the default that no announced channels are possible (which is
10033  * appropriate for any nodes which are not online very reliably).
10034  */
10035 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
10036
10037 /**
10038  * Set to the amount of time we're willing to wait to claim money back to us.
10039  *
10040  * Not checking this value would be a security issue, as our peer would be able to set it to
10041  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
10042  *
10043  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
10044  * reduce the loss of having useless locked funds (if your peer accepts)
10045  */
10046 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
10047
10048 /**
10049  * Set to the amount of time we're willing to wait to claim money back to us.
10050  *
10051  * Not checking this value would be a security issue, as our peer would be able to set it to
10052  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
10053  *
10054  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
10055  * reduce the loss of having useless locked funds (if your peer accepts)
10056  */
10057 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
10058
10059 /**
10060  * Constructs a new ChannelHandshakeLimits given each field
10061  */
10062 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);
10063
10064 /**
10065  * Creates a copy of the ChannelHandshakeLimits
10066  */
10067 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
10068
10069 /**
10070  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
10071  */
10072 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
10073
10074 /**
10075  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
10076  */
10077 void ChannelConfig_free(struct LDKChannelConfig this_obj);
10078
10079 /**
10080  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
10081  * This may be allowed to change at runtime in a later update, however doing so must result in
10082  * update messages sent to notify all nodes of our updated relay fee.
10083  *
10084  * Default value: 0.
10085  */
10086 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
10087
10088 /**
10089  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
10090  * This may be allowed to change at runtime in a later update, however doing so must result in
10091  * update messages sent to notify all nodes of our updated relay fee.
10092  *
10093  * Default value: 0.
10094  */
10095 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
10096
10097 /**
10098  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
10099  * the channel this config applies to.
10100  *
10101  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
10102  * HTLC balance when a channel appears on-chain whereas
10103  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
10104  * (non-HTLC-encumbered) balance.
10105  *
10106  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
10107  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
10108  * commitment transaction at least once per this many blocks (minus some margin to allow us
10109  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
10110  * the spending transaction).
10111  *
10112  * Default value: 72 (12 hours at an average of 6 blocks/hour).
10113  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
10114  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
10115  *
10116  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
10117  */
10118 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
10119
10120 /**
10121  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
10122  * the channel this config applies to.
10123  *
10124  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
10125  * HTLC balance when a channel appears on-chain whereas
10126  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
10127  * (non-HTLC-encumbered) balance.
10128  *
10129  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
10130  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
10131  * commitment transaction at least once per this many blocks (minus some margin to allow us
10132  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
10133  * the spending transaction).
10134  *
10135  * Default value: 72 (12 hours at an average of 6 blocks/hour).
10136  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
10137  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
10138  *
10139  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
10140  */
10141 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
10142
10143 /**
10144  * Set to announce the channel publicly and notify all nodes that they can route via this
10145  * channel.
10146  *
10147  * This should only be set to true for nodes which expect to be online reliably.
10148  *
10149  * As the node which funds a channel picks this value this will only apply for new outbound
10150  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
10151  *
10152  * This cannot be changed after the initial channel handshake.
10153  *
10154  * Default value: false.
10155  */
10156 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
10157
10158 /**
10159  * Set to announce the channel publicly and notify all nodes that they can route via this
10160  * channel.
10161  *
10162  * This should only be set to true for nodes which expect to be online reliably.
10163  *
10164  * As the node which funds a channel picks this value this will only apply for new outbound
10165  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
10166  *
10167  * This cannot be changed after the initial channel handshake.
10168  *
10169  * Default value: false.
10170  */
10171 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
10172
10173 /**
10174  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
10175  * supports it, they will then enforce the mutual-close output to us matches what we provided
10176  * at intialization, preventing us from closing to an alternate pubkey.
10177  *
10178  * This is set to true by default to provide a slight increase in security, though ultimately
10179  * any attacker who is able to take control of a channel can just as easily send the funds via
10180  * lightning payments, so we never require that our counterparties support this option.
10181  *
10182  * This cannot be changed after a channel has been initialized.
10183  *
10184  * Default value: true.
10185  */
10186 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
10187
10188 /**
10189  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
10190  * supports it, they will then enforce the mutual-close output to us matches what we provided
10191  * at intialization, preventing us from closing to an alternate pubkey.
10192  *
10193  * This is set to true by default to provide a slight increase in security, though ultimately
10194  * any attacker who is able to take control of a channel can just as easily send the funds via
10195  * lightning payments, so we never require that our counterparties support this option.
10196  *
10197  * This cannot be changed after a channel has been initialized.
10198  *
10199  * Default value: true.
10200  */
10201 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
10202
10203 /**
10204  * Constructs a new ChannelConfig given each field
10205  */
10206 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);
10207
10208 /**
10209  * Creates a copy of the ChannelConfig
10210  */
10211 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
10212
10213 /**
10214  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
10215  */
10216 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
10217
10218 /**
10219  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
10220  */
10221 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
10222
10223 /**
10224  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
10225  */
10226 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
10227
10228 /**
10229  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
10230  */
10231 void UserConfig_free(struct LDKUserConfig this_obj);
10232
10233 /**
10234  * Channel config that we propose to our counterparty.
10235  */
10236 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
10237
10238 /**
10239  * Channel config that we propose to our counterparty.
10240  */
10241 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
10242
10243 /**
10244  * Limits applied to our counterparty's proposed channel config settings.
10245  */
10246 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
10247
10248 /**
10249  * Limits applied to our counterparty's proposed channel config settings.
10250  */
10251 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
10252
10253 /**
10254  * Channel config which affects behavior during channel lifetime.
10255  */
10256 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
10257
10258 /**
10259  * Channel config which affects behavior during channel lifetime.
10260  */
10261 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
10262
10263 /**
10264  * Constructs a new UserConfig given each field
10265  */
10266 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);
10267
10268 /**
10269  * Creates a copy of the UserConfig
10270  */
10271 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
10272
10273 /**
10274  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
10275  */
10276 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
10277
10278 /**
10279  * Creates a copy of the AccessError
10280  */
10281 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
10282
10283 /**
10284  * Calls the free function if one is set
10285  */
10286 void Access_free(struct LDKAccess this_ptr);
10287
10288 /**
10289  * Calls the free function if one is set
10290  */
10291 void Listen_free(struct LDKListen this_ptr);
10292
10293 /**
10294  * Calls the free function if one is set
10295  */
10296 void Watch_free(struct LDKWatch this_ptr);
10297
10298 /**
10299  * Calls the free function if one is set
10300  */
10301 void Filter_free(struct LDKFilter this_ptr);
10302
10303 /**
10304  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
10305  */
10306 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
10307
10308 /**
10309  * First block where the transaction output may have been spent.
10310  */
10311 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10312
10313 /**
10314  * First block where the transaction output may have been spent.
10315  */
10316 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10317
10318 /**
10319  * Outpoint identifying the transaction output.
10320  */
10321 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10322
10323 /**
10324  * Outpoint identifying the transaction output.
10325  */
10326 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10327
10328 /**
10329  * Spending condition of the transaction output.
10330  */
10331 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10332
10333 /**
10334  * Spending condition of the transaction output.
10335  */
10336 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
10337
10338 /**
10339  * Constructs a new WatchedOutput given each field
10340  */
10341 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
10342
10343 /**
10344  * Calls the free function if one is set
10345  */
10346 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
10347
10348 /**
10349  * Creates a copy of the ConfirmationTarget
10350  */
10351 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
10352
10353 /**
10354  * Calls the free function if one is set
10355  */
10356 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
10357
10358 /**
10359  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
10360  */
10361 void ChainMonitor_free(struct LDKChainMonitor this_obj);
10362
10363 /**
10364  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10365  * of a channel and reacting accordingly based on transactions in the connected block. See
10366  * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
10367  * be returned by [`chain::Watch::release_pending_monitor_events`].
10368  *
10369  * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
10370  * calls must not exclude any transactions matching the new outputs nor any in-block
10371  * descendants of such transactions. It is not necessary to re-fetch the block to obtain
10372  * updated `txdata`.
10373  */
10374 void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
10375
10376 /**
10377  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10378  * of a channel and reacting accordingly to newly confirmed transactions. For details, see
10379  * [`ChannelMonitor::transactions_confirmed`].
10380  *
10381  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10382  * blocks. May be called before or after [`update_best_block`] for transactions in the
10383  * corresponding block. See [`update_best_block`] for further calling expectations.
10384  *
10385  * [`block_connected`]: Self::block_connected
10386  * [`update_best_block`]: Self::update_best_block
10387  */
10388 void ChainMonitor_transactions_confirmed(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
10389
10390 /**
10391  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10392  * of a channel and reacting accordingly based on the new chain tip. For details, see
10393  * [`ChannelMonitor::update_best_block`].
10394  *
10395  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10396  * blocks. May be called before or after [`transactions_confirmed`] for the corresponding
10397  * block.
10398  *
10399  * Must be called after new blocks become available for the most recent block. Intermediary
10400  * blocks, however, may be safely skipped. In the event of a chain re-organization, this only
10401  * needs to be called for the most recent block assuming `transaction_unconfirmed` is called
10402  * for any affected transactions.
10403  *
10404  * [`block_connected`]: Self::block_connected
10405  * [`transactions_confirmed`]: Self::transactions_confirmed
10406  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10407  */
10408 void ChainMonitor_update_best_block(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height);
10409
10410 /**
10411  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10412  * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
10413  * details.
10414  */
10415 void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
10416
10417 /**
10418  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10419  * of a channel based on transactions unconfirmed as a result of a chain reorganization. See
10420  * [`ChannelMonitor::transaction_unconfirmed`] for details.
10421  *
10422  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
10423  * than blocks. May be called before or after [`update_best_block`] for transactions in the
10424  * corresponding block. See [`update_best_block`] for further calling expectations.
10425  *
10426  * [`block_disconnected`]: Self::block_disconnected
10427  * [`update_best_block`]: Self::update_best_block
10428  */
10429 void ChainMonitor_transaction_unconfirmed(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32]);
10430
10431 /**
10432  * Returns the set of txids that should be monitored for re-organization out of the chain.
10433  */
10434 MUST_USE_RES struct LDKCVec_TxidZ ChainMonitor_get_relevant_txids(const struct LDKChainMonitor *NONNULL_PTR this_arg);
10435
10436 /**
10437  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
10438  *
10439  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
10440  * will call back to it indicating transactions and outputs of interest. This allows clients to
10441  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
10442  * always need to fetch full blocks absent another means for determining which blocks contain
10443  * transactions relevant to the watched channels.
10444  */
10445 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
10446
10447 /**
10448  * Constructs a new Watch which calls the relevant methods on this_arg.
10449  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
10450  */
10451 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
10452
10453 /**
10454  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
10455  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
10456  */
10457 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
10458
10459 /**
10460  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
10461  */
10462 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
10463
10464 /**
10465  * The sequence number of this update. Updates *must* be replayed in-order according to this
10466  * sequence number (and updates may panic if they are not). The update_id values are strictly
10467  * increasing and increase by one for each new update, with one exception specified below.
10468  *
10469  * This sequence number is also used to track up to which points updates which returned
10470  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
10471  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
10472  *
10473  * The only instance where update_id values are not strictly increasing is the case where we
10474  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
10475  * its docs for more details.
10476  */
10477 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
10478
10479 /**
10480  * The sequence number of this update. Updates *must* be replayed in-order according to this
10481  * sequence number (and updates may panic if they are not). The update_id values are strictly
10482  * increasing and increase by one for each new update, with one exception specified below.
10483  *
10484  * This sequence number is also used to track up to which points updates which returned
10485  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
10486  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
10487  *
10488  * The only instance where update_id values are not strictly increasing is the case where we
10489  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
10490  * its docs for more details.
10491  */
10492 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
10493
10494 /**
10495  * Creates a copy of the ChannelMonitorUpdate
10496  */
10497 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
10498
10499 /**
10500  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
10501  */
10502 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
10503
10504 /**
10505  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
10506  */
10507 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
10508
10509 /**
10510  * Creates a copy of the ChannelMonitorUpdateErr
10511  */
10512 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
10513
10514 /**
10515  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
10516  */
10517 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
10518
10519 /**
10520  * Creates a copy of the MonitorUpdateError
10521  */
10522 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
10523
10524 /**
10525  * Frees any resources used by the MonitorEvent
10526  */
10527 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
10528
10529 /**
10530  * Creates a copy of the MonitorEvent
10531  */
10532 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
10533
10534 /**
10535  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
10536  */
10537 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
10538
10539 /**
10540  * Creates a copy of the HTLCUpdate
10541  */
10542 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
10543
10544 /**
10545  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
10546  */
10547 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
10548
10549 /**
10550  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
10551  */
10552 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
10553
10554 /**
10555  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
10556  */
10557 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
10558
10559 /**
10560  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
10561  */
10562 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
10563
10564 /**
10565  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
10566  * itself.
10567  *
10568  * panics if the given update is not the next update by update_id.
10569  */
10570 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);
10571
10572 /**
10573  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
10574  * ChannelMonitor.
10575  */
10576 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10577
10578 /**
10579  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
10580  */
10581 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10582
10583 /**
10584  * Gets a list of txids, with their output scripts (in the order they appear in the
10585  * transaction), which we must learn about spends of via block_connected().
10586  */
10587 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10588
10589 /**
10590  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
10591  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
10592  * have been registered.
10593  */
10594 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
10595
10596 /**
10597  * Get the list of HTLCs who's status has been updated on chain. This should be called by
10598  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
10599  */
10600 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10601
10602 /**
10603  * Gets the list of pending events which were generated by previous actions, clearing the list
10604  * in the process.
10605  *
10606  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
10607  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
10608  * no internal locking in ChannelMonitors.
10609  */
10610 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10611
10612 /**
10613  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
10614  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
10615  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
10616  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
10617  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
10618  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
10619  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
10620  * out-of-band the other node operator to coordinate with him if option is available to you.
10621  * In any-case, choice is up to the user.
10622  */
10623 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);
10624
10625 /**
10626  * Processes transactions in a newly connected block, which may result in any of the following:
10627  * - update the monitor's state against resolved HTLCs
10628  * - punish the counterparty in the case of seeing a revoked commitment transaction
10629  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
10630  * - detect settled outputs for later spending
10631  * - schedule and bump any in-flight claims
10632  *
10633  * Returns any new outputs to watch from `txdata`; after called, these are also included in
10634  * [`get_outputs_to_watch`].
10635  *
10636  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
10637  */
10638 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);
10639
10640 /**
10641  * Determines if the disconnected block contained any transactions of interest and updates
10642  * appropriately.
10643  */
10644 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);
10645
10646 /**
10647  * Processes transactions confirmed in a block with the given header and height, returning new
10648  * outputs to watch. See [`block_connected`] for details.
10649  *
10650  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10651  * blocks. May be called before or after [`update_best_block`] for transactions in the
10652  * corresponding block. See [`update_best_block`] for further calling expectations.
10653  *
10654  * [`block_connected`]: Self::block_connected
10655  * [`update_best_block`]: Self::update_best_block
10656  */
10657 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);
10658
10659 /**
10660  * Processes a transaction that was reorganized out of the chain.
10661  *
10662  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
10663  * than blocks. May be called before or after [`update_best_block`] for transactions in the
10664  * corresponding block. See [`update_best_block`] for further calling expectations.
10665  *
10666  * [`block_disconnected`]: Self::block_disconnected
10667  * [`update_best_block`]: Self::update_best_block
10668  */
10669 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);
10670
10671 /**
10672  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
10673  * [`block_connected`] for details.
10674  *
10675  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10676  * blocks. May be called before or after [`transactions_confirmed`] for the corresponding
10677  * block.
10678  *
10679  * Must be called after new blocks become available for the most recent block. Intermediary
10680  * blocks, however, may be safely skipped. In the event of a chain re-organization, this only
10681  * needs to be called for the most recent block assuming `transaction_unconfirmed` is called
10682  * for any affected transactions.
10683  *
10684  * [`block_connected`]: Self::block_connected
10685  * [`transactions_confirmed`]: Self::transactions_confirmed
10686  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10687  */
10688 MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_update_best_block(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);
10689
10690 /**
10691  * Returns the set of txids that should be monitored for re-organization out of the chain.
10692  */
10693 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10694
10695 /**
10696  * Calls the free function if one is set
10697  */
10698 void Persist_free(struct LDKPersist this_ptr);
10699
10700 /**
10701  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
10702  */
10703 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
10704
10705 /**
10706  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
10707  */
10708 void OutPoint_free(struct LDKOutPoint this_obj);
10709
10710 /**
10711  * The referenced transaction's txid.
10712  */
10713 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
10714
10715 /**
10716  * The referenced transaction's txid.
10717  */
10718 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10719
10720 /**
10721  * The index of the referenced output in its transaction's vout.
10722  */
10723 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
10724
10725 /**
10726  * The index of the referenced output in its transaction's vout.
10727  */
10728 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
10729
10730 /**
10731  * Constructs a new OutPoint given each field
10732  */
10733 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
10734
10735 /**
10736  * Creates a copy of the OutPoint
10737  */
10738 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
10739
10740 /**
10741  * Convert an `OutPoint` to a lightning channel id.
10742  */
10743 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
10744
10745 /**
10746  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
10747  */
10748 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
10749
10750 /**
10751  * Read a OutPoint from a byte array, created by OutPoint_write
10752  */
10753 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
10754
10755 /**
10756  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
10757  */
10758 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
10759
10760 /**
10761  * The outpoint which is spendable
10762  */
10763 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10764
10765 /**
10766  * The outpoint which is spendable
10767  */
10768 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10769
10770 /**
10771  * Per commitment point to derive delayed_payment_key by key holder
10772  */
10773 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10774
10775 /**
10776  * Per commitment point to derive delayed_payment_key by key holder
10777  */
10778 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10779
10780 /**
10781  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
10782  * the witness_script.
10783  */
10784 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10785
10786 /**
10787  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
10788  * the witness_script.
10789  */
10790 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
10791
10792 /**
10793  * The output which is referenced by the given outpoint
10794  */
10795 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
10796
10797 /**
10798  * The revocation point specific to the commitment transaction which was broadcast. Used to
10799  * derive the witnessScript for this output.
10800  */
10801 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10802
10803 /**
10804  * The revocation point specific to the commitment transaction which was broadcast. Used to
10805  * derive the witnessScript for this output.
10806  */
10807 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10808
10809 /**
10810  * Arbitrary identification information returned by a call to
10811  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10812  * the channel to spend the output.
10813  */
10814 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
10815
10816 /**
10817  * Arbitrary identification information returned by a call to
10818  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10819  * the channel to spend the output.
10820  */
10821 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10822
10823 /**
10824  * The value of the channel which this output originated from, possibly indirectly.
10825  */
10826 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10827
10828 /**
10829  * The value of the channel which this output originated from, possibly indirectly.
10830  */
10831 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
10832
10833 /**
10834  * Constructs a new DelayedPaymentOutputDescriptor given each field
10835  */
10836 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);
10837
10838 /**
10839  * Creates a copy of the DelayedPaymentOutputDescriptor
10840  */
10841 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
10842
10843 /**
10844  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
10845  */
10846 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
10847
10848 /**
10849  * The outpoint which is spendable
10850  */
10851 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10852
10853 /**
10854  * The outpoint which is spendable
10855  */
10856 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10857
10858 /**
10859  * The output which is referenced by the given outpoint
10860  */
10861 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
10862
10863 /**
10864  * Arbitrary identification information returned by a call to
10865  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10866  * the channel to spend the output.
10867  */
10868 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
10869
10870 /**
10871  * Arbitrary identification information returned by a call to
10872  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10873  * the channel to spend the output.
10874  */
10875 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10876
10877 /**
10878  * The value of the channel which this transactions spends.
10879  */
10880 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10881
10882 /**
10883  * The value of the channel which this transactions spends.
10884  */
10885 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
10886
10887 /**
10888  * Constructs a new StaticPaymentOutputDescriptor given each field
10889  */
10890 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);
10891
10892 /**
10893  * Creates a copy of the StaticPaymentOutputDescriptor
10894  */
10895 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
10896
10897 /**
10898  * Frees any resources used by the SpendableOutputDescriptor
10899  */
10900 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
10901
10902 /**
10903  * Creates a copy of the SpendableOutputDescriptor
10904  */
10905 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
10906
10907 /**
10908  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
10909  */
10910 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
10911
10912 /**
10913  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
10914  */
10915 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
10916
10917 /**
10918  * Calls the free function if one is set
10919  */
10920 void BaseSign_free(struct LDKBaseSign this_ptr);
10921
10922 /**
10923  * Creates a copy of a Sign
10924  */
10925 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
10926
10927 /**
10928  * Calls the free function if one is set
10929  */
10930 void Sign_free(struct LDKSign this_ptr);
10931
10932 /**
10933  * Calls the free function if one is set
10934  */
10935 void KeysInterface_free(struct LDKKeysInterface this_ptr);
10936
10937 /**
10938  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
10939  */
10940 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
10941
10942 /**
10943  * Private key of anchor tx
10944  */
10945 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10946
10947 /**
10948  * Private key of anchor tx
10949  */
10950 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10951
10952 /**
10953  * Holder secret key for blinded revocation pubkey
10954  */
10955 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10956
10957 /**
10958  * Holder secret key for blinded revocation pubkey
10959  */
10960 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10961
10962 /**
10963  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
10964  */
10965 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10966
10967 /**
10968  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
10969  */
10970 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10971
10972 /**
10973  * Holder secret key used in HTLC tx
10974  */
10975 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10976
10977 /**
10978  * Holder secret key used in HTLC tx
10979  */
10980 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10981
10982 /**
10983  * Holder htlc secret key used in commitment tx htlc outputs
10984  */
10985 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10986
10987 /**
10988  * Holder htlc secret key used in commitment tx htlc outputs
10989  */
10990 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10991
10992 /**
10993  * Commitment seed
10994  */
10995 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10996
10997 /**
10998  * Commitment seed
10999  */
11000 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11001
11002 /**
11003  * Creates a copy of the InMemorySigner
11004  */
11005 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
11006
11007 /**
11008  * Create a new InMemorySigner
11009  */
11010 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);
11011
11012 /**
11013  * Counterparty pubkeys.
11014  * Will panic if ready_channel wasn't called.
11015  */
11016 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11017
11018 /**
11019  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
11020  * transactions, ie the amount of time that we have to wait to recover our funds if we
11021  * broadcast a transaction.
11022  * Will panic if ready_channel wasn't called.
11023  */
11024 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11025
11026 /**
11027  * The contest_delay value specified by us and applied on transactions broadcastable
11028  * by our counterparty, ie the amount of time that they have to wait to recover their funds
11029  * if they broadcast a transaction.
11030  * Will panic if ready_channel wasn't called.
11031  */
11032 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11033
11034 /**
11035  * Whether the holder is the initiator
11036  * Will panic if ready_channel wasn't called.
11037  */
11038 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11039
11040 /**
11041  * Funding outpoint
11042  * Will panic if ready_channel wasn't called.
11043  */
11044 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11045
11046 /**
11047  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
11048  * building transactions.
11049  *
11050  * Will panic if ready_channel wasn't called.
11051  */
11052 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11053
11054 /**
11055  * Sign the single input of spend_tx at index `input_idx` which spends the output
11056  * described by descriptor, returning the witness stack for the input.
11057  *
11058  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
11059  * or is not spending the outpoint described by `descriptor.outpoint`.
11060  */
11061 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);
11062
11063 /**
11064  * Sign the single input of spend_tx at index `input_idx` which spends the output
11065  * described by descriptor, returning the witness stack for the input.
11066  *
11067  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
11068  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
11069  * sequence set to `descriptor.to_self_delay`.
11070  */
11071 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);
11072
11073 /**
11074  * Constructs a new BaseSign which calls the relevant methods on this_arg.
11075  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
11076  */
11077 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11078
11079 /**
11080  * Constructs a new Sign which calls the relevant methods on this_arg.
11081  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
11082  */
11083 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11084
11085 /**
11086  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
11087  */
11088 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
11089
11090 /**
11091  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
11092  */
11093 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
11094
11095 /**
11096  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
11097  */
11098 void KeysManager_free(struct LDKKeysManager this_obj);
11099
11100 /**
11101  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
11102  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
11103  * starting_time isn't strictly required to actually be a time, but it must absolutely,
11104  * without a doubt, be unique to this instance. ie if you start multiple times with the same
11105  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
11106  * simply use the current time (with very high precision).
11107  *
11108  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
11109  * obviously, starting_time should be unique every time you reload the library - it is only
11110  * used to generate new ephemeral key data (which will be stored by the individual channel if
11111  * necessary).
11112  *
11113  * Note that the seed is required to recover certain on-chain funds independent of
11114  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
11115  * channel, and some on-chain during-closing funds.
11116  *
11117  * Note that until the 0.1 release there is no guarantee of backward compatibility between
11118  * versions. Once the library is more fully supported, the docs will be updated to include a
11119  * detailed description of the guarantee.
11120  */
11121 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
11122
11123 /**
11124  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
11125  *
11126  * Key derivation parameters are accessible through a per-channel secrets
11127  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
11128  * onchain output detection for which a corresponding delayed_payment_key must be derived.
11129  */
11130 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]);
11131
11132 /**
11133  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
11134  * output to the given change destination (if sufficient change value remains). The
11135  * transaction will have a feerate, at least, of the given value.
11136  *
11137  * Returns `Err(())` if the output value is greater than the input value minus required fee or
11138  * if a descriptor was duplicated.
11139  *
11140  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
11141  *
11142  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
11143  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
11144  */
11145 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);
11146
11147 /**
11148  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
11149  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
11150  */
11151 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
11152
11153 /**
11154  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
11155  */
11156 void ChannelManager_free(struct LDKChannelManager this_obj);
11157
11158 /**
11159  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
11160  */
11161 void ChainParameters_free(struct LDKChainParameters this_obj);
11162
11163 /**
11164  * The network for determining the `chain_hash` in Lightning messages.
11165  */
11166 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
11167
11168 /**
11169  * The network for determining the `chain_hash` in Lightning messages.
11170  */
11171 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
11172
11173 /**
11174  * The hash and height of the latest block successfully connected.
11175  *
11176  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
11177  */
11178 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
11179
11180 /**
11181  * The hash and height of the latest block successfully connected.
11182  *
11183  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
11184  */
11185 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
11186
11187 /**
11188  * Constructs a new ChainParameters given each field
11189  */
11190 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
11191
11192 /**
11193  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
11194  */
11195 void BestBlock_free(struct LDKBestBlock this_obj);
11196
11197 /**
11198  * Creates a copy of the BestBlock
11199  */
11200 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
11201
11202 /**
11203  * Returns the best block from the genesis of the given network.
11204  */
11205 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
11206
11207 /**
11208  * Returns the best block as identified by the given block hash and height.
11209  */
11210 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
11211
11212 /**
11213  * Returns the best block hash.
11214  */
11215 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
11216
11217 /**
11218  * Returns the best block height.
11219  */
11220 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
11221
11222 /**
11223  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
11224  */
11225 void ChannelDetails_free(struct LDKChannelDetails this_obj);
11226
11227 /**
11228  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
11229  * thereafter this is the txid of the funding transaction xor the funding transaction output).
11230  * Note that this means this value is *not* persistent - it can change once during the
11231  * lifetime of the channel.
11232  */
11233 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
11234
11235 /**
11236  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
11237  * thereafter this is the txid of the funding transaction xor the funding transaction output).
11238  * Note that this means this value is *not* persistent - it can change once during the
11239  * lifetime of the channel.
11240  */
11241 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11242
11243 /**
11244  * The position of the funding transaction in the chain. None if the funding transaction has
11245  * not yet been confirmed and the channel fully opened.
11246  */
11247 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11248
11249 /**
11250  * The position of the funding transaction in the chain. None if the funding transaction has
11251  * not yet been confirmed and the channel fully opened.
11252  */
11253 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
11254
11255 /**
11256  * The node_id of our counterparty
11257  */
11258 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11259
11260 /**
11261  * The node_id of our counterparty
11262  */
11263 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11264
11265 /**
11266  * The Features the channel counterparty provided upon last connection.
11267  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
11268  * many routing-relevant features are present in the init context.
11269  */
11270 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11271
11272 /**
11273  * The Features the channel counterparty provided upon last connection.
11274  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
11275  * many routing-relevant features are present in the init context.
11276  */
11277 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
11278
11279 /**
11280  * The value, in satoshis, of this channel as appears in the funding output
11281  */
11282 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11283
11284 /**
11285  * The value, in satoshis, of this channel as appears in the funding output
11286  */
11287 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11288
11289 /**
11290  * The user_id passed in to create_channel, or 0 if the channel was inbound.
11291  */
11292 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11293
11294 /**
11295  * The user_id passed in to create_channel, or 0 if the channel was inbound.
11296  */
11297 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11298
11299 /**
11300  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
11301  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11302  * available for inclusion in new outbound HTLCs). This further does not include any pending
11303  * outgoing HTLCs which are awaiting some other resolution to be sent.
11304  */
11305 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11306
11307 /**
11308  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
11309  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11310  * available for inclusion in new outbound HTLCs). This further does not include any pending
11311  * outgoing HTLCs which are awaiting some other resolution to be sent.
11312  */
11313 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11314
11315 /**
11316  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
11317  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11318  * available for inclusion in new inbound HTLCs).
11319  * Note that there are some corner cases not fully handled here, so the actual available
11320  * inbound capacity may be slightly higher than this.
11321  */
11322 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11323
11324 /**
11325  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
11326  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11327  * available for inclusion in new inbound HTLCs).
11328  * Note that there are some corner cases not fully handled here, so the actual available
11329  * inbound capacity may be slightly higher than this.
11330  */
11331 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11332
11333 /**
11334  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
11335  * the peer is connected, and (c) no monitor update failure is pending resolution.
11336  */
11337 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11338
11339 /**
11340  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
11341  * the peer is connected, and (c) no monitor update failure is pending resolution.
11342  */
11343 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
11344
11345 /**
11346  * Creates a copy of the ChannelDetails
11347  */
11348 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
11349
11350 /**
11351  * Frees any resources used by the PaymentSendFailure
11352  */
11353 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
11354
11355 /**
11356  * Creates a copy of the PaymentSendFailure
11357  */
11358 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
11359
11360 /**
11361  * Constructs a new ChannelManager to hold several channels and route between them.
11362  *
11363  * This is the main \"logic hub\" for all channel-related actions, and implements
11364  * ChannelMessageHandler.
11365  *
11366  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
11367  *
11368  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
11369  *
11370  * Users need to notify the new ChannelManager when a new block is connected or
11371  * disconnected using its `block_connected` and `block_disconnected` methods, starting
11372  * from after `params.latest_hash`.
11373  */
11374 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);
11375
11376 /**
11377  * Gets the current configuration applied to all new channels,  as
11378  */
11379 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
11380
11381 /**
11382  * Creates a new outbound channel to the given remote node and with the given value.
11383  *
11384  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
11385  * tracking of which events correspond with which create_channel call. Note that the
11386  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
11387  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
11388  * otherwise ignored.
11389  *
11390  * If successful, will generate a SendOpenChannel message event, so you should probably poll
11391  * PeerManager::process_events afterwards.
11392  *
11393  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
11394  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
11395  */
11396 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);
11397
11398 /**
11399  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
11400  * more information.
11401  */
11402 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11403
11404 /**
11405  * Gets the list of usable channels, in random order. Useful as an argument to
11406  * get_route to ensure non-announced channels are used.
11407  *
11408  * These are guaranteed to have their is_live value set to true, see the documentation for
11409  * ChannelDetails::is_live for more info on exactly what the criteria are.
11410  */
11411 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11412
11413 /**
11414  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
11415  * will be accepted on the given channel, and after additional timeout/the closing of all
11416  * pending HTLCs, the channel will be closed on chain.
11417  *
11418  * May generate a SendShutdown message event on success, which should be relayed.
11419  */
11420 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
11421
11422 /**
11423  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
11424  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
11425  */
11426 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
11427
11428 /**
11429  * Force close all channels, immediately broadcasting the latest local commitment transaction
11430  * for each to the chain and rejecting new HTLCs on each.
11431  */
11432 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11433
11434 /**
11435  * Sends a payment along a given route.
11436  *
11437  * Value parameters are provided via the last hop in route, see documentation for RouteHop
11438  * fields for more info.
11439  *
11440  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
11441  * payment), we don't do anything to stop you! We always try to ensure that if the provided
11442  * next hop knows the preimage to payment_hash they can claim an additional amount as
11443  * specified in the last hop in the route! Thus, you should probably do your own
11444  * payment_preimage tracking (which you should already be doing as they represent \"proof of
11445  * payment\") and prevent double-sends yourself.
11446  *
11447  * May generate SendHTLCs message(s) event on success, which should be relayed.
11448  *
11449  * Each path may have a different return value, and PaymentSendValue may return a Vec with
11450  * each entry matching the corresponding-index entry in the route paths, see
11451  * PaymentSendFailure for more info.
11452  *
11453  * In general, a path may raise:
11454  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
11455  *    node public key) is specified.
11456  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
11457  *    (including due to previous monitor update failure or new permanent monitor update
11458  *    failure).
11459  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
11460  *    relevant updates.
11461  *
11462  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
11463  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
11464  * different route unless you intend to pay twice!
11465  *
11466  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
11467  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
11468  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
11469  * must not contain multiple paths as multi-path payments require a recipient-provided
11470  * payment_secret.
11471  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
11472  * bit set (either as required or as available). If multiple paths are present in the Route,
11473  * we assume the invoice had the basic_mpp feature set.
11474  */
11475 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);
11476
11477 /**
11478  * Call this upon creation of a funding transaction for the given channel.
11479  *
11480  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
11481  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
11482  *
11483  * Panics if a funding transaction has already been provided for this channel.
11484  *
11485  * May panic if the output found in the funding transaction is duplicative with some other
11486  * channel (note that this should be trivially prevented by using unique funding transaction
11487  * keys per-channel).
11488  *
11489  * Do NOT broadcast the funding transaction yourself. When we have safely received our
11490  * counterparty's signature the funding transaction will automatically be broadcast via the
11491  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
11492  *
11493  * Note that this includes RBF or similar transaction replacement strategies - lightning does
11494  * not currently support replacing a funding transaction on an existing channel. Instead,
11495  * create a new channel with a conflicting funding transaction.
11496  */
11497 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);
11498
11499 /**
11500  * Generates a signed node_announcement from the given arguments and creates a
11501  * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
11502  * seen a channel_announcement from us (ie unless we have public channels open).
11503  *
11504  * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
11505  * to humans. They carry no in-protocol meaning.
11506  *
11507  * addresses represent the set (possibly empty) of socket addresses on which this node accepts
11508  * incoming connections. These will be broadcast to the network, publicly tying these
11509  * addresses together. If you wish to preserve user privacy, addresses should likely contain
11510  * only Tor Onion addresses.
11511  *
11512  * Panics if addresses is absurdly large (more than 500).
11513  */
11514 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
11515
11516 /**
11517  * Processes HTLCs which are pending waiting on random forward delay.
11518  *
11519  * Should only really ever be called in response to a PendingHTLCsForwardable event.
11520  * Will likely generate further events.
11521  */
11522 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
11523
11524 /**
11525  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
11526  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
11527  * to inform the network about the uselessness of these channels.
11528  *
11529  * This method handles all the details, and must be called roughly once per minute.
11530  *
11531  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
11532  */
11533 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
11534
11535 /**
11536  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
11537  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
11538  * along the path (including in our own channel on which we received it).
11539  * Returns false if no payment was found to fail backwards, true if the process of failing the
11540  * HTLC backwards has been started.
11541  */
11542 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);
11543
11544 /**
11545  * Provides a payment preimage in response to a PaymentReceived event, returning true and
11546  * generating message events for the net layer to claim the payment, if possible. Thus, you
11547  * should probably kick the net layer to go send messages if this returns true!
11548  *
11549  * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
11550  * available within a few percent of the expected amount. This is critical for several
11551  * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
11552  * payment_preimage without having provided the full value and b) it avoids certain
11553  * privacy-breaking recipient-probing attacks which may reveal payment activity to
11554  * motivated attackers.
11555  *
11556  * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
11557  * set. Thus, for such payments we will claim any payments which do not under-pay.
11558  *
11559  * May panic if called except in response to a PaymentReceived event.
11560  */
11561 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);
11562
11563 /**
11564  * Gets the node_id held by this ChannelManager
11565  */
11566 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
11567
11568 /**
11569  * Restores a single, given channel to normal operation after a
11570  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
11571  * operation.
11572  *
11573  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
11574  * fully committed in every copy of the given channels' ChannelMonitors.
11575  *
11576  * Note that there is no effect to calling with a highest_applied_update_id other than the
11577  * current latest ChannelMonitorUpdate and one call to this function after multiple
11578  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
11579  * exists largely only to prevent races between this and concurrent update_monitor calls.
11580  *
11581  * Thus, the anticipated use is, at a high level:
11582  *  1) You register a chain::Watch with this ChannelManager,
11583  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
11584  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
11585  *     any time it cannot do so instantly,
11586  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
11587  *  4) once all remote copies are updated, you call this function with the update_id that
11588  *     completed, and once it is the latest the Channel will be re-enabled.
11589  */
11590 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);
11591
11592 /**
11593  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
11594  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
11595  */
11596 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
11597
11598 /**
11599  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
11600  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
11601  */
11602 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
11603
11604 /**
11605  * Constructs a new Listen which calls the relevant methods on this_arg.
11606  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
11607  */
11608 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
11609
11610 /**
11611  * Updates channel state to take note of transactions which were confirmed in the given block
11612  * at the given height.
11613  *
11614  * Note that you must still call (or have called) [`update_best_block`] with the block
11615  * information which is included here.
11616  *
11617  * This method may be called before or after [`update_best_block`] for a given block's
11618  * transaction data and may be called multiple times with additional transaction data for a
11619  * given block.
11620  *
11621  * This method may be called for a previous block after an [`update_best_block`] call has
11622  * been made for a later block, however it must *not* be called with transaction data from a
11623  * block which is no longer in the best chain (ie where [`update_best_block`] has already
11624  * been informed about a blockchain reorganization which no longer includes the block which
11625  * corresponds to `header`).
11626  *
11627  * [`update_best_block`]: `Self::update_best_block`
11628  */
11629 void ChannelManager_transactions_confirmed(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKCVec_C2Tuple_usizeTransactionZZ txdata);
11630
11631 /**
11632  * Updates channel state with the current best blockchain tip. You should attempt to call this
11633  * quickly after a new block becomes available, however if multiple new blocks become
11634  * available at the same time, only a single `update_best_block()` call needs to be made.
11635  *
11636  * This method should also be called immediately after any block disconnections, once at the
11637  * reorganization fork point, and once with the new chain tip. Calling this method at the
11638  * blockchain reorganization fork point ensures we learn when a funding transaction which was
11639  * previously confirmed is reorganized out of the blockchain, ensuring we do not continue to
11640  * accept payments which cannot be enforced on-chain.
11641  *
11642  * In both the block-connection and block-disconnection case, this method may be called either
11643  * once per block connected or disconnected, or simply at the fork point and new tip(s),
11644  * skipping any intermediary blocks.
11645  */
11646 void ChannelManager_update_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height);
11647
11648 /**
11649  * Gets the set of txids which should be monitored for their confirmation state.
11650  *
11651  * If you're providing information about reorganizations via [`transaction_unconfirmed`], this
11652  * is the set of transactions which you may need to call [`transaction_unconfirmed`] for.
11653  *
11654  * This may be useful to poll to determine the set of transactions which must be registered
11655  * with an Electrum server or for which an Electrum server needs to be polled to determine
11656  * transaction confirmation state.
11657  *
11658  * This may update after any [`transactions_confirmed`] or [`block_connected`] call.
11659  *
11660  * Note that this is NOT the set of transactions which must be included in calls to
11661  * [`transactions_confirmed`] if they are confirmed, but a small subset of it.
11662  *
11663  * [`transactions_confirmed`]: Self::transactions_confirmed
11664  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
11665  * [`block_connected`]: chain::Listen::block_connected
11666  */
11667 MUST_USE_RES struct LDKCVec_TxidZ ChannelManager_get_relevant_txids(const struct LDKChannelManager *NONNULL_PTR this_arg);
11668
11669 /**
11670  * Marks a transaction as having been reorganized out of the blockchain.
11671  *
11672  * If a transaction is included in [`get_relevant_txids`], and is no longer in the main branch
11673  * of the blockchain, this function should be called to indicate that the transaction should
11674  * be considered reorganized out.
11675  *
11676  * Once this is called, the given transaction will no longer appear on [`get_relevant_txids`],
11677  * though this may be called repeatedly for a given transaction without issue.
11678  *
11679  * Note that if the transaction is confirmed on the main chain in a different block (indicated
11680  * via a call to [`transactions_confirmed`]), it may re-appear in [`get_relevant_txids`], thus
11681  * be very wary of race-conditions wherein the final state of a transaction indicated via
11682  * these APIs is not the same as its state on the blockchain.
11683  *
11684  * [`transactions_confirmed`]: Self::transactions_confirmed
11685  * [`get_relevant_txids`]: Self::get_relevant_txids
11686  */
11687 void ChannelManager_transaction_unconfirmed(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*txid)[32]);
11688
11689 /**
11690  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
11691  * indicating whether persistence is necessary. Only one listener on
11692  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
11693  * up.
11694  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
11695  */
11696 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
11697
11698 /**
11699  * Blocks until ChannelManager needs to be persisted. Only one listener on
11700  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
11701  * up.
11702  */
11703 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
11704
11705 /**
11706  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
11707  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
11708  */
11709 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
11710
11711 /**
11712  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
11713  */
11714 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
11715
11716 /**
11717  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
11718  */
11719 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
11720
11721 /**
11722  * The keys provider which will give us relevant keys. Some keys will be loaded during
11723  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
11724  * signing data.
11725  */
11726 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11727
11728 /**
11729  * The keys provider which will give us relevant keys. Some keys will be loaded during
11730  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
11731  * signing data.
11732  */
11733 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
11734
11735 /**
11736  * The fee_estimator for use in the ChannelManager in the future.
11737  *
11738  * No calls to the FeeEstimator will be made during deserialization.
11739  */
11740 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11741
11742 /**
11743  * The fee_estimator for use in the ChannelManager in the future.
11744  *
11745  * No calls to the FeeEstimator will be made during deserialization.
11746  */
11747 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
11748
11749 /**
11750  * The chain::Watch for use in the ChannelManager in the future.
11751  *
11752  * No calls to the chain::Watch will be made during deserialization. It is assumed that
11753  * you have deserialized ChannelMonitors separately and will add them to your
11754  * chain::Watch after deserializing this ChannelManager.
11755  */
11756 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11757
11758 /**
11759  * The chain::Watch for use in the ChannelManager in the future.
11760  *
11761  * No calls to the chain::Watch will be made during deserialization. It is assumed that
11762  * you have deserialized ChannelMonitors separately and will add them to your
11763  * chain::Watch after deserializing this ChannelManager.
11764  */
11765 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
11766
11767 /**
11768  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
11769  * used to broadcast the latest local commitment transactions of channels which must be
11770  * force-closed during deserialization.
11771  */
11772 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11773
11774 /**
11775  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
11776  * used to broadcast the latest local commitment transactions of channels which must be
11777  * force-closed during deserialization.
11778  */
11779 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
11780
11781 /**
11782  * The Logger for use in the ChannelManager and which may be used to log information during
11783  * deserialization.
11784  */
11785 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11786
11787 /**
11788  * The Logger for use in the ChannelManager and which may be used to log information during
11789  * deserialization.
11790  */
11791 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
11792
11793 /**
11794  * Default settings used for new channels. Any existing channels will continue to use the
11795  * runtime settings which were stored when the ChannelManager was serialized.
11796  */
11797 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11798
11799 /**
11800  * Default settings used for new channels. Any existing channels will continue to use the
11801  * runtime settings which were stored when the ChannelManager was serialized.
11802  */
11803 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
11804
11805 /**
11806  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
11807  * HashMap for you. This is primarily useful for C bindings where it is not practical to
11808  * populate a HashMap directly from C.
11809  */
11810 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);
11811
11812 /**
11813  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
11814  */
11815 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
11816
11817 /**
11818  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
11819  */
11820 void DecodeError_free(struct LDKDecodeError this_obj);
11821
11822 /**
11823  * Creates a copy of the DecodeError
11824  */
11825 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
11826
11827 /**
11828  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
11829  */
11830 void Init_free(struct LDKInit this_obj);
11831
11832 /**
11833  * The relevant features which the sender supports
11834  */
11835 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
11836
11837 /**
11838  * The relevant features which the sender supports
11839  */
11840 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
11841
11842 /**
11843  * Constructs a new Init given each field
11844  */
11845 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
11846
11847 /**
11848  * Creates a copy of the Init
11849  */
11850 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
11851
11852 /**
11853  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
11854  */
11855 void ErrorMessage_free(struct LDKErrorMessage this_obj);
11856
11857 /**
11858  * The channel ID involved in the error
11859  */
11860 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
11861
11862 /**
11863  * The channel ID involved in the error
11864  */
11865 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11866
11867 /**
11868  * A possibly human-readable error description.
11869  * The string should be sanitized before it is used (e.g. emitted to logs
11870  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
11871  * vulnerability in the terminal emulator or the logging subsystem.
11872  */
11873 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
11874
11875 /**
11876  * A possibly human-readable error description.
11877  * The string should be sanitized before it is used (e.g. emitted to logs
11878  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
11879  * vulnerability in the terminal emulator or the logging subsystem.
11880  */
11881 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
11882
11883 /**
11884  * Constructs a new ErrorMessage given each field
11885  */
11886 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg);
11887
11888 /**
11889  * Creates a copy of the ErrorMessage
11890  */
11891 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
11892
11893 /**
11894  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
11895  */
11896 void Ping_free(struct LDKPing this_obj);
11897
11898 /**
11899  * The desired response length
11900  */
11901 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
11902
11903 /**
11904  * The desired response length
11905  */
11906 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
11907
11908 /**
11909  * The ping packet size.
11910  * This field is not sent on the wire. byteslen zeros are sent.
11911  */
11912 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
11913
11914 /**
11915  * The ping packet size.
11916  * This field is not sent on the wire. byteslen zeros are sent.
11917  */
11918 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
11919
11920 /**
11921  * Constructs a new Ping given each field
11922  */
11923 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
11924
11925 /**
11926  * Creates a copy of the Ping
11927  */
11928 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
11929
11930 /**
11931  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
11932  */
11933 void Pong_free(struct LDKPong this_obj);
11934
11935 /**
11936  * The pong packet size.
11937  * This field is not sent on the wire. byteslen zeros are sent.
11938  */
11939 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
11940
11941 /**
11942  * The pong packet size.
11943  * This field is not sent on the wire. byteslen zeros are sent.
11944  */
11945 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
11946
11947 /**
11948  * Constructs a new Pong given each field
11949  */
11950 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
11951
11952 /**
11953  * Creates a copy of the Pong
11954  */
11955 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
11956
11957 /**
11958  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
11959  */
11960 void OpenChannel_free(struct LDKOpenChannel this_obj);
11961
11962 /**
11963  * The genesis hash of the blockchain where the channel is to be opened
11964  */
11965 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
11966
11967 /**
11968  * The genesis hash of the blockchain where the channel is to be opened
11969  */
11970 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11971
11972 /**
11973  * A temporary channel ID, until the funding outpoint is announced
11974  */
11975 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
11976
11977 /**
11978  * A temporary channel ID, until the funding outpoint is announced
11979  */
11980 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11981
11982 /**
11983  * The channel value
11984  */
11985 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11986
11987 /**
11988  * The channel value
11989  */
11990 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11991
11992 /**
11993  * The amount to push to the counterparty as part of the open, in milli-satoshi
11994  */
11995 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11996
11997 /**
11998  * The amount to push to the counterparty as part of the open, in milli-satoshi
11999  */
12000 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
12001
12002 /**
12003  * The threshold below which outputs on transactions broadcast by sender will be omitted
12004  */
12005 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12006
12007 /**
12008  * The threshold below which outputs on transactions broadcast by sender will be omitted
12009  */
12010 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
12011
12012 /**
12013  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
12014  */
12015 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12016
12017 /**
12018  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
12019  */
12020 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
12021
12022 /**
12023  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
12024  */
12025 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12026
12027 /**
12028  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
12029  */
12030 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
12031
12032 /**
12033  * The minimum HTLC size incoming to sender, in milli-satoshi
12034  */
12035 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12036
12037 /**
12038  * The minimum HTLC size incoming to sender, in milli-satoshi
12039  */
12040 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
12041
12042 /**
12043  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
12044  */
12045 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12046
12047 /**
12048  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
12049  */
12050 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
12051
12052 /**
12053  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
12054  */
12055 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12056
12057 /**
12058  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
12059  */
12060 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
12061
12062 /**
12063  * The maximum number of inbound HTLCs towards sender
12064  */
12065 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12066
12067 /**
12068  * The maximum number of inbound HTLCs towards sender
12069  */
12070 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
12071
12072 /**
12073  * The sender's key controlling the funding transaction
12074  */
12075 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12076
12077 /**
12078  * The sender's key controlling the funding transaction
12079  */
12080 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12081
12082 /**
12083  * Used to derive a revocation key for transactions broadcast by counterparty
12084  */
12085 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12086
12087 /**
12088  * Used to derive a revocation key for transactions broadcast by counterparty
12089  */
12090 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12091
12092 /**
12093  * A payment key to sender for transactions broadcast by counterparty
12094  */
12095 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12096
12097 /**
12098  * A payment key to sender for transactions broadcast by counterparty
12099  */
12100 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12101
12102 /**
12103  * Used to derive a payment key to sender for transactions broadcast by sender
12104  */
12105 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12106
12107 /**
12108  * Used to derive a payment key to sender for transactions broadcast by sender
12109  */
12110 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12111
12112 /**
12113  * Used to derive an HTLC payment key to sender
12114  */
12115 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12116
12117 /**
12118  * Used to derive an HTLC payment key to sender
12119  */
12120 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12121
12122 /**
12123  * The first to-be-broadcast-by-sender transaction's per commitment point
12124  */
12125 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12126
12127 /**
12128  * The first to-be-broadcast-by-sender transaction's per commitment point
12129  */
12130 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12131
12132 /**
12133  * Channel flags
12134  */
12135 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12136
12137 /**
12138  * Channel flags
12139  */
12140 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
12141
12142 /**
12143  * Creates a copy of the OpenChannel
12144  */
12145 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
12146
12147 /**
12148  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
12149  */
12150 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
12151
12152 /**
12153  * A temporary channel ID, until the funding outpoint is announced
12154  */
12155 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
12156
12157 /**
12158  * A temporary channel ID, until the funding outpoint is announced
12159  */
12160 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12161
12162 /**
12163  * The threshold below which outputs on transactions broadcast by sender will be omitted
12164  */
12165 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12166
12167 /**
12168  * The threshold below which outputs on transactions broadcast by sender will be omitted
12169  */
12170 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
12171
12172 /**
12173  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
12174  */
12175 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12176
12177 /**
12178  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
12179  */
12180 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
12181
12182 /**
12183  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
12184  */
12185 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12186
12187 /**
12188  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
12189  */
12190 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
12191
12192 /**
12193  * The minimum HTLC size incoming to sender, in milli-satoshi
12194  */
12195 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12196
12197 /**
12198  * The minimum HTLC size incoming to sender, in milli-satoshi
12199  */
12200 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
12201
12202 /**
12203  * Minimum depth of the funding transaction before the channel is considered open
12204  */
12205 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12206
12207 /**
12208  * Minimum depth of the funding transaction before the channel is considered open
12209  */
12210 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
12211
12212 /**
12213  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
12214  */
12215 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12216
12217 /**
12218  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
12219  */
12220 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
12221
12222 /**
12223  * The maximum number of inbound HTLCs towards sender
12224  */
12225 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12226
12227 /**
12228  * The maximum number of inbound HTLCs towards sender
12229  */
12230 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
12231
12232 /**
12233  * The sender's key controlling the funding transaction
12234  */
12235 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12236
12237 /**
12238  * The sender's key controlling the funding transaction
12239  */
12240 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12241
12242 /**
12243  * Used to derive a revocation key for transactions broadcast by counterparty
12244  */
12245 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12246
12247 /**
12248  * Used to derive a revocation key for transactions broadcast by counterparty
12249  */
12250 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12251
12252 /**
12253  * A payment key to sender for transactions broadcast by counterparty
12254  */
12255 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12256
12257 /**
12258  * A payment key to sender for transactions broadcast by counterparty
12259  */
12260 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12261
12262 /**
12263  * Used to derive a payment key to sender for transactions broadcast by sender
12264  */
12265 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12266
12267 /**
12268  * Used to derive a payment key to sender for transactions broadcast by sender
12269  */
12270 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12271
12272 /**
12273  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
12274  */
12275 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12276
12277 /**
12278  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
12279  */
12280 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12281
12282 /**
12283  * The first to-be-broadcast-by-sender transaction's per commitment point
12284  */
12285 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12286
12287 /**
12288  * The first to-be-broadcast-by-sender transaction's per commitment point
12289  */
12290 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12291
12292 /**
12293  * Creates a copy of the AcceptChannel
12294  */
12295 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
12296
12297 /**
12298  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
12299  */
12300 void FundingCreated_free(struct LDKFundingCreated this_obj);
12301
12302 /**
12303  * A temporary channel ID, until the funding is established
12304  */
12305 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
12306
12307 /**
12308  * A temporary channel ID, until the funding is established
12309  */
12310 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12311
12312 /**
12313  * The funding transaction ID
12314  */
12315 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
12316
12317 /**
12318  * The funding transaction ID
12319  */
12320 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12321
12322 /**
12323  * The specific output index funding this channel
12324  */
12325 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
12326
12327 /**
12328  * The specific output index funding this channel
12329  */
12330 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
12331
12332 /**
12333  * The signature of the channel initiator (funder) on the funding transaction
12334  */
12335 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
12336
12337 /**
12338  * The signature of the channel initiator (funder) on the funding transaction
12339  */
12340 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
12341
12342 /**
12343  * Constructs a new FundingCreated given each field
12344  */
12345 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);
12346
12347 /**
12348  * Creates a copy of the FundingCreated
12349  */
12350 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
12351
12352 /**
12353  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
12354  */
12355 void FundingSigned_free(struct LDKFundingSigned this_obj);
12356
12357 /**
12358  * The channel ID
12359  */
12360 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
12361
12362 /**
12363  * The channel ID
12364  */
12365 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12366
12367 /**
12368  * The signature of the channel acceptor (fundee) on the funding transaction
12369  */
12370 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
12371
12372 /**
12373  * The signature of the channel acceptor (fundee) on the funding transaction
12374  */
12375 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12376
12377 /**
12378  * Constructs a new FundingSigned given each field
12379  */
12380 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
12381
12382 /**
12383  * Creates a copy of the FundingSigned
12384  */
12385 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
12386
12387 /**
12388  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
12389  */
12390 void FundingLocked_free(struct LDKFundingLocked this_obj);
12391
12392 /**
12393  * The channel ID
12394  */
12395 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
12396
12397 /**
12398  * The channel ID
12399  */
12400 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12401
12402 /**
12403  * The per-commitment point of the second commitment transaction
12404  */
12405 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
12406
12407 /**
12408  * The per-commitment point of the second commitment transaction
12409  */
12410 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12411
12412 /**
12413  * Constructs a new FundingLocked given each field
12414  */
12415 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
12416
12417 /**
12418  * Creates a copy of the FundingLocked
12419  */
12420 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
12421
12422 /**
12423  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
12424  */
12425 void Shutdown_free(struct LDKShutdown this_obj);
12426
12427 /**
12428  * The channel ID
12429  */
12430 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
12431
12432 /**
12433  * The channel ID
12434  */
12435 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12436
12437 /**
12438  * The destination of this peer's funds on closing.
12439  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
12440  */
12441 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
12442
12443 /**
12444  * The destination of this peer's funds on closing.
12445  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
12446  */
12447 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
12448
12449 /**
12450  * Constructs a new Shutdown given each field
12451  */
12452 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
12453
12454 /**
12455  * Creates a copy of the Shutdown
12456  */
12457 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
12458
12459 /**
12460  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
12461  */
12462 void ClosingSigned_free(struct LDKClosingSigned this_obj);
12463
12464 /**
12465  * The channel ID
12466  */
12467 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
12468
12469 /**
12470  * The channel ID
12471  */
12472 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12473
12474 /**
12475  * The proposed total fee for the closing transaction
12476  */
12477 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
12478
12479 /**
12480  * The proposed total fee for the closing transaction
12481  */
12482 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
12483
12484 /**
12485  * A signature on the closing transaction
12486  */
12487 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
12488
12489 /**
12490  * A signature on the closing transaction
12491  */
12492 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12493
12494 /**
12495  * Constructs a new ClosingSigned given each field
12496  */
12497 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
12498
12499 /**
12500  * Creates a copy of the ClosingSigned
12501  */
12502 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
12503
12504 /**
12505  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
12506  */
12507 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
12508
12509 /**
12510  * The channel ID
12511  */
12512 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
12513
12514 /**
12515  * The channel ID
12516  */
12517 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12518
12519 /**
12520  * The HTLC ID
12521  */
12522 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12523
12524 /**
12525  * The HTLC ID
12526  */
12527 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
12528
12529 /**
12530  * The HTLC value in milli-satoshi
12531  */
12532 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12533
12534 /**
12535  * The HTLC value in milli-satoshi
12536  */
12537 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
12538
12539 /**
12540  * The payment hash, the pre-image of which controls HTLC redemption
12541  */
12542 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
12543
12544 /**
12545  * The payment hash, the pre-image of which controls HTLC redemption
12546  */
12547 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12548
12549 /**
12550  * The expiry height of the HTLC
12551  */
12552 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12553
12554 /**
12555  * The expiry height of the HTLC
12556  */
12557 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
12558
12559 /**
12560  * Creates a copy of the UpdateAddHTLC
12561  */
12562 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
12563
12564 /**
12565  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
12566  */
12567 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
12568
12569 /**
12570  * The channel ID
12571  */
12572 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
12573
12574 /**
12575  * The channel ID
12576  */
12577 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12578
12579 /**
12580  * The HTLC ID
12581  */
12582 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
12583
12584 /**
12585  * The HTLC ID
12586  */
12587 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
12588
12589 /**
12590  * The pre-image of the payment hash, allowing HTLC redemption
12591  */
12592 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
12593
12594 /**
12595  * The pre-image of the payment hash, allowing HTLC redemption
12596  */
12597 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12598
12599 /**
12600  * Constructs a new UpdateFulfillHTLC given each field
12601  */
12602 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
12603
12604 /**
12605  * Creates a copy of the UpdateFulfillHTLC
12606  */
12607 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
12608
12609 /**
12610  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
12611  */
12612 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
12613
12614 /**
12615  * The channel ID
12616  */
12617 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
12618
12619 /**
12620  * The channel ID
12621  */
12622 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12623
12624 /**
12625  * The HTLC ID
12626  */
12627 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
12628
12629 /**
12630  * The HTLC ID
12631  */
12632 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
12633
12634 /**
12635  * Creates a copy of the UpdateFailHTLC
12636  */
12637 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
12638
12639 /**
12640  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
12641  */
12642 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
12643
12644 /**
12645  * The channel ID
12646  */
12647 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
12648
12649 /**
12650  * The channel ID
12651  */
12652 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12653
12654 /**
12655  * The HTLC ID
12656  */
12657 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
12658
12659 /**
12660  * The HTLC ID
12661  */
12662 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
12663
12664 /**
12665  * The failure code
12666  */
12667 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
12668
12669 /**
12670  * The failure code
12671  */
12672 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
12673
12674 /**
12675  * Creates a copy of the UpdateFailMalformedHTLC
12676  */
12677 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
12678
12679 /**
12680  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
12681  */
12682 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
12683
12684 /**
12685  * The channel ID
12686  */
12687 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
12688
12689 /**
12690  * The channel ID
12691  */
12692 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12693
12694 /**
12695  * A signature on the commitment transaction
12696  */
12697 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
12698
12699 /**
12700  * A signature on the commitment transaction
12701  */
12702 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12703
12704 /**
12705  * Signatures on the HTLC transactions
12706  */
12707 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
12708
12709 /**
12710  * Constructs a new CommitmentSigned given each field
12711  */
12712 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
12713
12714 /**
12715  * Creates a copy of the CommitmentSigned
12716  */
12717 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
12718
12719 /**
12720  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
12721  */
12722 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
12723
12724 /**
12725  * The channel ID
12726  */
12727 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
12728
12729 /**
12730  * The channel ID
12731  */
12732 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12733
12734 /**
12735  * The secret corresponding to the per-commitment point
12736  */
12737 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
12738
12739 /**
12740  * The secret corresponding to the per-commitment point
12741  */
12742 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12743
12744 /**
12745  * The next sender-broadcast commitment transaction's per-commitment point
12746  */
12747 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
12748
12749 /**
12750  * The next sender-broadcast commitment transaction's per-commitment point
12751  */
12752 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12753
12754 /**
12755  * Constructs a new RevokeAndACK given each field
12756  */
12757 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);
12758
12759 /**
12760  * Creates a copy of the RevokeAndACK
12761  */
12762 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
12763
12764 /**
12765  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
12766  */
12767 void UpdateFee_free(struct LDKUpdateFee this_obj);
12768
12769 /**
12770  * The channel ID
12771  */
12772 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
12773
12774 /**
12775  * The channel ID
12776  */
12777 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12778
12779 /**
12780  * Fee rate per 1000-weight of the transaction
12781  */
12782 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
12783
12784 /**
12785  * Fee rate per 1000-weight of the transaction
12786  */
12787 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
12788
12789 /**
12790  * Constructs a new UpdateFee given each field
12791  */
12792 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
12793
12794 /**
12795  * Creates a copy of the UpdateFee
12796  */
12797 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
12798
12799 /**
12800  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
12801  */
12802 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
12803
12804 /**
12805  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
12806  * belonging to the recipient
12807  */
12808 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
12809
12810 /**
12811  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
12812  * belonging to the recipient
12813  */
12814 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12815
12816 /**
12817  * The sender's per-commitment point for their current commitment transaction
12818  */
12819 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
12820
12821 /**
12822  * The sender's per-commitment point for their current commitment transaction
12823  */
12824 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12825
12826 /**
12827  * Constructs a new DataLossProtect given each field
12828  */
12829 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
12830
12831 /**
12832  * Creates a copy of the DataLossProtect
12833  */
12834 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
12835
12836 /**
12837  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
12838  */
12839 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
12840
12841 /**
12842  * The channel ID
12843  */
12844 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
12845
12846 /**
12847  * The channel ID
12848  */
12849 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12850
12851 /**
12852  * The next commitment number for the sender
12853  */
12854 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
12855
12856 /**
12857  * The next commitment number for the sender
12858  */
12859 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
12860
12861 /**
12862  * The next commitment number for the recipient
12863  */
12864 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
12865
12866 /**
12867  * The next commitment number for the recipient
12868  */
12869 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
12870
12871 /**
12872  * Creates a copy of the ChannelReestablish
12873  */
12874 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
12875
12876 /**
12877  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
12878  */
12879 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
12880
12881 /**
12882  * The channel ID
12883  */
12884 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
12885
12886 /**
12887  * The channel ID
12888  */
12889 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12890
12891 /**
12892  * The short channel ID
12893  */
12894 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12895
12896 /**
12897  * The short channel ID
12898  */
12899 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
12900
12901 /**
12902  * A signature by the node key
12903  */
12904 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12905
12906 /**
12907  * A signature by the node key
12908  */
12909 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
12910
12911 /**
12912  * A signature by the funding key
12913  */
12914 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12915
12916 /**
12917  * A signature by the funding key
12918  */
12919 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
12920
12921 /**
12922  * Constructs a new AnnouncementSignatures given each field
12923  */
12924 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);
12925
12926 /**
12927  * Creates a copy of the AnnouncementSignatures
12928  */
12929 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
12930
12931 /**
12932  * Frees any resources used by the NetAddress
12933  */
12934 void NetAddress_free(struct LDKNetAddress this_ptr);
12935
12936 /**
12937  * Creates a copy of the NetAddress
12938  */
12939 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
12940
12941 /**
12942  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
12943  */
12944 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
12945
12946 /**
12947  * Read a Result from a byte array, created by Result_write
12948  */
12949 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
12950
12951 /**
12952  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
12953  */
12954 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
12955
12956 /**
12957  * The advertised features
12958  */
12959 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12960
12961 /**
12962  * The advertised features
12963  */
12964 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
12965
12966 /**
12967  * A strictly monotonic announcement counter, with gaps allowed
12968  */
12969 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12970
12971 /**
12972  * A strictly monotonic announcement counter, with gaps allowed
12973  */
12974 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
12975
12976 /**
12977  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
12978  * to this node).
12979  */
12980 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12981
12982 /**
12983  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
12984  * to this node).
12985  */
12986 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12987
12988 /**
12989  * An RGB color for UI purposes
12990  */
12991 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
12992
12993 /**
12994  * An RGB color for UI purposes
12995  */
12996 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
12997
12998 /**
12999  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
13000  * of uniqueness.
13001  */
13002 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
13003
13004 /**
13005  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
13006  * of uniqueness.
13007  */
13008 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13009
13010 /**
13011  * List of addresses on which this node is reachable
13012  */
13013 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
13014
13015 /**
13016  * Creates a copy of the UnsignedNodeAnnouncement
13017  */
13018 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
13019
13020 /**
13021  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
13022  */
13023 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
13024
13025 /**
13026  * The signature by the node key
13027  */
13028 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
13029
13030 /**
13031  * The signature by the node key
13032  */
13033 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
13034
13035 /**
13036  * The actual content of the announcement
13037  */
13038 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
13039
13040 /**
13041  * The actual content of the announcement
13042  */
13043 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
13044
13045 /**
13046  * Constructs a new NodeAnnouncement given each field
13047  */
13048 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
13049
13050 /**
13051  * Creates a copy of the NodeAnnouncement
13052  */
13053 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
13054
13055 /**
13056  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
13057  */
13058 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
13059
13060 /**
13061  * The advertised channel features
13062  */
13063 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13064
13065 /**
13066  * The advertised channel features
13067  */
13068 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
13069
13070 /**
13071  * The genesis hash of the blockchain where the channel is to be opened
13072  */
13073 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
13074
13075 /**
13076  * The genesis hash of the blockchain where the channel is to be opened
13077  */
13078 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13079
13080 /**
13081  * The short channel ID
13082  */
13083 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13084
13085 /**
13086  * The short channel ID
13087  */
13088 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
13089
13090 /**
13091  * One of the two node_ids which are endpoints of this channel
13092  */
13093 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13094
13095 /**
13096  * One of the two node_ids which are endpoints of this channel
13097  */
13098 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13099
13100 /**
13101  * The other of the two node_ids which are endpoints of this channel
13102  */
13103 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13104
13105 /**
13106  * The other of the two node_ids which are endpoints of this channel
13107  */
13108 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13109
13110 /**
13111  * The funding key for the first node
13112  */
13113 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13114
13115 /**
13116  * The funding key for the first node
13117  */
13118 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13119
13120 /**
13121  * The funding key for the second node
13122  */
13123 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13124
13125 /**
13126  * The funding key for the second node
13127  */
13128 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13129
13130 /**
13131  * Creates a copy of the UnsignedChannelAnnouncement
13132  */
13133 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
13134
13135 /**
13136  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
13137  */
13138 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
13139
13140 /**
13141  * Authentication of the announcement by the first public node
13142  */
13143 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13144
13145 /**
13146  * Authentication of the announcement by the first public node
13147  */
13148 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
13149
13150 /**
13151  * Authentication of the announcement by the second public node
13152  */
13153 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13154
13155 /**
13156  * Authentication of the announcement by the second public node
13157  */
13158 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
13159
13160 /**
13161  * Proof of funding UTXO ownership by the first public node
13162  */
13163 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13164
13165 /**
13166  * Proof of funding UTXO ownership by the first public node
13167  */
13168 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
13169
13170 /**
13171  * Proof of funding UTXO ownership by the second public node
13172  */
13173 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13174
13175 /**
13176  * Proof of funding UTXO ownership by the second public node
13177  */
13178 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
13179
13180 /**
13181  * The actual announcement
13182  */
13183 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13184
13185 /**
13186  * The actual announcement
13187  */
13188 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
13189
13190 /**
13191  * Constructs a new ChannelAnnouncement given each field
13192  */
13193 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);
13194
13195 /**
13196  * Creates a copy of the ChannelAnnouncement
13197  */
13198 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
13199
13200 /**
13201  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
13202  */
13203 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
13204
13205 /**
13206  * The genesis hash of the blockchain where the channel is to be opened
13207  */
13208 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
13209
13210 /**
13211  * The genesis hash of the blockchain where the channel is to be opened
13212  */
13213 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13214
13215 /**
13216  * The short channel ID
13217  */
13218 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13219
13220 /**
13221  * The short channel ID
13222  */
13223 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
13224
13225 /**
13226  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
13227  */
13228 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13229
13230 /**
13231  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
13232  */
13233 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
13234
13235 /**
13236  * Channel flags
13237  */
13238 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13239
13240 /**
13241  * Channel flags
13242  */
13243 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
13244
13245 /**
13246  * The number of blocks such that if:
13247  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
13248  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
13249  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
13250  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
13251  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
13252  * forwarding. Note that the HTLC sender is the one who originally sets this value when
13253  * constructing the route.
13254  */
13255 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13256
13257 /**
13258  * The number of blocks such that if:
13259  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
13260  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
13261  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
13262  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
13263  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
13264  * forwarding. Note that the HTLC sender is the one who originally sets this value when
13265  * constructing the route.
13266  */
13267 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
13268
13269 /**
13270  * The minimum HTLC size incoming to sender, in milli-satoshi
13271  */
13272 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13273
13274 /**
13275  * The minimum HTLC size incoming to sender, in milli-satoshi
13276  */
13277 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
13278
13279 /**
13280  * The base HTLC fee charged by sender, in milli-satoshi
13281  */
13282 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13283
13284 /**
13285  * The base HTLC fee charged by sender, in milli-satoshi
13286  */
13287 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
13288
13289 /**
13290  * The amount to fee multiplier, in micro-satoshi
13291  */
13292 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13293
13294 /**
13295  * The amount to fee multiplier, in micro-satoshi
13296  */
13297 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
13298
13299 /**
13300  * Creates a copy of the UnsignedChannelUpdate
13301  */
13302 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
13303
13304 /**
13305  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
13306  */
13307 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
13308
13309 /**
13310  * A signature of the channel update
13311  */
13312 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
13313
13314 /**
13315  * A signature of the channel update
13316  */
13317 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
13318
13319 /**
13320  * The actual channel update
13321  */
13322 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
13323
13324 /**
13325  * The actual channel update
13326  */
13327 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
13328
13329 /**
13330  * Constructs a new ChannelUpdate given each field
13331  */
13332 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
13333
13334 /**
13335  * Creates a copy of the ChannelUpdate
13336  */
13337 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
13338
13339 /**
13340  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
13341  */
13342 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
13343
13344 /**
13345  * The genesis hash of the blockchain being queried
13346  */
13347 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
13348
13349 /**
13350  * The genesis hash of the blockchain being queried
13351  */
13352 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13353
13354 /**
13355  * The height of the first block for the channel UTXOs being queried
13356  */
13357 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
13358
13359 /**
13360  * The height of the first block for the channel UTXOs being queried
13361  */
13362 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13363
13364 /**
13365  * The number of blocks to include in the query results
13366  */
13367 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
13368
13369 /**
13370  * The number of blocks to include in the query results
13371  */
13372 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13373
13374 /**
13375  * Constructs a new QueryChannelRange given each field
13376  */
13377 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
13378
13379 /**
13380  * Creates a copy of the QueryChannelRange
13381  */
13382 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
13383
13384 /**
13385  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
13386  */
13387 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
13388
13389 /**
13390  * The genesis hash of the blockchain being queried
13391  */
13392 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
13393
13394 /**
13395  * The genesis hash of the blockchain being queried
13396  */
13397 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13398
13399 /**
13400  * The height of the first block in the range of the reply
13401  */
13402 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13403
13404 /**
13405  * The height of the first block in the range of the reply
13406  */
13407 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13408
13409 /**
13410  * The number of blocks included in the range of the reply
13411  */
13412 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13413
13414 /**
13415  * The number of blocks included in the range of the reply
13416  */
13417 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13418
13419 /**
13420  * True when this is the final reply for a query
13421  */
13422 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13423
13424 /**
13425  * True when this is the final reply for a query
13426  */
13427 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
13428
13429 /**
13430  * The short_channel_ids in the channel range
13431  */
13432 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
13433
13434 /**
13435  * Constructs a new ReplyChannelRange given each field
13436  */
13437 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);
13438
13439 /**
13440  * Creates a copy of the ReplyChannelRange
13441  */
13442 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
13443
13444 /**
13445  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
13446  */
13447 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
13448
13449 /**
13450  * The genesis hash of the blockchain being queried
13451  */
13452 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
13453
13454 /**
13455  * The genesis hash of the blockchain being queried
13456  */
13457 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13458
13459 /**
13460  * The short_channel_ids that are being queried
13461  */
13462 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
13463
13464 /**
13465  * Constructs a new QueryShortChannelIds given each field
13466  */
13467 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
13468
13469 /**
13470  * Creates a copy of the QueryShortChannelIds
13471  */
13472 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
13473
13474 /**
13475  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
13476  */
13477 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
13478
13479 /**
13480  * The genesis hash of the blockchain that was queried
13481  */
13482 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
13483
13484 /**
13485  * The genesis hash of the blockchain that was queried
13486  */
13487 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13488
13489 /**
13490  * Indicates if the query recipient maintains up-to-date channel
13491  * information for the chain_hash
13492  */
13493 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
13494
13495 /**
13496  * Indicates if the query recipient maintains up-to-date channel
13497  * information for the chain_hash
13498  */
13499 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
13500
13501 /**
13502  * Constructs a new ReplyShortChannelIdsEnd given each field
13503  */
13504 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
13505
13506 /**
13507  * Creates a copy of the ReplyShortChannelIdsEnd
13508  */
13509 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
13510
13511 /**
13512  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
13513  */
13514 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
13515
13516 /**
13517  * The genesis hash of the blockchain for channel and node information
13518  */
13519 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
13520
13521 /**
13522  * The genesis hash of the blockchain for channel and node information
13523  */
13524 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13525
13526 /**
13527  * The starting unix timestamp
13528  */
13529 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
13530
13531 /**
13532  * The starting unix timestamp
13533  */
13534 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
13535
13536 /**
13537  * The range of information in seconds
13538  */
13539 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
13540
13541 /**
13542  * The range of information in seconds
13543  */
13544 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
13545
13546 /**
13547  * Constructs a new GossipTimestampFilter given each field
13548  */
13549 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
13550
13551 /**
13552  * Creates a copy of the GossipTimestampFilter
13553  */
13554 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
13555
13556 /**
13557  * Frees any resources used by the ErrorAction
13558  */
13559 void ErrorAction_free(struct LDKErrorAction this_ptr);
13560
13561 /**
13562  * Creates a copy of the ErrorAction
13563  */
13564 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
13565
13566 /**
13567  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
13568  */
13569 void LightningError_free(struct LDKLightningError this_obj);
13570
13571 /**
13572  * A human-readable message describing the error
13573  */
13574 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
13575
13576 /**
13577  * A human-readable message describing the error
13578  */
13579 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
13580
13581 /**
13582  * The action which should be taken against the offending peer.
13583  */
13584 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
13585
13586 /**
13587  * The action which should be taken against the offending peer.
13588  */
13589 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
13590
13591 /**
13592  * Constructs a new LightningError given each field
13593  */
13594 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
13595
13596 /**
13597  * Creates a copy of the LightningError
13598  */
13599 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
13600
13601 /**
13602  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
13603  */
13604 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
13605
13606 /**
13607  * update_add_htlc messages which should be sent
13608  */
13609 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
13610
13611 /**
13612  * update_fulfill_htlc messages which should be sent
13613  */
13614 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
13615
13616 /**
13617  * update_fail_htlc messages which should be sent
13618  */
13619 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
13620
13621 /**
13622  * update_fail_malformed_htlc messages which should be sent
13623  */
13624 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
13625
13626 /**
13627  * An update_fee message which should be sent
13628  */
13629 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
13630
13631 /**
13632  * An update_fee message which should be sent
13633  */
13634 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
13635
13636 /**
13637  * Finally, the commitment_signed message which should be sent
13638  */
13639 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
13640
13641 /**
13642  * Finally, the commitment_signed message which should be sent
13643  */
13644 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
13645
13646 /**
13647  * Constructs a new CommitmentUpdate given each field
13648  */
13649 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);
13650
13651 /**
13652  * Creates a copy of the CommitmentUpdate
13653  */
13654 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
13655
13656 /**
13657  * Frees any resources used by the HTLCFailChannelUpdate
13658  */
13659 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
13660
13661 /**
13662  * Creates a copy of the HTLCFailChannelUpdate
13663  */
13664 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
13665
13666 /**
13667  * Calls the free function if one is set
13668  */
13669 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
13670
13671 /**
13672  * Calls the free function if one is set
13673  */
13674 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
13675
13676 /**
13677  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
13678  */
13679 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
13680
13681 /**
13682  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
13683  */
13684 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
13685
13686 /**
13687  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
13688  */
13689 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
13690
13691 /**
13692  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
13693  */
13694 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
13695
13696 /**
13697  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
13698  */
13699 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
13700
13701 /**
13702  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
13703  */
13704 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
13705
13706 /**
13707  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
13708  */
13709 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
13710
13711 /**
13712  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
13713  */
13714 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
13715
13716 /**
13717  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
13718  */
13719 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
13720
13721 /**
13722  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
13723  */
13724 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
13725
13726 /**
13727  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
13728  */
13729 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
13730
13731 /**
13732  * Read a FundingCreated from a byte array, created by FundingCreated_write
13733  */
13734 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
13735
13736 /**
13737  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
13738  */
13739 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
13740
13741 /**
13742  * Read a FundingSigned from a byte array, created by FundingSigned_write
13743  */
13744 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
13745
13746 /**
13747  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
13748  */
13749 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
13750
13751 /**
13752  * Read a FundingLocked from a byte array, created by FundingLocked_write
13753  */
13754 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
13755
13756 /**
13757  * Serialize the Init object into a byte array which can be read by Init_read
13758  */
13759 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
13760
13761 /**
13762  * Read a Init from a byte array, created by Init_write
13763  */
13764 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
13765
13766 /**
13767  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
13768  */
13769 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
13770
13771 /**
13772  * Read a OpenChannel from a byte array, created by OpenChannel_write
13773  */
13774 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
13775
13776 /**
13777  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
13778  */
13779 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
13780
13781 /**
13782  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
13783  */
13784 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
13785
13786 /**
13787  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
13788  */
13789 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
13790
13791 /**
13792  * Read a Shutdown from a byte array, created by Shutdown_write
13793  */
13794 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
13795
13796 /**
13797  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
13798  */
13799 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
13800
13801 /**
13802  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
13803  */
13804 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
13805
13806 /**
13807  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
13808  */
13809 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
13810
13811 /**
13812  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
13813  */
13814 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
13815
13816 /**
13817  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
13818  */
13819 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
13820
13821 /**
13822  * Read a UpdateFee from a byte array, created by UpdateFee_write
13823  */
13824 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
13825
13826 /**
13827  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
13828  */
13829 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
13830
13831 /**
13832  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
13833  */
13834 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
13835
13836 /**
13837  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
13838  */
13839 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
13840
13841 /**
13842  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
13843  */
13844 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
13845
13846 /**
13847  * Serialize the Ping object into a byte array which can be read by Ping_read
13848  */
13849 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
13850
13851 /**
13852  * Read a Ping from a byte array, created by Ping_write
13853  */
13854 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
13855
13856 /**
13857  * Serialize the Pong object into a byte array which can be read by Pong_read
13858  */
13859 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
13860
13861 /**
13862  * Read a Pong from a byte array, created by Pong_write
13863  */
13864 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
13865
13866 /**
13867  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
13868  */
13869 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
13870
13871 /**
13872  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
13873  */
13874 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
13875
13876 /**
13877  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
13878  */
13879 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
13880
13881 /**
13882  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
13883  */
13884 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
13885
13886 /**
13887  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
13888  */
13889 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
13890
13891 /**
13892  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
13893  */
13894 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
13895
13896 /**
13897  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
13898  */
13899 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
13900
13901 /**
13902  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
13903  */
13904 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
13905
13906 /**
13907  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
13908  */
13909 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
13910
13911 /**
13912  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
13913  */
13914 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
13915
13916 /**
13917  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
13918  */
13919 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
13920
13921 /**
13922  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
13923  */
13924 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
13925
13926 /**
13927  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
13928  */
13929 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
13930
13931 /**
13932  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
13933  */
13934 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
13935
13936 /**
13937  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
13938  */
13939 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
13940
13941 /**
13942  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
13943  */
13944 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
13945
13946 /**
13947  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
13948  */
13949 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
13950
13951 /**
13952  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
13953  */
13954 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
13955
13956 /**
13957  *\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
13958  */
13959 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
13960
13961 /**
13962  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
13963  */
13964 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
13965
13966 /**
13967  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
13968  */
13969 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
13970
13971 /**
13972  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
13973  */
13974 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
13975
13976 /**
13977  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
13978  */
13979 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
13980
13981 /**
13982  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
13983  */
13984 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
13985
13986 /**
13987  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
13988  */
13989 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
13990
13991 /**
13992  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
13993  */
13994 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
13995
13996 /**
13997  * Constructs a new IgnoringMessageHandler given each field
13998  */
13999 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
14000
14001 /**
14002  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
14003  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
14004  */
14005 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
14006
14007 /**
14008  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
14009  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
14010  */
14011 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
14012
14013 /**
14014  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
14015  */
14016 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
14017
14018 /**
14019  * Constructs a new ErroringMessageHandler
14020  */
14021 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
14022
14023 /**
14024  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
14025  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
14026  */
14027 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
14028
14029 /**
14030  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
14031  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
14032  */
14033 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
14034
14035 /**
14036  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
14037  */
14038 void MessageHandler_free(struct LDKMessageHandler this_obj);
14039
14040 /**
14041  * A message handler which handles messages specific to channels. Usually this is just a
14042  * ChannelManager object or a ErroringMessageHandler.
14043  */
14044 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
14045
14046 /**
14047  * A message handler which handles messages specific to channels. Usually this is just a
14048  * ChannelManager object or a ErroringMessageHandler.
14049  */
14050 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
14051
14052 /**
14053  * A message handler which handles messages updating our knowledge of the network channel
14054  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
14055  */
14056 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
14057
14058 /**
14059  * A message handler which handles messages updating our knowledge of the network channel
14060  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
14061  */
14062 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
14063
14064 /**
14065  * Constructs a new MessageHandler given each field
14066  */
14067 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
14068
14069 /**
14070  * Creates a copy of a SocketDescriptor
14071  */
14072 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
14073
14074 /**
14075  * Calls the free function if one is set
14076  */
14077 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
14078
14079 /**
14080  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
14081  */
14082 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
14083
14084 /**
14085  * Used to indicate that we probably can't make any future connections to this peer, implying
14086  * we should go ahead and force-close any channels we have with it.
14087  */
14088 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
14089
14090 /**
14091  * Used to indicate that we probably can't make any future connections to this peer, implying
14092  * we should go ahead and force-close any channels we have with it.
14093  */
14094 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
14095
14096 /**
14097  * Constructs a new PeerHandleError given each field
14098  */
14099 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
14100
14101 /**
14102  * Creates a copy of the PeerHandleError
14103  */
14104 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
14105
14106 /**
14107  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
14108  */
14109 void PeerManager_free(struct LDKPeerManager this_obj);
14110
14111 /**
14112  * Constructs a new PeerManager with the given message handlers and node_id secret key
14113  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
14114  * cryptographically secure random bytes.
14115  */
14116 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);
14117
14118 /**
14119  * Get the list of node ids for peers which have completed the initial handshake.
14120  *
14121  * For outbound connections, this will be the same as the their_node_id parameter passed in to
14122  * new_outbound_connection, however entries will only appear once the initial handshake has
14123  * completed and we are sure the remote peer has the private key for the given node_id.
14124  */
14125 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
14126
14127 /**
14128  * Indicates a new outbound connection has been established to a node with the given node_id.
14129  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
14130  * descriptor but must disconnect the connection immediately.
14131  *
14132  * Returns a small number of bytes to send to the remote node (currently always 50).
14133  *
14134  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
14135  * socket_disconnected().
14136  */
14137 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);
14138
14139 /**
14140  * Indicates a new inbound connection has been established.
14141  *
14142  * May refuse the connection by returning an Err, but will never write bytes to the remote end
14143  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
14144  * call socket_disconnected for the new descriptor but must disconnect the connection
14145  * immediately.
14146  *
14147  * Panics if descriptor is duplicative with some other descriptor which has not yet had
14148  * socket_disconnected called.
14149  */
14150 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
14151
14152 /**
14153  * Indicates that there is room to write data to the given socket descriptor.
14154  *
14155  * May return an Err to indicate that the connection should be closed.
14156  *
14157  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
14158  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
14159  * invariants around calling write_buffer_space_avail in case a write did not fully complete
14160  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
14161  * here isn't sufficient! Panics if the descriptor was not previously registered in a
14162  * new_\\*_connection event.
14163  */
14164 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
14165
14166 /**
14167  * Indicates that data was read from the given socket descriptor.
14168  *
14169  * May return an Err to indicate that the connection should be closed.
14170  *
14171  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
14172  * Thus, however, you almost certainly want to call process_events() after any read_event to
14173  * generate send_data calls to handle responses.
14174  *
14175  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
14176  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
14177  *
14178  * Panics if the descriptor was not previously registered in a new_*_connection event.
14179  */
14180 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);
14181
14182 /**
14183  * Checks for any events generated by our handlers and processes them. Includes sending most
14184  * response messages as well as messages generated by calls to handler functions directly (eg
14185  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
14186  */
14187 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
14188
14189 /**
14190  * Indicates that the given socket descriptor's connection is now closed.
14191  *
14192  * This must only be called if the socket has been disconnected by the peer or your own
14193  * decision to disconnect it and must NOT be called in any case where other parts of this
14194  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
14195  * the peer.
14196  *
14197  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
14198  */
14199 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
14200
14201 /**
14202  * Disconnect a peer given its node id.
14203  *
14204  * Set no_connection_possible to true to prevent any further connection with this peer,
14205  * force-closing any channels we have with it.
14206  *
14207  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
14208  * so be careful about reentrancy issues.
14209  */
14210 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
14211
14212 /**
14213  * This function should be called roughly once every 30 seconds.
14214  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
14215  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
14216  */
14217 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
14218
14219 /**
14220  * Build the commitment secret from the seed and the commitment number
14221  */
14222 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
14223
14224 /**
14225  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
14226  * from the base secret and the per_commitment_point.
14227  *
14228  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14229  * generated (ie our own).
14230  */
14231 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
14232
14233 /**
14234  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
14235  * from the base point and the per_commitment_key. This is the public equivalent of
14236  * derive_private_key - using only public keys to derive a public key instead of private keys.
14237  *
14238  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14239  * generated (ie our own).
14240  */
14241 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
14242
14243 /**
14244  * Derives a per-commitment-transaction revocation key from its constituent parts.
14245  *
14246  * Only the cheating participant owns a valid witness to propagate a revoked
14247  * commitment transaction, thus per_commitment_secret always come from cheater
14248  * and revocation_base_secret always come from punisher, which is the broadcaster
14249  * of the transaction spending with this key knowledge.
14250  *
14251  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14252  * generated (ie our own).
14253  */
14254 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
14255
14256 /**
14257  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
14258  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
14259  * public key instead of private keys.
14260  *
14261  * Only the cheating participant owns a valid witness to propagate a revoked
14262  * commitment transaction, thus per_commitment_point always come from cheater
14263  * and revocation_base_point always come from punisher, which is the broadcaster
14264  * of the transaction spending with this key knowledge.
14265  *
14266  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14267  * generated (ie our own).
14268  */
14269 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
14270
14271 /**
14272  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
14273  */
14274 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
14275
14276 /**
14277  * The broadcaster's per-commitment public key which was used to derive the other keys.
14278  */
14279 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14280
14281 /**
14282  * The broadcaster's per-commitment public key which was used to derive the other keys.
14283  */
14284 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14285
14286 /**
14287  * The revocation key which is used to allow the broadcaster of the commitment
14288  * transaction to provide their counterparty the ability to punish them if they broadcast
14289  * an old state.
14290  */
14291 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14292
14293 /**
14294  * The revocation key which is used to allow the broadcaster of the commitment
14295  * transaction to provide their counterparty the ability to punish them if they broadcast
14296  * an old state.
14297  */
14298 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14299
14300 /**
14301  * Broadcaster's HTLC Key
14302  */
14303 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14304
14305 /**
14306  * Broadcaster's HTLC Key
14307  */
14308 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14309
14310 /**
14311  * Countersignatory's HTLC Key
14312  */
14313 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14314
14315 /**
14316  * Countersignatory's HTLC Key
14317  */
14318 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14319
14320 /**
14321  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
14322  */
14323 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14324
14325 /**
14326  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
14327  */
14328 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14329
14330 /**
14331  * Constructs a new TxCreationKeys given each field
14332  */
14333 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);
14334
14335 /**
14336  * Creates a copy of the TxCreationKeys
14337  */
14338 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
14339
14340 /**
14341  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
14342  */
14343 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
14344
14345 /**
14346  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
14347  */
14348 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
14349
14350 /**
14351  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
14352  */
14353 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
14354
14355 /**
14356  * The public key which is used to sign all commitment transactions, as it appears in the
14357  * on-chain channel lock-in 2-of-2 multisig output.
14358  */
14359 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14360
14361 /**
14362  * The public key which is used to sign all commitment transactions, as it appears in the
14363  * on-chain channel lock-in 2-of-2 multisig output.
14364  */
14365 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14366
14367 /**
14368  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
14369  * revocation keys. This is combined with the per-commitment-secret generated by the
14370  * counterparty to create a secret which the counterparty can reveal to revoke previous
14371  * states.
14372  */
14373 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14374
14375 /**
14376  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
14377  * revocation keys. This is combined with the per-commitment-secret generated by the
14378  * counterparty to create a secret which the counterparty can reveal to revoke previous
14379  * states.
14380  */
14381 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14382
14383 /**
14384  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
14385  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
14386  * static across every commitment transaction.
14387  */
14388 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14389
14390 /**
14391  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
14392  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
14393  * static across every commitment transaction.
14394  */
14395 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14396
14397 /**
14398  * The base point which is used (with derive_public_key) to derive a per-commitment payment
14399  * public key which receives non-HTLC-encumbered funds which are only available for spending
14400  * after some delay (or can be claimed via the revocation path).
14401  */
14402 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14403
14404 /**
14405  * The base point which is used (with derive_public_key) to derive a per-commitment payment
14406  * public key which receives non-HTLC-encumbered funds which are only available for spending
14407  * after some delay (or can be claimed via the revocation path).
14408  */
14409 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14410
14411 /**
14412  * The base point which is used (with derive_public_key) to derive a per-commitment public key
14413  * which is used to encumber HTLC-in-flight outputs.
14414  */
14415 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14416
14417 /**
14418  * The base point which is used (with derive_public_key) to derive a per-commitment public key
14419  * which is used to encumber HTLC-in-flight outputs.
14420  */
14421 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14422
14423 /**
14424  * Constructs a new ChannelPublicKeys given each field
14425  */
14426 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);
14427
14428 /**
14429  * Creates a copy of the ChannelPublicKeys
14430  */
14431 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
14432
14433 /**
14434  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
14435  */
14436 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
14437
14438 /**
14439  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
14440  */
14441 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
14442
14443 /**
14444  * Create per-state keys from channel base points and the per-commitment point.
14445  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
14446  */
14447 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);
14448
14449 /**
14450  * Generate per-state keys from channel static keys.
14451  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
14452  */
14453 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);
14454
14455 /**
14456  * A script either spendable by the revocation
14457  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
14458  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
14459  */
14460 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
14461
14462 /**
14463  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
14464  */
14465 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
14466
14467 /**
14468  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
14469  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
14470  * need to compare this value to whether the commitment transaction in question is that of
14471  * the counterparty or our own.
14472  */
14473 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14474
14475 /**
14476  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
14477  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
14478  * need to compare this value to whether the commitment transaction in question is that of
14479  * the counterparty or our own.
14480  */
14481 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
14482
14483 /**
14484  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
14485  * this divided by 1000.
14486  */
14487 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14488
14489 /**
14490  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
14491  * this divided by 1000.
14492  */
14493 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
14494
14495 /**
14496  * The CLTV lock-time at which this HTLC expires.
14497  */
14498 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14499
14500 /**
14501  * The CLTV lock-time at which this HTLC expires.
14502  */
14503 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
14504
14505 /**
14506  * The hash of the preimage which unlocks this HTLC.
14507  */
14508 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
14509
14510 /**
14511  * The hash of the preimage which unlocks this HTLC.
14512  */
14513 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14514
14515 /**
14516  * The position within the commitment transactions' outputs. This may be None if the value is
14517  * below the dust limit (in which case no output appears in the commitment transaction and the
14518  * value is spent to additional transaction fees).
14519  */
14520 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14521
14522 /**
14523  * The position within the commitment transactions' outputs. This may be None if the value is
14524  * below the dust limit (in which case no output appears in the commitment transaction and the
14525  * value is spent to additional transaction fees).
14526  */
14527 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
14528
14529 /**
14530  * Constructs a new HTLCOutputInCommitment given each field
14531  */
14532 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);
14533
14534 /**
14535  * Creates a copy of the HTLCOutputInCommitment
14536  */
14537 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
14538
14539 /**
14540  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
14541  */
14542 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
14543
14544 /**
14545  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
14546  */
14547 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
14548
14549 /**
14550  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
14551  * does not need to have its previous_output_index filled.
14552  */
14553 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
14554
14555 /**
14556  * Gets the redeemscript for a funding output from the two funding public keys.
14557  * Note that the order of funding public keys does not matter.
14558  */
14559 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
14560
14561 /**
14562  * panics if htlc.transaction_output_index.is_none()!
14563  */
14564 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);
14565
14566 /**
14567  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14568  */
14569 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
14570
14571 /**
14572  * Holder public keys
14573  */
14574 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14575
14576 /**
14577  * Holder public keys
14578  */
14579 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
14580
14581 /**
14582  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
14583  */
14584 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14585
14586 /**
14587  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
14588  */
14589 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
14590
14591 /**
14592  * Whether the holder is the initiator of this channel.
14593  * This is an input to the commitment number obscure factor computation.
14594  */
14595 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14596
14597 /**
14598  * Whether the holder is the initiator of this channel.
14599  * This is an input to the commitment number obscure factor computation.
14600  */
14601 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
14602
14603 /**
14604  * The late-bound counterparty channel transaction parameters.
14605  * These parameters are populated at the point in the protocol where the counterparty provides them.
14606  */
14607 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14608
14609 /**
14610  * The late-bound counterparty channel transaction parameters.
14611  * These parameters are populated at the point in the protocol where the counterparty provides them.
14612  */
14613 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
14614
14615 /**
14616  * The late-bound funding outpoint
14617  */
14618 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14619
14620 /**
14621  * The late-bound funding outpoint
14622  */
14623 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
14624
14625 /**
14626  * Constructs a new ChannelTransactionParameters given each field
14627  */
14628 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);
14629
14630 /**
14631  * Creates a copy of the ChannelTransactionParameters
14632  */
14633 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
14634
14635 /**
14636  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14637  */
14638 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
14639
14640 /**
14641  * Counter-party public keys
14642  */
14643 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
14644
14645 /**
14646  * Counter-party public keys
14647  */
14648 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
14649
14650 /**
14651  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
14652  */
14653 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
14654
14655 /**
14656  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
14657  */
14658 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
14659
14660 /**
14661  * Constructs a new CounterpartyChannelTransactionParameters given each field
14662  */
14663 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
14664
14665 /**
14666  * Creates a copy of the CounterpartyChannelTransactionParameters
14667  */
14668 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
14669
14670 /**
14671  * Whether the late bound parameters are populated.
14672  */
14673 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14674
14675 /**
14676  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
14677  * given that the holder is the broadcaster.
14678  *
14679  * self.is_populated() must be true before calling this function.
14680  */
14681 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14682
14683 /**
14684  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
14685  * given that the counterparty is the broadcaster.
14686  *
14687  * self.is_populated() must be true before calling this function.
14688  */
14689 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14690
14691 /**
14692  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
14693  */
14694 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
14695
14696 /**
14697  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
14698  */
14699 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
14700
14701 /**
14702  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
14703  */
14704 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
14705
14706 /**
14707  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
14708  */
14709 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
14710
14711 /**
14712  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14713  */
14714 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
14715
14716 /**
14717  * Get the channel pubkeys for the broadcaster
14718  */
14719 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14720
14721 /**
14722  * Get the channel pubkeys for the countersignatory
14723  */
14724 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14725
14726 /**
14727  * Get the contest delay applicable to the transactions.
14728  * Note that the contest delay was selected by the countersignatory.
14729  */
14730 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14731
14732 /**
14733  * Whether the channel is outbound from the broadcaster.
14734  *
14735  * The boolean representing the side that initiated the channel is
14736  * an input to the commitment number obscure factor computation.
14737  */
14738 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14739
14740 /**
14741  * The funding outpoint
14742  */
14743 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14744
14745 /**
14746  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
14747  */
14748 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
14749
14750 /**
14751  * Our counterparty's signature for the transaction
14752  */
14753 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
14754
14755 /**
14756  * Our counterparty's signature for the transaction
14757  */
14758 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
14759
14760 /**
14761  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
14762  */
14763 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
14764
14765 /**
14766  * Creates a copy of the HolderCommitmentTransaction
14767  */
14768 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
14769
14770 /**
14771  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
14772  */
14773 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
14774
14775 /**
14776  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
14777  */
14778 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
14779
14780 /**
14781  * Create a new holder transaction with the given counterparty signatures.
14782  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
14783  */
14784 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);
14785
14786 /**
14787  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
14788  */
14789 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
14790
14791 /**
14792  * The commitment transaction
14793  */
14794 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
14795
14796 /**
14797  * The commitment transaction
14798  */
14799 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
14800
14801 /**
14802  * The txid for the commitment transaction.
14803  *
14804  * This is provided as a performance optimization, instead of calling transaction.txid()
14805  * multiple times.
14806  */
14807 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
14808
14809 /**
14810  * The txid for the commitment transaction.
14811  *
14812  * This is provided as a performance optimization, instead of calling transaction.txid()
14813  * multiple times.
14814  */
14815 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14816
14817 /**
14818  * Constructs a new BuiltCommitmentTransaction given each field
14819  */
14820 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
14821
14822 /**
14823  * Creates a copy of the BuiltCommitmentTransaction
14824  */
14825 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
14826
14827 /**
14828  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
14829  */
14830 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
14831
14832 /**
14833  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
14834  */
14835 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
14836
14837 /**
14838  * Get the SIGHASH_ALL sighash value of the transaction.
14839  *
14840  * This can be used to verify a signature.
14841  */
14842 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);
14843
14844 /**
14845  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
14846  * because we are about to broadcast a holder transaction.
14847  */
14848 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);
14849
14850 /**
14851  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
14852  */
14853 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
14854
14855 /**
14856  * Creates a copy of the CommitmentTransaction
14857  */
14858 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
14859
14860 /**
14861  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
14862  */
14863 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
14864
14865 /**
14866  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
14867  */
14868 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
14869
14870 /**
14871  * The backwards-counting commitment number
14872  */
14873 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14874
14875 /**
14876  * The value to be sent to the broadcaster
14877  */
14878 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14879
14880 /**
14881  * The value to be sent to the counterparty
14882  */
14883 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14884
14885 /**
14886  * The feerate paid per 1000-weight-unit in this commitment transaction.
14887  */
14888 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14889
14890 /**
14891  * Trust our pre-built transaction and derived transaction creation public keys.
14892  *
14893  * Applies a wrapper which allows access to these fields.
14894  *
14895  * This should only be used if you fully trust the builder of this object.  It should not
14896  *\tbe used by an external signer - instead use the verify function.
14897  */
14898 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14899
14900 /**
14901  * Verify our pre-built transaction and derived transaction creation public keys.
14902  *
14903  * Applies a wrapper which allows access to these fields.
14904  *
14905  * An external validating signer must call this method before signing
14906  * or using the built transaction.
14907  */
14908 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);
14909
14910 /**
14911  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
14912  */
14913 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
14914
14915 /**
14916  * The transaction ID of the built Bitcoin transaction
14917  */
14918 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14919
14920 /**
14921  * The pre-built Bitcoin commitment transaction
14922  */
14923 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14924
14925 /**
14926  * The pre-calculated transaction creation public keys.
14927  */
14928 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14929
14930 /**
14931  * Get a signature for each HTLC which was included in the commitment transaction (ie for
14932  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
14933  *
14934  * The returned Vec has one entry for each HTLC, and in the same order.
14935  */
14936 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);
14937
14938 /**
14939  * Get the transaction number obscure factor
14940  */
14941 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
14942
14943 /**
14944  * Creates a copy of the InitFeatures
14945  */
14946 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
14947
14948 /**
14949  * Creates a copy of the NodeFeatures
14950  */
14951 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
14952
14953 /**
14954  * Creates a copy of the ChannelFeatures
14955  */
14956 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
14957
14958 /**
14959  * Creates a copy of the InvoiceFeatures
14960  */
14961 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
14962
14963 /**
14964  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
14965  */
14966 void InitFeatures_free(struct LDKInitFeatures this_obj);
14967
14968 /**
14969  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
14970  */
14971 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
14972
14973 /**
14974  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
14975  */
14976 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
14977
14978 /**
14979  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
14980  */
14981 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
14982
14983 /**
14984  * Create a blank Features with no features set
14985  */
14986 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
14987
14988 /**
14989  * Creates a Features with the bits set which are known by the implementation
14990  */
14991 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
14992
14993 /**
14994  * Create a blank Features with no features set
14995  */
14996 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
14997
14998 /**
14999  * Creates a Features with the bits set which are known by the implementation
15000  */
15001 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
15002
15003 /**
15004  * Create a blank Features with no features set
15005  */
15006 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
15007
15008 /**
15009  * Creates a Features with the bits set which are known by the implementation
15010  */
15011 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
15012
15013 /**
15014  * Create a blank Features with no features set
15015  */
15016 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
15017
15018 /**
15019  * Creates a Features with the bits set which are known by the implementation
15020  */
15021 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
15022
15023 /**
15024  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
15025  */
15026 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
15027
15028 /**
15029  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
15030  */
15031 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
15032
15033 /**
15034  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
15035  */
15036 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
15037
15038 /**
15039  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
15040  */
15041 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
15042
15043 /**
15044  * Read a InitFeatures from a byte array, created by InitFeatures_write
15045  */
15046 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
15047
15048 /**
15049  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
15050  */
15051 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
15052
15053 /**
15054  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
15055  */
15056 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
15057
15058 /**
15059  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
15060  */
15061 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
15062
15063 /**
15064  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
15065  */
15066 void RouteHop_free(struct LDKRouteHop this_obj);
15067
15068 /**
15069  * The node_id of the node at this hop.
15070  */
15071 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15072
15073 /**
15074  * The node_id of the node at this hop.
15075  */
15076 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15077
15078 /**
15079  * The node_announcement features of the node at this hop. For the last hop, these may be
15080  * amended to match the features present in the invoice this node generated.
15081  */
15082 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15083
15084 /**
15085  * The node_announcement features of the node at this hop. For the last hop, these may be
15086  * amended to match the features present in the invoice this node generated.
15087  */
15088 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
15089
15090 /**
15091  * The channel that should be used from the previous hop to reach this node.
15092  */
15093 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15094
15095 /**
15096  * The channel that should be used from the previous hop to reach this node.
15097  */
15098 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
15099
15100 /**
15101  * The channel_announcement features of the channel that should be used from the previous hop
15102  * to reach this node.
15103  */
15104 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15105
15106 /**
15107  * The channel_announcement features of the channel that should be used from the previous hop
15108  * to reach this node.
15109  */
15110 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
15111
15112 /**
15113  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
15114  * For the last hop, this should be the full value of the payment (might be more than
15115  * requested if we had to match htlc_minimum_msat).
15116  */
15117 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15118
15119 /**
15120  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
15121  * For the last hop, this should be the full value of the payment (might be more than
15122  * requested if we had to match htlc_minimum_msat).
15123  */
15124 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
15125
15126 /**
15127  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
15128  * expected at the destination, in excess of the current block height.
15129  */
15130 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15131
15132 /**
15133  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
15134  * expected at the destination, in excess of the current block height.
15135  */
15136 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
15137
15138 /**
15139  * Constructs a new RouteHop given each field
15140  */
15141 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);
15142
15143 /**
15144  * Creates a copy of the RouteHop
15145  */
15146 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
15147
15148 /**
15149  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
15150  */
15151 void Route_free(struct LDKRoute this_obj);
15152
15153 /**
15154  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
15155  * last RouteHop in each path must be the same.
15156  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
15157  * destination. Thus, this must always be at least length one. While the maximum length of any
15158  * given path is variable, keeping the length of any path to less than 20 should currently
15159  * ensure it is viable.
15160  */
15161 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
15162
15163 /**
15164  * Constructs a new Route given each field
15165  */
15166 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
15167
15168 /**
15169  * Creates a copy of the Route
15170  */
15171 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
15172
15173 /**
15174  * Serialize the Route object into a byte array which can be read by Route_read
15175  */
15176 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
15177
15178 /**
15179  * Read a Route from a byte array, created by Route_write
15180  */
15181 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
15182
15183 /**
15184  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
15185  */
15186 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
15187
15188 /**
15189  * The node_id of the non-target end of the route
15190  */
15191 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
15192
15193 /**
15194  * The node_id of the non-target end of the route
15195  */
15196 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15197
15198 /**
15199  * The short_channel_id of this channel
15200  */
15201 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
15202
15203 /**
15204  * The short_channel_id of this channel
15205  */
15206 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
15207
15208 /**
15209  * The fees which must be paid to use this channel
15210  */
15211 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
15212
15213 /**
15214  * The fees which must be paid to use this channel
15215  */
15216 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
15217
15218 /**
15219  * The difference in CLTV values between this node and the next node.
15220  */
15221 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
15222
15223 /**
15224  * The difference in CLTV values between this node and the next node.
15225  */
15226 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
15227
15228 /**
15229  * The minimum value, in msat, which must be relayed to the next hop.
15230  */
15231 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
15232
15233 /**
15234  * The minimum value, in msat, which must be relayed to the next hop.
15235  */
15236 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15237
15238 /**
15239  * The maximum value in msat available for routing with a single HTLC.
15240  */
15241 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
15242
15243 /**
15244  * The maximum value in msat available for routing with a single HTLC.
15245  */
15246 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15247
15248 /**
15249  * Constructs a new RouteHintHop given each field
15250  */
15251 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);
15252
15253 /**
15254  * Creates a copy of the RouteHintHop
15255  */
15256 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
15257
15258 /**
15259  * Gets a route from us (payer) to the given target node (payee).
15260  *
15261  * If the payee provided features in their invoice, they should be provided via payee_features.
15262  * Without this, MPP will only be used if the payee's features are available in the network graph.
15263  *
15264  * Extra routing hops between known nodes and the target will be used if they are included in
15265  * last_hops.
15266  *
15267  * If some channels aren't announced, it may be useful to fill in a first_hops with the
15268  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
15269  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
15270  * in first_hops will be used.
15271  *
15272  * Panics if first_hops contains channels without short_channel_ids
15273  * (ChannelManager::list_usable_channels will never include such channels).
15274  *
15275  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
15276  * equal), however the enabled/disabled bit on such channels as well as the
15277  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
15278  */
15279 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);
15280
15281 /**
15282  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
15283  */
15284 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
15285
15286 /**
15287  * Creates a copy of the NetworkGraph
15288  */
15289 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
15290
15291 /**
15292  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
15293  */
15294 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
15295
15296 /**
15297  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
15298  */
15299 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
15300
15301 /**
15302  * Creates a new tracker of the actual state of the network of channels and nodes,
15303  * assuming a fresh network graph.
15304  * Chain monitor is used to make sure announced channels exist on-chain,
15305  * channel data is correct, and that the announcement is signed with
15306  * channel owners' keys.
15307  */
15308 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
15309
15310 /**
15311  * Creates a new tracker of the actual state of the network of channels and nodes,
15312  * assuming an existing Network Graph.
15313  */
15314 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
15315
15316 /**
15317  * Adds a provider used to check new announcements. Does not affect
15318  * existing announcements unless they are updated.
15319  * Add, update or remove the provider would replace the current one.
15320  */
15321 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
15322
15323 /**
15324  * Take a read lock on the network_graph and return it in the C-bindings
15325  * newtype helper. This is likely only useful when called via the C
15326  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
15327  * yourself.
15328  */
15329 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15330
15331 /**
15332  * Get a reference to the NetworkGraph which this read-lock contains.
15333  */
15334 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
15335
15336 /**
15337  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
15338  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
15339  */
15340 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15341
15342 /**
15343  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15344  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15345  */
15346 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15347
15348 /**
15349  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
15350  */
15351 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
15352
15353 /**
15354  * When the last update to the channel direction was issued.
15355  * Value is opaque, as set in the announcement.
15356  */
15357 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15358
15359 /**
15360  * When the last update to the channel direction was issued.
15361  * Value is opaque, as set in the announcement.
15362  */
15363 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
15364
15365 /**
15366  * Whether the channel can be currently used for payments (in this one direction).
15367  */
15368 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15369
15370 /**
15371  * Whether the channel can be currently used for payments (in this one direction).
15372  */
15373 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
15374
15375 /**
15376  * The difference in CLTV values that you must have when routing through this channel.
15377  */
15378 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15379
15380 /**
15381  * The difference in CLTV values that you must have when routing through this channel.
15382  */
15383 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
15384
15385 /**
15386  * The minimum value, which must be relayed to the next hop via the channel
15387  */
15388 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15389
15390 /**
15391  * The minimum value, which must be relayed to the next hop via the channel
15392  */
15393 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
15394
15395 /**
15396  * The maximum value which may be relayed to the next hop via the channel.
15397  */
15398 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15399
15400 /**
15401  * The maximum value which may be relayed to the next hop via the channel.
15402  */
15403 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15404
15405 /**
15406  * Fees charged when the channel is used for routing
15407  */
15408 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15409
15410 /**
15411  * Fees charged when the channel is used for routing
15412  */
15413 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
15414
15415 /**
15416  * Most recent update for the channel received from the network
15417  * Mostly redundant with the data we store in fields explicitly.
15418  * Everything else is useful only for sending out for initial routing sync.
15419  * Not stored if contains excess data to prevent DoS.
15420  */
15421 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15422
15423 /**
15424  * Most recent update for the channel received from the network
15425  * Mostly redundant with the data we store in fields explicitly.
15426  * Everything else is useful only for sending out for initial routing sync.
15427  * Not stored if contains excess data to prevent DoS.
15428  */
15429 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
15430
15431 /**
15432  * Constructs a new DirectionalChannelInfo given each field
15433  */
15434 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);
15435
15436 /**
15437  * Creates a copy of the DirectionalChannelInfo
15438  */
15439 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
15440
15441 /**
15442  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
15443  */
15444 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
15445
15446 /**
15447  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
15448  */
15449 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
15450
15451 /**
15452  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
15453  */
15454 void ChannelInfo_free(struct LDKChannelInfo this_obj);
15455
15456 /**
15457  * Protocol features of a channel communicated during its announcement
15458  */
15459 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15460
15461 /**
15462  * Protocol features of a channel communicated during its announcement
15463  */
15464 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
15465
15466 /**
15467  * Source node of the first direction of a channel
15468  */
15469 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15470
15471 /**
15472  * Source node of the first direction of a channel
15473  */
15474 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15475
15476 /**
15477  * Details about the first direction of a channel
15478  */
15479 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15480
15481 /**
15482  * Details about the first direction of a channel
15483  */
15484 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
15485
15486 /**
15487  * Source node of the second direction of a channel
15488  */
15489 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15490
15491 /**
15492  * Source node of the second direction of a channel
15493  */
15494 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15495
15496 /**
15497  * Details about the second direction of a channel
15498  */
15499 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15500
15501 /**
15502  * Details about the second direction of a channel
15503  */
15504 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
15505
15506 /**
15507  * The channel capacity as seen on-chain, if chain lookup is available.
15508  */
15509 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15510
15511 /**
15512  * The channel capacity as seen on-chain, if chain lookup is available.
15513  */
15514 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15515
15516 /**
15517  * An initial announcement of the channel
15518  * Mostly redundant with the data we store in fields explicitly.
15519  * Everything else is useful only for sending out for initial routing sync.
15520  * Not stored if contains excess data to prevent DoS.
15521  */
15522 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15523
15524 /**
15525  * An initial announcement of the channel
15526  * Mostly redundant with the data we store in fields explicitly.
15527  * Everything else is useful only for sending out for initial routing sync.
15528  * Not stored if contains excess data to prevent DoS.
15529  */
15530 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
15531
15532 /**
15533  * Constructs a new ChannelInfo given each field
15534  */
15535 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);
15536
15537 /**
15538  * Creates a copy of the ChannelInfo
15539  */
15540 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
15541
15542 /**
15543  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
15544  */
15545 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
15546
15547 /**
15548  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
15549  */
15550 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
15551
15552 /**
15553  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
15554  */
15555 void RoutingFees_free(struct LDKRoutingFees this_obj);
15556
15557 /**
15558  * Flat routing fee in satoshis
15559  */
15560 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
15561
15562 /**
15563  * Flat routing fee in satoshis
15564  */
15565 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
15566
15567 /**
15568  * Liquidity-based routing fee in millionths of a routed amount.
15569  * In other words, 10000 is 1%.
15570  */
15571 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
15572
15573 /**
15574  * Liquidity-based routing fee in millionths of a routed amount.
15575  * In other words, 10000 is 1%.
15576  */
15577 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
15578
15579 /**
15580  * Constructs a new RoutingFees given each field
15581  */
15582 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
15583
15584 /**
15585  * Creates a copy of the RoutingFees
15586  */
15587 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
15588
15589 /**
15590  * Read a RoutingFees from a byte array, created by RoutingFees_write
15591  */
15592 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
15593
15594 /**
15595  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
15596  */
15597 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
15598
15599 /**
15600  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
15601  */
15602 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
15603
15604 /**
15605  * Protocol features the node announced support for
15606  */
15607 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15608
15609 /**
15610  * Protocol features the node announced support for
15611  */
15612 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
15613
15614 /**
15615  * When the last known update to the node state was issued.
15616  * Value is opaque, as set in the announcement.
15617  */
15618 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15619
15620 /**
15621  * When the last known update to the node state was issued.
15622  * Value is opaque, as set in the announcement.
15623  */
15624 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
15625
15626 /**
15627  * Color assigned to the node
15628  */
15629 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
15630
15631 /**
15632  * Color assigned to the node
15633  */
15634 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
15635
15636 /**
15637  * Moniker assigned to the node.
15638  * May be invalid or malicious (eg control chars),
15639  * should not be exposed to the user.
15640  */
15641 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
15642
15643 /**
15644  * Moniker assigned to the node.
15645  * May be invalid or malicious (eg control chars),
15646  * should not be exposed to the user.
15647  */
15648 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15649
15650 /**
15651  * Internet-level addresses via which one can connect to the node
15652  */
15653 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
15654
15655 /**
15656  * An initial announcement of the node
15657  * Mostly redundant with the data we store in fields explicitly.
15658  * Everything else is useful only for sending out for initial routing sync.
15659  * Not stored if contains excess data to prevent DoS.
15660  */
15661 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15662
15663 /**
15664  * An initial announcement of the node
15665  * Mostly redundant with the data we store in fields explicitly.
15666  * Everything else is useful only for sending out for initial routing sync.
15667  * Not stored if contains excess data to prevent DoS.
15668  */
15669 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
15670
15671 /**
15672  * Constructs a new NodeAnnouncementInfo given each field
15673  */
15674 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);
15675
15676 /**
15677  * Creates a copy of the NodeAnnouncementInfo
15678  */
15679 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
15680
15681 /**
15682  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
15683  */
15684 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
15685
15686 /**
15687  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
15688  */
15689 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
15690
15691 /**
15692  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
15693  */
15694 void NodeInfo_free(struct LDKNodeInfo this_obj);
15695
15696 /**
15697  * All valid channels a node has announced
15698  */
15699 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15700
15701 /**
15702  * Lowest fees enabling routing via any of the enabled, known channels to a node.
15703  * The two fields (flat and proportional fee) are independent,
15704  * meaning they don't have to refer to the same channel.
15705  */
15706 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
15707
15708 /**
15709  * Lowest fees enabling routing via any of the enabled, known channels to a node.
15710  * The two fields (flat and proportional fee) are independent,
15711  * meaning they don't have to refer to the same channel.
15712  */
15713 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
15714
15715 /**
15716  * More information about a node from node_announcement.
15717  * Optional because we store a Node entry after learning about it from
15718  * a channel announcement, but before receiving a node announcement.
15719  */
15720 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
15721
15722 /**
15723  * More information about a node from node_announcement.
15724  * Optional because we store a Node entry after learning about it from
15725  * a channel announcement, but before receiving a node announcement.
15726  */
15727 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
15728
15729 /**
15730  * Constructs a new NodeInfo given each field
15731  */
15732 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
15733
15734 /**
15735  * Creates a copy of the NodeInfo
15736  */
15737 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
15738
15739 /**
15740  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
15741  */
15742 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
15743
15744 /**
15745  * Read a NodeInfo from a byte array, created by NodeInfo_write
15746  */
15747 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
15748
15749 /**
15750  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
15751  */
15752 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
15753
15754 /**
15755  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
15756  */
15757 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
15758
15759 /**
15760  * Creates a new, empty, network graph.
15761  */
15762 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
15763
15764 /**
15765  * For an already known node (from channel announcements), update its stored properties from a
15766  * given node announcement.
15767  *
15768  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15769  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15770  * routing messages from a source using a protocol other than the lightning P2P protocol.
15771  */
15772 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
15773
15774 /**
15775  * For an already known node (from channel announcements), update its stored properties from a
15776  * given node announcement without verifying the associated signatures. Because we aren't
15777  * given the associated signatures here we cannot relay the node announcement to any of our
15778  * peers.
15779  */
15780 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
15781
15782 /**
15783  * Store or update channel info from a channel announcement.
15784  *
15785  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15786  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15787  * routing messages from a source using a protocol other than the lightning P2P protocol.
15788  *
15789  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
15790  * the corresponding UTXO exists on chain and is correctly-formatted.
15791  */
15792 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);
15793
15794 /**
15795  * Store or update channel info from a channel announcement without verifying the associated
15796  * signatures. Because we aren't given the associated signatures here we cannot relay the
15797  * channel announcement to any of our peers.
15798  *
15799  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
15800  * the corresponding UTXO exists on chain and is correctly-formatted.
15801  */
15802 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);
15803
15804 /**
15805  * Close a channel if a corresponding HTLC fail was sent.
15806  * If permanent, removes a channel from the local storage.
15807  * May cause the removal of nodes too, if this was their last channel.
15808  * If not permanent, makes channels unavailable for routing.
15809  */
15810 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
15811
15812 /**
15813  * For an already known (from announcement) channel, update info about one of the directions
15814  * of the channel.
15815  *
15816  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15817  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15818  * routing messages from a source using a protocol other than the lightning P2P protocol.
15819  */
15820 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
15821
15822 /**
15823  * For an already known (from announcement) channel, update info about one of the directions
15824  * of the channel without verifying the associated signatures. Because we aren't given the
15825  * associated signatures here we cannot relay the channel update to any of our peers.
15826  */
15827 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
15828
15829 /**
15830  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
15831  */
15832 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
15833
15834 /**
15835  * Initialize a new FilesystemPersister and set the path to the individual channels'
15836  * files.
15837  */
15838 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKCVec_u8Z path_to_channel_data);
15839
15840 /**
15841  * Get the directory which was provided when this persister was initialized.
15842  */
15843 MUST_USE_RES struct LDKCVec_u8Z FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
15844
15845 /**
15846  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
15847  * initialization, within a file called \"manager\".
15848  */
15849 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKCVec_u8Z data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
15850
15851 /**
15852  * Read `ChannelMonitor`s from disk.
15853  */
15854 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
15855
15856 /**
15857  * Constructs a new Persist which calls the relevant methods on this_arg.
15858  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
15859  */
15860 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
15861
15862 #endif /* LDK_C_BINDINGS_H */