Merge pull request #12 from TheBlueMatt/2021-04-incl-persister
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 /* Text to put at the beginning of the generated file. Probably a license. */
2
3 /* Generated with cbindgen:0.16.0 */
4
5 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
6
7 #include <stdarg.h>
8 #include <stdbool.h>
9 #include <stdint.h>
10
11
12 /**
13  * An error when accessing the chain via [`Access`].
14  */
15 typedef enum LDKAccessError {
16    /**
17     * The requested chain is unknown.
18     */
19    LDKAccessError_UnknownChain,
20    /**
21     * The requested transaction doesn't exist or hasn't confirmed.
22     */
23    LDKAccessError_UnknownTx,
24    /**
25     * Must be last for serialization purposes
26     */
27    LDKAccessError_Sentinel,
28 } LDKAccessError;
29
30 /**
31  * An error enum representing a failure to persist a channel monitor update.
32  */
33 typedef enum LDKChannelMonitorUpdateErr {
34    /**
35     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
36     * our state failed, but is expected to succeed at some point in the future).
37     *
38     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
39     * submitting new commitment transactions to the counterparty. Once the update(s) which failed
40     * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
41     * restore the channel to an operational state.
42     *
43     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
44     * you return a TemporaryFailure you must ensure that it is written to disk safely before
45     * writing out the latest ChannelManager state.
46     *
47     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
48     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
49     * to claim it on this channel) and those updates must be applied wherever they can be. At
50     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
51     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
52     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
53     * been \"frozen\".
54     *
55     * Note that even if updates made after TemporaryFailure succeed you must still call
56     * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
57     * operation.
58     *
59     * Note that the update being processed here will not be replayed for you when you call
60     * ChannelManager::channel_monitor_updated, so you must store the update itself along
61     * with the persisted ChannelMonitor on your own local disk prior to returning a
62     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
63     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
64     * reload-time.
65     *
66     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
67     * remote location (with local copies persisted immediately), it is anticipated that all
68     * updates will return TemporaryFailure until the remote copies could be updated.
69     */
70    LDKChannelMonitorUpdateErr_TemporaryFailure,
71    /**
72     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
73     * different watchtower and cannot update with all watchtowers that were previously informed
74     * of this channel).
75     *
76     * At reception of this error, ChannelManager will force-close the channel and return at
77     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
78     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
79     * update must be rejected.
80     *
81     * This failure may also signal a failure to update the local persisted copy of one of
82     * the channel monitor instance.
83     *
84     * Note that even when you fail a holder commitment transaction update, you must store the
85     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
86     * broadcasts it (e.g distributed channel-monitor deployment)
87     *
88     * In case of distributed watchtowers deployment, the new version must be written to disk, as
89     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
90     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
91     * lagging behind on block processing.
92     */
93    LDKChannelMonitorUpdateErr_PermanentFailure,
94    /**
95     * Must be last for serialization purposes
96     */
97    LDKChannelMonitorUpdateErr_Sentinel,
98 } LDKChannelMonitorUpdateErr;
99
100 /**
101  * An enum that represents the speed at which we want a transaction to confirm used for feerate
102  * estimation.
103  */
104 typedef enum LDKConfirmationTarget {
105    /**
106     * We are happy with this transaction confirming slowly when feerate drops some.
107     */
108    LDKConfirmationTarget_Background,
109    /**
110     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
111     */
112    LDKConfirmationTarget_Normal,
113    /**
114     * We'd like this transaction to confirm in the next few blocks.
115     */
116    LDKConfirmationTarget_HighPriority,
117    /**
118     * Must be last for serialization purposes
119     */
120    LDKConfirmationTarget_Sentinel,
121 } LDKConfirmationTarget;
122
123 /**
124  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
125  */
126 typedef enum LDKIOError {
127    LDKIOError_NotFound,
128    LDKIOError_PermissionDenied,
129    LDKIOError_ConnectionRefused,
130    LDKIOError_ConnectionReset,
131    LDKIOError_ConnectionAborted,
132    LDKIOError_NotConnected,
133    LDKIOError_AddrInUse,
134    LDKIOError_AddrNotAvailable,
135    LDKIOError_BrokenPipe,
136    LDKIOError_AlreadyExists,
137    LDKIOError_WouldBlock,
138    LDKIOError_InvalidInput,
139    LDKIOError_InvalidData,
140    LDKIOError_TimedOut,
141    LDKIOError_WriteZero,
142    LDKIOError_Interrupted,
143    LDKIOError_Other,
144    LDKIOError_UnexpectedEof,
145    /**
146     * Must be last for serialization purposes
147     */
148    LDKIOError_Sentinel,
149 } LDKIOError;
150
151 /**
152  * An enum representing the available verbosity levels of the logger.
153  */
154 typedef enum LDKLevel {
155    /**
156     *Designates logger being silent
157     */
158    LDKLevel_Off,
159    /**
160     * Designates very serious errors
161     */
162    LDKLevel_Error,
163    /**
164     * Designates hazardous situations
165     */
166    LDKLevel_Warn,
167    /**
168     * Designates useful information
169     */
170    LDKLevel_Info,
171    /**
172     * Designates lower priority information
173     */
174    LDKLevel_Debug,
175    /**
176     * Designates very low priority, often extremely verbose, information
177     */
178    LDKLevel_Trace,
179    /**
180     * Must be last for serialization purposes
181     */
182    LDKLevel_Sentinel,
183 } LDKLevel;
184
185 /**
186  * An enum representing the possible Bitcoin or test networks which we can run on
187  */
188 typedef enum LDKNetwork {
189    /**
190     * The main Bitcoin blockchain.
191     */
192    LDKNetwork_Bitcoin,
193    /**
194     * The testnet3 blockchain.
195     */
196    LDKNetwork_Testnet,
197    /**
198     * A local test blockchain.
199     */
200    LDKNetwork_Regtest,
201    /**
202     * A blockchain on which blocks are signed instead of mined.
203     */
204    LDKNetwork_Signet,
205    /**
206     * Must be last for serialization purposes
207     */
208    LDKNetwork_Sentinel,
209 } LDKNetwork;
210
211 /**
212  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
213  */
214 typedef enum LDKSecp256k1Error {
215    /**
216     * Signature failed verification
217     */
218    LDKSecp256k1Error_IncorrectSignature,
219    /**
220     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
221     */
222    LDKSecp256k1Error_InvalidMessage,
223    /**
224     * Bad public key
225     */
226    LDKSecp256k1Error_InvalidPublicKey,
227    /**
228     * Bad signature
229     */
230    LDKSecp256k1Error_InvalidSignature,
231    /**
232     * Bad secret key
233     */
234    LDKSecp256k1Error_InvalidSecretKey,
235    /**
236     * Bad recovery id
237     */
238    LDKSecp256k1Error_InvalidRecoveryId,
239    /**
240     * Invalid tweak for add_assign or mul_assign
241     */
242    LDKSecp256k1Error_InvalidTweak,
243    /**
244     * tweak_add_check failed on an xonly public key
245     */
246    LDKSecp256k1Error_TweakCheckFailed,
247    /**
248     * Didn't pass enough memory to context creation with preallocated memory
249     */
250    LDKSecp256k1Error_NotEnoughMemory,
251    /**
252     * Must be last for serialization purposes
253     */
254    LDKSecp256k1Error_Sentinel,
255 } LDKSecp256k1Error;
256
257 /**
258  * A serialized transaction, in (pointer, length) form.
259  *
260  * This type optionally owns its own memory, and thus the semantics around access change based on
261  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
262  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
263  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
264  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
265  * you would be invalid.
266  *
267  * Note that, while it may change in the future, because transactions on the Rust side are stored
268  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
269  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
270  * `data_is_owned` either set or unset at your discretion.
271  */
272 typedef struct LDKTransaction {
273    /**
274     * The serialized transaction data.
275     *
276     * This is non-const for your convenience, an object passed to Rust is never written to.
277     */
278    uint8_t *data;
279    /**
280     * The length of the serialized transaction
281     */
282    uintptr_t datalen;
283    /**
284     * Whether the data pointed to by `data` should be freed or not.
285     */
286    bool data_is_owned;
287 } LDKTransaction;
288
289 /**
290  * A dynamically-allocated array of u8s of arbitrary size.
291  * This corresponds to std::vector in C++
292  */
293 typedef struct LDKCVec_u8Z {
294    /**
295     * The elements in the array.
296     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
297     */
298    uint8_t *data;
299    /**
300     * The number of elements pointed to by `data`.
301     */
302    uintptr_t datalen;
303 } LDKCVec_u8Z;
304
305 /**
306  * A transaction output including a scriptPubKey and value.
307  * This type *does* own its own memory, so must be free'd appropriately.
308  */
309 typedef struct LDKTxOut {
310    /**
311     * The script_pubkey in this output
312     */
313    struct LDKCVec_u8Z script_pubkey;
314    /**
315     * The value, in satoshis, of this output
316     */
317    uint64_t value;
318 } LDKTxOut;
319
320
321
322 /**
323  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
324  * with our counterparty.
325  */
326 typedef struct MUST_USE_STRUCT LDKChannelConfig {
327    /**
328     * A pointer to the opaque Rust object.
329     * Nearly everywhere, inner must be non-null, however in places where
330     * the Rust equivalent takes an Option, it may be set to null to indicate None.
331     */
332    LDKnativeChannelConfig *inner;
333    /**
334     * Indicates that this is the only struct which contains the same pointer.
335     * Rust functions which take ownership of an object provided via an argument require
336     * this to be true and invalidate the object pointed to by inner.
337     */
338    bool is_owned;
339 } LDKChannelConfig;
340
341
342
343 /**
344  * An error in decoding a message or struct.
345  */
346 typedef struct MUST_USE_STRUCT LDKDecodeError {
347    /**
348     * A pointer to the opaque Rust object.
349     * Nearly everywhere, inner must be non-null, however in places where
350     * the Rust equivalent takes an Option, it may be set to null to indicate None.
351     */
352    LDKnativeDecodeError *inner;
353    /**
354     * Indicates that this is the only struct which contains the same pointer.
355     * Rust functions which take ownership of an object provided via an argument require
356     * this to be true and invalidate the object pointed to by inner.
357     */
358    bool is_owned;
359 } LDKDecodeError;
360
361 /**
362  * The contents of CResult_ChannelConfigDecodeErrorZ
363  */
364 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
365    /**
366     * A pointer to the contents in the success state.
367     * Reading from this pointer when `result_ok` is not set is undefined.
368     */
369    struct LDKChannelConfig *result;
370    /**
371     * A pointer to the contents in the error state.
372     * Reading from this pointer when `result_ok` is set is undefined.
373     */
374    struct LDKDecodeError *err;
375 } LDKCResult_ChannelConfigDecodeErrorZPtr;
376
377 /**
378  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
379  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
380  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
381  */
382 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
383    /**
384     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
385     * `err` or `result` depending on the state of `result_ok`.
386     */
387    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
388    /**
389     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
390     */
391    bool result_ok;
392 } LDKCResult_ChannelConfigDecodeErrorZ;
393
394
395
396 /**
397  * A reference to a transaction output.
398  *
399  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
400  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
401  */
402 typedef struct MUST_USE_STRUCT LDKOutPoint {
403    /**
404     * A pointer to the opaque Rust object.
405     * Nearly everywhere, inner must be non-null, however in places where
406     * the Rust equivalent takes an Option, it may be set to null to indicate None.
407     */
408    LDKnativeOutPoint *inner;
409    /**
410     * Indicates that this is the only struct which contains the same pointer.
411     * Rust functions which take ownership of an object provided via an argument require
412     * this to be true and invalidate the object pointed to by inner.
413     */
414    bool is_owned;
415 } LDKOutPoint;
416
417 /**
418  * The contents of CResult_OutPointDecodeErrorZ
419  */
420 typedef union LDKCResult_OutPointDecodeErrorZPtr {
421    /**
422     * A pointer to the contents in the success state.
423     * Reading from this pointer when `result_ok` is not set is undefined.
424     */
425    struct LDKOutPoint *result;
426    /**
427     * A pointer to the contents in the error state.
428     * Reading from this pointer when `result_ok` is set is undefined.
429     */
430    struct LDKDecodeError *err;
431 } LDKCResult_OutPointDecodeErrorZPtr;
432
433 /**
434  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
435  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
436  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
437  */
438 typedef struct LDKCResult_OutPointDecodeErrorZ {
439    /**
440     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
441     * `err` or `result` depending on the state of `result_ok`.
442     */
443    union LDKCResult_OutPointDecodeErrorZPtr contents;
444    /**
445     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
446     */
447    bool result_ok;
448 } LDKCResult_OutPointDecodeErrorZ;
449
450 /**
451  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
452  */
453 typedef struct LDKSecretKey {
454    /**
455     * The bytes of the secret key
456     */
457    uint8_t bytes[32];
458 } LDKSecretKey;
459
460 /**
461  * The contents of CResult_SecretKeyErrorZ
462  */
463 typedef union LDKCResult_SecretKeyErrorZPtr {
464    /**
465     * A pointer to the contents in the success state.
466     * Reading from this pointer when `result_ok` is not set is undefined.
467     */
468    struct LDKSecretKey *result;
469    /**
470     * A pointer to the contents in the error state.
471     * Reading from this pointer when `result_ok` is set is undefined.
472     */
473    enum LDKSecp256k1Error *err;
474 } LDKCResult_SecretKeyErrorZPtr;
475
476 /**
477  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
478  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
479  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
480  */
481 typedef struct LDKCResult_SecretKeyErrorZ {
482    /**
483     * The contents of this CResult_SecretKeyErrorZ, accessible via either
484     * `err` or `result` depending on the state of `result_ok`.
485     */
486    union LDKCResult_SecretKeyErrorZPtr contents;
487    /**
488     * Whether this CResult_SecretKeyErrorZ represents a success state.
489     */
490    bool result_ok;
491 } LDKCResult_SecretKeyErrorZ;
492
493 /**
494  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
495  */
496 typedef struct LDKPublicKey {
497    /**
498     * The bytes of the public key
499     */
500    uint8_t compressed_form[33];
501 } LDKPublicKey;
502
503 /**
504  * The contents of CResult_PublicKeyErrorZ
505  */
506 typedef union LDKCResult_PublicKeyErrorZPtr {
507    /**
508     * A pointer to the contents in the success state.
509     * Reading from this pointer when `result_ok` is not set is undefined.
510     */
511    struct LDKPublicKey *result;
512    /**
513     * A pointer to the contents in the error state.
514     * Reading from this pointer when `result_ok` is set is undefined.
515     */
516    enum LDKSecp256k1Error *err;
517 } LDKCResult_PublicKeyErrorZPtr;
518
519 /**
520  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
521  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
522  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
523  */
524 typedef struct LDKCResult_PublicKeyErrorZ {
525    /**
526     * The contents of this CResult_PublicKeyErrorZ, accessible via either
527     * `err` or `result` depending on the state of `result_ok`.
528     */
529    union LDKCResult_PublicKeyErrorZPtr contents;
530    /**
531     * Whether this CResult_PublicKeyErrorZ represents a success state.
532     */
533    bool result_ok;
534 } LDKCResult_PublicKeyErrorZ;
535
536
537
538 /**
539  * The set of public keys which are used in the creation of one commitment transaction.
540  * These are derived from the channel base keys and per-commitment data.
541  *
542  * A broadcaster key is provided from potential broadcaster of the computed transaction.
543  * A countersignatory key is coming from a protocol participant unable to broadcast the
544  * transaction.
545  *
546  * These keys are assumed to be good, either because the code derived them from
547  * channel basepoints via the new function, or they were obtained via
548  * CommitmentTransaction.trust().keys() because we trusted the source of the
549  * pre-calculated keys.
550  */
551 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
552    /**
553     * A pointer to the opaque Rust object.
554     * Nearly everywhere, inner must be non-null, however in places where
555     * the Rust equivalent takes an Option, it may be set to null to indicate None.
556     */
557    LDKnativeTxCreationKeys *inner;
558    /**
559     * Indicates that this is the only struct which contains the same pointer.
560     * Rust functions which take ownership of an object provided via an argument require
561     * this to be true and invalidate the object pointed to by inner.
562     */
563    bool is_owned;
564 } LDKTxCreationKeys;
565
566 /**
567  * The contents of CResult_TxCreationKeysDecodeErrorZ
568  */
569 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
570    /**
571     * A pointer to the contents in the success state.
572     * Reading from this pointer when `result_ok` is not set is undefined.
573     */
574    struct LDKTxCreationKeys *result;
575    /**
576     * A pointer to the contents in the error state.
577     * Reading from this pointer when `result_ok` is set is undefined.
578     */
579    struct LDKDecodeError *err;
580 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
581
582 /**
583  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
584  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
585  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
586  */
587 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
588    /**
589     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
590     * `err` or `result` depending on the state of `result_ok`.
591     */
592    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
593    /**
594     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
595     */
596    bool result_ok;
597 } LDKCResult_TxCreationKeysDecodeErrorZ;
598
599
600
601 /**
602  * One counterparty's public keys which do not change over the life of a channel.
603  */
604 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
605    /**
606     * A pointer to the opaque Rust object.
607     * Nearly everywhere, inner must be non-null, however in places where
608     * the Rust equivalent takes an Option, it may be set to null to indicate None.
609     */
610    LDKnativeChannelPublicKeys *inner;
611    /**
612     * Indicates that this is the only struct which contains the same pointer.
613     * Rust functions which take ownership of an object provided via an argument require
614     * this to be true and invalidate the object pointed to by inner.
615     */
616    bool is_owned;
617 } LDKChannelPublicKeys;
618
619 /**
620  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
621  */
622 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
623    /**
624     * A pointer to the contents in the success state.
625     * Reading from this pointer when `result_ok` is not set is undefined.
626     */
627    struct LDKChannelPublicKeys *result;
628    /**
629     * A pointer to the contents in the error state.
630     * Reading from this pointer when `result_ok` is set is undefined.
631     */
632    struct LDKDecodeError *err;
633 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
634
635 /**
636  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
637  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
638  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
639  */
640 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
641    /**
642     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
643     * `err` or `result` depending on the state of `result_ok`.
644     */
645    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
646    /**
647     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
648     */
649    bool result_ok;
650 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
651
652 /**
653  * The contents of CResult_TxCreationKeysErrorZ
654  */
655 typedef union LDKCResult_TxCreationKeysErrorZPtr {
656    /**
657     * A pointer to the contents in the success state.
658     * Reading from this pointer when `result_ok` is not set is undefined.
659     */
660    struct LDKTxCreationKeys *result;
661    /**
662     * A pointer to the contents in the error state.
663     * Reading from this pointer when `result_ok` is set is undefined.
664     */
665    enum LDKSecp256k1Error *err;
666 } LDKCResult_TxCreationKeysErrorZPtr;
667
668 /**
669  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
670  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
671  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
672  */
673 typedef struct LDKCResult_TxCreationKeysErrorZ {
674    /**
675     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
676     * `err` or `result` depending on the state of `result_ok`.
677     */
678    union LDKCResult_TxCreationKeysErrorZPtr contents;
679    /**
680     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
681     */
682    bool result_ok;
683 } LDKCResult_TxCreationKeysErrorZ;
684
685 /**
686  * An enum which can either contain a u32 or not
687  */
688 typedef enum LDKCOption_u32Z_Tag {
689    /**
690     * When we're in this state, this COption_u32Z contains a u32
691     */
692    LDKCOption_u32Z_Some,
693    /**
694     * When we're in this state, this COption_u32Z contains nothing
695     */
696    LDKCOption_u32Z_None,
697    /**
698     * Must be last for serialization purposes
699     */
700    LDKCOption_u32Z_Sentinel,
701 } LDKCOption_u32Z_Tag;
702
703 typedef struct LDKCOption_u32Z {
704    LDKCOption_u32Z_Tag tag;
705    union {
706       struct {
707          uint32_t some;
708       };
709    };
710 } LDKCOption_u32Z;
711
712
713
714 /**
715  * Information about an HTLC as it appears in a commitment transaction
716  */
717 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
718    /**
719     * A pointer to the opaque Rust object.
720     * Nearly everywhere, inner must be non-null, however in places where
721     * the Rust equivalent takes an Option, it may be set to null to indicate None.
722     */
723    LDKnativeHTLCOutputInCommitment *inner;
724    /**
725     * Indicates that this is the only struct which contains the same pointer.
726     * Rust functions which take ownership of an object provided via an argument require
727     * this to be true and invalidate the object pointed to by inner.
728     */
729    bool is_owned;
730 } LDKHTLCOutputInCommitment;
731
732 /**
733  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
734  */
735 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
736    /**
737     * A pointer to the contents in the success state.
738     * Reading from this pointer when `result_ok` is not set is undefined.
739     */
740    struct LDKHTLCOutputInCommitment *result;
741    /**
742     * A pointer to the contents in the error state.
743     * Reading from this pointer when `result_ok` is set is undefined.
744     */
745    struct LDKDecodeError *err;
746 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
747
748 /**
749  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
750  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
751  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
752  */
753 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
754    /**
755     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
756     * `err` or `result` depending on the state of `result_ok`.
757     */
758    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
759    /**
760     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
761     */
762    bool result_ok;
763 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
764
765
766
767 /**
768  * Late-bound per-channel counterparty data used to build transactions.
769  */
770 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
771    /**
772     * A pointer to the opaque Rust object.
773     * Nearly everywhere, inner must be non-null, however in places where
774     * the Rust equivalent takes an Option, it may be set to null to indicate None.
775     */
776    LDKnativeCounterpartyChannelTransactionParameters *inner;
777    /**
778     * Indicates that this is the only struct which contains the same pointer.
779     * Rust functions which take ownership of an object provided via an argument require
780     * this to be true and invalidate the object pointed to by inner.
781     */
782    bool is_owned;
783 } LDKCounterpartyChannelTransactionParameters;
784
785 /**
786  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
787  */
788 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
789    /**
790     * A pointer to the contents in the success state.
791     * Reading from this pointer when `result_ok` is not set is undefined.
792     */
793    struct LDKCounterpartyChannelTransactionParameters *result;
794    /**
795     * A pointer to the contents in the error state.
796     * Reading from this pointer when `result_ok` is set is undefined.
797     */
798    struct LDKDecodeError *err;
799 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
800
801 /**
802  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
803  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
804  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
805  */
806 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
807    /**
808     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
809     * `err` or `result` depending on the state of `result_ok`.
810     */
811    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
812    /**
813     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
814     */
815    bool result_ok;
816 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
817
818
819
820 /**
821  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
822  * The fields are organized by holder/counterparty.
823  *
824  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
825  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
826  */
827 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
828    /**
829     * A pointer to the opaque Rust object.
830     * Nearly everywhere, inner must be non-null, however in places where
831     * the Rust equivalent takes an Option, it may be set to null to indicate None.
832     */
833    LDKnativeChannelTransactionParameters *inner;
834    /**
835     * Indicates that this is the only struct which contains the same pointer.
836     * Rust functions which take ownership of an object provided via an argument require
837     * this to be true and invalidate the object pointed to by inner.
838     */
839    bool is_owned;
840 } LDKChannelTransactionParameters;
841
842 /**
843  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
844  */
845 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
846    /**
847     * A pointer to the contents in the success state.
848     * Reading from this pointer when `result_ok` is not set is undefined.
849     */
850    struct LDKChannelTransactionParameters *result;
851    /**
852     * A pointer to the contents in the error state.
853     * Reading from this pointer when `result_ok` is set is undefined.
854     */
855    struct LDKDecodeError *err;
856 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
857
858 /**
859  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
860  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
861  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
862  */
863 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
864    /**
865     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
866     * `err` or `result` depending on the state of `result_ok`.
867     */
868    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
869    /**
870     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
871     */
872    bool result_ok;
873 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
874
875 /**
876  * Represents a secp256k1 signature serialized as two 32-byte numbers
877  */
878 typedef struct LDKSignature {
879    /**
880     * The bytes of the signature in "compact" form
881     */
882    uint8_t compact_form[64];
883 } LDKSignature;
884
885 /**
886  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
887  * This corresponds to std::vector in C++
888  */
889 typedef struct LDKCVec_SignatureZ {
890    /**
891     * The elements in the array.
892     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
893     */
894    struct LDKSignature *data;
895    /**
896     * The number of elements pointed to by `data`.
897     */
898    uintptr_t datalen;
899 } LDKCVec_SignatureZ;
900
901
902
903 /**
904  * Information needed to build and sign a holder's commitment transaction.
905  *
906  * The transaction is only signed once we are ready to broadcast.
907  */
908 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
909    /**
910     * A pointer to the opaque Rust object.
911     * Nearly everywhere, inner must be non-null, however in places where
912     * the Rust equivalent takes an Option, it may be set to null to indicate None.
913     */
914    LDKnativeHolderCommitmentTransaction *inner;
915    /**
916     * Indicates that this is the only struct which contains the same pointer.
917     * Rust functions which take ownership of an object provided via an argument require
918     * this to be true and invalidate the object pointed to by inner.
919     */
920    bool is_owned;
921 } LDKHolderCommitmentTransaction;
922
923 /**
924  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
925  */
926 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
927    /**
928     * A pointer to the contents in the success state.
929     * Reading from this pointer when `result_ok` is not set is undefined.
930     */
931    struct LDKHolderCommitmentTransaction *result;
932    /**
933     * A pointer to the contents in the error state.
934     * Reading from this pointer when `result_ok` is set is undefined.
935     */
936    struct LDKDecodeError *err;
937 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
938
939 /**
940  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
941  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
942  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
943  */
944 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
945    /**
946     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
947     * `err` or `result` depending on the state of `result_ok`.
948     */
949    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
950    /**
951     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
952     */
953    bool result_ok;
954 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
955
956
957
958 /**
959  * A pre-built Bitcoin commitment transaction and its txid.
960  */
961 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
962    /**
963     * A pointer to the opaque Rust object.
964     * Nearly everywhere, inner must be non-null, however in places where
965     * the Rust equivalent takes an Option, it may be set to null to indicate None.
966     */
967    LDKnativeBuiltCommitmentTransaction *inner;
968    /**
969     * Indicates that this is the only struct which contains the same pointer.
970     * Rust functions which take ownership of an object provided via an argument require
971     * this to be true and invalidate the object pointed to by inner.
972     */
973    bool is_owned;
974 } LDKBuiltCommitmentTransaction;
975
976 /**
977  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
978  */
979 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
980    /**
981     * A pointer to the contents in the success state.
982     * Reading from this pointer when `result_ok` is not set is undefined.
983     */
984    struct LDKBuiltCommitmentTransaction *result;
985    /**
986     * A pointer to the contents in the error state.
987     * Reading from this pointer when `result_ok` is set is undefined.
988     */
989    struct LDKDecodeError *err;
990 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
991
992 /**
993  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
994  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
995  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
996  */
997 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
998    /**
999     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1000     * `err` or `result` depending on the state of `result_ok`.
1001     */
1002    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1003    /**
1004     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1005     */
1006    bool result_ok;
1007 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1008
1009
1010
1011 /**
1012  * This class tracks the per-transaction information needed to build a commitment transaction and to
1013  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1014  * and for transactions we sign for the counterparty.
1015  *
1016  * This class can be used inside a signer implementation to generate a signature given the relevant
1017  * secret key.
1018  */
1019 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1020    /**
1021     * A pointer to the opaque Rust object.
1022     * Nearly everywhere, inner must be non-null, however in places where
1023     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1024     */
1025    LDKnativeCommitmentTransaction *inner;
1026    /**
1027     * Indicates that this is the only struct which contains the same pointer.
1028     * Rust functions which take ownership of an object provided via an argument require
1029     * this to be true and invalidate the object pointed to by inner.
1030     */
1031    bool is_owned;
1032 } LDKCommitmentTransaction;
1033
1034 /**
1035  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1036  */
1037 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1038    /**
1039     * A pointer to the contents in the success state.
1040     * Reading from this pointer when `result_ok` is not set is undefined.
1041     */
1042    struct LDKCommitmentTransaction *result;
1043    /**
1044     * A pointer to the contents in the error state.
1045     * Reading from this pointer when `result_ok` is set is undefined.
1046     */
1047    struct LDKDecodeError *err;
1048 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1049
1050 /**
1051  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1052  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1053  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1054  */
1055 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1056    /**
1057     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1058     * `err` or `result` depending on the state of `result_ok`.
1059     */
1060    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1061    /**
1062     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1063     */
1064    bool result_ok;
1065 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1066
1067
1068
1069 /**
1070  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1071  * transaction and the transaction creation keys) are trusted.
1072  *
1073  * See trust() and verify() functions on CommitmentTransaction.
1074  *
1075  * This structure implements Deref.
1076  */
1077 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1078    /**
1079     * A pointer to the opaque Rust object.
1080     * Nearly everywhere, inner must be non-null, however in places where
1081     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1082     */
1083    LDKnativeTrustedCommitmentTransaction *inner;
1084    /**
1085     * Indicates that this is the only struct which contains the same pointer.
1086     * Rust functions which take ownership of an object provided via an argument require
1087     * this to be true and invalidate the object pointed to by inner.
1088     */
1089    bool is_owned;
1090 } LDKTrustedCommitmentTransaction;
1091
1092 /**
1093  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1094  */
1095 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1096    /**
1097     * A pointer to the contents in the success state.
1098     * Reading from this pointer when `result_ok` is not set is undefined.
1099     */
1100    struct LDKTrustedCommitmentTransaction *result;
1101    /**
1102     * Note that this value is always NULL, as there are no contents in the Err variant
1103     */
1104    void *err;
1105 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1106
1107 /**
1108  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1109  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1110  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1111  */
1112 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1113    /**
1114     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1115     * `err` or `result` depending on the state of `result_ok`.
1116     */
1117    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1118    /**
1119     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1120     */
1121    bool result_ok;
1122 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1123
1124 /**
1125  * The contents of CResult_CVec_SignatureZNoneZ
1126  */
1127 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1128    /**
1129     * A pointer to the contents in the success state.
1130     * Reading from this pointer when `result_ok` is not set is undefined.
1131     */
1132    struct LDKCVec_SignatureZ *result;
1133    /**
1134     * Note that this value is always NULL, as there are no contents in the Err variant
1135     */
1136    void *err;
1137 } LDKCResult_CVec_SignatureZNoneZPtr;
1138
1139 /**
1140  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1141  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1142  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1143  */
1144 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1145    /**
1146     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1147     * `err` or `result` depending on the state of `result_ok`.
1148     */
1149    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1150    /**
1151     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1152     */
1153    bool result_ok;
1154 } LDKCResult_CVec_SignatureZNoneZ;
1155
1156
1157
1158 /**
1159  * An update generated by the underlying Channel itself which contains some new information the
1160  * ChannelMonitor should be made aware of.
1161  */
1162 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1163    /**
1164     * A pointer to the opaque Rust object.
1165     * Nearly everywhere, inner must be non-null, however in places where
1166     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1167     */
1168    LDKnativeChannelMonitorUpdate *inner;
1169    /**
1170     * Indicates that this is the only struct which contains the same pointer.
1171     * Rust functions which take ownership of an object provided via an argument require
1172     * this to be true and invalidate the object pointed to by inner.
1173     */
1174    bool is_owned;
1175 } LDKChannelMonitorUpdate;
1176
1177 /**
1178  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
1179  */
1180 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
1181    /**
1182     * A pointer to the contents in the success state.
1183     * Reading from this pointer when `result_ok` is not set is undefined.
1184     */
1185    struct LDKChannelMonitorUpdate *result;
1186    /**
1187     * A pointer to the contents in the error state.
1188     * Reading from this pointer when `result_ok` is set is undefined.
1189     */
1190    struct LDKDecodeError *err;
1191 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
1192
1193 /**
1194  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
1195  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
1196  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1197  */
1198 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
1199    /**
1200     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
1201     * `err` or `result` depending on the state of `result_ok`.
1202     */
1203    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
1204    /**
1205     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
1206     */
1207    bool result_ok;
1208 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
1209
1210
1211
1212 /**
1213  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
1214  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
1215  * preimage claim backward will lead to loss of funds.
1216  */
1217 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
1218    /**
1219     * A pointer to the opaque Rust object.
1220     * Nearly everywhere, inner must be non-null, however in places where
1221     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1222     */
1223    LDKnativeHTLCUpdate *inner;
1224    /**
1225     * Indicates that this is the only struct which contains the same pointer.
1226     * Rust functions which take ownership of an object provided via an argument require
1227     * this to be true and invalidate the object pointed to by inner.
1228     */
1229    bool is_owned;
1230 } LDKHTLCUpdate;
1231
1232 /**
1233  * The contents of CResult_HTLCUpdateDecodeErrorZ
1234  */
1235 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
1236    /**
1237     * A pointer to the contents in the success state.
1238     * Reading from this pointer when `result_ok` is not set is undefined.
1239     */
1240    struct LDKHTLCUpdate *result;
1241    /**
1242     * A pointer to the contents in the error state.
1243     * Reading from this pointer when `result_ok` is set is undefined.
1244     */
1245    struct LDKDecodeError *err;
1246 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
1247
1248 /**
1249  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
1250  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
1251  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1252  */
1253 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
1254    /**
1255     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
1256     * `err` or `result` depending on the state of `result_ok`.
1257     */
1258    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
1259    /**
1260     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
1261     */
1262    bool result_ok;
1263 } LDKCResult_HTLCUpdateDecodeErrorZ;
1264
1265
1266
1267 /**
1268  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
1269  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
1270  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
1271  * corrupted.
1272  * Contains a developer-readable error message.
1273  */
1274 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
1275    /**
1276     * A pointer to the opaque Rust object.
1277     * Nearly everywhere, inner must be non-null, however in places where
1278     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1279     */
1280    LDKnativeMonitorUpdateError *inner;
1281    /**
1282     * Indicates that this is the only struct which contains the same pointer.
1283     * Rust functions which take ownership of an object provided via an argument require
1284     * this to be true and invalidate the object pointed to by inner.
1285     */
1286    bool is_owned;
1287 } LDKMonitorUpdateError;
1288
1289 /**
1290  * The contents of CResult_NoneMonitorUpdateErrorZ
1291  */
1292 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
1293    /**
1294     * Note that this value is always NULL, as there are no contents in the OK variant
1295     */
1296    void *result;
1297    /**
1298     * A pointer to the contents in the error state.
1299     * Reading from this pointer when `result_ok` is set is undefined.
1300     */
1301    struct LDKMonitorUpdateError *err;
1302 } LDKCResult_NoneMonitorUpdateErrorZPtr;
1303
1304 /**
1305  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
1306  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
1307  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1308  */
1309 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
1310    /**
1311     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
1312     * `err` or `result` depending on the state of `result_ok`.
1313     */
1314    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
1315    /**
1316     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
1317     */
1318    bool result_ok;
1319 } LDKCResult_NoneMonitorUpdateErrorZ;
1320
1321 /**
1322  * A tuple of 2 elements. See the individual fields for the types contained.
1323  */
1324 typedef struct LDKC2Tuple_OutPointScriptZ {
1325    /**
1326     * The element at position 0
1327     */
1328    struct LDKOutPoint a;
1329    /**
1330     * The element at position 1
1331     */
1332    struct LDKCVec_u8Z b;
1333 } LDKC2Tuple_OutPointScriptZ;
1334
1335 /**
1336  * A tuple of 2 elements. See the individual fields for the types contained.
1337  */
1338 typedef struct LDKC2Tuple_u32ScriptZ {
1339    /**
1340     * The element at position 0
1341     */
1342    uint32_t a;
1343    /**
1344     * The element at position 1
1345     */
1346    struct LDKCVec_u8Z b;
1347 } LDKC2Tuple_u32ScriptZ;
1348
1349 /**
1350  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
1351  * This corresponds to std::vector in C++
1352  */
1353 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
1354    /**
1355     * The elements in the array.
1356     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1357     */
1358    struct LDKC2Tuple_u32ScriptZ *data;
1359    /**
1360     * The number of elements pointed to by `data`.
1361     */
1362    uintptr_t datalen;
1363 } LDKCVec_C2Tuple_u32ScriptZZ;
1364
1365 /**
1366  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1367  * look up the corresponding function in rust-lightning's docs.
1368  */
1369 typedef struct LDKThirtyTwoBytes {
1370    /**
1371     * The thirty-two bytes
1372     */
1373    uint8_t data[32];
1374 } LDKThirtyTwoBytes;
1375
1376 /**
1377  * A tuple of 2 elements. See the individual fields for the types contained.
1378  */
1379 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
1380    /**
1381     * The element at position 0
1382     */
1383    struct LDKThirtyTwoBytes a;
1384    /**
1385     * The element at position 1
1386     */
1387    struct LDKCVec_C2Tuple_u32ScriptZZ b;
1388 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
1389
1390 /**
1391  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
1392  * This corresponds to std::vector in C++
1393  */
1394 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1395    /**
1396     * The elements in the array.
1397     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1398     */
1399    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
1400    /**
1401     * The number of elements pointed to by `data`.
1402     */
1403    uintptr_t datalen;
1404 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
1405
1406 /**
1407  * An event to be processed by the ChannelManager.
1408  */
1409 typedef enum LDKMonitorEvent_Tag {
1410    /**
1411     * A monitor event containing an HTLCUpdate.
1412     */
1413    LDKMonitorEvent_HTLCEvent,
1414    /**
1415     * A monitor event that the Channel's commitment transaction was broadcasted.
1416     */
1417    LDKMonitorEvent_CommitmentTxBroadcasted,
1418    /**
1419     * Must be last for serialization purposes
1420     */
1421    LDKMonitorEvent_Sentinel,
1422 } LDKMonitorEvent_Tag;
1423
1424 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1425    LDKMonitorEvent_Tag tag;
1426    union {
1427       struct {
1428          struct LDKHTLCUpdate htlc_event;
1429       };
1430       struct {
1431          struct LDKOutPoint commitment_tx_broadcasted;
1432       };
1433    };
1434 } LDKMonitorEvent;
1435
1436 /**
1437  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
1438  * This corresponds to std::vector in C++
1439  */
1440 typedef struct LDKCVec_MonitorEventZ {
1441    /**
1442     * The elements in the array.
1443     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1444     */
1445    struct LDKMonitorEvent *data;
1446    /**
1447     * The number of elements pointed to by `data`.
1448     */
1449    uintptr_t datalen;
1450 } LDKCVec_MonitorEventZ;
1451
1452
1453
1454 /**
1455  * Information about a spendable output to a P2WSH script. See
1456  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
1457  */
1458 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
1459    /**
1460     * A pointer to the opaque Rust object.
1461     * Nearly everywhere, inner must be non-null, however in places where
1462     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1463     */
1464    LDKnativeDelayedPaymentOutputDescriptor *inner;
1465    /**
1466     * Indicates that this is the only struct which contains the same pointer.
1467     * Rust functions which take ownership of an object provided via an argument require
1468     * this to be true and invalidate the object pointed to by inner.
1469     */
1470    bool is_owned;
1471 } LDKDelayedPaymentOutputDescriptor;
1472
1473
1474
1475 /**
1476  * Information about a spendable output to our \"payment key\". See
1477  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
1478  */
1479 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
1480    /**
1481     * A pointer to the opaque Rust object.
1482     * Nearly everywhere, inner must be non-null, however in places where
1483     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1484     */
1485    LDKnativeStaticPaymentOutputDescriptor *inner;
1486    /**
1487     * Indicates that this is the only struct which contains the same pointer.
1488     * Rust functions which take ownership of an object provided via an argument require
1489     * this to be true and invalidate the object pointed to by inner.
1490     */
1491    bool is_owned;
1492 } LDKStaticPaymentOutputDescriptor;
1493
1494 /**
1495  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
1496  * claim at any point in the future) an event is generated which you must track and be able to
1497  * spend on-chain. The information needed to do this is provided in this enum, including the
1498  * outpoint describing which txid and output index is available, the full output which exists at
1499  * that txid/index, and any keys or other information required to sign.
1500  */
1501 typedef enum LDKSpendableOutputDescriptor_Tag {
1502    /**
1503     * An output to a script which was provided via KeysInterface directly, either from
1504     * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
1505     * spend it. No secret keys are provided as rust-lightning was never given any key.
1506     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
1507     * on-chain using the payment preimage or after it has timed out.
1508     */
1509    LDKSpendableOutputDescriptor_StaticOutput,
1510    /**
1511     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
1512     *
1513     * The witness in the spending input should be:
1514     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
1515     *
1516     * Note that the nSequence field in the spending input must be set to to_self_delay
1517     * (which means the transaction is not broadcastable until at least to_self_delay
1518     * blocks after the outpoint confirms).
1519     *
1520     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
1521     * it is an output from an old state which we broadcast (which should never happen).
1522     *
1523     * To derive the delayed_payment key which is used to sign for this input, you must pass the
1524     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
1525     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
1526     * chan_utils::derive_private_key. The public key can be generated without the secret key
1527     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
1528     * Sign::pubkeys().
1529     *
1530     * To derive the revocation_pubkey provided here (which is used in the witness
1531     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
1532     * call to Sign::ready_channel) and the provided per_commitment point
1533     * to chan_utils::derive_public_revocation_key.
1534     *
1535     * The witness script which is hashed and included in the output script_pubkey may be
1536     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
1537     * (derived as above), and the to_self_delay contained here to
1538     * chan_utils::get_revokeable_redeemscript.
1539     */
1540    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
1541    /**
1542     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
1543     * corresponds to the public key in Sign::pubkeys().payment_point).
1544     * The witness in the spending input, is, thus, simply:
1545     * <BIP 143 signature> <payment key>
1546     *
1547     * These are generally the result of our counterparty having broadcast the current state,
1548     * allowing us to claim the non-HTLC-encumbered outputs immediately.
1549     */
1550    LDKSpendableOutputDescriptor_StaticPaymentOutput,
1551    /**
1552     * Must be last for serialization purposes
1553     */
1554    LDKSpendableOutputDescriptor_Sentinel,
1555 } LDKSpendableOutputDescriptor_Tag;
1556
1557 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
1558    /**
1559     * The outpoint which is spendable
1560     */
1561    struct LDKOutPoint outpoint;
1562    /**
1563     * The output which is referenced by the given outpoint.
1564     */
1565    struct LDKTxOut output;
1566 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
1567
1568 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
1569    LDKSpendableOutputDescriptor_Tag tag;
1570    union {
1571       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
1572       struct {
1573          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
1574       };
1575       struct {
1576          struct LDKStaticPaymentOutputDescriptor static_payment_output;
1577       };
1578    };
1579 } LDKSpendableOutputDescriptor;
1580
1581 /**
1582  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
1583  * This corresponds to std::vector in C++
1584  */
1585 typedef struct LDKCVec_SpendableOutputDescriptorZ {
1586    /**
1587     * The elements in the array.
1588     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1589     */
1590    struct LDKSpendableOutputDescriptor *data;
1591    /**
1592     * The number of elements pointed to by `data`.
1593     */
1594    uintptr_t datalen;
1595 } LDKCVec_SpendableOutputDescriptorZ;
1596
1597 /**
1598  * An Event which you should probably take some action in response to.
1599  *
1600  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
1601  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
1602  * written as it makes no sense to respond to it after reconnecting to peers).
1603  */
1604 typedef enum LDKEvent_Tag {
1605    /**
1606     * Used to indicate that the client should generate a funding transaction with the given
1607     * parameters and then call ChannelManager::funding_transaction_generated.
1608     * Generated in ChannelManager message handling.
1609     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
1610     * counterparty can steal your funds!
1611     */
1612    LDKEvent_FundingGenerationReady,
1613    /**
1614     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
1615     * ChannelManager::claim_funds to get it....
1616     * Note that if the preimage is not known or the amount paid is incorrect, you should call
1617     * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
1618     * network congestion.
1619     * The amount paid should be considered 'incorrect' when it is less than or more than twice
1620     * the amount expected.
1621     * If you fail to call either ChannelManager::claim_funds or
1622     * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
1623     * automatically failed.
1624     */
1625    LDKEvent_PaymentReceived,
1626    /**
1627     * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
1628     * and we got back the payment preimage for it).
1629     * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
1630     * deduplicate them by payment_preimage (which MUST be unique)!
1631     */
1632    LDKEvent_PaymentSent,
1633    /**
1634     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
1635     * something. You may wish to retry with a different route.
1636     * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
1637     * deduplicate them by payment_hash (which MUST be unique)!
1638     */
1639    LDKEvent_PaymentFailed,
1640    /**
1641     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
1642     * time in the future.
1643     */
1644    LDKEvent_PendingHTLCsForwardable,
1645    /**
1646     * Used to indicate that an output was generated on-chain which you should know how to spend.
1647     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
1648     * counterparty spending them due to some kind of timeout. Thus, you need to store them
1649     * somewhere and spend them when you create on-chain transactions.
1650     */
1651    LDKEvent_SpendableOutputs,
1652    /**
1653     * Must be last for serialization purposes
1654     */
1655    LDKEvent_Sentinel,
1656 } LDKEvent_Tag;
1657
1658 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
1659    /**
1660     * The random channel_id we picked which you'll need to pass into
1661     * ChannelManager::funding_transaction_generated.
1662     */
1663    struct LDKThirtyTwoBytes temporary_channel_id;
1664    /**
1665     * The value, in satoshis, that the output should have.
1666     */
1667    uint64_t channel_value_satoshis;
1668    /**
1669     * The script which should be used in the transaction output.
1670     */
1671    struct LDKCVec_u8Z output_script;
1672    /**
1673     * The value passed in to ChannelManager::create_channel
1674     */
1675    uint64_t user_channel_id;
1676 } LDKEvent_LDKFundingGenerationReady_Body;
1677
1678 typedef struct LDKEvent_LDKPaymentReceived_Body {
1679    /**
1680     * The hash for which the preimage should be handed to the ChannelManager.
1681     */
1682    struct LDKThirtyTwoBytes payment_hash;
1683    /**
1684     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
1685     * number of deanonymization attacks during the routing process.
1686     * As nodes upgrade, the invoices you provide should likely migrate to setting the
1687     * payment_secret feature to required, at which point you should fail_backwards any HTLCs
1688     * which have a None here.
1689     * Until then, however, values of None should be ignored, and only incorrect Some values
1690     * should result in an HTLC fail_backwards.
1691     * Note that, in any case, this value must be passed as-is to any fail or claim calls as
1692     * the HTLC index includes this value.
1693     */
1694    struct LDKThirtyTwoBytes payment_secret;
1695    /**
1696     * The value, in thousandths of a satoshi, that this payment is for. Note that you must
1697     * compare this to the expected value before accepting the payment (as otherwise you are
1698     * providing proof-of-payment for less than the value you expected!).
1699     */
1700    uint64_t amt;
1701 } LDKEvent_LDKPaymentReceived_Body;
1702
1703 typedef struct LDKEvent_LDKPaymentSent_Body {
1704    /**
1705     * The preimage to the hash given to ChannelManager::send_payment.
1706     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
1707     * store it somehow!
1708     */
1709    struct LDKThirtyTwoBytes payment_preimage;
1710 } LDKEvent_LDKPaymentSent_Body;
1711
1712 typedef struct LDKEvent_LDKPaymentFailed_Body {
1713    /**
1714     * The hash which was given to ChannelManager::send_payment.
1715     */
1716    struct LDKThirtyTwoBytes payment_hash;
1717    /**
1718     * Indicates the payment was rejected for some reason by the recipient. This implies that
1719     * the payment has failed, not just the route in question. If this is not set, you may
1720     * retry the payment via a different route.
1721     */
1722    bool rejected_by_dest;
1723 } LDKEvent_LDKPaymentFailed_Body;
1724
1725 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
1726    /**
1727     * The minimum amount of time that should be waited prior to calling
1728     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
1729     * you should wait a random amount of time in roughly the range (now + time_forwardable,
1730     * now + 5*time_forwardable).
1731     */
1732    uint64_t time_forwardable;
1733 } LDKEvent_LDKPendingHTLCsForwardable_Body;
1734
1735 typedef struct LDKEvent_LDKSpendableOutputs_Body {
1736    /**
1737     * The outputs which you should store as spendable by you.
1738     */
1739    struct LDKCVec_SpendableOutputDescriptorZ outputs;
1740 } LDKEvent_LDKSpendableOutputs_Body;
1741
1742 typedef struct MUST_USE_STRUCT LDKEvent {
1743    LDKEvent_Tag tag;
1744    union {
1745       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
1746       LDKEvent_LDKPaymentReceived_Body payment_received;
1747       LDKEvent_LDKPaymentSent_Body payment_sent;
1748       LDKEvent_LDKPaymentFailed_Body payment_failed;
1749       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
1750       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
1751    };
1752 } LDKEvent;
1753
1754 /**
1755  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
1756  * This corresponds to std::vector in C++
1757  */
1758 typedef struct LDKCVec_EventZ {
1759    /**
1760     * The elements in the array.
1761     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1762     */
1763    struct LDKEvent *data;
1764    /**
1765     * The number of elements pointed to by `data`.
1766     */
1767    uintptr_t datalen;
1768 } LDKCVec_EventZ;
1769
1770 /**
1771  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
1772  * This corresponds to std::vector in C++
1773  */
1774 typedef struct LDKCVec_TransactionZ {
1775    /**
1776     * The elements in the array.
1777     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1778     */
1779    struct LDKTransaction *data;
1780    /**
1781     * The number of elements pointed to by `data`.
1782     */
1783    uintptr_t datalen;
1784 } LDKCVec_TransactionZ;
1785
1786 /**
1787  * A tuple of 2 elements. See the individual fields for the types contained.
1788  */
1789 typedef struct LDKC2Tuple_usizeTransactionZ {
1790    /**
1791     * The element at position 0
1792     */
1793    uintptr_t a;
1794    /**
1795     * The element at position 1
1796     */
1797    struct LDKTransaction b;
1798 } LDKC2Tuple_usizeTransactionZ;
1799
1800 /**
1801  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
1802  * This corresponds to std::vector in C++
1803  */
1804 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
1805    /**
1806     * The elements in the array.
1807     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1808     */
1809    struct LDKC2Tuple_usizeTransactionZ *data;
1810    /**
1811     * The number of elements pointed to by `data`.
1812     */
1813    uintptr_t datalen;
1814 } LDKCVec_C2Tuple_usizeTransactionZZ;
1815
1816 /**
1817  * A tuple of 2 elements. See the individual fields for the types contained.
1818  */
1819 typedef struct LDKC2Tuple_u32TxOutZ {
1820    /**
1821     * The element at position 0
1822     */
1823    uint32_t a;
1824    /**
1825     * The element at position 1
1826     */
1827    struct LDKTxOut b;
1828 } LDKC2Tuple_u32TxOutZ;
1829
1830 /**
1831  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
1832  * This corresponds to std::vector in C++
1833  */
1834 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
1835    /**
1836     * The elements in the array.
1837     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1838     */
1839    struct LDKC2Tuple_u32TxOutZ *data;
1840    /**
1841     * The number of elements pointed to by `data`.
1842     */
1843    uintptr_t datalen;
1844 } LDKCVec_C2Tuple_u32TxOutZZ;
1845
1846 /**
1847  * A tuple of 2 elements. See the individual fields for the types contained.
1848  */
1849 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
1850    /**
1851     * The element at position 0
1852     */
1853    struct LDKThirtyTwoBytes a;
1854    /**
1855     * The element at position 1
1856     */
1857    struct LDKCVec_C2Tuple_u32TxOutZZ b;
1858 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
1859
1860 /**
1861  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
1862  * This corresponds to std::vector in C++
1863  */
1864 typedef struct LDKCVec_TransactionOutputsZ {
1865    /**
1866     * The elements in the array.
1867     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1868     */
1869    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
1870    /**
1871     * The number of elements pointed to by `data`.
1872     */
1873    uintptr_t datalen;
1874 } LDKCVec_TransactionOutputsZ;
1875
1876 /**
1877  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1878  * This corresponds to std::vector in C++
1879  */
1880 typedef struct LDKCVec_TxidZ {
1881    /**
1882     * The elements in the array.
1883     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1884     */
1885    struct LDKThirtyTwoBytes *data;
1886    /**
1887     * The number of elements pointed to by `data`.
1888     */
1889    uintptr_t datalen;
1890 } LDKCVec_TxidZ;
1891
1892 /**
1893  * The contents of CResult_NoneChannelMonitorUpdateErrZ
1894  */
1895 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
1896    /**
1897     * Note that this value is always NULL, as there are no contents in the OK variant
1898     */
1899    void *result;
1900    /**
1901     * A pointer to the contents in the error state.
1902     * Reading from this pointer when `result_ok` is set is undefined.
1903     */
1904    enum LDKChannelMonitorUpdateErr *err;
1905 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
1906
1907 /**
1908  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
1909  * containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
1910  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1911  */
1912 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
1913    /**
1914     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
1915     * `err` or `result` depending on the state of `result_ok`.
1916     */
1917    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
1918    /**
1919     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
1920     */
1921    bool result_ok;
1922 } LDKCResult_NoneChannelMonitorUpdateErrZ;
1923
1924 /**
1925  * A tuple of 2 elements. See the individual fields for the types contained.
1926  */
1927 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
1928    /**
1929     * The element at position 0
1930     */
1931    struct LDKSignature a;
1932    /**
1933     * The element at position 1
1934     */
1935    struct LDKCVec_SignatureZ b;
1936 } LDKC2Tuple_SignatureCVec_SignatureZZ;
1937
1938 /**
1939  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
1940  */
1941 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1942    /**
1943     * A pointer to the contents in the success state.
1944     * Reading from this pointer when `result_ok` is not set is undefined.
1945     */
1946    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
1947    /**
1948     * Note that this value is always NULL, as there are no contents in the Err variant
1949     */
1950    void *err;
1951 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
1952
1953 /**
1954  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
1955  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
1956  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1957  */
1958 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1959    /**
1960     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
1961     * `err` or `result` depending on the state of `result_ok`.
1962     */
1963    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
1964    /**
1965     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
1966     */
1967    bool result_ok;
1968 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
1969
1970 /**
1971  * The contents of CResult_SignatureNoneZ
1972  */
1973 typedef union LDKCResult_SignatureNoneZPtr {
1974    /**
1975     * A pointer to the contents in the success state.
1976     * Reading from this pointer when `result_ok` is not set is undefined.
1977     */
1978    struct LDKSignature *result;
1979    /**
1980     * Note that this value is always NULL, as there are no contents in the Err variant
1981     */
1982    void *err;
1983 } LDKCResult_SignatureNoneZPtr;
1984
1985 /**
1986  * A CResult_SignatureNoneZ represents the result of a fallible operation,
1987  * containing a crate::c_types::Signature on success and a () on failure.
1988  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1989  */
1990 typedef struct LDKCResult_SignatureNoneZ {
1991    /**
1992     * The contents of this CResult_SignatureNoneZ, accessible via either
1993     * `err` or `result` depending on the state of `result_ok`.
1994     */
1995    union LDKCResult_SignatureNoneZPtr contents;
1996    /**
1997     * Whether this CResult_SignatureNoneZ represents a success state.
1998     */
1999    bool result_ok;
2000 } LDKCResult_SignatureNoneZ;
2001
2002
2003
2004 /**
2005  * The unsigned part of a channel_announcement
2006  */
2007 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
2008    /**
2009     * A pointer to the opaque Rust object.
2010     * Nearly everywhere, inner must be non-null, however in places where
2011     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2012     */
2013    LDKnativeUnsignedChannelAnnouncement *inner;
2014    /**
2015     * Indicates that this is the only struct which contains the same pointer.
2016     * Rust functions which take ownership of an object provided via an argument require
2017     * this to be true and invalidate the object pointed to by inner.
2018     */
2019    bool is_owned;
2020 } LDKUnsignedChannelAnnouncement;
2021
2022 /**
2023  * A trait to sign lightning channel transactions as described in BOLT 3.
2024  *
2025  * Signing services could be implemented on a hardware wallet. In this case,
2026  * the current Sign would be a front-end on top of a communication
2027  * channel connected to your secure device and lightning key material wouldn't
2028  * reside on a hot server. Nevertheless, a this deployment would still need
2029  * to trust the ChannelManager to avoid loss of funds as this latest component
2030  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
2031  *
2032  * A more secure iteration would be to use hashlock (or payment points) to pair
2033  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
2034  * at the price of more state and computation on the hardware wallet side. In the future,
2035  * we are looking forward to design such interface.
2036  *
2037  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
2038  * to act, as liveness and breach reply correctness are always going to be hard requirements
2039  * of LN security model, orthogonal of key management issues.
2040  */
2041 typedef struct LDKBaseSign {
2042    /**
2043     * An opaque pointer which is passed to your function implementations as an argument.
2044     * This has no meaning in the LDK, and can be NULL or any other value.
2045     */
2046    void *this_arg;
2047    /**
2048     * Gets the per-commitment point for a specific commitment number
2049     *
2050     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
2051     */
2052    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
2053    /**
2054     * Gets the commitment secret for a specific commitment number as part of the revocation process
2055     *
2056     * An external signer implementation should error here if the commitment was already signed
2057     * and should refuse to sign it in the future.
2058     *
2059     * May be called more than once for the same index.
2060     *
2061     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
2062     */
2063    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
2064    /**
2065     * Gets the holder's channel public keys and basepoints
2066     */
2067    struct LDKChannelPublicKeys pubkeys;
2068    /**
2069     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
2070     * Note that this takes a pointer to this object, not the this_ptr like other methods do
2071     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
2072     */
2073    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
2074    /**
2075     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
2076     * some SpendableOutputDescriptor types. This should be sufficient to identify this
2077     * Sign object uniquely and lookup or re-derive its keys.
2078     */
2079    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
2080    /**
2081     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
2082     *
2083     * Note that if signing fails or is rejected, the channel will be force-closed.
2084     */
2085    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
2086    /**
2087     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
2088     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
2089     * latest commitment_tx when we initiate a force-close.
2090     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
2091     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
2092     * the latest.
2093     * This may be called multiple times for the same transaction.
2094     *
2095     * An external signer implementation should check that the commitment has not been revoked.
2096     *
2097     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
2098     */
2099    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
2100    /**
2101     * Create a signature for the given input in a transaction spending an HTLC or commitment
2102     * transaction output when our counterparty broadcasts an old state.
2103     *
2104     * A justice transaction may claim multiples outputs at the same time if timelocks are
2105     * similar, but only a signature for the input at index `input` should be signed for here.
2106     * It may be called multiples time for same output(s) if a fee-bump is needed with regards
2107     * to an upcoming timelock expiration.
2108     *
2109     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2110     *
2111     * per_commitment_key is revocation secret which was provided by our counterparty when they
2112     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
2113     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
2114     * so).
2115     *
2116     * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
2117     * changing the format of the witness script (which is committed to in the BIP 143
2118     * signatures).
2119     */
2120    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);
2121    /**
2122     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
2123     * transaction, either offered or received.
2124     *
2125     * Such a transaction may claim multiples offered outputs at same time if we know the
2126     * preimage for each when we create it, but only the input at index `input` should be
2127     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
2128     * needed with regards to an upcoming timelock expiration.
2129     *
2130     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
2131     * outputs.
2132     *
2133     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2134     *
2135     * Per_commitment_point is the dynamic point corresponding to the channel state
2136     * detected onchain. It has been generated by our counterparty and is used to derive
2137     * channel state keys, which are then included in the witness script and committed to in the
2138     * BIP 143 signature.
2139     */
2140    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);
2141    /**
2142     * Create a signature for a (proposed) closing transaction.
2143     *
2144     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
2145     * chosen to forgo their output as dust.
2146     */
2147    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
2148    /**
2149     * Signs a channel announcement message with our funding key, proving it comes from one
2150     * of the channel participants.
2151     *
2152     * Note that if this fails or is rejected, the channel will not be publicly announced and
2153     * our counterparty may (though likely will not) close the channel on us for violating the
2154     * protocol.
2155     */
2156    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
2157    /**
2158     * Set the counterparty static channel data, including basepoints,
2159     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
2160     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
2161     * they MUST NOT be allowed to change to different values once set.
2162     *
2163     * channel_parameters.is_populated() MUST be true.
2164     *
2165     * We bind holder_selected_contest_delay late here for API convenience.
2166     *
2167     * Will be called before any signatures are applied.
2168     */
2169    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
2170    /**
2171     * Frees any resources associated with this object given its this_arg pointer.
2172     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2173     */
2174    void (*free)(void *this_arg);
2175 } LDKBaseSign;
2176
2177 /**
2178  * A cloneable signer.
2179  *
2180  * Although we require signers to be cloneable, it may be useful for developers to be able to use
2181  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
2182  * which implies Sized, into this derived trait.
2183  */
2184 typedef struct LDKSign {
2185    /**
2186     * An opaque pointer which is passed to your function implementations as an argument.
2187     * This has no meaning in the LDK, and can be NULL or any other value.
2188     */
2189    void *this_arg;
2190    /**
2191     * Implementation of BaseSign for this object.
2192     */
2193    struct LDKBaseSign BaseSign;
2194    /**
2195     * Creates a copy of the BaseSign, for a copy of this Sign.
2196     * Because BaseSign doesn't natively support copying itself, you have to provide a full copy implementation here.
2197     */
2198    struct LDKBaseSign (*BaseSign_clone)(const struct LDKBaseSign *NONNULL_PTR orig_BaseSign);
2199    /**
2200     * Serialize the object into a byte array
2201     */
2202    struct LDKCVec_u8Z (*write)(const void *this_arg);
2203    /**
2204     * Creates a copy of the object pointed to by this_arg, for a copy of this Sign.
2205     * Note that the ultimate copy of the Sign will have all function pointers the same as the original.
2206     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new Sign.
2207     */
2208    void *(*clone)(const void *this_arg);
2209    /**
2210     * Frees any resources associated with this object given its this_arg pointer.
2211     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2212     */
2213    void (*free)(void *this_arg);
2214 } LDKSign;
2215
2216
2217
2218 /**
2219  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
2220  * on-chain transactions to ensure no loss of funds occurs.
2221  *
2222  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
2223  * information and are actively monitoring the chain.
2224  *
2225  * Pending Events or updated HTLCs which have not yet been read out by
2226  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
2227  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
2228  * gotten are fully handled before re-serializing the new state.
2229  *
2230  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
2231  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
2232  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
2233  * returned block hash and the the current chain and then reconnecting blocks to get to the
2234  * best chain) upon deserializing the object!
2235  */
2236 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
2237    /**
2238     * A pointer to the opaque Rust object.
2239     * Nearly everywhere, inner must be non-null, however in places where
2240     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2241     */
2242    LDKnativeChannelMonitor *inner;
2243    /**
2244     * Indicates that this is the only struct which contains the same pointer.
2245     * Rust functions which take ownership of an object provided via an argument require
2246     * this to be true and invalidate the object pointed to by inner.
2247     */
2248    bool is_owned;
2249 } LDKChannelMonitor;
2250
2251 /**
2252  * A tuple of 2 elements. See the individual fields for the types contained.
2253  */
2254 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
2255    /**
2256     * The element at position 0
2257     */
2258    struct LDKThirtyTwoBytes a;
2259    /**
2260     * The element at position 1
2261     */
2262    struct LDKChannelMonitor b;
2263 } LDKC2Tuple_BlockHashChannelMonitorZ;
2264
2265 /**
2266  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
2267  */
2268 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2269    /**
2270     * A pointer to the contents in the success state.
2271     * Reading from this pointer when `result_ok` is not set is undefined.
2272     */
2273    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
2274    /**
2275     * A pointer to the contents in the error state.
2276     * Reading from this pointer when `result_ok` is set is undefined.
2277     */
2278    struct LDKDecodeError *err;
2279 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
2280
2281 /**
2282  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
2283  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2284  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2285  */
2286 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2287    /**
2288     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
2289     * `err` or `result` depending on the state of `result_ok`.
2290     */
2291    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
2292    /**
2293     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
2294     */
2295    bool result_ok;
2296 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
2297
2298
2299
2300 /**
2301  * A hop in a route
2302  */
2303 typedef struct MUST_USE_STRUCT LDKRouteHop {
2304    /**
2305     * A pointer to the opaque Rust object.
2306     * Nearly everywhere, inner must be non-null, however in places where
2307     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2308     */
2309    LDKnativeRouteHop *inner;
2310    /**
2311     * Indicates that this is the only struct which contains the same pointer.
2312     * Rust functions which take ownership of an object provided via an argument require
2313     * this to be true and invalidate the object pointed to by inner.
2314     */
2315    bool is_owned;
2316 } LDKRouteHop;
2317
2318 /**
2319  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2320  * This corresponds to std::vector in C++
2321  */
2322 typedef struct LDKCVec_RouteHopZ {
2323    /**
2324     * The elements in the array.
2325     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2326     */
2327    struct LDKRouteHop *data;
2328    /**
2329     * The number of elements pointed to by `data`.
2330     */
2331    uintptr_t datalen;
2332 } LDKCVec_RouteHopZ;
2333
2334 /**
2335  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2336  * This corresponds to std::vector in C++
2337  */
2338 typedef struct LDKCVec_CVec_RouteHopZZ {
2339    /**
2340     * The elements in the array.
2341     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2342     */
2343    struct LDKCVec_RouteHopZ *data;
2344    /**
2345     * The number of elements pointed to by `data`.
2346     */
2347    uintptr_t datalen;
2348 } LDKCVec_CVec_RouteHopZZ;
2349
2350
2351
2352 /**
2353  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2354  * it can take multiple paths. Each path is composed of one or more hops through the network.
2355  */
2356 typedef struct MUST_USE_STRUCT LDKRoute {
2357    /**
2358     * A pointer to the opaque Rust object.
2359     * Nearly everywhere, inner must be non-null, however in places where
2360     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2361     */
2362    LDKnativeRoute *inner;
2363    /**
2364     * Indicates that this is the only struct which contains the same pointer.
2365     * Rust functions which take ownership of an object provided via an argument require
2366     * this to be true and invalidate the object pointed to by inner.
2367     */
2368    bool is_owned;
2369 } LDKRoute;
2370
2371 /**
2372  * The contents of CResult_RouteDecodeErrorZ
2373  */
2374 typedef union LDKCResult_RouteDecodeErrorZPtr {
2375    /**
2376     * A pointer to the contents in the success state.
2377     * Reading from this pointer when `result_ok` is not set is undefined.
2378     */
2379    struct LDKRoute *result;
2380    /**
2381     * A pointer to the contents in the error state.
2382     * Reading from this pointer when `result_ok` is set is undefined.
2383     */
2384    struct LDKDecodeError *err;
2385 } LDKCResult_RouteDecodeErrorZPtr;
2386
2387 /**
2388  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2389  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2390  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2391  */
2392 typedef struct LDKCResult_RouteDecodeErrorZ {
2393    /**
2394     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
2395     * `err` or `result` depending on the state of `result_ok`.
2396     */
2397    union LDKCResult_RouteDecodeErrorZPtr contents;
2398    /**
2399     * Whether this CResult_RouteDecodeErrorZ represents a success state.
2400     */
2401    bool result_ok;
2402 } LDKCResult_RouteDecodeErrorZ;
2403
2404 /**
2405  * An enum which can either contain a u64 or not
2406  */
2407 typedef enum LDKCOption_u64Z_Tag {
2408    /**
2409     * When we're in this state, this COption_u64Z contains a u64
2410     */
2411    LDKCOption_u64Z_Some,
2412    /**
2413     * When we're in this state, this COption_u64Z contains nothing
2414     */
2415    LDKCOption_u64Z_None,
2416    /**
2417     * Must be last for serialization purposes
2418     */
2419    LDKCOption_u64Z_Sentinel,
2420 } LDKCOption_u64Z_Tag;
2421
2422 typedef struct LDKCOption_u64Z {
2423    LDKCOption_u64Z_Tag tag;
2424    union {
2425       struct {
2426          uint64_t some;
2427       };
2428    };
2429 } LDKCOption_u64Z;
2430
2431
2432
2433 /**
2434  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2435  */
2436 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2437    /**
2438     * A pointer to the opaque Rust object.
2439     * Nearly everywhere, inner must be non-null, however in places where
2440     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2441     */
2442    LDKnativeChannelDetails *inner;
2443    /**
2444     * Indicates that this is the only struct which contains the same pointer.
2445     * Rust functions which take ownership of an object provided via an argument require
2446     * this to be true and invalidate the object pointed to by inner.
2447     */
2448    bool is_owned;
2449 } LDKChannelDetails;
2450
2451 /**
2452  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2453  * This corresponds to std::vector in C++
2454  */
2455 typedef struct LDKCVec_ChannelDetailsZ {
2456    /**
2457     * The elements in the array.
2458     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2459     */
2460    struct LDKChannelDetails *data;
2461    /**
2462     * The number of elements pointed to by `data`.
2463     */
2464    uintptr_t datalen;
2465 } LDKCVec_ChannelDetailsZ;
2466
2467
2468
2469 /**
2470  * A channel descriptor which provides a last-hop route to get_route
2471  */
2472 typedef struct MUST_USE_STRUCT LDKRouteHint {
2473    /**
2474     * A pointer to the opaque Rust object.
2475     * Nearly everywhere, inner must be non-null, however in places where
2476     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2477     */
2478    LDKnativeRouteHint *inner;
2479    /**
2480     * Indicates that this is the only struct which contains the same pointer.
2481     * Rust functions which take ownership of an object provided via an argument require
2482     * this to be true and invalidate the object pointed to by inner.
2483     */
2484    bool is_owned;
2485 } LDKRouteHint;
2486
2487 /**
2488  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2489  * This corresponds to std::vector in C++
2490  */
2491 typedef struct LDKCVec_RouteHintZ {
2492    /**
2493     * The elements in the array.
2494     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2495     */
2496    struct LDKRouteHint *data;
2497    /**
2498     * The number of elements pointed to by `data`.
2499     */
2500    uintptr_t datalen;
2501 } LDKCVec_RouteHintZ;
2502
2503
2504
2505 /**
2506  * An Err type for failure to process messages.
2507  */
2508 typedef struct MUST_USE_STRUCT LDKLightningError {
2509    /**
2510     * A pointer to the opaque Rust object.
2511     * Nearly everywhere, inner must be non-null, however in places where
2512     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2513     */
2514    LDKnativeLightningError *inner;
2515    /**
2516     * Indicates that this is the only struct which contains the same pointer.
2517     * Rust functions which take ownership of an object provided via an argument require
2518     * this to be true and invalidate the object pointed to by inner.
2519     */
2520    bool is_owned;
2521 } LDKLightningError;
2522
2523 /**
2524  * The contents of CResult_RouteLightningErrorZ
2525  */
2526 typedef union LDKCResult_RouteLightningErrorZPtr {
2527    /**
2528     * A pointer to the contents in the success state.
2529     * Reading from this pointer when `result_ok` is not set is undefined.
2530     */
2531    struct LDKRoute *result;
2532    /**
2533     * A pointer to the contents in the error state.
2534     * Reading from this pointer when `result_ok` is set is undefined.
2535     */
2536    struct LDKLightningError *err;
2537 } LDKCResult_RouteLightningErrorZPtr;
2538
2539 /**
2540  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2541  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2542  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2543  */
2544 typedef struct LDKCResult_RouteLightningErrorZ {
2545    /**
2546     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2547     * `err` or `result` depending on the state of `result_ok`.
2548     */
2549    union LDKCResult_RouteLightningErrorZPtr contents;
2550    /**
2551     * Whether this CResult_RouteLightningErrorZ represents a success state.
2552     */
2553    bool result_ok;
2554 } LDKCResult_RouteLightningErrorZ;
2555
2556
2557
2558 /**
2559  * An accept_channel message to be sent or received from a peer
2560  */
2561 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
2562    /**
2563     * A pointer to the opaque Rust object.
2564     * Nearly everywhere, inner must be non-null, however in places where
2565     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2566     */
2567    LDKnativeAcceptChannel *inner;
2568    /**
2569     * Indicates that this is the only struct which contains the same pointer.
2570     * Rust functions which take ownership of an object provided via an argument require
2571     * this to be true and invalidate the object pointed to by inner.
2572     */
2573    bool is_owned;
2574 } LDKAcceptChannel;
2575
2576
2577
2578 /**
2579  * An open_channel message to be sent or received from a peer
2580  */
2581 typedef struct MUST_USE_STRUCT LDKOpenChannel {
2582    /**
2583     * A pointer to the opaque Rust object.
2584     * Nearly everywhere, inner must be non-null, however in places where
2585     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2586     */
2587    LDKnativeOpenChannel *inner;
2588    /**
2589     * Indicates that this is the only struct which contains the same pointer.
2590     * Rust functions which take ownership of an object provided via an argument require
2591     * this to be true and invalidate the object pointed to by inner.
2592     */
2593    bool is_owned;
2594 } LDKOpenChannel;
2595
2596
2597
2598 /**
2599  * A funding_created message to be sent or received from a peer
2600  */
2601 typedef struct MUST_USE_STRUCT LDKFundingCreated {
2602    /**
2603     * A pointer to the opaque Rust object.
2604     * Nearly everywhere, inner must be non-null, however in places where
2605     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2606     */
2607    LDKnativeFundingCreated *inner;
2608    /**
2609     * Indicates that this is the only struct which contains the same pointer.
2610     * Rust functions which take ownership of an object provided via an argument require
2611     * this to be true and invalidate the object pointed to by inner.
2612     */
2613    bool is_owned;
2614 } LDKFundingCreated;
2615
2616
2617
2618 /**
2619  * A funding_signed message to be sent or received from a peer
2620  */
2621 typedef struct MUST_USE_STRUCT LDKFundingSigned {
2622    /**
2623     * A pointer to the opaque Rust object.
2624     * Nearly everywhere, inner must be non-null, however in places where
2625     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2626     */
2627    LDKnativeFundingSigned *inner;
2628    /**
2629     * Indicates that this is the only struct which contains the same pointer.
2630     * Rust functions which take ownership of an object provided via an argument require
2631     * this to be true and invalidate the object pointed to by inner.
2632     */
2633    bool is_owned;
2634 } LDKFundingSigned;
2635
2636
2637
2638 /**
2639  * A funding_locked message to be sent or received from a peer
2640  */
2641 typedef struct MUST_USE_STRUCT LDKFundingLocked {
2642    /**
2643     * A pointer to the opaque Rust object.
2644     * Nearly everywhere, inner must be non-null, however in places where
2645     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2646     */
2647    LDKnativeFundingLocked *inner;
2648    /**
2649     * Indicates that this is the only struct which contains the same pointer.
2650     * Rust functions which take ownership of an object provided via an argument require
2651     * this to be true and invalidate the object pointed to by inner.
2652     */
2653    bool is_owned;
2654 } LDKFundingLocked;
2655
2656
2657
2658 /**
2659  * An announcement_signatures message to be sent or received from a peer
2660  */
2661 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
2662    /**
2663     * A pointer to the opaque Rust object.
2664     * Nearly everywhere, inner must be non-null, however in places where
2665     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2666     */
2667    LDKnativeAnnouncementSignatures *inner;
2668    /**
2669     * Indicates that this is the only struct which contains the same pointer.
2670     * Rust functions which take ownership of an object provided via an argument require
2671     * this to be true and invalidate the object pointed to by inner.
2672     */
2673    bool is_owned;
2674 } LDKAnnouncementSignatures;
2675
2676
2677
2678 /**
2679  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
2680  * transaction updates if they were pending.
2681  */
2682 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
2683    /**
2684     * A pointer to the opaque Rust object.
2685     * Nearly everywhere, inner must be non-null, however in places where
2686     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2687     */
2688    LDKnativeCommitmentUpdate *inner;
2689    /**
2690     * Indicates that this is the only struct which contains the same pointer.
2691     * Rust functions which take ownership of an object provided via an argument require
2692     * this to be true and invalidate the object pointed to by inner.
2693     */
2694    bool is_owned;
2695 } LDKCommitmentUpdate;
2696
2697
2698
2699 /**
2700  * A revoke_and_ack message to be sent or received from a peer
2701  */
2702 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
2703    /**
2704     * A pointer to the opaque Rust object.
2705     * Nearly everywhere, inner must be non-null, however in places where
2706     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2707     */
2708    LDKnativeRevokeAndACK *inner;
2709    /**
2710     * Indicates that this is the only struct which contains the same pointer.
2711     * Rust functions which take ownership of an object provided via an argument require
2712     * this to be true and invalidate the object pointed to by inner.
2713     */
2714    bool is_owned;
2715 } LDKRevokeAndACK;
2716
2717
2718
2719 /**
2720  * A closing_signed message to be sent or received from a peer
2721  */
2722 typedef struct MUST_USE_STRUCT LDKClosingSigned {
2723    /**
2724     * A pointer to the opaque Rust object.
2725     * Nearly everywhere, inner must be non-null, however in places where
2726     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2727     */
2728    LDKnativeClosingSigned *inner;
2729    /**
2730     * Indicates that this is the only struct which contains the same pointer.
2731     * Rust functions which take ownership of an object provided via an argument require
2732     * this to be true and invalidate the object pointed to by inner.
2733     */
2734    bool is_owned;
2735 } LDKClosingSigned;
2736
2737
2738
2739 /**
2740  * A shutdown message to be sent or received from a peer
2741  */
2742 typedef struct MUST_USE_STRUCT LDKShutdown {
2743    /**
2744     * A pointer to the opaque Rust object.
2745     * Nearly everywhere, inner must be non-null, however in places where
2746     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2747     */
2748    LDKnativeShutdown *inner;
2749    /**
2750     * Indicates that this is the only struct which contains the same pointer.
2751     * Rust functions which take ownership of an object provided via an argument require
2752     * this to be true and invalidate the object pointed to by inner.
2753     */
2754    bool is_owned;
2755 } LDKShutdown;
2756
2757
2758
2759 /**
2760  * A channel_reestablish message to be sent or received from a peer
2761  */
2762 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
2763    /**
2764     * A pointer to the opaque Rust object.
2765     * Nearly everywhere, inner must be non-null, however in places where
2766     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2767     */
2768    LDKnativeChannelReestablish *inner;
2769    /**
2770     * Indicates that this is the only struct which contains the same pointer.
2771     * Rust functions which take ownership of an object provided via an argument require
2772     * this to be true and invalidate the object pointed to by inner.
2773     */
2774    bool is_owned;
2775 } LDKChannelReestablish;
2776
2777
2778
2779 /**
2780  * A channel_announcement message to be sent or received from a peer
2781  */
2782 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
2783    /**
2784     * A pointer to the opaque Rust object.
2785     * Nearly everywhere, inner must be non-null, however in places where
2786     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2787     */
2788    LDKnativeChannelAnnouncement *inner;
2789    /**
2790     * Indicates that this is the only struct which contains the same pointer.
2791     * Rust functions which take ownership of an object provided via an argument require
2792     * this to be true and invalidate the object pointed to by inner.
2793     */
2794    bool is_owned;
2795 } LDKChannelAnnouncement;
2796
2797
2798
2799 /**
2800  * A channel_update message to be sent or received from a peer
2801  */
2802 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2803    /**
2804     * A pointer to the opaque Rust object.
2805     * Nearly everywhere, inner must be non-null, however in places where
2806     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2807     */
2808    LDKnativeChannelUpdate *inner;
2809    /**
2810     * Indicates that this is the only struct which contains the same pointer.
2811     * Rust functions which take ownership of an object provided via an argument require
2812     * this to be true and invalidate the object pointed to by inner.
2813     */
2814    bool is_owned;
2815 } LDKChannelUpdate;
2816
2817
2818
2819 /**
2820  * A node_announcement message to be sent or received from a peer
2821  */
2822 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
2823    /**
2824     * A pointer to the opaque Rust object.
2825     * Nearly everywhere, inner must be non-null, however in places where
2826     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2827     */
2828    LDKnativeNodeAnnouncement *inner;
2829    /**
2830     * Indicates that this is the only struct which contains the same pointer.
2831     * Rust functions which take ownership of an object provided via an argument require
2832     * this to be true and invalidate the object pointed to by inner.
2833     */
2834    bool is_owned;
2835 } LDKNodeAnnouncement;
2836
2837
2838
2839 /**
2840  * An error message to be sent or received from a peer
2841  */
2842 typedef struct MUST_USE_STRUCT LDKErrorMessage {
2843    /**
2844     * A pointer to the opaque Rust object.
2845     * Nearly everywhere, inner must be non-null, however in places where
2846     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2847     */
2848    LDKnativeErrorMessage *inner;
2849    /**
2850     * Indicates that this is the only struct which contains the same pointer.
2851     * Rust functions which take ownership of an object provided via an argument require
2852     * this to be true and invalidate the object pointed to by inner.
2853     */
2854    bool is_owned;
2855 } LDKErrorMessage;
2856
2857 /**
2858  * Used to put an error message in a LightningError
2859  */
2860 typedef enum LDKErrorAction_Tag {
2861    /**
2862     * The peer took some action which made us think they were useless. Disconnect them.
2863     */
2864    LDKErrorAction_DisconnectPeer,
2865    /**
2866     * The peer did something harmless that we weren't able to process, just log and ignore
2867     */
2868    LDKErrorAction_IgnoreError,
2869    /**
2870     * The peer did something incorrect. Tell them.
2871     */
2872    LDKErrorAction_SendErrorMessage,
2873    /**
2874     * Must be last for serialization purposes
2875     */
2876    LDKErrorAction_Sentinel,
2877 } LDKErrorAction_Tag;
2878
2879 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
2880    /**
2881     * An error message which we should make an effort to send before we disconnect.
2882     */
2883    struct LDKErrorMessage msg;
2884 } LDKErrorAction_LDKDisconnectPeer_Body;
2885
2886 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
2887    /**
2888     * The message to send.
2889     */
2890    struct LDKErrorMessage msg;
2891 } LDKErrorAction_LDKSendErrorMessage_Body;
2892
2893 typedef struct MUST_USE_STRUCT LDKErrorAction {
2894    LDKErrorAction_Tag tag;
2895    union {
2896       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
2897       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
2898    };
2899 } LDKErrorAction;
2900
2901 /**
2902  * The information we received from a peer along the route of a payment we originated. This is
2903  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
2904  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
2905  */
2906 typedef enum LDKHTLCFailChannelUpdate_Tag {
2907    /**
2908     * We received an error which included a full ChannelUpdate message.
2909     */
2910    LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
2911    /**
2912     * We received an error which indicated only that a channel has been closed
2913     */
2914    LDKHTLCFailChannelUpdate_ChannelClosed,
2915    /**
2916     * We received an error which indicated only that a node has failed
2917     */
2918    LDKHTLCFailChannelUpdate_NodeFailure,
2919    /**
2920     * Must be last for serialization purposes
2921     */
2922    LDKHTLCFailChannelUpdate_Sentinel,
2923 } LDKHTLCFailChannelUpdate_Tag;
2924
2925 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
2926    /**
2927     * The unwrapped message we received
2928     */
2929    struct LDKChannelUpdate msg;
2930 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
2931
2932 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
2933    /**
2934     * The short_channel_id which has now closed.
2935     */
2936    uint64_t short_channel_id;
2937    /**
2938     * when this true, this channel should be permanently removed from the
2939     * consideration. Otherwise, this channel can be restored as new channel_update is received
2940     */
2941    bool is_permanent;
2942 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
2943
2944 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
2945    /**
2946     * The node_id that has failed.
2947     */
2948    struct LDKPublicKey node_id;
2949    /**
2950     * when this true, node should be permanently removed from the
2951     * consideration. Otherwise, the channels connected to this node can be
2952     * restored as new channel_update is received
2953     */
2954    bool is_permanent;
2955 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
2956
2957 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
2958    LDKHTLCFailChannelUpdate_Tag tag;
2959    union {
2960       LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2961       LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
2962       LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
2963    };
2964 } LDKHTLCFailChannelUpdate;
2965
2966
2967
2968 /**
2969  * A query_channel_range message is used to query a peer for channel
2970  * UTXOs in a range of blocks. The recipient of a query makes a best
2971  * effort to reply to the query using one or more reply_channel_range
2972  * messages.
2973  */
2974 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
2975    /**
2976     * A pointer to the opaque Rust object.
2977     * Nearly everywhere, inner must be non-null, however in places where
2978     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2979     */
2980    LDKnativeQueryChannelRange *inner;
2981    /**
2982     * Indicates that this is the only struct which contains the same pointer.
2983     * Rust functions which take ownership of an object provided via an argument require
2984     * this to be true and invalidate the object pointed to by inner.
2985     */
2986    bool is_owned;
2987 } LDKQueryChannelRange;
2988
2989
2990
2991 /**
2992  * A query_short_channel_ids message is used to query a peer for
2993  * routing gossip messages related to one or more short_channel_ids.
2994  * The query recipient will reply with the latest, if available,
2995  * channel_announcement, channel_update and node_announcement messages
2996  * it maintains for the requested short_channel_ids followed by a
2997  * reply_short_channel_ids_end message. The short_channel_ids sent in
2998  * this query are encoded. We only support encoding_type=0 uncompressed
2999  * serialization and do not support encoding_type=1 zlib serialization.
3000  */
3001 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3002    /**
3003     * A pointer to the opaque Rust object.
3004     * Nearly everywhere, inner must be non-null, however in places where
3005     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3006     */
3007    LDKnativeQueryShortChannelIds *inner;
3008    /**
3009     * Indicates that this is the only struct which contains the same pointer.
3010     * Rust functions which take ownership of an object provided via an argument require
3011     * this to be true and invalidate the object pointed to by inner.
3012     */
3013    bool is_owned;
3014 } LDKQueryShortChannelIds;
3015
3016
3017
3018 /**
3019  * A reply_channel_range message is a reply to a query_channel_range
3020  * message. Multiple reply_channel_range messages can be sent in reply
3021  * to a single query_channel_range message. The query recipient makes a
3022  * best effort to respond based on their local network view which may
3023  * not be a perfect view of the network. The short_channel_ids in the
3024  * reply are encoded. We only support encoding_type=0 uncompressed
3025  * serialization and do not support encoding_type=1 zlib serialization.
3026  */
3027 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3028    /**
3029     * A pointer to the opaque Rust object.
3030     * Nearly everywhere, inner must be non-null, however in places where
3031     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3032     */
3033    LDKnativeReplyChannelRange *inner;
3034    /**
3035     * Indicates that this is the only struct which contains the same pointer.
3036     * Rust functions which take ownership of an object provided via an argument require
3037     * this to be true and invalidate the object pointed to by inner.
3038     */
3039    bool is_owned;
3040 } LDKReplyChannelRange;
3041
3042 /**
3043  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3044  * broadcast to most peers).
3045  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3046  */
3047 typedef enum LDKMessageSendEvent_Tag {
3048    /**
3049     * Used to indicate that we've accepted a channel open and should send the accept_channel
3050     * message provided to the given peer.
3051     */
3052    LDKMessageSendEvent_SendAcceptChannel,
3053    /**
3054     * Used to indicate that we've initiated a channel open and should send the open_channel
3055     * message provided to the given peer.
3056     */
3057    LDKMessageSendEvent_SendOpenChannel,
3058    /**
3059     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3060     */
3061    LDKMessageSendEvent_SendFundingCreated,
3062    /**
3063     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3064     */
3065    LDKMessageSendEvent_SendFundingSigned,
3066    /**
3067     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
3068     */
3069    LDKMessageSendEvent_SendFundingLocked,
3070    /**
3071     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3072     */
3073    LDKMessageSendEvent_SendAnnouncementSignatures,
3074    /**
3075     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3076     * message should be sent to the peer with the given node_id.
3077     */
3078    LDKMessageSendEvent_UpdateHTLCs,
3079    /**
3080     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3081     */
3082    LDKMessageSendEvent_SendRevokeAndACK,
3083    /**
3084     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3085     */
3086    LDKMessageSendEvent_SendClosingSigned,
3087    /**
3088     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3089     */
3090    LDKMessageSendEvent_SendShutdown,
3091    /**
3092     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3093     */
3094    LDKMessageSendEvent_SendChannelReestablish,
3095    /**
3096     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3097     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3098     *
3099     * Note that after doing so, you very likely (unless you did so very recently) want to call
3100     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3101     * This ensures that any nodes which see our channel_announcement also have a relevant
3102     * node_announcement, including relevant feature flags which may be important for routing
3103     * through or to us.
3104     */
3105    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3106    /**
3107     * Used to indicate that a node_announcement should be broadcast to all peers.
3108     */
3109    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3110    /**
3111     * Used to indicate that a channel_update should be broadcast to all peers.
3112     */
3113    LDKMessageSendEvent_BroadcastChannelUpdate,
3114    /**
3115     * Broadcast an error downstream to be handled
3116     */
3117    LDKMessageSendEvent_HandleError,
3118    /**
3119     * When a payment fails we may receive updates back from the hop where it failed. In such
3120     * cases this event is generated so that we can inform the network graph of this information.
3121     */
3122    LDKMessageSendEvent_PaymentFailureNetworkUpdate,
3123    /**
3124     * Query a peer for channels with funding transaction UTXOs in a block range.
3125     */
3126    LDKMessageSendEvent_SendChannelRangeQuery,
3127    /**
3128     * Request routing gossip messages from a peer for a list of channels identified by
3129     * their short_channel_ids.
3130     */
3131    LDKMessageSendEvent_SendShortIdsQuery,
3132    /**
3133     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3134     * emitted during processing of the query.
3135     */
3136    LDKMessageSendEvent_SendReplyChannelRange,
3137    /**
3138     * Must be last for serialization purposes
3139     */
3140    LDKMessageSendEvent_Sentinel,
3141 } LDKMessageSendEvent_Tag;
3142
3143 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3144    /**
3145     * The node_id of the node which should receive this message
3146     */
3147    struct LDKPublicKey node_id;
3148    /**
3149     * The message which should be sent.
3150     */
3151    struct LDKAcceptChannel msg;
3152 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3153
3154 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3155    /**
3156     * The node_id of the node which should receive this message
3157     */
3158    struct LDKPublicKey node_id;
3159    /**
3160     * The message which should be sent.
3161     */
3162    struct LDKOpenChannel msg;
3163 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3164
3165 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3166    /**
3167     * The node_id of the node which should receive this message
3168     */
3169    struct LDKPublicKey node_id;
3170    /**
3171     * The message which should be sent.
3172     */
3173    struct LDKFundingCreated msg;
3174 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3175
3176 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
3177    /**
3178     * The node_id of the node which should receive this message
3179     */
3180    struct LDKPublicKey node_id;
3181    /**
3182     * The message which should be sent.
3183     */
3184    struct LDKFundingSigned msg;
3185 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3186
3187 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
3188    /**
3189     * The node_id of the node which should receive these message(s)
3190     */
3191    struct LDKPublicKey node_id;
3192    /**
3193     * The funding_locked message which should be sent.
3194     */
3195    struct LDKFundingLocked msg;
3196 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
3197
3198 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
3199    /**
3200     * The node_id of the node which should receive these message(s)
3201     */
3202    struct LDKPublicKey node_id;
3203    /**
3204     * The announcement_signatures message which should be sent.
3205     */
3206    struct LDKAnnouncementSignatures msg;
3207 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
3208
3209 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
3210    /**
3211     * The node_id of the node which should receive these message(s)
3212     */
3213    struct LDKPublicKey node_id;
3214    /**
3215     * The update messages which should be sent. ALL messages in the struct should be sent!
3216     */
3217    struct LDKCommitmentUpdate updates;
3218 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
3219
3220 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
3221    /**
3222     * The node_id of the node which should receive this message
3223     */
3224    struct LDKPublicKey node_id;
3225    /**
3226     * The message which should be sent.
3227     */
3228    struct LDKRevokeAndACK msg;
3229 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
3230
3231 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
3232    /**
3233     * The node_id of the node which should receive this message
3234     */
3235    struct LDKPublicKey node_id;
3236    /**
3237     * The message which should be sent.
3238     */
3239    struct LDKClosingSigned msg;
3240 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
3241
3242 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
3243    /**
3244     * The node_id of the node which should receive this message
3245     */
3246    struct LDKPublicKey node_id;
3247    /**
3248     * The message which should be sent.
3249     */
3250    struct LDKShutdown msg;
3251 } LDKMessageSendEvent_LDKSendShutdown_Body;
3252
3253 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
3254    /**
3255     * The node_id of the node which should receive this message
3256     */
3257    struct LDKPublicKey node_id;
3258    /**
3259     * The message which should be sent.
3260     */
3261    struct LDKChannelReestablish msg;
3262 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
3263
3264 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
3265    /**
3266     * The channel_announcement which should be sent.
3267     */
3268    struct LDKChannelAnnouncement msg;
3269    /**
3270     * The followup channel_update which should be sent.
3271     */
3272    struct LDKChannelUpdate update_msg;
3273 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
3274
3275 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
3276    /**
3277     * The node_announcement which should be sent.
3278     */
3279    struct LDKNodeAnnouncement msg;
3280 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
3281
3282 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
3283    /**
3284     * The channel_update which should be sent.
3285     */
3286    struct LDKChannelUpdate msg;
3287 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
3288
3289 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
3290    /**
3291     * The node_id of the node which should receive this message
3292     */
3293    struct LDKPublicKey node_id;
3294    /**
3295     * The action which should be taken.
3296     */
3297    struct LDKErrorAction action;
3298 } LDKMessageSendEvent_LDKHandleError_Body;
3299
3300 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
3301    /**
3302     * The channel/node update which should be sent to NetGraphMsgHandler
3303     */
3304    struct LDKHTLCFailChannelUpdate update;
3305 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
3306
3307 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
3308    /**
3309     * The node_id of this message recipient
3310     */
3311    struct LDKPublicKey node_id;
3312    /**
3313     * The query_channel_range which should be sent.
3314     */
3315    struct LDKQueryChannelRange msg;
3316 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
3317
3318 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
3319    /**
3320     * The node_id of this message recipient
3321     */
3322    struct LDKPublicKey node_id;
3323    /**
3324     * The query_short_channel_ids which should be sent.
3325     */
3326    struct LDKQueryShortChannelIds msg;
3327 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
3328
3329 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
3330    /**
3331     * The node_id of this message recipient
3332     */
3333    struct LDKPublicKey node_id;
3334    /**
3335     * The reply_channel_range which should be sent.
3336     */
3337    struct LDKReplyChannelRange msg;
3338 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
3339
3340 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
3341    LDKMessageSendEvent_Tag tag;
3342    union {
3343       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
3344       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
3345       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
3346       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
3347       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
3348       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
3349       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
3350       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
3351       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
3352       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
3353       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
3354       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
3355       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
3356       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
3357       LDKMessageSendEvent_LDKHandleError_Body handle_error;
3358       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
3359       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
3360       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
3361       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
3362    };
3363 } LDKMessageSendEvent;
3364
3365 /**
3366  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3367  * This corresponds to std::vector in C++
3368  */
3369 typedef struct LDKCVec_MessageSendEventZ {
3370    /**
3371     * The elements in the array.
3372     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3373     */
3374    struct LDKMessageSendEvent *data;
3375    /**
3376     * The number of elements pointed to by `data`.
3377     */
3378    uintptr_t datalen;
3379 } LDKCVec_MessageSendEventZ;
3380
3381 /**
3382  * The contents of CResult_boolLightningErrorZ
3383  */
3384 typedef union LDKCResult_boolLightningErrorZPtr {
3385    /**
3386     * A pointer to the contents in the success state.
3387     * Reading from this pointer when `result_ok` is not set is undefined.
3388     */
3389    bool *result;
3390    /**
3391     * A pointer to the contents in the error state.
3392     * Reading from this pointer when `result_ok` is set is undefined.
3393     */
3394    struct LDKLightningError *err;
3395 } LDKCResult_boolLightningErrorZPtr;
3396
3397 /**
3398  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
3399  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
3400  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3401  */
3402 typedef struct LDKCResult_boolLightningErrorZ {
3403    /**
3404     * The contents of this CResult_boolLightningErrorZ, accessible via either
3405     * `err` or `result` depending on the state of `result_ok`.
3406     */
3407    union LDKCResult_boolLightningErrorZPtr contents;
3408    /**
3409     * Whether this CResult_boolLightningErrorZ represents a success state.
3410     */
3411    bool result_ok;
3412 } LDKCResult_boolLightningErrorZ;
3413
3414 /**
3415  * A tuple of 3 elements. See the individual fields for the types contained.
3416  */
3417 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3418    /**
3419     * The element at position 0
3420     */
3421    struct LDKChannelAnnouncement a;
3422    /**
3423     * The element at position 1
3424     */
3425    struct LDKChannelUpdate b;
3426    /**
3427     * The element at position 2
3428     */
3429    struct LDKChannelUpdate c;
3430 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
3431
3432 /**
3433  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
3434  * This corresponds to std::vector in C++
3435  */
3436 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3437    /**
3438     * The elements in the array.
3439     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3440     */
3441    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
3442    /**
3443     * The number of elements pointed to by `data`.
3444     */
3445    uintptr_t datalen;
3446 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
3447
3448 /**
3449  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
3450  * This corresponds to std::vector in C++
3451  */
3452 typedef struct LDKCVec_NodeAnnouncementZ {
3453    /**
3454     * The elements in the array.
3455     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3456     */
3457    struct LDKNodeAnnouncement *data;
3458    /**
3459     * The number of elements pointed to by `data`.
3460     */
3461    uintptr_t datalen;
3462 } LDKCVec_NodeAnnouncementZ;
3463
3464 /**
3465  * The contents of CResult_NoneLightningErrorZ
3466  */
3467 typedef union LDKCResult_NoneLightningErrorZPtr {
3468    /**
3469     * Note that this value is always NULL, as there are no contents in the OK variant
3470     */
3471    void *result;
3472    /**
3473     * A pointer to the contents in the error state.
3474     * Reading from this pointer when `result_ok` is set is undefined.
3475     */
3476    struct LDKLightningError *err;
3477 } LDKCResult_NoneLightningErrorZPtr;
3478
3479 /**
3480  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
3481  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
3482  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3483  */
3484 typedef struct LDKCResult_NoneLightningErrorZ {
3485    /**
3486     * The contents of this CResult_NoneLightningErrorZ, accessible via either
3487     * `err` or `result` depending on the state of `result_ok`.
3488     */
3489    union LDKCResult_NoneLightningErrorZPtr contents;
3490    /**
3491     * Whether this CResult_NoneLightningErrorZ represents a success state.
3492     */
3493    bool result_ok;
3494 } LDKCResult_NoneLightningErrorZ;
3495
3496 /**
3497  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
3498  * This corresponds to std::vector in C++
3499  */
3500 typedef struct LDKCVec_PublicKeyZ {
3501    /**
3502     * The elements in the array.
3503     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3504     */
3505    struct LDKPublicKey *data;
3506    /**
3507     * The number of elements pointed to by `data`.
3508     */
3509    uintptr_t datalen;
3510 } LDKCVec_PublicKeyZ;
3511
3512
3513
3514 /**
3515  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
3516  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
3517  * descriptor.
3518  */
3519 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
3520    /**
3521     * A pointer to the opaque Rust object.
3522     * Nearly everywhere, inner must be non-null, however in places where
3523     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3524     */
3525    LDKnativePeerHandleError *inner;
3526    /**
3527     * Indicates that this is the only struct which contains the same pointer.
3528     * Rust functions which take ownership of an object provided via an argument require
3529     * this to be true and invalidate the object pointed to by inner.
3530     */
3531    bool is_owned;
3532 } LDKPeerHandleError;
3533
3534 /**
3535  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
3536  */
3537 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
3538    /**
3539     * A pointer to the contents in the success state.
3540     * Reading from this pointer when `result_ok` is not set is undefined.
3541     */
3542    struct LDKCVec_u8Z *result;
3543    /**
3544     * A pointer to the contents in the error state.
3545     * Reading from this pointer when `result_ok` is set is undefined.
3546     */
3547    struct LDKPeerHandleError *err;
3548 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
3549
3550 /**
3551  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
3552  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3553  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3554  */
3555 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
3556    /**
3557     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
3558     * `err` or `result` depending on the state of `result_ok`.
3559     */
3560    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
3561    /**
3562     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
3563     */
3564    bool result_ok;
3565 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
3566
3567 /**
3568  * The contents of CResult_NonePeerHandleErrorZ
3569  */
3570 typedef union LDKCResult_NonePeerHandleErrorZPtr {
3571    /**
3572     * Note that this value is always NULL, as there are no contents in the OK variant
3573     */
3574    void *result;
3575    /**
3576     * A pointer to the contents in the error state.
3577     * Reading from this pointer when `result_ok` is set is undefined.
3578     */
3579    struct LDKPeerHandleError *err;
3580 } LDKCResult_NonePeerHandleErrorZPtr;
3581
3582 /**
3583  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
3584  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3585  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3586  */
3587 typedef struct LDKCResult_NonePeerHandleErrorZ {
3588    /**
3589     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
3590     * `err` or `result` depending on the state of `result_ok`.
3591     */
3592    union LDKCResult_NonePeerHandleErrorZPtr contents;
3593    /**
3594     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
3595     */
3596    bool result_ok;
3597 } LDKCResult_NonePeerHandleErrorZ;
3598
3599 /**
3600  * The contents of CResult_boolPeerHandleErrorZ
3601  */
3602 typedef union LDKCResult_boolPeerHandleErrorZPtr {
3603    /**
3604     * A pointer to the contents in the success state.
3605     * Reading from this pointer when `result_ok` is not set is undefined.
3606     */
3607    bool *result;
3608    /**
3609     * A pointer to the contents in the error state.
3610     * Reading from this pointer when `result_ok` is set is undefined.
3611     */
3612    struct LDKPeerHandleError *err;
3613 } LDKCResult_boolPeerHandleErrorZPtr;
3614
3615 /**
3616  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
3617  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3618  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3619  */
3620 typedef struct LDKCResult_boolPeerHandleErrorZ {
3621    /**
3622     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
3623     * `err` or `result` depending on the state of `result_ok`.
3624     */
3625    union LDKCResult_boolPeerHandleErrorZPtr contents;
3626    /**
3627     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
3628     */
3629    bool result_ok;
3630 } LDKCResult_boolPeerHandleErrorZ;
3631
3632 /**
3633  * The contents of CResult_TxOutAccessErrorZ
3634  */
3635 typedef union LDKCResult_TxOutAccessErrorZPtr {
3636    /**
3637     * A pointer to the contents in the success state.
3638     * Reading from this pointer when `result_ok` is not set is undefined.
3639     */
3640    struct LDKTxOut *result;
3641    /**
3642     * A pointer to the contents in the error state.
3643     * Reading from this pointer when `result_ok` is set is undefined.
3644     */
3645    enum LDKAccessError *err;
3646 } LDKCResult_TxOutAccessErrorZPtr;
3647
3648 /**
3649  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3650  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3651  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3652  */
3653 typedef struct LDKCResult_TxOutAccessErrorZ {
3654    /**
3655     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
3656     * `err` or `result` depending on the state of `result_ok`.
3657     */
3658    union LDKCResult_TxOutAccessErrorZPtr contents;
3659    /**
3660     * Whether this CResult_TxOutAccessErrorZ represents a success state.
3661     */
3662    bool result_ok;
3663 } LDKCResult_TxOutAccessErrorZ;
3664
3665 /**
3666  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3667  */
3668 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
3669    /**
3670     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3671     */
3672    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
3673    /**
3674     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3675     */
3676    LDKCOption_C2Tuple_usizeTransactionZZ_None,
3677    /**
3678     * Must be last for serialization purposes
3679     */
3680    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
3681 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
3682
3683 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
3684    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
3685    union {
3686       struct {
3687          struct LDKC2Tuple_usizeTransactionZ some;
3688       };
3689    };
3690 } LDKCOption_C2Tuple_usizeTransactionZZ;
3691
3692
3693
3694 /**
3695  * Details about one direction of a channel. Received
3696  * within a channel update.
3697  */
3698 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
3699    /**
3700     * A pointer to the opaque Rust object.
3701     * Nearly everywhere, inner must be non-null, however in places where
3702     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3703     */
3704    LDKnativeDirectionalChannelInfo *inner;
3705    /**
3706     * Indicates that this is the only struct which contains the same pointer.
3707     * Rust functions which take ownership of an object provided via an argument require
3708     * this to be true and invalidate the object pointed to by inner.
3709     */
3710    bool is_owned;
3711 } LDKDirectionalChannelInfo;
3712
3713 /**
3714  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
3715  */
3716 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
3717    /**
3718     * A pointer to the contents in the success state.
3719     * Reading from this pointer when `result_ok` is not set is undefined.
3720     */
3721    struct LDKDirectionalChannelInfo *result;
3722    /**
3723     * A pointer to the contents in the error state.
3724     * Reading from this pointer when `result_ok` is set is undefined.
3725     */
3726    struct LDKDecodeError *err;
3727 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
3728
3729 /**
3730  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
3731  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
3732  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3733  */
3734 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
3735    /**
3736     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
3737     * `err` or `result` depending on the state of `result_ok`.
3738     */
3739    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
3740    /**
3741     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
3742     */
3743    bool result_ok;
3744 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
3745
3746
3747
3748 /**
3749  * Details about a channel (both directions).
3750  * Received within a channel announcement.
3751  */
3752 typedef struct MUST_USE_STRUCT LDKChannelInfo {
3753    /**
3754     * A pointer to the opaque Rust object.
3755     * Nearly everywhere, inner must be non-null, however in places where
3756     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3757     */
3758    LDKnativeChannelInfo *inner;
3759    /**
3760     * Indicates that this is the only struct which contains the same pointer.
3761     * Rust functions which take ownership of an object provided via an argument require
3762     * this to be true and invalidate the object pointed to by inner.
3763     */
3764    bool is_owned;
3765 } LDKChannelInfo;
3766
3767 /**
3768  * The contents of CResult_ChannelInfoDecodeErrorZ
3769  */
3770 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
3771    /**
3772     * A pointer to the contents in the success state.
3773     * Reading from this pointer when `result_ok` is not set is undefined.
3774     */
3775    struct LDKChannelInfo *result;
3776    /**
3777     * A pointer to the contents in the error state.
3778     * Reading from this pointer when `result_ok` is set is undefined.
3779     */
3780    struct LDKDecodeError *err;
3781 } LDKCResult_ChannelInfoDecodeErrorZPtr;
3782
3783 /**
3784  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
3785  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
3786  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3787  */
3788 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
3789    /**
3790     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
3791     * `err` or `result` depending on the state of `result_ok`.
3792     */
3793    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
3794    /**
3795     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
3796     */
3797    bool result_ok;
3798 } LDKCResult_ChannelInfoDecodeErrorZ;
3799
3800
3801
3802 /**
3803  * Fees for routing via a given channel or a node
3804  */
3805 typedef struct MUST_USE_STRUCT LDKRoutingFees {
3806    /**
3807     * A pointer to the opaque Rust object.
3808     * Nearly everywhere, inner must be non-null, however in places where
3809     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3810     */
3811    LDKnativeRoutingFees *inner;
3812    /**
3813     * Indicates that this is the only struct which contains the same pointer.
3814     * Rust functions which take ownership of an object provided via an argument require
3815     * this to be true and invalidate the object pointed to by inner.
3816     */
3817    bool is_owned;
3818 } LDKRoutingFees;
3819
3820 /**
3821  * The contents of CResult_RoutingFeesDecodeErrorZ
3822  */
3823 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
3824    /**
3825     * A pointer to the contents in the success state.
3826     * Reading from this pointer when `result_ok` is not set is undefined.
3827     */
3828    struct LDKRoutingFees *result;
3829    /**
3830     * A pointer to the contents in the error state.
3831     * Reading from this pointer when `result_ok` is set is undefined.
3832     */
3833    struct LDKDecodeError *err;
3834 } LDKCResult_RoutingFeesDecodeErrorZPtr;
3835
3836 /**
3837  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
3838  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
3839  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3840  */
3841 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
3842    /**
3843     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
3844     * `err` or `result` depending on the state of `result_ok`.
3845     */
3846    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
3847    /**
3848     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
3849     */
3850    bool result_ok;
3851 } LDKCResult_RoutingFeesDecodeErrorZ;
3852
3853 /**
3854  * A 4-byte byte array.
3855  */
3856 typedef struct LDKFourBytes {
3857    /**
3858     * The four bytes
3859     */
3860    uint8_t data[4];
3861 } LDKFourBytes;
3862
3863 /**
3864  * A 16-byte byte array.
3865  */
3866 typedef struct LDKSixteenBytes {
3867    /**
3868     * The sixteen bytes
3869     */
3870    uint8_t data[16];
3871 } LDKSixteenBytes;
3872
3873 /**
3874  * A 10-byte byte array.
3875  */
3876 typedef struct LDKTenBytes {
3877    /**
3878     * The ten bytes
3879     */
3880    uint8_t data[10];
3881 } LDKTenBytes;
3882
3883 /**
3884  * An address which can be used to connect to a remote peer
3885  */
3886 typedef enum LDKNetAddress_Tag {
3887    /**
3888     * An IPv4 address/port on which the peer is listening.
3889     */
3890    LDKNetAddress_IPv4,
3891    /**
3892     * An IPv6 address/port on which the peer is listening.
3893     */
3894    LDKNetAddress_IPv6,
3895    /**
3896     * An old-style Tor onion address/port on which the peer is listening.
3897     */
3898    LDKNetAddress_OnionV2,
3899    /**
3900     * A new-style Tor onion address/port on which the peer is listening.
3901     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
3902     * wrap as base32 and append \".onion\".
3903     */
3904    LDKNetAddress_OnionV3,
3905    /**
3906     * Must be last for serialization purposes
3907     */
3908    LDKNetAddress_Sentinel,
3909 } LDKNetAddress_Tag;
3910
3911 typedef struct LDKNetAddress_LDKIPv4_Body {
3912    /**
3913     * The 4-byte IPv4 address
3914     */
3915    struct LDKFourBytes addr;
3916    /**
3917     * The port on which the node is listening
3918     */
3919    uint16_t port;
3920 } LDKNetAddress_LDKIPv4_Body;
3921
3922 typedef struct LDKNetAddress_LDKIPv6_Body {
3923    /**
3924     * The 16-byte IPv6 address
3925     */
3926    struct LDKSixteenBytes addr;
3927    /**
3928     * The port on which the node is listening
3929     */
3930    uint16_t port;
3931 } LDKNetAddress_LDKIPv6_Body;
3932
3933 typedef struct LDKNetAddress_LDKOnionV2_Body {
3934    /**
3935     * The bytes (usually encoded in base32 with \".onion\" appended)
3936     */
3937    struct LDKTenBytes addr;
3938    /**
3939     * The port on which the node is listening
3940     */
3941    uint16_t port;
3942 } LDKNetAddress_LDKOnionV2_Body;
3943
3944 typedef struct LDKNetAddress_LDKOnionV3_Body {
3945    /**
3946     * The ed25519 long-term public key of the peer
3947     */
3948    struct LDKThirtyTwoBytes ed25519_pubkey;
3949    /**
3950     * The checksum of the pubkey and version, as included in the onion address
3951     */
3952    uint16_t checksum;
3953    /**
3954     * The version byte, as defined by the Tor Onion v3 spec.
3955     */
3956    uint8_t version;
3957    /**
3958     * The port on which the node is listening
3959     */
3960    uint16_t port;
3961 } LDKNetAddress_LDKOnionV3_Body;
3962
3963 typedef struct MUST_USE_STRUCT LDKNetAddress {
3964    LDKNetAddress_Tag tag;
3965    union {
3966       LDKNetAddress_LDKIPv4_Body i_pv4;
3967       LDKNetAddress_LDKIPv6_Body i_pv6;
3968       LDKNetAddress_LDKOnionV2_Body onion_v2;
3969       LDKNetAddress_LDKOnionV3_Body onion_v3;
3970    };
3971 } LDKNetAddress;
3972
3973 /**
3974  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
3975  * This corresponds to std::vector in C++
3976  */
3977 typedef struct LDKCVec_NetAddressZ {
3978    /**
3979     * The elements in the array.
3980     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3981     */
3982    struct LDKNetAddress *data;
3983    /**
3984     * The number of elements pointed to by `data`.
3985     */
3986    uintptr_t datalen;
3987 } LDKCVec_NetAddressZ;
3988
3989
3990
3991 /**
3992  * Information received in the latest node_announcement from this node.
3993  */
3994 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
3995    /**
3996     * A pointer to the opaque Rust object.
3997     * Nearly everywhere, inner must be non-null, however in places where
3998     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3999     */
4000    LDKnativeNodeAnnouncementInfo *inner;
4001    /**
4002     * Indicates that this is the only struct which contains the same pointer.
4003     * Rust functions which take ownership of an object provided via an argument require
4004     * this to be true and invalidate the object pointed to by inner.
4005     */
4006    bool is_owned;
4007 } LDKNodeAnnouncementInfo;
4008
4009 /**
4010  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
4011  */
4012 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
4013    /**
4014     * A pointer to the contents in the success state.
4015     * Reading from this pointer when `result_ok` is not set is undefined.
4016     */
4017    struct LDKNodeAnnouncementInfo *result;
4018    /**
4019     * A pointer to the contents in the error state.
4020     * Reading from this pointer when `result_ok` is set is undefined.
4021     */
4022    struct LDKDecodeError *err;
4023 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
4024
4025 /**
4026  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
4027  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4028  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4029  */
4030 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
4031    /**
4032     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
4033     * `err` or `result` depending on the state of `result_ok`.
4034     */
4035    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
4036    /**
4037     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
4038     */
4039    bool result_ok;
4040 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
4041
4042 /**
4043  * A dynamically-allocated array of u64s of arbitrary size.
4044  * This corresponds to std::vector in C++
4045  */
4046 typedef struct LDKCVec_u64Z {
4047    /**
4048     * The elements in the array.
4049     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4050     */
4051    uint64_t *data;
4052    /**
4053     * The number of elements pointed to by `data`.
4054     */
4055    uintptr_t datalen;
4056 } LDKCVec_u64Z;
4057
4058
4059
4060 /**
4061  * Details about a node in the network, known from the network announcement.
4062  */
4063 typedef struct MUST_USE_STRUCT LDKNodeInfo {
4064    /**
4065     * A pointer to the opaque Rust object.
4066     * Nearly everywhere, inner must be non-null, however in places where
4067     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4068     */
4069    LDKnativeNodeInfo *inner;
4070    /**
4071     * Indicates that this is the only struct which contains the same pointer.
4072     * Rust functions which take ownership of an object provided via an argument require
4073     * this to be true and invalidate the object pointed to by inner.
4074     */
4075    bool is_owned;
4076 } LDKNodeInfo;
4077
4078 /**
4079  * The contents of CResult_NodeInfoDecodeErrorZ
4080  */
4081 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
4082    /**
4083     * A pointer to the contents in the success state.
4084     * Reading from this pointer when `result_ok` is not set is undefined.
4085     */
4086    struct LDKNodeInfo *result;
4087    /**
4088     * A pointer to the contents in the error state.
4089     * Reading from this pointer when `result_ok` is set is undefined.
4090     */
4091    struct LDKDecodeError *err;
4092 } LDKCResult_NodeInfoDecodeErrorZPtr;
4093
4094 /**
4095  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
4096  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4097  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4098  */
4099 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
4100    /**
4101     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
4102     * `err` or `result` depending on the state of `result_ok`.
4103     */
4104    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
4105    /**
4106     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
4107     */
4108    bool result_ok;
4109 } LDKCResult_NodeInfoDecodeErrorZ;
4110
4111
4112
4113 /**
4114  * Represents the network as nodes and channels between them
4115  */
4116 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4117    /**
4118     * A pointer to the opaque Rust object.
4119     * Nearly everywhere, inner must be non-null, however in places where
4120     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4121     */
4122    LDKnativeNetworkGraph *inner;
4123    /**
4124     * Indicates that this is the only struct which contains the same pointer.
4125     * Rust functions which take ownership of an object provided via an argument require
4126     * this to be true and invalidate the object pointed to by inner.
4127     */
4128    bool is_owned;
4129 } LDKNetworkGraph;
4130
4131 /**
4132  * The contents of CResult_NetworkGraphDecodeErrorZ
4133  */
4134 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
4135    /**
4136     * A pointer to the contents in the success state.
4137     * Reading from this pointer when `result_ok` is not set is undefined.
4138     */
4139    struct LDKNetworkGraph *result;
4140    /**
4141     * A pointer to the contents in the error state.
4142     * Reading from this pointer when `result_ok` is set is undefined.
4143     */
4144    struct LDKDecodeError *err;
4145 } LDKCResult_NetworkGraphDecodeErrorZPtr;
4146
4147 /**
4148  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
4149  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
4150  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4151  */
4152 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
4153    /**
4154     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
4155     * `err` or `result` depending on the state of `result_ok`.
4156     */
4157    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
4158    /**
4159     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
4160     */
4161    bool result_ok;
4162 } LDKCResult_NetworkGraphDecodeErrorZ;
4163
4164
4165
4166 /**
4167  * Features used within an `init` message.
4168  */
4169 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4170    /**
4171     * A pointer to the opaque Rust object.
4172     * Nearly everywhere, inner must be non-null, however in places where
4173     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4174     */
4175    LDKnativeInitFeatures *inner;
4176    /**
4177     * Indicates that this is the only struct which contains the same pointer.
4178     * Rust functions which take ownership of an object provided via an argument require
4179     * this to be true and invalidate the object pointed to by inner.
4180     */
4181    bool is_owned;
4182 } LDKInitFeatures;
4183
4184 /**
4185  * The contents of CResult_InitFeaturesDecodeErrorZ
4186  */
4187 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4188    /**
4189     * A pointer to the contents in the success state.
4190     * Reading from this pointer when `result_ok` is not set is undefined.
4191     */
4192    struct LDKInitFeatures *result;
4193    /**
4194     * A pointer to the contents in the error state.
4195     * Reading from this pointer when `result_ok` is set is undefined.
4196     */
4197    struct LDKDecodeError *err;
4198 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4199
4200 /**
4201  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4202  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4203  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4204  */
4205 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4206    /**
4207     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4208     * `err` or `result` depending on the state of `result_ok`.
4209     */
4210    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4211    /**
4212     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4213     */
4214    bool result_ok;
4215 } LDKCResult_InitFeaturesDecodeErrorZ;
4216
4217
4218
4219 /**
4220  * Features used within a `node_announcement` message.
4221  */
4222 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4223    /**
4224     * A pointer to the opaque Rust object.
4225     * Nearly everywhere, inner must be non-null, however in places where
4226     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4227     */
4228    LDKnativeNodeFeatures *inner;
4229    /**
4230     * Indicates that this is the only struct which contains the same pointer.
4231     * Rust functions which take ownership of an object provided via an argument require
4232     * this to be true and invalidate the object pointed to by inner.
4233     */
4234    bool is_owned;
4235 } LDKNodeFeatures;
4236
4237 /**
4238  * The contents of CResult_NodeFeaturesDecodeErrorZ
4239  */
4240 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4241    /**
4242     * A pointer to the contents in the success state.
4243     * Reading from this pointer when `result_ok` is not set is undefined.
4244     */
4245    struct LDKNodeFeatures *result;
4246    /**
4247     * A pointer to the contents in the error state.
4248     * Reading from this pointer when `result_ok` is set is undefined.
4249     */
4250    struct LDKDecodeError *err;
4251 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
4252
4253 /**
4254  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4255  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4256  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4257  */
4258 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
4259    /**
4260     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4261     * `err` or `result` depending on the state of `result_ok`.
4262     */
4263    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
4264    /**
4265     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4266     */
4267    bool result_ok;
4268 } LDKCResult_NodeFeaturesDecodeErrorZ;
4269
4270
4271
4272 /**
4273  * Features used within a `channel_announcement` message.
4274  */
4275 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
4276    /**
4277     * A pointer to the opaque Rust object.
4278     * Nearly everywhere, inner must be non-null, however in places where
4279     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4280     */
4281    LDKnativeChannelFeatures *inner;
4282    /**
4283     * Indicates that this is the only struct which contains the same pointer.
4284     * Rust functions which take ownership of an object provided via an argument require
4285     * this to be true and invalidate the object pointed to by inner.
4286     */
4287    bool is_owned;
4288 } LDKChannelFeatures;
4289
4290 /**
4291  * The contents of CResult_ChannelFeaturesDecodeErrorZ
4292  */
4293 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
4294    /**
4295     * A pointer to the contents in the success state.
4296     * Reading from this pointer when `result_ok` is not set is undefined.
4297     */
4298    struct LDKChannelFeatures *result;
4299    /**
4300     * A pointer to the contents in the error state.
4301     * Reading from this pointer when `result_ok` is set is undefined.
4302     */
4303    struct LDKDecodeError *err;
4304 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
4305
4306 /**
4307  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4308  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4309  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4310  */
4311 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
4312    /**
4313     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4314     * `err` or `result` depending on the state of `result_ok`.
4315     */
4316    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
4317    /**
4318     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4319     */
4320    bool result_ok;
4321 } LDKCResult_ChannelFeaturesDecodeErrorZ;
4322
4323
4324
4325 /**
4326  * Features used within an invoice.
4327  */
4328 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
4329    /**
4330     * A pointer to the opaque Rust object.
4331     * Nearly everywhere, inner must be non-null, however in places where
4332     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4333     */
4334    LDKnativeInvoiceFeatures *inner;
4335    /**
4336     * Indicates that this is the only struct which contains the same pointer.
4337     * Rust functions which take ownership of an object provided via an argument require
4338     * this to be true and invalidate the object pointed to by inner.
4339     */
4340    bool is_owned;
4341 } LDKInvoiceFeatures;
4342
4343 /**
4344  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
4345  */
4346 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
4347    /**
4348     * A pointer to the contents in the success state.
4349     * Reading from this pointer when `result_ok` is not set is undefined.
4350     */
4351    struct LDKInvoiceFeatures *result;
4352    /**
4353     * A pointer to the contents in the error state.
4354     * Reading from this pointer when `result_ok` is set is undefined.
4355     */
4356    struct LDKDecodeError *err;
4357 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
4358
4359 /**
4360  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4361  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4362  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4363  */
4364 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
4365    /**
4366     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4367     * `err` or `result` depending on the state of `result_ok`.
4368     */
4369    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
4370    /**
4371     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4372     */
4373    bool result_ok;
4374 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
4375
4376 /**
4377  * The contents of CResult_NetAddressu8Z
4378  */
4379 typedef union LDKCResult_NetAddressu8ZPtr {
4380    /**
4381     * A pointer to the contents in the success state.
4382     * Reading from this pointer when `result_ok` is not set is undefined.
4383     */
4384    struct LDKNetAddress *result;
4385    /**
4386     * A pointer to the contents in the error state.
4387     * Reading from this pointer when `result_ok` is set is undefined.
4388     */
4389    uint8_t *err;
4390 } LDKCResult_NetAddressu8ZPtr;
4391
4392 /**
4393  * A CResult_NetAddressu8Z represents the result of a fallible operation,
4394  * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
4395  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4396  */
4397 typedef struct LDKCResult_NetAddressu8Z {
4398    /**
4399     * The contents of this CResult_NetAddressu8Z, accessible via either
4400     * `err` or `result` depending on the state of `result_ok`.
4401     */
4402    union LDKCResult_NetAddressu8ZPtr contents;
4403    /**
4404     * Whether this CResult_NetAddressu8Z represents a success state.
4405     */
4406    bool result_ok;
4407 } LDKCResult_NetAddressu8Z;
4408
4409 /**
4410  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
4411  */
4412 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4413    /**
4414     * A pointer to the contents in the success state.
4415     * Reading from this pointer when `result_ok` is not set is undefined.
4416     */
4417    struct LDKCResult_NetAddressu8Z *result;
4418    /**
4419     * A pointer to the contents in the error state.
4420     * Reading from this pointer when `result_ok` is set is undefined.
4421     */
4422    struct LDKDecodeError *err;
4423 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
4424
4425 /**
4426  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
4427  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
4428  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4429  */
4430 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
4431    /**
4432     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
4433     * `err` or `result` depending on the state of `result_ok`.
4434     */
4435    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
4436    /**
4437     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
4438     */
4439    bool result_ok;
4440 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
4441
4442
4443
4444 /**
4445  * An update_add_htlc message to be sent or received from a peer
4446  */
4447 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
4448    /**
4449     * A pointer to the opaque Rust object.
4450     * Nearly everywhere, inner must be non-null, however in places where
4451     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4452     */
4453    LDKnativeUpdateAddHTLC *inner;
4454    /**
4455     * Indicates that this is the only struct which contains the same pointer.
4456     * Rust functions which take ownership of an object provided via an argument require
4457     * this to be true and invalidate the object pointed to by inner.
4458     */
4459    bool is_owned;
4460 } LDKUpdateAddHTLC;
4461
4462 /**
4463  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
4464  * This corresponds to std::vector in C++
4465  */
4466 typedef struct LDKCVec_UpdateAddHTLCZ {
4467    /**
4468     * The elements in the array.
4469     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4470     */
4471    struct LDKUpdateAddHTLC *data;
4472    /**
4473     * The number of elements pointed to by `data`.
4474     */
4475    uintptr_t datalen;
4476 } LDKCVec_UpdateAddHTLCZ;
4477
4478
4479
4480 /**
4481  * An update_fulfill_htlc message to be sent or received from a peer
4482  */
4483 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
4484    /**
4485     * A pointer to the opaque Rust object.
4486     * Nearly everywhere, inner must be non-null, however in places where
4487     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4488     */
4489    LDKnativeUpdateFulfillHTLC *inner;
4490    /**
4491     * Indicates that this is the only struct which contains the same pointer.
4492     * Rust functions which take ownership of an object provided via an argument require
4493     * this to be true and invalidate the object pointed to by inner.
4494     */
4495    bool is_owned;
4496 } LDKUpdateFulfillHTLC;
4497
4498 /**
4499  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
4500  * This corresponds to std::vector in C++
4501  */
4502 typedef struct LDKCVec_UpdateFulfillHTLCZ {
4503    /**
4504     * The elements in the array.
4505     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4506     */
4507    struct LDKUpdateFulfillHTLC *data;
4508    /**
4509     * The number of elements pointed to by `data`.
4510     */
4511    uintptr_t datalen;
4512 } LDKCVec_UpdateFulfillHTLCZ;
4513
4514
4515
4516 /**
4517  * An update_fail_htlc message to be sent or received from a peer
4518  */
4519 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
4520    /**
4521     * A pointer to the opaque Rust object.
4522     * Nearly everywhere, inner must be non-null, however in places where
4523     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4524     */
4525    LDKnativeUpdateFailHTLC *inner;
4526    /**
4527     * Indicates that this is the only struct which contains the same pointer.
4528     * Rust functions which take ownership of an object provided via an argument require
4529     * this to be true and invalidate the object pointed to by inner.
4530     */
4531    bool is_owned;
4532 } LDKUpdateFailHTLC;
4533
4534 /**
4535  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
4536  * This corresponds to std::vector in C++
4537  */
4538 typedef struct LDKCVec_UpdateFailHTLCZ {
4539    /**
4540     * The elements in the array.
4541     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4542     */
4543    struct LDKUpdateFailHTLC *data;
4544    /**
4545     * The number of elements pointed to by `data`.
4546     */
4547    uintptr_t datalen;
4548 } LDKCVec_UpdateFailHTLCZ;
4549
4550
4551
4552 /**
4553  * An update_fail_malformed_htlc message to be sent or received from a peer
4554  */
4555 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
4556    /**
4557     * A pointer to the opaque Rust object.
4558     * Nearly everywhere, inner must be non-null, however in places where
4559     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4560     */
4561    LDKnativeUpdateFailMalformedHTLC *inner;
4562    /**
4563     * Indicates that this is the only struct which contains the same pointer.
4564     * Rust functions which take ownership of an object provided via an argument require
4565     * this to be true and invalidate the object pointed to by inner.
4566     */
4567    bool is_owned;
4568 } LDKUpdateFailMalformedHTLC;
4569
4570 /**
4571  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
4572  * This corresponds to std::vector in C++
4573  */
4574 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
4575    /**
4576     * The elements in the array.
4577     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4578     */
4579    struct LDKUpdateFailMalformedHTLC *data;
4580    /**
4581     * The number of elements pointed to by `data`.
4582     */
4583    uintptr_t datalen;
4584 } LDKCVec_UpdateFailMalformedHTLCZ;
4585
4586 /**
4587  * The contents of CResult_AcceptChannelDecodeErrorZ
4588  */
4589 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
4590    /**
4591     * A pointer to the contents in the success state.
4592     * Reading from this pointer when `result_ok` is not set is undefined.
4593     */
4594    struct LDKAcceptChannel *result;
4595    /**
4596     * A pointer to the contents in the error state.
4597     * Reading from this pointer when `result_ok` is set is undefined.
4598     */
4599    struct LDKDecodeError *err;
4600 } LDKCResult_AcceptChannelDecodeErrorZPtr;
4601
4602 /**
4603  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
4604  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
4605  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4606  */
4607 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
4608    /**
4609     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
4610     * `err` or `result` depending on the state of `result_ok`.
4611     */
4612    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
4613    /**
4614     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
4615     */
4616    bool result_ok;
4617 } LDKCResult_AcceptChannelDecodeErrorZ;
4618
4619 /**
4620  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
4621  */
4622 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
4623    /**
4624     * A pointer to the contents in the success state.
4625     * Reading from this pointer when `result_ok` is not set is undefined.
4626     */
4627    struct LDKAnnouncementSignatures *result;
4628    /**
4629     * A pointer to the contents in the error state.
4630     * Reading from this pointer when `result_ok` is set is undefined.
4631     */
4632    struct LDKDecodeError *err;
4633 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
4634
4635 /**
4636  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
4637  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4638  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4639  */
4640 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
4641    /**
4642     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
4643     * `err` or `result` depending on the state of `result_ok`.
4644     */
4645    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
4646    /**
4647     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
4648     */
4649    bool result_ok;
4650 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
4651
4652 /**
4653  * The contents of CResult_ChannelReestablishDecodeErrorZ
4654  */
4655 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
4656    /**
4657     * A pointer to the contents in the success state.
4658     * Reading from this pointer when `result_ok` is not set is undefined.
4659     */
4660    struct LDKChannelReestablish *result;
4661    /**
4662     * A pointer to the contents in the error state.
4663     * Reading from this pointer when `result_ok` is set is undefined.
4664     */
4665    struct LDKDecodeError *err;
4666 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
4667
4668 /**
4669  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
4670  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
4671  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4672  */
4673 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
4674    /**
4675     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
4676     * `err` or `result` depending on the state of `result_ok`.
4677     */
4678    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
4679    /**
4680     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
4681     */
4682    bool result_ok;
4683 } LDKCResult_ChannelReestablishDecodeErrorZ;
4684
4685 /**
4686  * The contents of CResult_ClosingSignedDecodeErrorZ
4687  */
4688 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
4689    /**
4690     * A pointer to the contents in the success state.
4691     * Reading from this pointer when `result_ok` is not set is undefined.
4692     */
4693    struct LDKClosingSigned *result;
4694    /**
4695     * A pointer to the contents in the error state.
4696     * Reading from this pointer when `result_ok` is set is undefined.
4697     */
4698    struct LDKDecodeError *err;
4699 } LDKCResult_ClosingSignedDecodeErrorZPtr;
4700
4701 /**
4702  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
4703  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
4704  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4705  */
4706 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
4707    /**
4708     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
4709     * `err` or `result` depending on the state of `result_ok`.
4710     */
4711    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
4712    /**
4713     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
4714     */
4715    bool result_ok;
4716 } LDKCResult_ClosingSignedDecodeErrorZ;
4717
4718
4719
4720 /**
4721  * A commitment_signed message to be sent or received from a peer
4722  */
4723 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
4724    /**
4725     * A pointer to the opaque Rust object.
4726     * Nearly everywhere, inner must be non-null, however in places where
4727     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4728     */
4729    LDKnativeCommitmentSigned *inner;
4730    /**
4731     * Indicates that this is the only struct which contains the same pointer.
4732     * Rust functions which take ownership of an object provided via an argument require
4733     * this to be true and invalidate the object pointed to by inner.
4734     */
4735    bool is_owned;
4736 } LDKCommitmentSigned;
4737
4738 /**
4739  * The contents of CResult_CommitmentSignedDecodeErrorZ
4740  */
4741 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
4742    /**
4743     * A pointer to the contents in the success state.
4744     * Reading from this pointer when `result_ok` is not set is undefined.
4745     */
4746    struct LDKCommitmentSigned *result;
4747    /**
4748     * A pointer to the contents in the error state.
4749     * Reading from this pointer when `result_ok` is set is undefined.
4750     */
4751    struct LDKDecodeError *err;
4752 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
4753
4754 /**
4755  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
4756  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
4757  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4758  */
4759 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
4760    /**
4761     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
4762     * `err` or `result` depending on the state of `result_ok`.
4763     */
4764    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
4765    /**
4766     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
4767     */
4768    bool result_ok;
4769 } LDKCResult_CommitmentSignedDecodeErrorZ;
4770
4771 /**
4772  * The contents of CResult_FundingCreatedDecodeErrorZ
4773  */
4774 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
4775    /**
4776     * A pointer to the contents in the success state.
4777     * Reading from this pointer when `result_ok` is not set is undefined.
4778     */
4779    struct LDKFundingCreated *result;
4780    /**
4781     * A pointer to the contents in the error state.
4782     * Reading from this pointer when `result_ok` is set is undefined.
4783     */
4784    struct LDKDecodeError *err;
4785 } LDKCResult_FundingCreatedDecodeErrorZPtr;
4786
4787 /**
4788  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
4789  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
4790  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4791  */
4792 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
4793    /**
4794     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
4795     * `err` or `result` depending on the state of `result_ok`.
4796     */
4797    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
4798    /**
4799     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
4800     */
4801    bool result_ok;
4802 } LDKCResult_FundingCreatedDecodeErrorZ;
4803
4804 /**
4805  * The contents of CResult_FundingSignedDecodeErrorZ
4806  */
4807 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
4808    /**
4809     * A pointer to the contents in the success state.
4810     * Reading from this pointer when `result_ok` is not set is undefined.
4811     */
4812    struct LDKFundingSigned *result;
4813    /**
4814     * A pointer to the contents in the error state.
4815     * Reading from this pointer when `result_ok` is set is undefined.
4816     */
4817    struct LDKDecodeError *err;
4818 } LDKCResult_FundingSignedDecodeErrorZPtr;
4819
4820 /**
4821  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
4822  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
4823  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4824  */
4825 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
4826    /**
4827     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
4828     * `err` or `result` depending on the state of `result_ok`.
4829     */
4830    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
4831    /**
4832     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
4833     */
4834    bool result_ok;
4835 } LDKCResult_FundingSignedDecodeErrorZ;
4836
4837 /**
4838  * The contents of CResult_FundingLockedDecodeErrorZ
4839  */
4840 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
4841    /**
4842     * A pointer to the contents in the success state.
4843     * Reading from this pointer when `result_ok` is not set is undefined.
4844     */
4845    struct LDKFundingLocked *result;
4846    /**
4847     * A pointer to the contents in the error state.
4848     * Reading from this pointer when `result_ok` is set is undefined.
4849     */
4850    struct LDKDecodeError *err;
4851 } LDKCResult_FundingLockedDecodeErrorZPtr;
4852
4853 /**
4854  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
4855  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
4856  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4857  */
4858 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
4859    /**
4860     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
4861     * `err` or `result` depending on the state of `result_ok`.
4862     */
4863    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
4864    /**
4865     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
4866     */
4867    bool result_ok;
4868 } LDKCResult_FundingLockedDecodeErrorZ;
4869
4870
4871
4872 /**
4873  * An init message to be sent or received from a peer
4874  */
4875 typedef struct MUST_USE_STRUCT LDKInit {
4876    /**
4877     * A pointer to the opaque Rust object.
4878     * Nearly everywhere, inner must be non-null, however in places where
4879     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4880     */
4881    LDKnativeInit *inner;
4882    /**
4883     * Indicates that this is the only struct which contains the same pointer.
4884     * Rust functions which take ownership of an object provided via an argument require
4885     * this to be true and invalidate the object pointed to by inner.
4886     */
4887    bool is_owned;
4888 } LDKInit;
4889
4890 /**
4891  * The contents of CResult_InitDecodeErrorZ
4892  */
4893 typedef union LDKCResult_InitDecodeErrorZPtr {
4894    /**
4895     * A pointer to the contents in the success state.
4896     * Reading from this pointer when `result_ok` is not set is undefined.
4897     */
4898    struct LDKInit *result;
4899    /**
4900     * A pointer to the contents in the error state.
4901     * Reading from this pointer when `result_ok` is set is undefined.
4902     */
4903    struct LDKDecodeError *err;
4904 } LDKCResult_InitDecodeErrorZPtr;
4905
4906 /**
4907  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
4908  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
4909  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4910  */
4911 typedef struct LDKCResult_InitDecodeErrorZ {
4912    /**
4913     * The contents of this CResult_InitDecodeErrorZ, accessible via either
4914     * `err` or `result` depending on the state of `result_ok`.
4915     */
4916    union LDKCResult_InitDecodeErrorZPtr contents;
4917    /**
4918     * Whether this CResult_InitDecodeErrorZ represents a success state.
4919     */
4920    bool result_ok;
4921 } LDKCResult_InitDecodeErrorZ;
4922
4923 /**
4924  * The contents of CResult_OpenChannelDecodeErrorZ
4925  */
4926 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
4927    /**
4928     * A pointer to the contents in the success state.
4929     * Reading from this pointer when `result_ok` is not set is undefined.
4930     */
4931    struct LDKOpenChannel *result;
4932    /**
4933     * A pointer to the contents in the error state.
4934     * Reading from this pointer when `result_ok` is set is undefined.
4935     */
4936    struct LDKDecodeError *err;
4937 } LDKCResult_OpenChannelDecodeErrorZPtr;
4938
4939 /**
4940  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
4941  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
4942  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4943  */
4944 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
4945    /**
4946     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
4947     * `err` or `result` depending on the state of `result_ok`.
4948     */
4949    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
4950    /**
4951     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
4952     */
4953    bool result_ok;
4954 } LDKCResult_OpenChannelDecodeErrorZ;
4955
4956 /**
4957  * The contents of CResult_RevokeAndACKDecodeErrorZ
4958  */
4959 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
4960    /**
4961     * A pointer to the contents in the success state.
4962     * Reading from this pointer when `result_ok` is not set is undefined.
4963     */
4964    struct LDKRevokeAndACK *result;
4965    /**
4966     * A pointer to the contents in the error state.
4967     * Reading from this pointer when `result_ok` is set is undefined.
4968     */
4969    struct LDKDecodeError *err;
4970 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
4971
4972 /**
4973  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
4974  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
4975  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4976  */
4977 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
4978    /**
4979     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
4980     * `err` or `result` depending on the state of `result_ok`.
4981     */
4982    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
4983    /**
4984     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
4985     */
4986    bool result_ok;
4987 } LDKCResult_RevokeAndACKDecodeErrorZ;
4988
4989 /**
4990  * The contents of CResult_ShutdownDecodeErrorZ
4991  */
4992 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
4993    /**
4994     * A pointer to the contents in the success state.
4995     * Reading from this pointer when `result_ok` is not set is undefined.
4996     */
4997    struct LDKShutdown *result;
4998    /**
4999     * A pointer to the contents in the error state.
5000     * Reading from this pointer when `result_ok` is set is undefined.
5001     */
5002    struct LDKDecodeError *err;
5003 } LDKCResult_ShutdownDecodeErrorZPtr;
5004
5005 /**
5006  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
5007  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
5008  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5009  */
5010 typedef struct LDKCResult_ShutdownDecodeErrorZ {
5011    /**
5012     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
5013     * `err` or `result` depending on the state of `result_ok`.
5014     */
5015    union LDKCResult_ShutdownDecodeErrorZPtr contents;
5016    /**
5017     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
5018     */
5019    bool result_ok;
5020 } LDKCResult_ShutdownDecodeErrorZ;
5021
5022 /**
5023  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
5024  */
5025 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
5026    /**
5027     * A pointer to the contents in the success state.
5028     * Reading from this pointer when `result_ok` is not set is undefined.
5029     */
5030    struct LDKUpdateFailHTLC *result;
5031    /**
5032     * A pointer to the contents in the error state.
5033     * Reading from this pointer when `result_ok` is set is undefined.
5034     */
5035    struct LDKDecodeError *err;
5036 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
5037
5038 /**
5039  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
5040  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5041  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5042  */
5043 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
5044    /**
5045     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
5046     * `err` or `result` depending on the state of `result_ok`.
5047     */
5048    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
5049    /**
5050     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
5051     */
5052    bool result_ok;
5053 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
5054
5055 /**
5056  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
5057  */
5058 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5059    /**
5060     * A pointer to the contents in the success state.
5061     * Reading from this pointer when `result_ok` is not set is undefined.
5062     */
5063    struct LDKUpdateFailMalformedHTLC *result;
5064    /**
5065     * A pointer to the contents in the error state.
5066     * Reading from this pointer when `result_ok` is set is undefined.
5067     */
5068    struct LDKDecodeError *err;
5069 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
5070
5071 /**
5072  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
5073  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5074  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5075  */
5076 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
5077    /**
5078     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
5079     * `err` or `result` depending on the state of `result_ok`.
5080     */
5081    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
5082    /**
5083     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
5084     */
5085    bool result_ok;
5086 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
5087
5088
5089
5090 /**
5091  * An update_fee message to be sent or received from a peer
5092  */
5093 typedef struct MUST_USE_STRUCT LDKUpdateFee {
5094    /**
5095     * A pointer to the opaque Rust object.
5096     * Nearly everywhere, inner must be non-null, however in places where
5097     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5098     */
5099    LDKnativeUpdateFee *inner;
5100    /**
5101     * Indicates that this is the only struct which contains the same pointer.
5102     * Rust functions which take ownership of an object provided via an argument require
5103     * this to be true and invalidate the object pointed to by inner.
5104     */
5105    bool is_owned;
5106 } LDKUpdateFee;
5107
5108 /**
5109  * The contents of CResult_UpdateFeeDecodeErrorZ
5110  */
5111 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
5112    /**
5113     * A pointer to the contents in the success state.
5114     * Reading from this pointer when `result_ok` is not set is undefined.
5115     */
5116    struct LDKUpdateFee *result;
5117    /**
5118     * A pointer to the contents in the error state.
5119     * Reading from this pointer when `result_ok` is set is undefined.
5120     */
5121    struct LDKDecodeError *err;
5122 } LDKCResult_UpdateFeeDecodeErrorZPtr;
5123
5124 /**
5125  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
5126  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
5127  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5128  */
5129 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
5130    /**
5131     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
5132     * `err` or `result` depending on the state of `result_ok`.
5133     */
5134    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
5135    /**
5136     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
5137     */
5138    bool result_ok;
5139 } LDKCResult_UpdateFeeDecodeErrorZ;
5140
5141 /**
5142  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
5143  */
5144 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
5145    /**
5146     * A pointer to the contents in the success state.
5147     * Reading from this pointer when `result_ok` is not set is undefined.
5148     */
5149    struct LDKUpdateFulfillHTLC *result;
5150    /**
5151     * A pointer to the contents in the error state.
5152     * Reading from this pointer when `result_ok` is set is undefined.
5153     */
5154    struct LDKDecodeError *err;
5155 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
5156
5157 /**
5158  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
5159  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5160  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5161  */
5162 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
5163    /**
5164     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
5165     * `err` or `result` depending on the state of `result_ok`.
5166     */
5167    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
5168    /**
5169     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
5170     */
5171    bool result_ok;
5172 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
5173
5174 /**
5175  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
5176  */
5177 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
5178    /**
5179     * A pointer to the contents in the success state.
5180     * Reading from this pointer when `result_ok` is not set is undefined.
5181     */
5182    struct LDKUpdateAddHTLC *result;
5183    /**
5184     * A pointer to the contents in the error state.
5185     * Reading from this pointer when `result_ok` is set is undefined.
5186     */
5187    struct LDKDecodeError *err;
5188 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
5189
5190 /**
5191  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
5192  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5193  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5194  */
5195 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
5196    /**
5197     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
5198     * `err` or `result` depending on the state of `result_ok`.
5199     */
5200    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
5201    /**
5202     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
5203     */
5204    bool result_ok;
5205 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
5206
5207
5208
5209 /**
5210  * A ping message to be sent or received from a peer
5211  */
5212 typedef struct MUST_USE_STRUCT LDKPing {
5213    /**
5214     * A pointer to the opaque Rust object.
5215     * Nearly everywhere, inner must be non-null, however in places where
5216     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5217     */
5218    LDKnativePing *inner;
5219    /**
5220     * Indicates that this is the only struct which contains the same pointer.
5221     * Rust functions which take ownership of an object provided via an argument require
5222     * this to be true and invalidate the object pointed to by inner.
5223     */
5224    bool is_owned;
5225 } LDKPing;
5226
5227 /**
5228  * The contents of CResult_PingDecodeErrorZ
5229  */
5230 typedef union LDKCResult_PingDecodeErrorZPtr {
5231    /**
5232     * A pointer to the contents in the success state.
5233     * Reading from this pointer when `result_ok` is not set is undefined.
5234     */
5235    struct LDKPing *result;
5236    /**
5237     * A pointer to the contents in the error state.
5238     * Reading from this pointer when `result_ok` is set is undefined.
5239     */
5240    struct LDKDecodeError *err;
5241 } LDKCResult_PingDecodeErrorZPtr;
5242
5243 /**
5244  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
5245  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
5246  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5247  */
5248 typedef struct LDKCResult_PingDecodeErrorZ {
5249    /**
5250     * The contents of this CResult_PingDecodeErrorZ, accessible via either
5251     * `err` or `result` depending on the state of `result_ok`.
5252     */
5253    union LDKCResult_PingDecodeErrorZPtr contents;
5254    /**
5255     * Whether this CResult_PingDecodeErrorZ represents a success state.
5256     */
5257    bool result_ok;
5258 } LDKCResult_PingDecodeErrorZ;
5259
5260
5261
5262 /**
5263  * A pong message to be sent or received from a peer
5264  */
5265 typedef struct MUST_USE_STRUCT LDKPong {
5266    /**
5267     * A pointer to the opaque Rust object.
5268     * Nearly everywhere, inner must be non-null, however in places where
5269     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5270     */
5271    LDKnativePong *inner;
5272    /**
5273     * Indicates that this is the only struct which contains the same pointer.
5274     * Rust functions which take ownership of an object provided via an argument require
5275     * this to be true and invalidate the object pointed to by inner.
5276     */
5277    bool is_owned;
5278 } LDKPong;
5279
5280 /**
5281  * The contents of CResult_PongDecodeErrorZ
5282  */
5283 typedef union LDKCResult_PongDecodeErrorZPtr {
5284    /**
5285     * A pointer to the contents in the success state.
5286     * Reading from this pointer when `result_ok` is not set is undefined.
5287     */
5288    struct LDKPong *result;
5289    /**
5290     * A pointer to the contents in the error state.
5291     * Reading from this pointer when `result_ok` is set is undefined.
5292     */
5293    struct LDKDecodeError *err;
5294 } LDKCResult_PongDecodeErrorZPtr;
5295
5296 /**
5297  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
5298  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
5299  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5300  */
5301 typedef struct LDKCResult_PongDecodeErrorZ {
5302    /**
5303     * The contents of this CResult_PongDecodeErrorZ, accessible via either
5304     * `err` or `result` depending on the state of `result_ok`.
5305     */
5306    union LDKCResult_PongDecodeErrorZPtr contents;
5307    /**
5308     * Whether this CResult_PongDecodeErrorZ represents a success state.
5309     */
5310    bool result_ok;
5311 } LDKCResult_PongDecodeErrorZ;
5312
5313 /**
5314  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
5315  */
5316 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
5317    /**
5318     * A pointer to the contents in the success state.
5319     * Reading from this pointer when `result_ok` is not set is undefined.
5320     */
5321    struct LDKUnsignedChannelAnnouncement *result;
5322    /**
5323     * A pointer to the contents in the error state.
5324     * Reading from this pointer when `result_ok` is set is undefined.
5325     */
5326    struct LDKDecodeError *err;
5327 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
5328
5329 /**
5330  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
5331  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
5332  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5333  */
5334 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
5335    /**
5336     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
5337     * `err` or `result` depending on the state of `result_ok`.
5338     */
5339    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
5340    /**
5341     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
5342     */
5343    bool result_ok;
5344 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
5345
5346 /**
5347  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
5348  */
5349 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
5350    /**
5351     * A pointer to the contents in the success state.
5352     * Reading from this pointer when `result_ok` is not set is undefined.
5353     */
5354    struct LDKChannelAnnouncement *result;
5355    /**
5356     * A pointer to the contents in the error state.
5357     * Reading from this pointer when `result_ok` is set is undefined.
5358     */
5359    struct LDKDecodeError *err;
5360 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
5361
5362 /**
5363  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
5364  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
5365  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5366  */
5367 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
5368    /**
5369     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
5370     * `err` or `result` depending on the state of `result_ok`.
5371     */
5372    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
5373    /**
5374     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
5375     */
5376    bool result_ok;
5377 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
5378
5379
5380
5381 /**
5382  * The unsigned part of a channel_update
5383  */
5384 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
5385    /**
5386     * A pointer to the opaque Rust object.
5387     * Nearly everywhere, inner must be non-null, however in places where
5388     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5389     */
5390    LDKnativeUnsignedChannelUpdate *inner;
5391    /**
5392     * Indicates that this is the only struct which contains the same pointer.
5393     * Rust functions which take ownership of an object provided via an argument require
5394     * this to be true and invalidate the object pointed to by inner.
5395     */
5396    bool is_owned;
5397 } LDKUnsignedChannelUpdate;
5398
5399 /**
5400  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
5401  */
5402 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
5403    /**
5404     * A pointer to the contents in the success state.
5405     * Reading from this pointer when `result_ok` is not set is undefined.
5406     */
5407    struct LDKUnsignedChannelUpdate *result;
5408    /**
5409     * A pointer to the contents in the error state.
5410     * Reading from this pointer when `result_ok` is set is undefined.
5411     */
5412    struct LDKDecodeError *err;
5413 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
5414
5415 /**
5416  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
5417  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5418  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5419  */
5420 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
5421    /**
5422     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
5423     * `err` or `result` depending on the state of `result_ok`.
5424     */
5425    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
5426    /**
5427     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
5428     */
5429    bool result_ok;
5430 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
5431
5432 /**
5433  * The contents of CResult_ChannelUpdateDecodeErrorZ
5434  */
5435 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
5436    /**
5437     * A pointer to the contents in the success state.
5438     * Reading from this pointer when `result_ok` is not set is undefined.
5439     */
5440    struct LDKChannelUpdate *result;
5441    /**
5442     * A pointer to the contents in the error state.
5443     * Reading from this pointer when `result_ok` is set is undefined.
5444     */
5445    struct LDKDecodeError *err;
5446 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
5447
5448 /**
5449  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
5450  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5451  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5452  */
5453 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
5454    /**
5455     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
5456     * `err` or `result` depending on the state of `result_ok`.
5457     */
5458    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
5459    /**
5460     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
5461     */
5462    bool result_ok;
5463 } LDKCResult_ChannelUpdateDecodeErrorZ;
5464
5465 /**
5466  * The contents of CResult_ErrorMessageDecodeErrorZ
5467  */
5468 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
5469    /**
5470     * A pointer to the contents in the success state.
5471     * Reading from this pointer when `result_ok` is not set is undefined.
5472     */
5473    struct LDKErrorMessage *result;
5474    /**
5475     * A pointer to the contents in the error state.
5476     * Reading from this pointer when `result_ok` is set is undefined.
5477     */
5478    struct LDKDecodeError *err;
5479 } LDKCResult_ErrorMessageDecodeErrorZPtr;
5480
5481 /**
5482  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
5483  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
5484  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5485  */
5486 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
5487    /**
5488     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
5489     * `err` or `result` depending on the state of `result_ok`.
5490     */
5491    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
5492    /**
5493     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
5494     */
5495    bool result_ok;
5496 } LDKCResult_ErrorMessageDecodeErrorZ;
5497
5498
5499
5500 /**
5501  * The unsigned part of a node_announcement
5502  */
5503 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
5504    /**
5505     * A pointer to the opaque Rust object.
5506     * Nearly everywhere, inner must be non-null, however in places where
5507     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5508     */
5509    LDKnativeUnsignedNodeAnnouncement *inner;
5510    /**
5511     * Indicates that this is the only struct which contains the same pointer.
5512     * Rust functions which take ownership of an object provided via an argument require
5513     * this to be true and invalidate the object pointed to by inner.
5514     */
5515    bool is_owned;
5516 } LDKUnsignedNodeAnnouncement;
5517
5518 /**
5519  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
5520  */
5521 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
5522    /**
5523     * A pointer to the contents in the success state.
5524     * Reading from this pointer when `result_ok` is not set is undefined.
5525     */
5526    struct LDKUnsignedNodeAnnouncement *result;
5527    /**
5528     * A pointer to the contents in the error state.
5529     * Reading from this pointer when `result_ok` is set is undefined.
5530     */
5531    struct LDKDecodeError *err;
5532 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
5533
5534 /**
5535  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
5536  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
5537  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5538  */
5539 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
5540    /**
5541     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
5542     * `err` or `result` depending on the state of `result_ok`.
5543     */
5544    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
5545    /**
5546     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
5547     */
5548    bool result_ok;
5549 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
5550
5551 /**
5552  * The contents of CResult_NodeAnnouncementDecodeErrorZ
5553  */
5554 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
5555    /**
5556     * A pointer to the contents in the success state.
5557     * Reading from this pointer when `result_ok` is not set is undefined.
5558     */
5559    struct LDKNodeAnnouncement *result;
5560    /**
5561     * A pointer to the contents in the error state.
5562     * Reading from this pointer when `result_ok` is set is undefined.
5563     */
5564    struct LDKDecodeError *err;
5565 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
5566
5567 /**
5568  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
5569  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
5570  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5571  */
5572 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
5573    /**
5574     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
5575     * `err` or `result` depending on the state of `result_ok`.
5576     */
5577    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
5578    /**
5579     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
5580     */
5581    bool result_ok;
5582 } LDKCResult_NodeAnnouncementDecodeErrorZ;
5583
5584 /**
5585  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
5586  */
5587 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
5588    /**
5589     * A pointer to the contents in the success state.
5590     * Reading from this pointer when `result_ok` is not set is undefined.
5591     */
5592    struct LDKQueryShortChannelIds *result;
5593    /**
5594     * A pointer to the contents in the error state.
5595     * Reading from this pointer when `result_ok` is set is undefined.
5596     */
5597    struct LDKDecodeError *err;
5598 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
5599
5600 /**
5601  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
5602  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
5603  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5604  */
5605 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
5606    /**
5607     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
5608     * `err` or `result` depending on the state of `result_ok`.
5609     */
5610    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
5611    /**
5612     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
5613     */
5614    bool result_ok;
5615 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
5616
5617
5618
5619 /**
5620  * A reply_short_channel_ids_end message is sent as a reply to a
5621  * query_short_channel_ids message. The query recipient makes a best
5622  * effort to respond based on their local network view which may not be
5623  * a perfect view of the network.
5624  */
5625 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
5626    /**
5627     * A pointer to the opaque Rust object.
5628     * Nearly everywhere, inner must be non-null, however in places where
5629     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5630     */
5631    LDKnativeReplyShortChannelIdsEnd *inner;
5632    /**
5633     * Indicates that this is the only struct which contains the same pointer.
5634     * Rust functions which take ownership of an object provided via an argument require
5635     * this to be true and invalidate the object pointed to by inner.
5636     */
5637    bool is_owned;
5638 } LDKReplyShortChannelIdsEnd;
5639
5640 /**
5641  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
5642  */
5643 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
5644    /**
5645     * A pointer to the contents in the success state.
5646     * Reading from this pointer when `result_ok` is not set is undefined.
5647     */
5648    struct LDKReplyShortChannelIdsEnd *result;
5649    /**
5650     * A pointer to the contents in the error state.
5651     * Reading from this pointer when `result_ok` is set is undefined.
5652     */
5653    struct LDKDecodeError *err;
5654 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
5655
5656 /**
5657  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
5658  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
5659  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5660  */
5661 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
5662    /**
5663     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
5664     * `err` or `result` depending on the state of `result_ok`.
5665     */
5666    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
5667    /**
5668     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
5669     */
5670    bool result_ok;
5671 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
5672
5673 /**
5674  * The contents of CResult_QueryChannelRangeDecodeErrorZ
5675  */
5676 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
5677    /**
5678     * A pointer to the contents in the success state.
5679     * Reading from this pointer when `result_ok` is not set is undefined.
5680     */
5681    struct LDKQueryChannelRange *result;
5682    /**
5683     * A pointer to the contents in the error state.
5684     * Reading from this pointer when `result_ok` is set is undefined.
5685     */
5686    struct LDKDecodeError *err;
5687 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
5688
5689 /**
5690  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
5691  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
5692  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5693  */
5694 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
5695    /**
5696     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
5697     * `err` or `result` depending on the state of `result_ok`.
5698     */
5699    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
5700    /**
5701     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
5702     */
5703    bool result_ok;
5704 } LDKCResult_QueryChannelRangeDecodeErrorZ;
5705
5706 /**
5707  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
5708  */
5709 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
5710    /**
5711     * A pointer to the contents in the success state.
5712     * Reading from this pointer when `result_ok` is not set is undefined.
5713     */
5714    struct LDKReplyChannelRange *result;
5715    /**
5716     * A pointer to the contents in the error state.
5717     * Reading from this pointer when `result_ok` is set is undefined.
5718     */
5719    struct LDKDecodeError *err;
5720 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
5721
5722 /**
5723  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
5724  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
5725  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5726  */
5727 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
5728    /**
5729     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
5730     * `err` or `result` depending on the state of `result_ok`.
5731     */
5732    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
5733    /**
5734     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
5735     */
5736    bool result_ok;
5737 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
5738
5739
5740
5741 /**
5742  * A gossip_timestamp_filter message is used by a node to request
5743  * gossip relay for messages in the requested time range when the
5744  * gossip_queries feature has been negotiated.
5745  */
5746 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
5747    /**
5748     * A pointer to the opaque Rust object.
5749     * Nearly everywhere, inner must be non-null, however in places where
5750     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5751     */
5752    LDKnativeGossipTimestampFilter *inner;
5753    /**
5754     * Indicates that this is the only struct which contains the same pointer.
5755     * Rust functions which take ownership of an object provided via an argument require
5756     * this to be true and invalidate the object pointed to by inner.
5757     */
5758    bool is_owned;
5759 } LDKGossipTimestampFilter;
5760
5761 /**
5762  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
5763  */
5764 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
5765    /**
5766     * A pointer to the contents in the success state.
5767     * Reading from this pointer when `result_ok` is not set is undefined.
5768     */
5769    struct LDKGossipTimestampFilter *result;
5770    /**
5771     * A pointer to the contents in the error state.
5772     * Reading from this pointer when `result_ok` is set is undefined.
5773     */
5774    struct LDKDecodeError *err;
5775 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
5776
5777 /**
5778  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
5779  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
5780  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5781  */
5782 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
5783    /**
5784     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
5785     * `err` or `result` depending on the state of `result_ok`.
5786     */
5787    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
5788    /**
5789     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
5790     */
5791    bool result_ok;
5792 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
5793
5794 /**
5795  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
5796  */
5797 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
5798    /**
5799     * A pointer to the contents in the success state.
5800     * Reading from this pointer when `result_ok` is not set is undefined.
5801     */
5802    struct LDKSpendableOutputDescriptor *result;
5803    /**
5804     * A pointer to the contents in the error state.
5805     * Reading from this pointer when `result_ok` is set is undefined.
5806     */
5807    struct LDKDecodeError *err;
5808 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
5809
5810 /**
5811  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5812  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5813  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5814  */
5815 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
5816    /**
5817     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
5818     * `err` or `result` depending on the state of `result_ok`.
5819     */
5820    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
5821    /**
5822     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
5823     */
5824    bool result_ok;
5825 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
5826
5827 /**
5828  * The contents of CResult_SignDecodeErrorZ
5829  */
5830 typedef union LDKCResult_SignDecodeErrorZPtr {
5831    /**
5832     * A pointer to the contents in the success state.
5833     * Reading from this pointer when `result_ok` is not set is undefined.
5834     */
5835    struct LDKSign *result;
5836    /**
5837     * A pointer to the contents in the error state.
5838     * Reading from this pointer when `result_ok` is set is undefined.
5839     */
5840    struct LDKDecodeError *err;
5841 } LDKCResult_SignDecodeErrorZPtr;
5842
5843 /**
5844  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5845  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5846  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5847  */
5848 typedef struct LDKCResult_SignDecodeErrorZ {
5849    /**
5850     * The contents of this CResult_SignDecodeErrorZ, accessible via either
5851     * `err` or `result` depending on the state of `result_ok`.
5852     */
5853    union LDKCResult_SignDecodeErrorZPtr contents;
5854    /**
5855     * Whether this CResult_SignDecodeErrorZ represents a success state.
5856     */
5857    bool result_ok;
5858 } LDKCResult_SignDecodeErrorZ;
5859
5860 /**
5861  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5862  * This corresponds to std::vector in C++
5863  */
5864 typedef struct LDKCVec_CVec_u8ZZ {
5865    /**
5866     * The elements in the array.
5867     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5868     */
5869    struct LDKCVec_u8Z *data;
5870    /**
5871     * The number of elements pointed to by `data`.
5872     */
5873    uintptr_t datalen;
5874 } LDKCVec_CVec_u8ZZ;
5875
5876 /**
5877  * The contents of CResult_CVec_CVec_u8ZZNoneZ
5878  */
5879 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
5880    /**
5881     * A pointer to the contents in the success state.
5882     * Reading from this pointer when `result_ok` is not set is undefined.
5883     */
5884    struct LDKCVec_CVec_u8ZZ *result;
5885    /**
5886     * Note that this value is always NULL, as there are no contents in the Err variant
5887     */
5888    void *err;
5889 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
5890
5891 /**
5892  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5893  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5894  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5895  */
5896 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
5897    /**
5898     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5899     * `err` or `result` depending on the state of `result_ok`.
5900     */
5901    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
5902    /**
5903     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5904     */
5905    bool result_ok;
5906 } LDKCResult_CVec_CVec_u8ZZNoneZ;
5907
5908
5909
5910 /**
5911  * A simple implementation of Sign that just keeps the private keys in memory.
5912  *
5913  * This implementation performs no policy checks and is insufficient by itself as
5914  * a secure external signer.
5915  */
5916 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
5917    /**
5918     * A pointer to the opaque Rust object.
5919     * Nearly everywhere, inner must be non-null, however in places where
5920     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5921     */
5922    LDKnativeInMemorySigner *inner;
5923    /**
5924     * Indicates that this is the only struct which contains the same pointer.
5925     * Rust functions which take ownership of an object provided via an argument require
5926     * this to be true and invalidate the object pointed to by inner.
5927     */
5928    bool is_owned;
5929 } LDKInMemorySigner;
5930
5931 /**
5932  * The contents of CResult_InMemorySignerDecodeErrorZ
5933  */
5934 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
5935    /**
5936     * A pointer to the contents in the success state.
5937     * Reading from this pointer when `result_ok` is not set is undefined.
5938     */
5939    struct LDKInMemorySigner *result;
5940    /**
5941     * A pointer to the contents in the error state.
5942     * Reading from this pointer when `result_ok` is set is undefined.
5943     */
5944    struct LDKDecodeError *err;
5945 } LDKCResult_InMemorySignerDecodeErrorZPtr;
5946
5947 /**
5948  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5949  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5950  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5951  */
5952 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
5953    /**
5954     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5955     * `err` or `result` depending on the state of `result_ok`.
5956     */
5957    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
5958    /**
5959     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5960     */
5961    bool result_ok;
5962 } LDKCResult_InMemorySignerDecodeErrorZ;
5963
5964 /**
5965  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5966  * This corresponds to std::vector in C++
5967  */
5968 typedef struct LDKCVec_TxOutZ {
5969    /**
5970     * The elements in the array.
5971     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5972     */
5973    struct LDKTxOut *data;
5974    /**
5975     * The number of elements pointed to by `data`.
5976     */
5977    uintptr_t datalen;
5978 } LDKCVec_TxOutZ;
5979
5980 /**
5981  * The contents of CResult_TransactionNoneZ
5982  */
5983 typedef union LDKCResult_TransactionNoneZPtr {
5984    /**
5985     * A pointer to the contents in the success state.
5986     * Reading from this pointer when `result_ok` is not set is undefined.
5987     */
5988    struct LDKTransaction *result;
5989    /**
5990     * Note that this value is always NULL, as there are no contents in the Err variant
5991     */
5992    void *err;
5993 } LDKCResult_TransactionNoneZPtr;
5994
5995 /**
5996  * A CResult_TransactionNoneZ represents the result of a fallible operation,
5997  * containing a crate::c_types::Transaction on success and a () on failure.
5998  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5999  */
6000 typedef struct LDKCResult_TransactionNoneZ {
6001    /**
6002     * The contents of this CResult_TransactionNoneZ, accessible via either
6003     * `err` or `result` depending on the state of `result_ok`.
6004     */
6005    union LDKCResult_TransactionNoneZPtr contents;
6006    /**
6007     * Whether this CResult_TransactionNoneZ represents a success state.
6008     */
6009    bool result_ok;
6010 } LDKCResult_TransactionNoneZ;
6011
6012 /**
6013  * The contents of CResult_NoneErrorZ
6014  */
6015 typedef union LDKCResult_NoneErrorZPtr {
6016    /**
6017     * Note that this value is always NULL, as there are no contents in the OK variant
6018     */
6019    void *result;
6020    /**
6021     * A pointer to the contents in the error state.
6022     * Reading from this pointer when `result_ok` is set is undefined.
6023     */
6024    enum LDKIOError *err;
6025 } LDKCResult_NoneErrorZPtr;
6026
6027 /**
6028  * A CResult_NoneErrorZ represents the result of a fallible operation,
6029  * containing a () on success and a crate::c_types::IOError on failure.
6030  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6031  */
6032 typedef struct LDKCResult_NoneErrorZ {
6033    /**
6034     * The contents of this CResult_NoneErrorZ, accessible via either
6035     * `err` or `result` depending on the state of `result_ok`.
6036     */
6037    union LDKCResult_NoneErrorZPtr contents;
6038    /**
6039     * Whether this CResult_NoneErrorZ represents a success state.
6040     */
6041    bool result_ok;
6042 } LDKCResult_NoneErrorZ;
6043
6044 /**
6045  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
6046  * This corresponds to std::vector in C++
6047  */
6048 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
6049    /**
6050     * The elements in the array.
6051     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6052     */
6053    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
6054    /**
6055     * The number of elements pointed to by `data`.
6056     */
6057    uintptr_t datalen;
6058 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
6059
6060 /**
6061  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
6062  */
6063 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6064    /**
6065     * A pointer to the contents in the success state.
6066     * Reading from this pointer when `result_ok` is not set is undefined.
6067     */
6068    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
6069    /**
6070     * A pointer to the contents in the error state.
6071     * Reading from this pointer when `result_ok` is set is undefined.
6072     */
6073    enum LDKIOError *err;
6074 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
6075
6076 /**
6077  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
6078  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
6079  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6080  */
6081 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6082    /**
6083     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
6084     * `err` or `result` depending on the state of `result_ok`.
6085     */
6086    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
6087    /**
6088     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
6089     */
6090    bool result_ok;
6091 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
6092
6093 /**
6094  * A Rust str object, ie a reference to a UTF8-valid string.
6095  * This is *not* null-terminated so cannot be used directly as a C string!
6096  */
6097 typedef struct LDKStr {
6098    /**
6099     * A pointer to the string's bytes, in UTF8 encoding
6100     */
6101    const uint8_t *chars;
6102    /**
6103     * The number of bytes (not characters!) pointed to by `chars`
6104     */
6105    uintptr_t len;
6106 } LDKStr;
6107
6108 /**
6109  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
6110  * too-high values)
6111  */
6112 typedef enum LDKAPIError_Tag {
6113    /**
6114     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
6115     * are documented, but generally indicates some precondition of a function was violated.
6116     */
6117    LDKAPIError_APIMisuseError,
6118    /**
6119     * Due to a high feerate, we were unable to complete the request.
6120     * For example, this may be returned if the feerate implies we cannot open a channel at the
6121     * requested value, but opening a larger channel would succeed.
6122     */
6123    LDKAPIError_FeeRateTooHigh,
6124    /**
6125     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
6126     * too-many-hops, etc).
6127     */
6128    LDKAPIError_RouteError,
6129    /**
6130     * We were unable to complete the request as the Channel required to do so is unable to
6131     * complete the request (or was not found). This can take many forms, including disconnected
6132     * peer, channel at capacity, channel shutting down, etc.
6133     */
6134    LDKAPIError_ChannelUnavailable,
6135    /**
6136     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
6137     * attempted action to fail.
6138     */
6139    LDKAPIError_MonitorUpdateFailed,
6140    /**
6141     * Must be last for serialization purposes
6142     */
6143    LDKAPIError_Sentinel,
6144 } LDKAPIError_Tag;
6145
6146 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
6147    /**
6148     * A human-readable error message
6149     */
6150    struct LDKCVec_u8Z err;
6151 } LDKAPIError_LDKAPIMisuseError_Body;
6152
6153 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
6154    /**
6155     * A human-readable error message
6156     */
6157    struct LDKCVec_u8Z err;
6158    /**
6159     * The feerate which was too high.
6160     */
6161    uint32_t feerate;
6162 } LDKAPIError_LDKFeeRateTooHigh_Body;
6163
6164 typedef struct LDKAPIError_LDKRouteError_Body {
6165    /**
6166     * A human-readable error message
6167     */
6168    struct LDKStr err;
6169 } LDKAPIError_LDKRouteError_Body;
6170
6171 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
6172    /**
6173     * A human-readable error message
6174     */
6175    struct LDKCVec_u8Z err;
6176 } LDKAPIError_LDKChannelUnavailable_Body;
6177
6178 typedef struct MUST_USE_STRUCT LDKAPIError {
6179    LDKAPIError_Tag tag;
6180    union {
6181       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
6182       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
6183       LDKAPIError_LDKRouteError_Body route_error;
6184       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
6185    };
6186 } LDKAPIError;
6187
6188 /**
6189  * The contents of CResult_NoneAPIErrorZ
6190  */
6191 typedef union LDKCResult_NoneAPIErrorZPtr {
6192    /**
6193     * Note that this value is always NULL, as there are no contents in the OK variant
6194     */
6195    void *result;
6196    /**
6197     * A pointer to the contents in the error state.
6198     * Reading from this pointer when `result_ok` is set is undefined.
6199     */
6200    struct LDKAPIError *err;
6201 } LDKCResult_NoneAPIErrorZPtr;
6202
6203 /**
6204  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6205  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
6206  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6207  */
6208 typedef struct LDKCResult_NoneAPIErrorZ {
6209    /**
6210     * The contents of this CResult_NoneAPIErrorZ, accessible via either
6211     * `err` or `result` depending on the state of `result_ok`.
6212     */
6213    union LDKCResult_NoneAPIErrorZPtr contents;
6214    /**
6215     * Whether this CResult_NoneAPIErrorZ represents a success state.
6216     */
6217    bool result_ok;
6218 } LDKCResult_NoneAPIErrorZ;
6219
6220 /**
6221  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6222  * This corresponds to std::vector in C++
6223  */
6224 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
6225    /**
6226     * The elements in the array.
6227     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6228     */
6229    struct LDKCResult_NoneAPIErrorZ *data;
6230    /**
6231     * The number of elements pointed to by `data`.
6232     */
6233    uintptr_t datalen;
6234 } LDKCVec_CResult_NoneAPIErrorZZ;
6235
6236 /**
6237  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6238  * This corresponds to std::vector in C++
6239  */
6240 typedef struct LDKCVec_APIErrorZ {
6241    /**
6242     * The elements in the array.
6243     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6244     */
6245    struct LDKAPIError *data;
6246    /**
6247     * The number of elements pointed to by `data`.
6248     */
6249    uintptr_t datalen;
6250 } LDKCVec_APIErrorZ;
6251
6252 /**
6253  * If a payment fails to send, it can be in one of several states. This enum is returned as the
6254  * Err() type describing which state the payment is in, see the description of individual enum
6255  * states for more.
6256  */
6257 typedef enum LDKPaymentSendFailure_Tag {
6258    /**
6259     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
6260     * send the payment at all. No channel state has been changed or messages sent to peers, and
6261     * once you've changed the parameter at error, you can freely retry the payment in full.
6262     */
6263    LDKPaymentSendFailure_ParameterError,
6264    /**
6265     * A parameter in a single path which was passed to send_payment was invalid, preventing us
6266     * from attempting to send the payment at all. No channel state has been changed or messages
6267     * sent to peers, and once you've changed the parameter at error, you can freely retry the
6268     * payment in full.
6269     *
6270     * The results here are ordered the same as the paths in the route object which was passed to
6271     * send_payment.
6272     */
6273    LDKPaymentSendFailure_PathParameterError,
6274    /**
6275     * All paths which were attempted failed to send, with no channel state change taking place.
6276     * You can freely retry the payment in full (though you probably want to do so over different
6277     * paths than the ones selected).
6278     */
6279    LDKPaymentSendFailure_AllFailedRetrySafe,
6280    /**
6281     * Some paths which were attempted failed to send, though possibly not all. At least some
6282     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
6283     * in over-/re-payment.
6284     *
6285     * The results here are ordered the same as the paths in the route object which was passed to
6286     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
6287     * retried (though there is currently no API with which to do so).
6288     *
6289     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
6290     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
6291     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
6292     * with the latest update_id.
6293     */
6294    LDKPaymentSendFailure_PartialFailure,
6295    /**
6296     * Must be last for serialization purposes
6297     */
6298    LDKPaymentSendFailure_Sentinel,
6299 } LDKPaymentSendFailure_Tag;
6300
6301 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
6302    LDKPaymentSendFailure_Tag tag;
6303    union {
6304       struct {
6305          struct LDKAPIError parameter_error;
6306       };
6307       struct {
6308          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
6309       };
6310       struct {
6311          struct LDKCVec_APIErrorZ all_failed_retry_safe;
6312       };
6313       struct {
6314          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
6315       };
6316    };
6317 } LDKPaymentSendFailure;
6318
6319 /**
6320  * The contents of CResult_NonePaymentSendFailureZ
6321  */
6322 typedef union LDKCResult_NonePaymentSendFailureZPtr {
6323    /**
6324     * Note that this value is always NULL, as there are no contents in the OK variant
6325     */
6326    void *result;
6327    /**
6328     * A pointer to the contents in the error state.
6329     * Reading from this pointer when `result_ok` is set is undefined.
6330     */
6331    struct LDKPaymentSendFailure *err;
6332 } LDKCResult_NonePaymentSendFailureZPtr;
6333
6334 /**
6335  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6336  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6337  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6338  */
6339 typedef struct LDKCResult_NonePaymentSendFailureZ {
6340    /**
6341     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6342     * `err` or `result` depending on the state of `result_ok`.
6343     */
6344    union LDKCResult_NonePaymentSendFailureZPtr contents;
6345    /**
6346     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
6347     */
6348    bool result_ok;
6349 } LDKCResult_NonePaymentSendFailureZ;
6350
6351 /**
6352  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
6353  * This corresponds to std::vector in C++
6354  */
6355 typedef struct LDKCVec_ChannelMonitorZ {
6356    /**
6357     * The elements in the array.
6358     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6359     */
6360    struct LDKChannelMonitor *data;
6361    /**
6362     * The number of elements pointed to by `data`.
6363     */
6364    uintptr_t datalen;
6365 } LDKCVec_ChannelMonitorZ;
6366
6367 /**
6368  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
6369  * blocks are connected and disconnected.
6370  *
6371  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
6372  * responsible for maintaining a set of monitors such that they can be updated accordingly as
6373  * channel state changes and HTLCs are resolved. See method documentation for specific
6374  * requirements.
6375  *
6376  * Implementations **must** ensure that updates are successfully applied and persisted upon method
6377  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
6378  * without taking any further action such as persisting the current state.
6379  *
6380  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
6381  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
6382  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
6383  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
6384  * multiple instances.
6385  *
6386  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
6387  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
6388  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
6389  */
6390 typedef struct LDKWatch {
6391    /**
6392     * An opaque pointer which is passed to your function implementations as an argument.
6393     * This has no meaning in the LDK, and can be NULL or any other value.
6394     */
6395    void *this_arg;
6396    /**
6397     * Watches a channel identified by `funding_txo` using `monitor`.
6398     *
6399     * Implementations are responsible for watching the chain for the funding transaction along
6400     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
6401     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
6402     *
6403     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
6404     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
6405     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
6406     */
6407    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
6408    /**
6409     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
6410     *
6411     * Implementations must call [`update_monitor`] with the given update. See
6412     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
6413     *
6414     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
6415     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
6416     */
6417    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
6418    /**
6419     * Returns any monitor events since the last call. Subsequent calls must only return new
6420     * events.
6421     */
6422    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
6423    /**
6424     * Frees any resources associated with this object given its this_arg pointer.
6425     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6426     */
6427    void (*free)(void *this_arg);
6428 } LDKWatch;
6429
6430 /**
6431  * An interface to send a transaction to the Bitcoin network.
6432  */
6433 typedef struct LDKBroadcasterInterface {
6434    /**
6435     * An opaque pointer which is passed to your function implementations as an argument.
6436     * This has no meaning in the LDK, and can be NULL or any other value.
6437     */
6438    void *this_arg;
6439    /**
6440     * Sends a transaction out to (hopefully) be mined.
6441     */
6442    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
6443    /**
6444     * Frees any resources associated with this object given its this_arg pointer.
6445     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6446     */
6447    void (*free)(void *this_arg);
6448 } LDKBroadcasterInterface;
6449
6450 /**
6451  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
6452  * own the memory pointed to by data.
6453  */
6454 typedef struct LDKu8slice {
6455    /**
6456     * A pointer to the byte buffer
6457     */
6458    const uint8_t *data;
6459    /**
6460     * The number of bytes pointed to by `data`.
6461     */
6462    uintptr_t datalen;
6463 } LDKu8slice;
6464
6465 /**
6466  * A trait to describe an object which can get user secrets and key material.
6467  */
6468 typedef struct LDKKeysInterface {
6469    /**
6470     * An opaque pointer which is passed to your function implementations as an argument.
6471     * This has no meaning in the LDK, and can be NULL or any other value.
6472     */
6473    void *this_arg;
6474    /**
6475     * Get node secret key (aka node_id or network_key).
6476     *
6477     * This method must return the same value each time it is called.
6478     */
6479    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
6480    /**
6481     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
6482     *
6483     * This method should return a different value each time it is called, to avoid linking
6484     * on-chain funds across channels as controlled to the same user.
6485     */
6486    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
6487    /**
6488     * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
6489     * a channel.
6490     *
6491     * This method should return a different value each time it is called, to avoid linking
6492     * on-chain funds across channels as controlled to the same user.
6493     */
6494    struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
6495    /**
6496     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
6497     * restarted with some stale data!
6498     *
6499     * This method must return a different value each time it is called.
6500     */
6501    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
6502    /**
6503     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
6504     * onion packets and for temporary channel IDs. There is no requirement that these be
6505     * persisted anywhere, though they must be unique across restarts.
6506     *
6507     * This method must return a different value each time it is called.
6508     */
6509    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
6510    /**
6511     * Reads a `Signer` for this `KeysInterface` from the given input stream.
6512     * This is only called during deserialization of other objects which contain
6513     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
6514     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
6515     * contain no versioning scheme. You may wish to include your own version prefix and ensure
6516     * you've read all of the provided bytes to ensure no corruption occurred.
6517     */
6518    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
6519    /**
6520     * Frees any resources associated with this object given its this_arg pointer.
6521     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6522     */
6523    void (*free)(void *this_arg);
6524 } LDKKeysInterface;
6525
6526 /**
6527  * A trait which should be implemented to provide feerate information on a number of time
6528  * horizons.
6529  *
6530  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
6531  * called from inside the library in response to chain events, P2P events, or timer events).
6532  */
6533 typedef struct LDKFeeEstimator {
6534    /**
6535     * An opaque pointer which is passed to your function implementations as an argument.
6536     * This has no meaning in the LDK, and can be NULL or any other value.
6537     */
6538    void *this_arg;
6539    /**
6540     * Gets estimated satoshis of fee required per 1000 Weight-Units.
6541     *
6542     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
6543     * don't put us below 1 satoshi-per-byte).
6544     *
6545     * This translates to:
6546     *  * satoshis-per-byte * 250
6547     *  * ceil(satoshis-per-kbyte / 4)
6548     */
6549    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
6550    /**
6551     * Frees any resources associated with this object given its this_arg pointer.
6552     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6553     */
6554    void (*free)(void *this_arg);
6555 } LDKFeeEstimator;
6556
6557 /**
6558  * A trait encapsulating the operations required of a logger
6559  */
6560 typedef struct LDKLogger {
6561    /**
6562     * An opaque pointer which is passed to your function implementations as an argument.
6563     * This has no meaning in the LDK, and can be NULL or any other value.
6564     */
6565    void *this_arg;
6566    /**
6567     * Logs the `Record`
6568     */
6569    void (*log)(const void *this_arg, const char *record);
6570    /**
6571     * Frees any resources associated with this object given its this_arg pointer.
6572     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6573     */
6574    void (*free)(void *this_arg);
6575 } LDKLogger;
6576
6577
6578
6579 /**
6580  * Manager which keeps track of a number of channels and sends messages to the appropriate
6581  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
6582  *
6583  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
6584  * to individual Channels.
6585  *
6586  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
6587  * all peers during write/read (though does not modify this instance, only the instance being
6588  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
6589  * called funding_transaction_generated for outbound channels).
6590  *
6591  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
6592  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
6593  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
6594  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
6595  * the serialization process). If the deserialized version is out-of-date compared to the
6596  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
6597  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
6598  *
6599  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
6600  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
6601  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
6602  * block_connected() to step towards your best block) upon deserialization before using the
6603  * object!
6604  *
6605  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
6606  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
6607  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
6608  * offline for a full minute. In order to track this, you must call
6609  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
6610  *
6611  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
6612  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
6613  * essentially you should default to using a SimpleRefChannelManager, and use a
6614  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
6615  * you're using lightning-net-tokio.
6616  */
6617 typedef struct MUST_USE_STRUCT LDKChannelManager {
6618    /**
6619     * A pointer to the opaque Rust object.
6620     * Nearly everywhere, inner must be non-null, however in places where
6621     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6622     */
6623    LDKnativeChannelManager *inner;
6624    /**
6625     * Indicates that this is the only struct which contains the same pointer.
6626     * Rust functions which take ownership of an object provided via an argument require
6627     * this to be true and invalidate the object pointed to by inner.
6628     */
6629    bool is_owned;
6630 } LDKChannelManager;
6631
6632 /**
6633  * A tuple of 2 elements. See the individual fields for the types contained.
6634  */
6635 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
6636    /**
6637     * The element at position 0
6638     */
6639    struct LDKThirtyTwoBytes a;
6640    /**
6641     * The element at position 1
6642     */
6643    struct LDKChannelManager b;
6644 } LDKC2Tuple_BlockHashChannelManagerZ;
6645
6646 /**
6647  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
6648  */
6649 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6650    /**
6651     * A pointer to the contents in the success state.
6652     * Reading from this pointer when `result_ok` is not set is undefined.
6653     */
6654    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
6655    /**
6656     * A pointer to the contents in the error state.
6657     * Reading from this pointer when `result_ok` is set is undefined.
6658     */
6659    struct LDKDecodeError *err;
6660 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
6661
6662 /**
6663  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
6664  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6665  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6666  */
6667 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6668    /**
6669     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
6670     * `err` or `result` depending on the state of `result_ok`.
6671     */
6672    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
6673    /**
6674     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
6675     */
6676    bool result_ok;
6677 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
6678
6679 /**
6680  * A trait indicating an object may generate message send events
6681  */
6682 typedef struct LDKMessageSendEventsProvider {
6683    /**
6684     * An opaque pointer which is passed to your function implementations as an argument.
6685     * This has no meaning in the LDK, and can be NULL or any other value.
6686     */
6687    void *this_arg;
6688    /**
6689     * Gets the list of pending events which were generated by previous actions, clearing the list
6690     * in the process.
6691     */
6692    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
6693    /**
6694     * Frees any resources associated with this object given its this_arg pointer.
6695     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6696     */
6697    void (*free)(void *this_arg);
6698 } LDKMessageSendEventsProvider;
6699
6700 /**
6701  * A trait indicating an object may generate events
6702  */
6703 typedef struct LDKEventsProvider {
6704    /**
6705     * An opaque pointer which is passed to your function implementations as an argument.
6706     * This has no meaning in the LDK, and can be NULL or any other value.
6707     */
6708    void *this_arg;
6709    /**
6710     * Gets the list of pending events which were generated by previous actions, clearing the list
6711     * in the process.
6712     */
6713    struct LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
6714    /**
6715     * Frees any resources associated with this object given its this_arg pointer.
6716     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6717     */
6718    void (*free)(void *this_arg);
6719 } LDKEventsProvider;
6720
6721
6722
6723 /**
6724  * Configuration we set when applicable.
6725  *
6726  * Default::default() provides sane defaults.
6727  */
6728 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
6729    /**
6730     * A pointer to the opaque Rust object.
6731     * Nearly everywhere, inner must be non-null, however in places where
6732     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6733     */
6734    LDKnativeChannelHandshakeConfig *inner;
6735    /**
6736     * Indicates that this is the only struct which contains the same pointer.
6737     * Rust functions which take ownership of an object provided via an argument require
6738     * this to be true and invalidate the object pointed to by inner.
6739     */
6740    bool is_owned;
6741 } LDKChannelHandshakeConfig;
6742
6743
6744
6745 /**
6746  * Optional channel limits which are applied during channel creation.
6747  *
6748  * These limits are only applied to our counterparty's limits, not our own.
6749  *
6750  * Use 0/<type>::max_value() as appropriate to skip checking.
6751  *
6752  * Provides sane defaults for most configurations.
6753  *
6754  * Most additional limits are disabled except those with which specify a default in individual
6755  * field documentation. Note that this may result in barely-usable channels, but since they
6756  * are applied mostly only to incoming channels that's not much of a problem.
6757  */
6758 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
6759    /**
6760     * A pointer to the opaque Rust object.
6761     * Nearly everywhere, inner must be non-null, however in places where
6762     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6763     */
6764    LDKnativeChannelHandshakeLimits *inner;
6765    /**
6766     * Indicates that this is the only struct which contains the same pointer.
6767     * Rust functions which take ownership of an object provided via an argument require
6768     * this to be true and invalidate the object pointed to by inner.
6769     */
6770    bool is_owned;
6771 } LDKChannelHandshakeLimits;
6772
6773
6774
6775 /**
6776  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
6777  *
6778  * Default::default() provides sane defaults for most configurations
6779  * (but currently with 0 relay fees!)
6780  */
6781 typedef struct MUST_USE_STRUCT LDKUserConfig {
6782    /**
6783     * A pointer to the opaque Rust object.
6784     * Nearly everywhere, inner must be non-null, however in places where
6785     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6786     */
6787    LDKnativeUserConfig *inner;
6788    /**
6789     * Indicates that this is the only struct which contains the same pointer.
6790     * Rust functions which take ownership of an object provided via an argument require
6791     * this to be true and invalidate the object pointed to by inner.
6792     */
6793    bool is_owned;
6794 } LDKUserConfig;
6795
6796 /**
6797  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
6798  * UTXOs.
6799  */
6800 typedef struct LDKAccess {
6801    /**
6802     * An opaque pointer which is passed to your function implementations as an argument.
6803     * This has no meaning in the LDK, and can be NULL or any other value.
6804     */
6805    void *this_arg;
6806    /**
6807     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
6808     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
6809     * is unknown.
6810     *
6811     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
6812     */
6813    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
6814    /**
6815     * Frees any resources associated with this object given its this_arg pointer.
6816     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6817     */
6818    void (*free)(void *this_arg);
6819 } LDKAccess;
6820
6821 /**
6822  * The `Listen` trait is used to be notified of when blocks have been connected or disconnected
6823  * from the chain.
6824  *
6825  * Useful when needing to replay chain data upon startup or as new chain events occur.
6826  */
6827 typedef struct LDKListen {
6828    /**
6829     * An opaque pointer which is passed to your function implementations as an argument.
6830     * This has no meaning in the LDK, and can be NULL or any other value.
6831     */
6832    void *this_arg;
6833    /**
6834     * Notifies the listener that a block was added at the given height.
6835     */
6836    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
6837    /**
6838     * Notifies the listener that a block was removed at the given height.
6839     */
6840    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
6841    /**
6842     * Frees any resources associated with this object given its this_arg pointer.
6843     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6844     */
6845    void (*free)(void *this_arg);
6846 } LDKListen;
6847
6848
6849
6850 /**
6851  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
6852  *
6853  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
6854  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
6855  * the return value of [`Filter::register_output`].
6856  *
6857  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
6858  * may have been spent there. See [`Filter::register_output`] for details.
6859  *
6860  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
6861  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
6862  */
6863 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
6864    /**
6865     * A pointer to the opaque Rust object.
6866     * Nearly everywhere, inner must be non-null, however in places where
6867     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6868     */
6869    LDKnativeWatchedOutput *inner;
6870    /**
6871     * Indicates that this is the only struct which contains the same pointer.
6872     * Rust functions which take ownership of an object provided via an argument require
6873     * this to be true and invalidate the object pointed to by inner.
6874     */
6875    bool is_owned;
6876 } LDKWatchedOutput;
6877
6878 /**
6879  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
6880  * channels.
6881  *
6882  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
6883  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
6884  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
6885  * receiving full blocks from a chain source, any further filtering is unnecessary.
6886  *
6887  * After an output has been registered, subsequent block retrievals from the chain source must not
6888  * exclude any transactions matching the new criteria nor any in-block descendants of such
6889  * transactions.
6890  *
6891  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
6892  * should not block on I/O. Implementations should instead queue the newly monitored data to be
6893  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
6894  * invocation that has called the `Filter` must return [`TemporaryFailure`].
6895  *
6896  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
6897  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
6898  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
6899  */
6900 typedef struct LDKFilter {
6901    /**
6902     * An opaque pointer which is passed to your function implementations as an argument.
6903     * This has no meaning in the LDK, and can be NULL or any other value.
6904     */
6905    void *this_arg;
6906    /**
6907     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
6908     * a spending condition.
6909     */
6910    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
6911    /**
6912     * Registers interest in spends of a transaction output.
6913     *
6914     * Optionally, when `output.block_hash` is set, should return any transaction spending the
6915     * output that is found in the corresponding block along with its index.
6916     *
6917     * This return value is useful for Electrum clients in order to supply in-block descendant
6918     * transactions which otherwise were not included. This is not necessary for other clients if
6919     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
6920     * full block).
6921     */
6922    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
6923    /**
6924     * Frees any resources associated with this object given its this_arg pointer.
6925     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6926     */
6927    void (*free)(void *this_arg);
6928 } LDKFilter;
6929
6930 /**
6931  * `Persist` defines behavior for persisting channel monitors: this could mean
6932  * writing once to disk, and/or uploading to one or more backup services.
6933  *
6934  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
6935  * to disk/backups. And, on every update, you **must** persist either the
6936  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
6937  * of situations such as revoking a transaction, then crashing before this
6938  * revocation can be persisted, then unintentionally broadcasting a revoked
6939  * transaction and losing money. This is a risk because previous channel states
6940  * are toxic, so it's important that whatever channel state is persisted is
6941  * kept up-to-date.
6942  */
6943 typedef struct LDKPersist {
6944    /**
6945     * An opaque pointer which is passed to your function implementations as an argument.
6946     * This has no meaning in the LDK, and can be NULL or any other value.
6947     */
6948    void *this_arg;
6949    /**
6950     * Persist a new channel's data. The data can be stored any way you want, but
6951     * the identifier provided by Rust-Lightning is the channel's outpoint (and
6952     * it is up to you to maintain a correct mapping between the outpoint and the
6953     * stored channel data). Note that you **must** persist every new monitor to
6954     * disk. See the `Persist` trait documentation for more details.
6955     *
6956     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
6957     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
6958     */
6959    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
6960    /**
6961     * Update one channel's data. The provided `ChannelMonitor` has already
6962     * applied the given update.
6963     *
6964     * Note that on every update, you **must** persist either the
6965     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
6966     * the `Persist` trait documentation for more details.
6967     *
6968     * If an implementer chooses to persist the updates only, they need to make
6969     * sure that all the updates are applied to the `ChannelMonitors` *before*
6970     * the set of channel monitors is given to the `ChannelManager`
6971     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
6972     * applying a monitor update to a monitor. If full `ChannelMonitors` are
6973     * persisted, then there is no need to persist individual updates.
6974     *
6975     * Note that there could be a performance tradeoff between persisting complete
6976     * channel monitors on every update vs. persisting only updates and applying
6977     * them in batches. The size of each monitor grows `O(number of state updates)`
6978     * whereas updates are small and `O(1)`.
6979     *
6980     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
6981     * [`ChannelMonitorUpdate::write`] for writing out an update, and
6982     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
6983     */
6984    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);
6985    /**
6986     * Frees any resources associated with this object given its this_arg pointer.
6987     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6988     */
6989    void (*free)(void *this_arg);
6990 } LDKPersist;
6991
6992
6993
6994 /**
6995  * An implementation of [`chain::Watch`] for monitoring channels.
6996  *
6997  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
6998  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
6999  * or used independently to monitor channels remotely. See the [module-level documentation] for
7000  * details.
7001  *
7002  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
7003  * [module-level documentation]: crate::chain::chainmonitor
7004  */
7005 typedef struct MUST_USE_STRUCT LDKChainMonitor {
7006    /**
7007     * A pointer to the opaque Rust object.
7008     * Nearly everywhere, inner must be non-null, however in places where
7009     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7010     */
7011    LDKnativeChainMonitor *inner;
7012    /**
7013     * Indicates that this is the only struct which contains the same pointer.
7014     * Rust functions which take ownership of an object provided via an argument require
7015     * this to be true and invalidate the object pointed to by inner.
7016     */
7017    bool is_owned;
7018 } LDKChainMonitor;
7019
7020
7021
7022 /**
7023  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
7024  * and derives keys from that.
7025  *
7026  * Your node_id is seed/0'
7027  * ChannelMonitor closes may use seed/1'
7028  * Cooperative closes may use seed/2'
7029  * The two close keys may be needed to claim on-chain funds!
7030  */
7031 typedef struct MUST_USE_STRUCT LDKKeysManager {
7032    /**
7033     * A pointer to the opaque Rust object.
7034     * Nearly everywhere, inner must be non-null, however in places where
7035     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7036     */
7037    LDKnativeKeysManager *inner;
7038    /**
7039     * Indicates that this is the only struct which contains the same pointer.
7040     * Rust functions which take ownership of an object provided via an argument require
7041     * this to be true and invalidate the object pointed to by inner.
7042     */
7043    bool is_owned;
7044 } LDKKeysManager;
7045
7046
7047
7048 /**
7049  * Chain-related parameters used to construct a new `ChannelManager`.
7050  *
7051  * Typically, the block-specific parameters are derived from the best block hash for the network,
7052  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
7053  * are not needed when deserializing a previously constructed `ChannelManager`.
7054  */
7055 typedef struct MUST_USE_STRUCT LDKChainParameters {
7056    /**
7057     * A pointer to the opaque Rust object.
7058     * Nearly everywhere, inner must be non-null, however in places where
7059     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7060     */
7061    LDKnativeChainParameters *inner;
7062    /**
7063     * Indicates that this is the only struct which contains the same pointer.
7064     * Rust functions which take ownership of an object provided via an argument require
7065     * this to be true and invalidate the object pointed to by inner.
7066     */
7067    bool is_owned;
7068 } LDKChainParameters;
7069
7070
7071
7072 /**
7073  * The best known block as identified by its hash and height.
7074  */
7075 typedef struct MUST_USE_STRUCT LDKBestBlock {
7076    /**
7077     * A pointer to the opaque Rust object.
7078     * Nearly everywhere, inner must be non-null, however in places where
7079     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7080     */
7081    LDKnativeBestBlock *inner;
7082    /**
7083     * Indicates that this is the only struct which contains the same pointer.
7084     * Rust functions which take ownership of an object provided via an argument require
7085     * this to be true and invalidate the object pointed to by inner.
7086     */
7087    bool is_owned;
7088 } LDKBestBlock;
7089
7090 /**
7091  * A 3-byte byte array.
7092  */
7093 typedef struct LDKThreeBytes {
7094    /**
7095     * The three bytes
7096     */
7097    uint8_t data[3];
7098 } LDKThreeBytes;
7099
7100 /**
7101  * A trait to describe an object which can receive channel messages.
7102  *
7103  * Messages MAY be called in parallel when they originate from different their_node_ids, however
7104  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
7105  */
7106 typedef struct LDKChannelMessageHandler {
7107    /**
7108     * An opaque pointer which is passed to your function implementations as an argument.
7109     * This has no meaning in the LDK, and can be NULL or any other value.
7110     */
7111    void *this_arg;
7112    /**
7113     * Handle an incoming open_channel message from the given peer.
7114     */
7115    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
7116    /**
7117     * Handle an incoming accept_channel message from the given peer.
7118     */
7119    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
7120    /**
7121     * Handle an incoming funding_created message from the given peer.
7122     */
7123    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
7124    /**
7125     * Handle an incoming funding_signed message from the given peer.
7126     */
7127    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
7128    /**
7129     * Handle an incoming funding_locked message from the given peer.
7130     */
7131    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
7132    /**
7133     * Handle an incoming shutdown message from the given peer.
7134     */
7135    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);
7136    /**
7137     * Handle an incoming closing_signed message from the given peer.
7138     */
7139    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
7140    /**
7141     * Handle an incoming update_add_htlc message from the given peer.
7142     */
7143    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
7144    /**
7145     * Handle an incoming update_fulfill_htlc message from the given peer.
7146     */
7147    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
7148    /**
7149     * Handle an incoming update_fail_htlc message from the given peer.
7150     */
7151    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
7152    /**
7153     * Handle an incoming update_fail_malformed_htlc message from the given peer.
7154     */
7155    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
7156    /**
7157     * Handle an incoming commitment_signed message from the given peer.
7158     */
7159    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
7160    /**
7161     * Handle an incoming revoke_and_ack message from the given peer.
7162     */
7163    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
7164    /**
7165     * Handle an incoming update_fee message from the given peer.
7166     */
7167    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
7168    /**
7169     * Handle an incoming announcement_signatures message from the given peer.
7170     */
7171    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
7172    /**
7173     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
7174     * is believed to be possible in the future (eg they're sending us messages we don't
7175     * understand or indicate they require unknown feature bits), no_connection_possible is set
7176     * and any outstanding channels should be failed.
7177     */
7178    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
7179    /**
7180     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
7181     */
7182    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
7183    /**
7184     * Handle an incoming channel_reestablish message from the given peer.
7185     */
7186    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
7187    /**
7188     * Handle an incoming channel update from the given peer.
7189     */
7190    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
7191    /**
7192     * Handle an incoming error message from the given peer.
7193     */
7194    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
7195    /**
7196     * Implementation of MessageSendEventsProvider for this object.
7197     */
7198    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
7199    /**
7200     * Frees any resources associated with this object given its this_arg pointer.
7201     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7202     */
7203    void (*free)(void *this_arg);
7204 } LDKChannelMessageHandler;
7205
7206
7207
7208 /**
7209  * Arguments for the creation of a ChannelManager that are not deserialized.
7210  *
7211  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
7212  * is:
7213  * 1) Deserialize all stored ChannelMonitors.
7214  * 2) Deserialize the ChannelManager by filling in this struct and calling:
7215  *    <(BlockHash, ChannelManager)>::read(reader, args)
7216  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
7217  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
7218  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
7219  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
7220  *    ChannelMonitor::get_funding_txo().
7221  * 4) Reconnect blocks on your ChannelMonitors.
7222  * 5) Disconnect/connect blocks on the ChannelManager.
7223  * 6) Move the ChannelMonitors into your local chain::Watch.
7224  *
7225  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
7226  * call any other methods on the newly-deserialized ChannelManager.
7227  *
7228  * Note that because some channels may be closed during deserialization, it is critical that you
7229  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
7230  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
7231  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
7232  * not force-close the same channels but consider them live), you may end up revoking a state for
7233  * which you've already broadcasted the transaction.
7234  */
7235 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
7236    /**
7237     * A pointer to the opaque Rust object.
7238     * Nearly everywhere, inner must be non-null, however in places where
7239     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7240     */
7241    LDKnativeChannelManagerReadArgs *inner;
7242    /**
7243     * Indicates that this is the only struct which contains the same pointer.
7244     * Rust functions which take ownership of an object provided via an argument require
7245     * this to be true and invalidate the object pointed to by inner.
7246     */
7247    bool is_owned;
7248 } LDKChannelManagerReadArgs;
7249
7250
7251
7252 /**
7253  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
7254  * This is used to convince the recipient that the channel is at a certain commitment
7255  * number even if they lost that data due to a local failure.  Of course, the peer may lie
7256  * and even later commitments may have been revoked.
7257  */
7258 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
7259    /**
7260     * A pointer to the opaque Rust object.
7261     * Nearly everywhere, inner must be non-null, however in places where
7262     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7263     */
7264    LDKnativeDataLossProtect *inner;
7265    /**
7266     * Indicates that this is the only struct which contains the same pointer.
7267     * Rust functions which take ownership of an object provided via an argument require
7268     * this to be true and invalidate the object pointed to by inner.
7269     */
7270    bool is_owned;
7271 } LDKDataLossProtect;
7272
7273 /**
7274  * A trait to describe an object which can receive routing messages.
7275  *
7276  * # Implementor DoS Warnings
7277  *
7278  * For `gossip_queries` messages there are potential DoS vectors when handling
7279  * inbound queries. Implementors using an on-disk network graph should be aware of
7280  * repeated disk I/O for queries accessing different parts of the network graph.
7281  */
7282 typedef struct LDKRoutingMessageHandler {
7283    /**
7284     * An opaque pointer which is passed to your function implementations as an argument.
7285     * This has no meaning in the LDK, and can be NULL or any other value.
7286     */
7287    void *this_arg;
7288    /**
7289     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
7290     * false or returning an Err otherwise.
7291     */
7292    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
7293    /**
7294     * Handle a channel_announcement message, returning true if it should be forwarded on, false
7295     * or returning an Err otherwise.
7296     */
7297    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
7298    /**
7299     * Handle an incoming channel_update message, returning true if it should be forwarded on,
7300     * false or returning an Err otherwise.
7301     */
7302    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
7303    /**
7304     * Handle some updates to the route graph that we learned due to an outbound failed payment.
7305     */
7306    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
7307    /**
7308     * Gets a subset of the channel announcements and updates required to dump our routing table
7309     * to a remote node, starting at the short_channel_id indicated by starting_point and
7310     * including the batch_amount entries immediately higher in numerical value than starting_point.
7311     */
7312    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
7313    /**
7314     * Gets a subset of the node announcements required to dump our routing table to a remote node,
7315     * starting at the node *after* the provided publickey and including batch_amount entries
7316     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
7317     * If None is provided for starting_point, we start at the first node.
7318     */
7319    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
7320    /**
7321     * Called when a connection is established with a peer. This can be used to
7322     * perform routing table synchronization using a strategy defined by the
7323     * implementor.
7324     */
7325    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
7326    /**
7327     * Handles the reply of a query we initiated to learn about channels
7328     * for a given range of blocks. We can expect to receive one or more
7329     * replies to a single query.
7330     */
7331    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
7332    /**
7333     * Handles the reply of a query we initiated asking for routing gossip
7334     * messages for a list of channels. We should receive this message when
7335     * a node has completed its best effort to send us the pertaining routing
7336     * gossip messages.
7337     */
7338    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
7339    /**
7340     * Handles when a peer asks us to send a list of short_channel_ids
7341     * for the requested range of blocks.
7342     */
7343    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
7344    /**
7345     * Handles when a peer asks us to send routing gossip messages for a
7346     * list of short_channel_ids.
7347     */
7348    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
7349    /**
7350     * Implementation of MessageSendEventsProvider for this object.
7351     */
7352    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
7353    /**
7354     * Frees any resources associated with this object given its this_arg pointer.
7355     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7356     */
7357    void (*free)(void *this_arg);
7358 } LDKRoutingMessageHandler;
7359
7360
7361
7362 /**
7363  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
7364  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
7365  */
7366 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
7367    /**
7368     * A pointer to the opaque Rust object.
7369     * Nearly everywhere, inner must be non-null, however in places where
7370     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7371     */
7372    LDKnativeIgnoringMessageHandler *inner;
7373    /**
7374     * Indicates that this is the only struct which contains the same pointer.
7375     * Rust functions which take ownership of an object provided via an argument require
7376     * this to be true and invalidate the object pointed to by inner.
7377     */
7378    bool is_owned;
7379 } LDKIgnoringMessageHandler;
7380
7381
7382
7383 /**
7384  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
7385  * You can provide one of these as the route_handler in a MessageHandler.
7386  */
7387 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
7388    /**
7389     * A pointer to the opaque Rust object.
7390     * Nearly everywhere, inner must be non-null, however in places where
7391     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7392     */
7393    LDKnativeErroringMessageHandler *inner;
7394    /**
7395     * Indicates that this is the only struct which contains the same pointer.
7396     * Rust functions which take ownership of an object provided via an argument require
7397     * this to be true and invalidate the object pointed to by inner.
7398     */
7399    bool is_owned;
7400 } LDKErroringMessageHandler;
7401
7402
7403
7404 /**
7405  * Provides references to trait impls which handle different types of messages.
7406  */
7407 typedef struct MUST_USE_STRUCT LDKMessageHandler {
7408    /**
7409     * A pointer to the opaque Rust object.
7410     * Nearly everywhere, inner must be non-null, however in places where
7411     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7412     */
7413    LDKnativeMessageHandler *inner;
7414    /**
7415     * Indicates that this is the only struct which contains the same pointer.
7416     * Rust functions which take ownership of an object provided via an argument require
7417     * this to be true and invalidate the object pointed to by inner.
7418     */
7419    bool is_owned;
7420 } LDKMessageHandler;
7421
7422 /**
7423  * Provides an object which can be used to send data to and which uniquely identifies a connection
7424  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
7425  * implement Hash to meet the PeerManager API.
7426  *
7427  * For efficiency, Clone should be relatively cheap for this type.
7428  *
7429  * You probably want to just extend an int and put a file descriptor in a struct and implement
7430  * send_data. Note that if you are using a higher-level net library that may call close() itself,
7431  * be careful to ensure you don't have races whereby you might register a new connection with an
7432  * fd which is the same as a previous one which has yet to be removed via
7433  * PeerManager::socket_disconnected().
7434  */
7435 typedef struct LDKSocketDescriptor {
7436    /**
7437     * An opaque pointer which is passed to your function implementations as an argument.
7438     * This has no meaning in the LDK, and can be NULL or any other value.
7439     */
7440    void *this_arg;
7441    /**
7442     * Attempts to send some data from the given slice to the peer.
7443     *
7444     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
7445     * Note that in the disconnected case, socket_disconnected must still fire and further write
7446     * attempts may occur until that time.
7447     *
7448     * If the returned size is smaller than data.len(), a write_available event must
7449     * trigger the next time more data can be written. Additionally, until the a send_data event
7450     * completes fully, no further read_events should trigger on the same peer!
7451     *
7452     * If a read_event on this descriptor had previously returned true (indicating that read
7453     * events should be paused to prevent DoS in the send buffer), resume_read may be set
7454     * indicating that read events on this descriptor should resume. A resume_read of false does
7455     * *not* imply that further read events should be paused.
7456     */
7457    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
7458    /**
7459     * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
7460     * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
7461     * this descriptor. No socket_disconnected call should be generated as a result of this call,
7462     * though races may occur whereby disconnect_socket is called after a call to
7463     * socket_disconnected but prior to socket_disconnected returning.
7464     */
7465    void (*disconnect_socket)(void *this_arg);
7466    /**
7467     * Checks if two objects are equal given this object's this_arg pointer and another object.
7468     */
7469    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
7470    /**
7471     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
7472     * This is used, for example, for inclusion of this object in a hash map.
7473     */
7474    uint64_t (*hash)(const void *this_arg);
7475    /**
7476     * Creates a copy of the object pointed to by this_arg, for a copy of this SocketDescriptor.
7477     * Note that the ultimate copy of the SocketDescriptor will have all function pointers the same as the original.
7478     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new SocketDescriptor.
7479     */
7480    void *(*clone)(const void *this_arg);
7481    /**
7482     * Frees any resources associated with this object given its this_arg pointer.
7483     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7484     */
7485    void (*free)(void *this_arg);
7486 } LDKSocketDescriptor;
7487
7488
7489
7490 /**
7491  * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
7492  * events into messages which it passes on to its MessageHandlers.
7493  *
7494  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
7495  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
7496  * essentially you should default to using a SimpleRefPeerManager, and use a
7497  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
7498  * you're using lightning-net-tokio.
7499  */
7500 typedef struct MUST_USE_STRUCT LDKPeerManager {
7501    /**
7502     * A pointer to the opaque Rust object.
7503     * Nearly everywhere, inner must be non-null, however in places where
7504     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7505     */
7506    LDKnativePeerManager *inner;
7507    /**
7508     * Indicates that this is the only struct which contains the same pointer.
7509     * Rust functions which take ownership of an object provided via an argument require
7510     * this to be true and invalidate the object pointed to by inner.
7511     */
7512    bool is_owned;
7513 } LDKPeerManager;
7514
7515
7516
7517 /**
7518  * Static channel fields used to build transactions given per-commitment fields, organized by
7519  * broadcaster/countersignatory.
7520  *
7521  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
7522  * as_holder_broadcastable and as_counterparty_broadcastable functions.
7523  */
7524 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
7525    /**
7526     * A pointer to the opaque Rust object.
7527     * Nearly everywhere, inner must be non-null, however in places where
7528     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7529     */
7530    LDKnativeDirectedChannelTransactionParameters *inner;
7531    /**
7532     * Indicates that this is the only struct which contains the same pointer.
7533     * Rust functions which take ownership of an object provided via an argument require
7534     * this to be true and invalidate the object pointed to by inner.
7535     */
7536    bool is_owned;
7537 } LDKDirectedChannelTransactionParameters;
7538
7539
7540
7541 /**
7542  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
7543  * This exists only to make accessing a RwLock<NetworkGraph> possible from
7544  * the C bindings, as it can be done directly in Rust code.
7545  */
7546 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
7547    /**
7548     * A pointer to the opaque Rust object.
7549     * Nearly everywhere, inner must be non-null, however in places where
7550     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7551     */
7552    LDKnativeLockedNetworkGraph *inner;
7553    /**
7554     * Indicates that this is the only struct which contains the same pointer.
7555     * Rust functions which take ownership of an object provided via an argument require
7556     * this to be true and invalidate the object pointed to by inner.
7557     */
7558    bool is_owned;
7559 } LDKLockedNetworkGraph;
7560
7561
7562
7563 /**
7564  * Receives and validates network updates from peers,
7565  * stores authentic and relevant data as a network graph.
7566  * This network graph is then used for routing payments.
7567  * Provides interface to help with initial routing sync by
7568  * serving historical announcements.
7569  */
7570 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
7571    /**
7572     * A pointer to the opaque Rust object.
7573     * Nearly everywhere, inner must be non-null, however in places where
7574     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7575     */
7576    LDKnativeNetGraphMsgHandler *inner;
7577    /**
7578     * Indicates that this is the only struct which contains the same pointer.
7579     * Rust functions which take ownership of an object provided via an argument require
7580     * this to be true and invalidate the object pointed to by inner.
7581     */
7582    bool is_owned;
7583 } LDKNetGraphMsgHandler;
7584
7585
7586
7587 /**
7588  * FilesystemPersister persists channel data on disk, where each channel's
7589  * data is stored in a file named after its funding outpoint.
7590  *
7591  * Warning: this module does the best it can with calls to persist data, but it
7592  * can only guarantee that the data is passed to the drive. It is up to the
7593  * drive manufacturers to do the actual persistence properly, which they often
7594  * don't (especially on consumer-grade hardware). Therefore, it is up to the
7595  * user to validate their entire storage stack, to ensure the writes are
7596  * persistent.
7597  * Corollary: especially when dealing with larger amounts of money, it is best
7598  * practice to have multiple channel data backups and not rely only on one
7599  * FilesystemPersister.
7600  */
7601 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
7602    /**
7603     * A pointer to the opaque Rust object.
7604     * Nearly everywhere, inner must be non-null, however in places where
7605     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7606     */
7607    LDKnativeFilesystemPersister *inner;
7608    /**
7609     * Indicates that this is the only struct which contains the same pointer.
7610     * Rust functions which take ownership of an object provided via an argument require
7611     * this to be true and invalidate the object pointed to by inner.
7612     */
7613    bool is_owned;
7614 } LDKFilesystemPersister;
7615
7616 extern const uintptr_t MAX_BUF_SIZE;
7617
7618 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
7619
7620 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
7621
7622 extern const uint16_t BREAKDOWN_TIMEOUT;
7623
7624 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
7625
7626 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
7627
7628 /**
7629  * Frees the data buffer, if data_is_owned is set and datalen > 0.
7630  */
7631 void Transaction_free(struct LDKTransaction _res);
7632
7633 /**
7634  * Frees the data pointed to by script_pubkey.
7635  */
7636 void TxOut_free(struct LDKTxOut _res);
7637
7638 /**
7639  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
7640  */
7641 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
7642
7643 /**
7644  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7645  */
7646 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
7647
7648 /**
7649  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7650  */
7651 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
7652
7653 /**
7654  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7655  */
7656 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
7657
7658 /**
7659  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7660  * but with all dynamically-allocated buffers duplicated in new buffers.
7661  */
7662 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
7663
7664 /**
7665  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
7666  */
7667 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
7668
7669 /**
7670  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
7671  */
7672 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
7673
7674 /**
7675  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
7676  */
7677 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
7678
7679 /**
7680  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7681  * but with all dynamically-allocated buffers duplicated in new buffers.
7682  */
7683 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
7684
7685 /**
7686  * Creates a new CResult_SecretKeyErrorZ in the success state.
7687  */
7688 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
7689
7690 /**
7691  * Creates a new CResult_SecretKeyErrorZ in the error state.
7692  */
7693 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
7694
7695 /**
7696  * Frees any resources used by the CResult_SecretKeyErrorZ.
7697  */
7698 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
7699
7700 /**
7701  * Creates a new CResult_PublicKeyErrorZ in the success state.
7702  */
7703 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
7704
7705 /**
7706  * Creates a new CResult_PublicKeyErrorZ in the error state.
7707  */
7708 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
7709
7710 /**
7711  * Frees any resources used by the CResult_PublicKeyErrorZ.
7712  */
7713 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
7714
7715 /**
7716  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
7717  */
7718 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
7719
7720 /**
7721  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
7722  */
7723 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
7724
7725 /**
7726  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
7727  */
7728 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
7729
7730 /**
7731  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
7732  * but with all dynamically-allocated buffers duplicated in new buffers.
7733  */
7734 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
7735
7736 /**
7737  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
7738  */
7739 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
7740
7741 /**
7742  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
7743  */
7744 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
7745
7746 /**
7747  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
7748  */
7749 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
7750
7751 /**
7752  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
7753  * but with all dynamically-allocated buffers duplicated in new buffers.
7754  */
7755 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
7756
7757 /**
7758  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
7759  */
7760 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
7761
7762 /**
7763  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
7764  */
7765 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
7766
7767 /**
7768  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
7769  */
7770 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
7771
7772 /**
7773  * Constructs a new COption_u32Z containing a u32
7774  */
7775 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
7776
7777 /**
7778  * Constructs a new COption_u32Z containing nothing
7779  */
7780 struct LDKCOption_u32Z COption_u32Z_none(void);
7781
7782 /**
7783  * Frees any resources associated with the u32, if we are in the Some state
7784  */
7785 void COption_u32Z_free(struct LDKCOption_u32Z _res);
7786
7787 /**
7788  * Creates a new COption_u32Z which has the same data as `orig`
7789  * but with all dynamically-allocated buffers duplicated in new buffers.
7790  */
7791 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
7792
7793 /**
7794  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
7795  */
7796 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
7797
7798 /**
7799  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
7800  */
7801 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
7802
7803 /**
7804  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
7805  */
7806 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
7807
7808 /**
7809  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
7810  * but with all dynamically-allocated buffers duplicated in new buffers.
7811  */
7812 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
7813
7814 /**
7815  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
7816  */
7817 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
7818
7819 /**
7820  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
7821  */
7822 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
7823
7824 /**
7825  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
7826  */
7827 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
7828
7829 /**
7830  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
7831  * but with all dynamically-allocated buffers duplicated in new buffers.
7832  */
7833 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
7834
7835 /**
7836  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
7837  */
7838 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
7839
7840 /**
7841  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
7842  */
7843 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
7844
7845 /**
7846  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
7847  */
7848 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
7849
7850 /**
7851  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
7852  * but with all dynamically-allocated buffers duplicated in new buffers.
7853  */
7854 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
7855
7856 /**
7857  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7858  */
7859 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
7860
7861 /**
7862  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
7863  */
7864 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
7865
7866 /**
7867  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
7868  */
7869 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
7870
7871 /**
7872  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
7873  */
7874 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
7875
7876 /**
7877  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
7878  * but with all dynamically-allocated buffers duplicated in new buffers.
7879  */
7880 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
7881
7882 /**
7883  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
7884  */
7885 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
7886
7887 /**
7888  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
7889  */
7890 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
7891
7892 /**
7893  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
7894  */
7895 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
7896
7897 /**
7898  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
7899  * but with all dynamically-allocated buffers duplicated in new buffers.
7900  */
7901 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
7902
7903 /**
7904  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
7905  */
7906 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
7907
7908 /**
7909  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
7910  */
7911 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
7912
7913 /**
7914  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
7915  */
7916 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
7917
7918 /**
7919  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
7920  * but with all dynamically-allocated buffers duplicated in new buffers.
7921  */
7922 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
7923
7924 /**
7925  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
7926  */
7927 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
7928
7929 /**
7930  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
7931  */
7932 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
7933
7934 /**
7935  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
7936  */
7937 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
7938
7939 /**
7940  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
7941  */
7942 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
7943
7944 /**
7945  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
7946  */
7947 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
7948
7949 /**
7950  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
7951  */
7952 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
7953
7954 /**
7955  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
7956  * but with all dynamically-allocated buffers duplicated in new buffers.
7957  */
7958 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
7959
7960 /**
7961  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
7962  */
7963 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
7964
7965 /**
7966  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
7967  */
7968 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
7969
7970 /**
7971  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
7972  */
7973 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
7974
7975 /**
7976  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
7977  * but with all dynamically-allocated buffers duplicated in new buffers.
7978  */
7979 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
7980
7981 /**
7982  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
7983  */
7984 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
7985
7986 /**
7987  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
7988  */
7989 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
7990
7991 /**
7992  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
7993  */
7994 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
7995
7996 /**
7997  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
7998  * but with all dynamically-allocated buffers duplicated in new buffers.
7999  */
8000 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
8001
8002 /**
8003  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
8004  */
8005 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
8006
8007 /**
8008  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
8009  */
8010 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
8011
8012 /**
8013  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
8014  */
8015 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
8016
8017 /**
8018  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
8019  * but with all dynamically-allocated buffers duplicated in new buffers.
8020  */
8021 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
8022
8023 /**
8024  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
8025  */
8026 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
8027
8028 /**
8029  * Frees any resources used by the C2Tuple_OutPointScriptZ.
8030  */
8031 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
8032
8033 /**
8034  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
8035  */
8036 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
8037
8038 /**
8039  * Frees any resources used by the C2Tuple_u32ScriptZ.
8040  */
8041 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
8042
8043 /**
8044  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8045  */
8046 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
8047
8048 /**
8049  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
8050  */
8051 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
8052
8053 /**
8054  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
8055  */
8056 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
8057
8058 /**
8059  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8060  */
8061 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
8062
8063 /**
8064  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8065  */
8066 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
8067
8068 /**
8069  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8070  */
8071 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
8072
8073 /**
8074  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8075  */
8076 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
8077
8078 /**
8079  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
8080  */
8081 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
8082
8083 /**
8084  * Frees any resources used by the C2Tuple_usizeTransactionZ.
8085  */
8086 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
8087
8088 /**
8089  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8090  */
8091 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
8092
8093 /**
8094  * Creates a new tuple which has the same data as `orig`
8095  * but with all dynamically-allocated buffers duplicated in new buffers.
8096  */
8097 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
8098
8099 /**
8100  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
8101  */
8102 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
8103
8104 /**
8105  * Frees any resources used by the C2Tuple_u32TxOutZ.
8106  */
8107 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
8108
8109 /**
8110  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8111  */
8112 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
8113
8114 /**
8115  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
8116  */
8117 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
8118
8119 /**
8120  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
8121  */
8122 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
8123
8124 /**
8125  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8126  */
8127 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
8128
8129 /**
8130  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8131  */
8132 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
8133
8134 /**
8135  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
8136  */
8137 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
8138
8139 /**
8140  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
8141  */
8142 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
8143
8144 /**
8145  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
8146  */
8147 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
8148
8149 /**
8150  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
8151  * but with all dynamically-allocated buffers duplicated in new buffers.
8152  */
8153 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
8154
8155 /**
8156  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
8157  */
8158 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
8159
8160 /**
8161  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
8162  */
8163 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
8164
8165 /**
8166  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
8167  */
8168 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
8169
8170 /**
8171  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
8172  */
8173 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
8174
8175 /**
8176  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
8177  */
8178 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
8179
8180 /**
8181  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8182  */
8183 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
8184
8185 /**
8186  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8187  */
8188 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
8189
8190 /**
8191  * Creates a new CResult_RouteDecodeErrorZ in the success state.
8192  */
8193 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
8194
8195 /**
8196  * Creates a new CResult_RouteDecodeErrorZ in the error state.
8197  */
8198 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
8199
8200 /**
8201  * Frees any resources used by the CResult_RouteDecodeErrorZ.
8202  */
8203 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
8204
8205 /**
8206  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
8207  * but with all dynamically-allocated buffers duplicated in new buffers.
8208  */
8209 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
8210
8211 /**
8212  * Constructs a new COption_u64Z containing a u64
8213  */
8214 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
8215
8216 /**
8217  * Constructs a new COption_u64Z containing nothing
8218  */
8219 struct LDKCOption_u64Z COption_u64Z_none(void);
8220
8221 /**
8222  * Frees any resources associated with the u64, if we are in the Some state
8223  */
8224 void COption_u64Z_free(struct LDKCOption_u64Z _res);
8225
8226 /**
8227  * Creates a new COption_u64Z which has the same data as `orig`
8228  * but with all dynamically-allocated buffers duplicated in new buffers.
8229  */
8230 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
8231
8232 /**
8233  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8234  */
8235 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
8236
8237 /**
8238  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8239  */
8240 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
8241
8242 /**
8243  * Creates a new CResult_RouteLightningErrorZ in the success state.
8244  */
8245 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
8246
8247 /**
8248  * Creates a new CResult_RouteLightningErrorZ in the error state.
8249  */
8250 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
8251
8252 /**
8253  * Frees any resources used by the CResult_RouteLightningErrorZ.
8254  */
8255 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
8256
8257 /**
8258  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
8259  * but with all dynamically-allocated buffers duplicated in new buffers.
8260  */
8261 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
8262
8263 /**
8264  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8265  */
8266 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
8267
8268 /**
8269  * Creates a new CResult_boolLightningErrorZ in the success state.
8270  */
8271 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
8272
8273 /**
8274  * Creates a new CResult_boolLightningErrorZ in the error state.
8275  */
8276 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
8277
8278 /**
8279  * Frees any resources used by the CResult_boolLightningErrorZ.
8280  */
8281 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
8282
8283 /**
8284  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
8285  * but with all dynamically-allocated buffers duplicated in new buffers.
8286  */
8287 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
8288
8289 /**
8290  * Creates a new tuple which has the same data as `orig`
8291  * but with all dynamically-allocated buffers duplicated in new buffers.
8292  */
8293 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
8294
8295 /**
8296  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
8297  */
8298 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
8299
8300 /**
8301  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
8302  */
8303 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
8304
8305 /**
8306  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8307  */
8308 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
8309
8310 /**
8311  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8312  */
8313 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
8314
8315 /**
8316  * Creates a new CResult_NoneLightningErrorZ in the success state.
8317  */
8318 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
8319
8320 /**
8321  * Creates a new CResult_NoneLightningErrorZ in the error state.
8322  */
8323 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
8324
8325 /**
8326  * Frees any resources used by the CResult_NoneLightningErrorZ.
8327  */
8328 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
8329
8330 /**
8331  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
8332  * but with all dynamically-allocated buffers duplicated in new buffers.
8333  */
8334 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
8335
8336 /**
8337  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8338  */
8339 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
8340
8341 /**
8342  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8343  */
8344 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
8345
8346 /**
8347  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
8348  */
8349 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
8350
8351 /**
8352  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
8353  */
8354 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
8355
8356 /**
8357  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
8358  */
8359 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
8360
8361 /**
8362  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
8363  * but with all dynamically-allocated buffers duplicated in new buffers.
8364  */
8365 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
8366
8367 /**
8368  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
8369  */
8370 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
8371
8372 /**
8373  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
8374  */
8375 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
8376
8377 /**
8378  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
8379  */
8380 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
8381
8382 /**
8383  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
8384  * but with all dynamically-allocated buffers duplicated in new buffers.
8385  */
8386 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
8387
8388 /**
8389  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
8390  */
8391 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
8392
8393 /**
8394  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
8395  */
8396 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
8397
8398 /**
8399  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
8400  */
8401 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
8402
8403 /**
8404  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
8405  * but with all dynamically-allocated buffers duplicated in new buffers.
8406  */
8407 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
8408
8409 /**
8410  * Creates a new CResult_TxOutAccessErrorZ in the success state.
8411  */
8412 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
8413
8414 /**
8415  * Creates a new CResult_TxOutAccessErrorZ in the error state.
8416  */
8417 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
8418
8419 /**
8420  * Frees any resources used by the CResult_TxOutAccessErrorZ.
8421  */
8422 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
8423
8424 /**
8425  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
8426  * but with all dynamically-allocated buffers duplicated in new buffers.
8427  */
8428 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
8429
8430 /**
8431  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
8432  */
8433 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
8434
8435 /**
8436  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
8437  */
8438 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
8439
8440 /**
8441  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
8442  */
8443 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
8444
8445 /**
8446  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8447  */
8448 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
8449
8450 /**
8451  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
8452  */
8453 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
8454
8455 /**
8456  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
8457  */
8458 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
8459
8460 /**
8461  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
8462  */
8463 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
8464
8465 /**
8466  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
8467  * but with all dynamically-allocated buffers duplicated in new buffers.
8468  */
8469 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
8470
8471 /**
8472  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8473  */
8474 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
8475
8476 /**
8477  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8478  */
8479 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
8480
8481 /**
8482  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8483  */
8484 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
8485
8486 /**
8487  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8488  * but with all dynamically-allocated buffers duplicated in new buffers.
8489  */
8490 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
8491
8492 /**
8493  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8494  */
8495 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
8496
8497 /**
8498  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8499  */
8500 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
8501
8502 /**
8503  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8504  */
8505 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
8506
8507 /**
8508  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8509  * but with all dynamically-allocated buffers duplicated in new buffers.
8510  */
8511 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
8512
8513 /**
8514  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8515  */
8516 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
8517
8518 /**
8519  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8520  */
8521 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
8522
8523 /**
8524  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8525  */
8526 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
8527
8528 /**
8529  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8530  */
8531 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
8532
8533 /**
8534  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
8535  * but with all dynamically-allocated buffers duplicated in new buffers.
8536  */
8537 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
8538
8539 /**
8540  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8541  */
8542 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
8543
8544 /**
8545  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
8546  */
8547 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
8548
8549 /**
8550  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
8551  */
8552 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
8553
8554 /**
8555  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
8556  */
8557 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
8558
8559 /**
8560  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
8561  * but with all dynamically-allocated buffers duplicated in new buffers.
8562  */
8563 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
8564
8565 /**
8566  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
8567  */
8568 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
8569
8570 /**
8571  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
8572  */
8573 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
8574
8575 /**
8576  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
8577  */
8578 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
8579
8580 /**
8581  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
8582  * but with all dynamically-allocated buffers duplicated in new buffers.
8583  */
8584 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
8585
8586 /**
8587  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
8588  */
8589 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
8590
8591 /**
8592  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
8593  */
8594 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8595
8596 /**
8597  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
8598  */
8599 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
8600
8601 /**
8602  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
8603  */
8604 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
8605
8606 /**
8607  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
8608  */
8609 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8610
8611 /**
8612  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
8613  */
8614 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
8615
8616 /**
8617  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
8618  */
8619 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
8620
8621 /**
8622  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
8623  */
8624 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8625
8626 /**
8627  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
8628  */
8629 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
8630
8631 /**
8632  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
8633  */
8634 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
8635
8636 /**
8637  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
8638  */
8639 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8640
8641 /**
8642  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
8643  */
8644 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
8645
8646 /**
8647  * Creates a new CResult_NetAddressu8Z in the success state.
8648  */
8649 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
8650
8651 /**
8652  * Creates a new CResult_NetAddressu8Z in the error state.
8653  */
8654 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
8655
8656 /**
8657  * Frees any resources used by the CResult_NetAddressu8Z.
8658  */
8659 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
8660
8661 /**
8662  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
8663  * but with all dynamically-allocated buffers duplicated in new buffers.
8664  */
8665 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
8666
8667 /**
8668  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
8669  */
8670 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
8671
8672 /**
8673  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
8674  */
8675 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
8676
8677 /**
8678  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
8679  */
8680 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
8681
8682 /**
8683  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
8684  * but with all dynamically-allocated buffers duplicated in new buffers.
8685  */
8686 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
8687
8688 /**
8689  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8690  */
8691 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
8692
8693 /**
8694  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8695  */
8696 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
8697
8698 /**
8699  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8700  */
8701 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
8702
8703 /**
8704  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8705  */
8706 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
8707
8708 /**
8709  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8710  */
8711 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
8712
8713 /**
8714  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8715  */
8716 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
8717
8718 /**
8719  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8720  */
8721 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
8722
8723 /**
8724  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8725  * but with all dynamically-allocated buffers duplicated in new buffers.
8726  */
8727 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
8728
8729 /**
8730  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8731  */
8732 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
8733
8734 /**
8735  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8736  */
8737 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
8738
8739 /**
8740  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
8741  */
8742 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
8743
8744 /**
8745  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
8746  * but with all dynamically-allocated buffers duplicated in new buffers.
8747  */
8748 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
8749
8750 /**
8751  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
8752  */
8753 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
8754
8755 /**
8756  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
8757  */
8758 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
8759
8760 /**
8761  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
8762  */
8763 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
8764
8765 /**
8766  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
8767  * but with all dynamically-allocated buffers duplicated in new buffers.
8768  */
8769 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
8770
8771 /**
8772  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
8773  */
8774 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
8775
8776 /**
8777  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
8778  */
8779 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
8780
8781 /**
8782  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
8783  */
8784 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
8785
8786 /**
8787  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
8788  * but with all dynamically-allocated buffers duplicated in new buffers.
8789  */
8790 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
8791
8792 /**
8793  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
8794  */
8795 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
8796
8797 /**
8798  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
8799  */
8800 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
8801
8802 /**
8803  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
8804  */
8805 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
8806
8807 /**
8808  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
8809  * but with all dynamically-allocated buffers duplicated in new buffers.
8810  */
8811 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
8812
8813 /**
8814  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
8815  */
8816 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
8817
8818 /**
8819  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
8820  */
8821 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
8822
8823 /**
8824  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
8825  */
8826 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
8827
8828 /**
8829  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
8830  * but with all dynamically-allocated buffers duplicated in new buffers.
8831  */
8832 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
8833
8834 /**
8835  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
8836  */
8837 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
8838
8839 /**
8840  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
8841  */
8842 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
8843
8844 /**
8845  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
8846  */
8847 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
8848
8849 /**
8850  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
8851  * but with all dynamically-allocated buffers duplicated in new buffers.
8852  */
8853 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
8854
8855 /**
8856  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
8857  */
8858 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
8859
8860 /**
8861  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
8862  */
8863 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
8864
8865 /**
8866  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
8867  */
8868 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
8869
8870 /**
8871  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
8872  * but with all dynamically-allocated buffers duplicated in new buffers.
8873  */
8874 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
8875
8876 /**
8877  * Creates a new CResult_InitDecodeErrorZ in the success state.
8878  */
8879 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
8880
8881 /**
8882  * Creates a new CResult_InitDecodeErrorZ in the error state.
8883  */
8884 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
8885
8886 /**
8887  * Frees any resources used by the CResult_InitDecodeErrorZ.
8888  */
8889 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
8890
8891 /**
8892  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
8893  * but with all dynamically-allocated buffers duplicated in new buffers.
8894  */
8895 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
8896
8897 /**
8898  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
8899  */
8900 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
8901
8902 /**
8903  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
8904  */
8905 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
8906
8907 /**
8908  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
8909  */
8910 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
8911
8912 /**
8913  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
8914  * but with all dynamically-allocated buffers duplicated in new buffers.
8915  */
8916 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
8917
8918 /**
8919  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
8920  */
8921 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
8922
8923 /**
8924  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
8925  */
8926 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
8927
8928 /**
8929  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
8930  */
8931 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
8932
8933 /**
8934  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
8935  * but with all dynamically-allocated buffers duplicated in new buffers.
8936  */
8937 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
8938
8939 /**
8940  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
8941  */
8942 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
8943
8944 /**
8945  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
8946  */
8947 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
8948
8949 /**
8950  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
8951  */
8952 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
8953
8954 /**
8955  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
8956  * but with all dynamically-allocated buffers duplicated in new buffers.
8957  */
8958 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
8959
8960 /**
8961  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
8962  */
8963 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
8964
8965 /**
8966  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
8967  */
8968 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
8969
8970 /**
8971  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
8972  */
8973 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
8974
8975 /**
8976  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
8977  * but with all dynamically-allocated buffers duplicated in new buffers.
8978  */
8979 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
8980
8981 /**
8982  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
8983  */
8984 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
8985
8986 /**
8987  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
8988  */
8989 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
8990
8991 /**
8992  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
8993  */
8994 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
8995
8996 /**
8997  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
8998  * but with all dynamically-allocated buffers duplicated in new buffers.
8999  */
9000 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
9001
9002 /**
9003  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
9004  */
9005 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
9006
9007 /**
9008  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
9009  */
9010 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
9011
9012 /**
9013  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
9014  */
9015 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
9016
9017 /**
9018  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
9019  * but with all dynamically-allocated buffers duplicated in new buffers.
9020  */
9021 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
9022
9023 /**
9024  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
9025  */
9026 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
9027
9028 /**
9029  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
9030  */
9031 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
9032
9033 /**
9034  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
9035  */
9036 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
9037
9038 /**
9039  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
9040  * but with all dynamically-allocated buffers duplicated in new buffers.
9041  */
9042 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
9043
9044 /**
9045  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
9046  */
9047 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
9048
9049 /**
9050  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
9051  */
9052 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
9053
9054 /**
9055  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
9056  */
9057 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
9058
9059 /**
9060  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
9061  * but with all dynamically-allocated buffers duplicated in new buffers.
9062  */
9063 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
9064
9065 /**
9066  * Creates a new CResult_PingDecodeErrorZ in the success state.
9067  */
9068 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
9069
9070 /**
9071  * Creates a new CResult_PingDecodeErrorZ in the error state.
9072  */
9073 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
9074
9075 /**
9076  * Frees any resources used by the CResult_PingDecodeErrorZ.
9077  */
9078 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
9079
9080 /**
9081  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
9082  * but with all dynamically-allocated buffers duplicated in new buffers.
9083  */
9084 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
9085
9086 /**
9087  * Creates a new CResult_PongDecodeErrorZ in the success state.
9088  */
9089 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
9090
9091 /**
9092  * Creates a new CResult_PongDecodeErrorZ in the error state.
9093  */
9094 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
9095
9096 /**
9097  * Frees any resources used by the CResult_PongDecodeErrorZ.
9098  */
9099 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
9100
9101 /**
9102  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
9103  * but with all dynamically-allocated buffers duplicated in new buffers.
9104  */
9105 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
9106
9107 /**
9108  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
9109  */
9110 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
9111
9112 /**
9113  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
9114  */
9115 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9116
9117 /**
9118  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
9119  */
9120 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
9121
9122 /**
9123  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
9124  * but with all dynamically-allocated buffers duplicated in new buffers.
9125  */
9126 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9127
9128 /**
9129  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
9130  */
9131 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
9132
9133 /**
9134  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
9135  */
9136 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9137
9138 /**
9139  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
9140  */
9141 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
9142
9143 /**
9144  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
9145  * but with all dynamically-allocated buffers duplicated in new buffers.
9146  */
9147 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9148
9149 /**
9150  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
9151  */
9152 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
9153
9154 /**
9155  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
9156  */
9157 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9158
9159 /**
9160  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
9161  */
9162 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
9163
9164 /**
9165  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
9166  * but with all dynamically-allocated buffers duplicated in new buffers.
9167  */
9168 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
9169
9170 /**
9171  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
9172  */
9173 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
9174
9175 /**
9176  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
9177  */
9178 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9179
9180 /**
9181  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
9182  */
9183 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
9184
9185 /**
9186  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
9187  * but with all dynamically-allocated buffers duplicated in new buffers.
9188  */
9189 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
9190
9191 /**
9192  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
9193  */
9194 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
9195
9196 /**
9197  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
9198  */
9199 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
9200
9201 /**
9202  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
9203  */
9204 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
9205
9206 /**
9207  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
9208  * but with all dynamically-allocated buffers duplicated in new buffers.
9209  */
9210 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
9211
9212 /**
9213  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
9214  */
9215 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
9216
9217 /**
9218  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
9219  */
9220 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9221
9222 /**
9223  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
9224  */
9225 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
9226
9227 /**
9228  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
9229  * but with all dynamically-allocated buffers duplicated in new buffers.
9230  */
9231 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9232
9233 /**
9234  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
9235  */
9236 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
9237
9238 /**
9239  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
9240  */
9241 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9242
9243 /**
9244  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
9245  */
9246 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
9247
9248 /**
9249  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
9250  * but with all dynamically-allocated buffers duplicated in new buffers.
9251  */
9252 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9253
9254 /**
9255  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
9256  */
9257 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
9258
9259 /**
9260  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
9261  */
9262 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
9263
9264 /**
9265  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
9266  */
9267 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
9268
9269 /**
9270  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
9271  * but with all dynamically-allocated buffers duplicated in new buffers.
9272  */
9273 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
9274
9275 /**
9276  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
9277  */
9278 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
9279
9280 /**
9281  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
9282  */
9283 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
9284
9285 /**
9286  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
9287  */
9288 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
9289
9290 /**
9291  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
9292  * but with all dynamically-allocated buffers duplicated in new buffers.
9293  */
9294 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
9295
9296 /**
9297  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
9298  */
9299 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
9300
9301 /**
9302  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
9303  */
9304 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
9305
9306 /**
9307  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
9308  */
9309 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
9310
9311 /**
9312  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
9313  * but with all dynamically-allocated buffers duplicated in new buffers.
9314  */
9315 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
9316
9317 /**
9318  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
9319  */
9320 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
9321
9322 /**
9323  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
9324  */
9325 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
9326
9327 /**
9328  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
9329  */
9330 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
9331
9332 /**
9333  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
9334  * but with all dynamically-allocated buffers duplicated in new buffers.
9335  */
9336 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
9337
9338 /**
9339  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
9340  */
9341 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
9342
9343 /**
9344  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
9345  */
9346 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
9347
9348 /**
9349  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
9350  */
9351 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
9352
9353 /**
9354  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
9355  * but with all dynamically-allocated buffers duplicated in new buffers.
9356  */
9357 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
9358
9359 /**
9360  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
9361  */
9362 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
9363
9364 /**
9365  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
9366  */
9367 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9368
9369 /**
9370  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
9371  */
9372 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
9373
9374 /**
9375  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
9376  * but with all dynamically-allocated buffers duplicated in new buffers.
9377  */
9378 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9379
9380 /**
9381  * Creates a new tuple which has the same data as `orig`
9382  * but with all dynamically-allocated buffers duplicated in new buffers.
9383  */
9384 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
9385
9386 /**
9387  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
9388  */
9389 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
9390
9391 /**
9392  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
9393  */
9394 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
9395
9396 /**
9397  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
9398  */
9399 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
9400
9401 /**
9402  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
9403  */
9404 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
9405
9406 /**
9407  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
9408  */
9409 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
9410
9411 /**
9412  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
9413  * but with all dynamically-allocated buffers duplicated in new buffers.
9414  */
9415 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
9416
9417 /**
9418  * Creates a new CResult_SignatureNoneZ in the success state.
9419  */
9420 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
9421
9422 /**
9423  * Creates a new CResult_SignatureNoneZ in the error state.
9424  */
9425 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
9426
9427 /**
9428  * Frees any resources used by the CResult_SignatureNoneZ.
9429  */
9430 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
9431
9432 /**
9433  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
9434  * but with all dynamically-allocated buffers duplicated in new buffers.
9435  */
9436 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
9437
9438 /**
9439  * Creates a new CResult_SignDecodeErrorZ in the success state.
9440  */
9441 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
9442
9443 /**
9444  * Creates a new CResult_SignDecodeErrorZ in the error state.
9445  */
9446 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
9447
9448 /**
9449  * Frees any resources used by the CResult_SignDecodeErrorZ.
9450  */
9451 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
9452
9453 /**
9454  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
9455  * but with all dynamically-allocated buffers duplicated in new buffers.
9456  */
9457 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
9458
9459 /**
9460  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9461  */
9462 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
9463
9464 /**
9465  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
9466  */
9467 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
9468
9469 /**
9470  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
9471  */
9472 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
9473
9474 /**
9475  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
9476  */
9477 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
9478
9479 /**
9480  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
9481  * but with all dynamically-allocated buffers duplicated in new buffers.
9482  */
9483 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
9484
9485 /**
9486  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
9487  */
9488 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
9489
9490 /**
9491  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
9492  */
9493 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
9494
9495 /**
9496  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
9497  */
9498 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
9499
9500 /**
9501  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
9502  * but with all dynamically-allocated buffers duplicated in new buffers.
9503  */
9504 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
9505
9506 /**
9507  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9508  */
9509 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
9510
9511 /**
9512  * Creates a new CResult_TransactionNoneZ in the success state.
9513  */
9514 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
9515
9516 /**
9517  * Creates a new CResult_TransactionNoneZ in the error state.
9518  */
9519 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
9520
9521 /**
9522  * Frees any resources used by the CResult_TransactionNoneZ.
9523  */
9524 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
9525
9526 /**
9527  * Creates a new CResult_NoneErrorZ in the success state.
9528  */
9529 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
9530
9531 /**
9532  * Creates a new CResult_NoneErrorZ in the error state.
9533  */
9534 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
9535
9536 /**
9537  * Frees any resources used by the CResult_NoneErrorZ.
9538  */
9539 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
9540
9541 /**
9542  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9543  */
9544 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
9545
9546 /**
9547  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
9548  */
9549 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
9550
9551 /**
9552  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
9553  */
9554 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
9555
9556 /**
9557  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
9558  */
9559 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
9560
9561 /**
9562  * Creates a new CResult_NoneAPIErrorZ in the success state.
9563  */
9564 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
9565
9566 /**
9567  * Creates a new CResult_NoneAPIErrorZ in the error state.
9568  */
9569 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
9570
9571 /**
9572  * Frees any resources used by the CResult_NoneAPIErrorZ.
9573  */
9574 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
9575
9576 /**
9577  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
9578  * but with all dynamically-allocated buffers duplicated in new buffers.
9579  */
9580 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
9581
9582 /**
9583  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9584  */
9585 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
9586
9587 /**
9588  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9589  */
9590 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
9591
9592 /**
9593  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
9594  */
9595 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
9596
9597 /**
9598  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
9599  */
9600 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
9601
9602 /**
9603  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
9604  */
9605 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
9606
9607 /**
9608  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9609  * but with all dynamically-allocated buffers duplicated in new buffers.
9610  */
9611 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
9612
9613 /**
9614  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9615  */
9616 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
9617
9618 /**
9619  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9620  */
9621 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
9622
9623 /**
9624  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9625  */
9626 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
9627
9628 /**
9629  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9630  */
9631 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
9632
9633 /**
9634  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9635  */
9636 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
9637
9638 /**
9639  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9640  */
9641 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
9642
9643 /**
9644  * Frees any resources used by the Event
9645  */
9646 void Event_free(struct LDKEvent this_ptr);
9647
9648 /**
9649  * Creates a copy of the Event
9650  */
9651 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
9652
9653 /**
9654  * Serialize the Event object into a byte array which can be read by Event_read
9655  */
9656 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
9657
9658 /**
9659  * Frees any resources used by the MessageSendEvent
9660  */
9661 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
9662
9663 /**
9664  * Creates a copy of the MessageSendEvent
9665  */
9666 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
9667
9668 /**
9669  * Calls the free function if one is set
9670  */
9671 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
9672
9673 /**
9674  * Calls the free function if one is set
9675  */
9676 void EventsProvider_free(struct LDKEventsProvider this_ptr);
9677
9678 /**
9679  * Frees any resources used by the APIError
9680  */
9681 void APIError_free(struct LDKAPIError this_ptr);
9682
9683 /**
9684  * Creates a copy of the APIError
9685  */
9686 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
9687
9688 /**
9689  * Creates a copy of the Level
9690  */
9691 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
9692
9693 /**
9694  * Returns the most verbose logging level.
9695  */
9696 MUST_USE_RES enum LDKLevel Level_max(void);
9697
9698 /**
9699  * Calls the free function if one is set
9700  */
9701 void Logger_free(struct LDKLogger this_ptr);
9702
9703 /**
9704  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
9705  */
9706 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
9707
9708 /**
9709  * Confirmations we will wait for before considering the channel locked in.
9710  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
9711  * equivalent limit applied to outbound channels).
9712  *
9713  * Default value: 6.
9714  */
9715 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9716
9717 /**
9718  * Confirmations we will wait for before considering the channel locked in.
9719  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
9720  * equivalent limit applied to outbound channels).
9721  *
9722  * Default value: 6.
9723  */
9724 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
9725
9726 /**
9727  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
9728  * the number of blocks we have to punish our counterparty if they broadcast a revoked
9729  * transaction).
9730  *
9731  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
9732  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
9733  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
9734  * possibly with time in between to RBF the spending transaction).
9735  *
9736  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
9737  * case of an honest unilateral channel close, which implicitly decrease the economic value of
9738  * our channel.
9739  *
9740  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
9741  * can tweak config to ask for more security, not less.
9742  */
9743 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9744
9745 /**
9746  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
9747  * the number of blocks we have to punish our counterparty if they broadcast a revoked
9748  * transaction).
9749  *
9750  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
9751  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
9752  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
9753  * possibly with time in between to RBF the spending transaction).
9754  *
9755  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
9756  * case of an honest unilateral channel close, which implicitly decrease the economic value of
9757  * our channel.
9758  *
9759  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
9760  * can tweak config to ask for more security, not less.
9761  */
9762 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
9763
9764 /**
9765  * Set to the smallest value HTLC we will accept to process.
9766  *
9767  * This value is sent to our counterparty on channel-open and we close the channel any time
9768  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
9769  *
9770  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
9771  * by the protocol.
9772  */
9773 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9774
9775 /**
9776  * Set to the smallest value HTLC we will accept to process.
9777  *
9778  * This value is sent to our counterparty on channel-open and we close the channel any time
9779  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
9780  *
9781  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
9782  * by the protocol.
9783  */
9784 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
9785
9786 /**
9787  * Constructs a new ChannelHandshakeConfig given each field
9788  */
9789 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);
9790
9791 /**
9792  * Creates a copy of the ChannelHandshakeConfig
9793  */
9794 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
9795
9796 /**
9797  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
9798  */
9799 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
9800
9801 /**
9802  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
9803  */
9804 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
9805
9806 /**
9807  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
9808  * only applies to inbound channels.
9809  *
9810  * Default value: 0.
9811  */
9812 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9813
9814 /**
9815  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
9816  * only applies to inbound channels.
9817  *
9818  * Default value: 0.
9819  */
9820 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9821
9822 /**
9823  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
9824  * you to limit the maximum minimum-size they can require.
9825  *
9826  * Default value: u64::max_value.
9827  */
9828 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9829
9830 /**
9831  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
9832  * you to limit the maximum minimum-size they can require.
9833  *
9834  * Default value: u64::max_value.
9835  */
9836 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9837
9838 /**
9839  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
9840  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
9841  *
9842  * Default value: 0.
9843  */
9844 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9845
9846 /**
9847  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
9848  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
9849  *
9850  * Default value: 0.
9851  */
9852 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9853
9854 /**
9855  * The remote node will require we keep a certain amount in direct payment to ourselves at all
9856  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
9857  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
9858  *
9859  * Default value: u64::max_value.
9860  */
9861 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9862
9863 /**
9864  * The remote node will require we keep a certain amount in direct payment to ourselves at all
9865  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
9866  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
9867  *
9868  * Default value: u64::max_value.
9869  */
9870 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9871
9872 /**
9873  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
9874  * time. This allows you to set a minimum such value.
9875  *
9876  * Default value: 0.
9877  */
9878 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9879
9880 /**
9881  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
9882  * time. This allows you to set a minimum such value.
9883  *
9884  * Default value: 0.
9885  */
9886 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
9887
9888 /**
9889  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
9890  * required to always be higher than this value so this only applies to HTLC outputs (and
9891  * potentially to-self outputs before any payments have been made).
9892  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9893  * This setting allows you to set a minimum dust limit for their commitment transactions,
9894  * reflecting the reality that tiny outputs are not considered standard transactions and will
9895  * not propagate through the Bitcoin network.
9896  *
9897  * Default value: 546, the current dust limit on the Bitcoin network.
9898  */
9899 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9900
9901 /**
9902  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
9903  * required to always be higher than this value so this only applies to HTLC outputs (and
9904  * potentially to-self outputs before any payments have been made).
9905  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9906  * This setting allows you to set a minimum dust limit for their commitment transactions,
9907  * reflecting the reality that tiny outputs are not considered standard transactions and will
9908  * not propagate through the Bitcoin network.
9909  *
9910  * Default value: 546, the current dust limit on the Bitcoin network.
9911  */
9912 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9913
9914 /**
9915  * Maximum allowed threshold above which outputs will not be generated in their commitment
9916  * transactions.
9917  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9918  *
9919  * Default value: u64::max_value.
9920  */
9921 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9922
9923 /**
9924  * Maximum allowed threshold above which outputs will not be generated in their commitment
9925  * transactions.
9926  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9927  *
9928  * Default value: u64::max_value.
9929  */
9930 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9931
9932 /**
9933  * Before a channel is usable the funding transaction will need to be confirmed by at least a
9934  * certain number of blocks, specified by the node which is not the funder (as the funder can
9935  * assume they aren't going to double-spend themselves).
9936  * This config allows you to set a limit on the maximum amount of time to wait.
9937  *
9938  * Default value: 144, or roughly one day and only applies to outbound channels.
9939  */
9940 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9941
9942 /**
9943  * Before a channel is usable the funding transaction will need to be confirmed by at least a
9944  * certain number of blocks, specified by the node which is not the funder (as the funder can
9945  * assume they aren't going to double-spend themselves).
9946  * This config allows you to set a limit on the maximum amount of time to wait.
9947  *
9948  * Default value: 144, or roughly one day and only applies to outbound channels.
9949  */
9950 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
9951
9952 /**
9953  * Set to force the incoming channel to match our announced channel preference in
9954  * ChannelConfig.
9955  *
9956  * Default value: true, to make the default that no announced channels are possible (which is
9957  * appropriate for any nodes which are not online very reliably).
9958  */
9959 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9960
9961 /**
9962  * Set to force the incoming channel to match our announced channel preference in
9963  * ChannelConfig.
9964  *
9965  * Default value: true, to make the default that no announced channels are possible (which is
9966  * appropriate for any nodes which are not online very reliably).
9967  */
9968 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
9969
9970 /**
9971  * Set to the amount of time we're willing to wait to claim money back to us.
9972  *
9973  * Not checking this value would be a security issue, as our peer would be able to set it to
9974  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
9975  *
9976  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
9977  * reduce the loss of having useless locked funds (if your peer accepts)
9978  */
9979 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9980
9981 /**
9982  * Set to the amount of time we're willing to wait to claim money back to us.
9983  *
9984  * Not checking this value would be a security issue, as our peer would be able to set it to
9985  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
9986  *
9987  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
9988  * reduce the loss of having useless locked funds (if your peer accepts)
9989  */
9990 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
9991
9992 /**
9993  * Constructs a new ChannelHandshakeLimits given each field
9994  */
9995 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);
9996
9997 /**
9998  * Creates a copy of the ChannelHandshakeLimits
9999  */
10000 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
10001
10002 /**
10003  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
10004  */
10005 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
10006
10007 /**
10008  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
10009  */
10010 void ChannelConfig_free(struct LDKChannelConfig this_obj);
10011
10012 /**
10013  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
10014  * This may be allowed to change at runtime in a later update, however doing so must result in
10015  * update messages sent to notify all nodes of our updated relay fee.
10016  *
10017  * Default value: 0.
10018  */
10019 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
10020
10021 /**
10022  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
10023  * This may be allowed to change at runtime in a later update, however doing so must result in
10024  * update messages sent to notify all nodes of our updated relay fee.
10025  *
10026  * Default value: 0.
10027  */
10028 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
10029
10030 /**
10031  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
10032  * the channel this config applies to.
10033  *
10034  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
10035  * HTLC balance when a channel appears on-chain whereas
10036  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
10037  * (non-HTLC-encumbered) balance.
10038  *
10039  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
10040  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
10041  * commitment transaction at least once per this many blocks (minus some margin to allow us
10042  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
10043  * the spending transaction).
10044  *
10045  * Default value: 72 (12 hours at an average of 6 blocks/hour).
10046  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
10047  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
10048  *
10049  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
10050  */
10051 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
10052
10053 /**
10054  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
10055  * the channel this config applies to.
10056  *
10057  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
10058  * HTLC balance when a channel appears on-chain whereas
10059  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
10060  * (non-HTLC-encumbered) balance.
10061  *
10062  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
10063  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
10064  * commitment transaction at least once per this many blocks (minus some margin to allow us
10065  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
10066  * the spending transaction).
10067  *
10068  * Default value: 72 (12 hours at an average of 6 blocks/hour).
10069  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
10070  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
10071  *
10072  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
10073  */
10074 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
10075
10076 /**
10077  * Set to announce the channel publicly and notify all nodes that they can route via this
10078  * channel.
10079  *
10080  * This should only be set to true for nodes which expect to be online reliably.
10081  *
10082  * As the node which funds a channel picks this value this will only apply for new outbound
10083  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
10084  *
10085  * This cannot be changed after the initial channel handshake.
10086  *
10087  * Default value: false.
10088  */
10089 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
10090
10091 /**
10092  * Set to announce the channel publicly and notify all nodes that they can route via this
10093  * channel.
10094  *
10095  * This should only be set to true for nodes which expect to be online reliably.
10096  *
10097  * As the node which funds a channel picks this value this will only apply for new outbound
10098  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
10099  *
10100  * This cannot be changed after the initial channel handshake.
10101  *
10102  * Default value: false.
10103  */
10104 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
10105
10106 /**
10107  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
10108  * supports it, they will then enforce the mutual-close output to us matches what we provided
10109  * at intialization, preventing us from closing to an alternate pubkey.
10110  *
10111  * This is set to true by default to provide a slight increase in security, though ultimately
10112  * any attacker who is able to take control of a channel can just as easily send the funds via
10113  * lightning payments, so we never require that our counterparties support this option.
10114  *
10115  * This cannot be changed after a channel has been initialized.
10116  *
10117  * Default value: true.
10118  */
10119 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
10120
10121 /**
10122  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
10123  * supports it, they will then enforce the mutual-close output to us matches what we provided
10124  * at intialization, preventing us from closing to an alternate pubkey.
10125  *
10126  * This is set to true by default to provide a slight increase in security, though ultimately
10127  * any attacker who is able to take control of a channel can just as easily send the funds via
10128  * lightning payments, so we never require that our counterparties support this option.
10129  *
10130  * This cannot be changed after a channel has been initialized.
10131  *
10132  * Default value: true.
10133  */
10134 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
10135
10136 /**
10137  * Constructs a new ChannelConfig given each field
10138  */
10139 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);
10140
10141 /**
10142  * Creates a copy of the ChannelConfig
10143  */
10144 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
10145
10146 /**
10147  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
10148  */
10149 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
10150
10151 /**
10152  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
10153  */
10154 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
10155
10156 /**
10157  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
10158  */
10159 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
10160
10161 /**
10162  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
10163  */
10164 void UserConfig_free(struct LDKUserConfig this_obj);
10165
10166 /**
10167  * Channel config that we propose to our counterparty.
10168  */
10169 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
10170
10171 /**
10172  * Channel config that we propose to our counterparty.
10173  */
10174 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
10175
10176 /**
10177  * Limits applied to our counterparty's proposed channel config settings.
10178  */
10179 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
10180
10181 /**
10182  * Limits applied to our counterparty's proposed channel config settings.
10183  */
10184 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
10185
10186 /**
10187  * Channel config which affects behavior during channel lifetime.
10188  */
10189 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
10190
10191 /**
10192  * Channel config which affects behavior during channel lifetime.
10193  */
10194 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
10195
10196 /**
10197  * Constructs a new UserConfig given each field
10198  */
10199 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);
10200
10201 /**
10202  * Creates a copy of the UserConfig
10203  */
10204 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
10205
10206 /**
10207  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
10208  */
10209 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
10210
10211 /**
10212  * Creates a copy of the AccessError
10213  */
10214 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
10215
10216 /**
10217  * Calls the free function if one is set
10218  */
10219 void Access_free(struct LDKAccess this_ptr);
10220
10221 /**
10222  * Calls the free function if one is set
10223  */
10224 void Listen_free(struct LDKListen this_ptr);
10225
10226 /**
10227  * Calls the free function if one is set
10228  */
10229 void Watch_free(struct LDKWatch this_ptr);
10230
10231 /**
10232  * Calls the free function if one is set
10233  */
10234 void Filter_free(struct LDKFilter this_ptr);
10235
10236 /**
10237  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
10238  */
10239 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
10240
10241 /**
10242  * First block where the transaction output may have been spent.
10243  */
10244 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10245
10246 /**
10247  * First block where the transaction output may have been spent.
10248  */
10249 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10250
10251 /**
10252  * Outpoint identifying the transaction output.
10253  */
10254 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10255
10256 /**
10257  * Outpoint identifying the transaction output.
10258  */
10259 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10260
10261 /**
10262  * Spending condition of the transaction output.
10263  */
10264 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10265
10266 /**
10267  * Spending condition of the transaction output.
10268  */
10269 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
10270
10271 /**
10272  * Constructs a new WatchedOutput given each field
10273  */
10274 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
10275
10276 /**
10277  * Calls the free function if one is set
10278  */
10279 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
10280
10281 /**
10282  * Creates a copy of the ConfirmationTarget
10283  */
10284 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
10285
10286 /**
10287  * Calls the free function if one is set
10288  */
10289 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
10290
10291 /**
10292  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
10293  */
10294 void ChainMonitor_free(struct LDKChainMonitor this_obj);
10295
10296 /**
10297  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10298  * of a channel and reacting accordingly based on transactions in the connected block. See
10299  * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
10300  * be returned by [`chain::Watch::release_pending_monitor_events`].
10301  *
10302  * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
10303  * calls must not exclude any transactions matching the new outputs nor any in-block
10304  * descendants of such transactions. It is not necessary to re-fetch the block to obtain
10305  * updated `txdata`.
10306  */
10307 void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
10308
10309 /**
10310  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10311  * of a channel and reacting accordingly to newly confirmed transactions. For details, see
10312  * [`ChannelMonitor::transactions_confirmed`].
10313  *
10314  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10315  * blocks. May be called before or after [`update_best_block`] for transactions in the
10316  * corresponding block. See [`update_best_block`] for further calling expectations.
10317  *
10318  * [`block_connected`]: Self::block_connected
10319  * [`update_best_block`]: Self::update_best_block
10320  */
10321 void ChainMonitor_transactions_confirmed(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
10322
10323 /**
10324  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10325  * of a channel and reacting accordingly based on the new chain tip. For details, see
10326  * [`ChannelMonitor::update_best_block`].
10327  *
10328  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10329  * blocks. May be called before or after [`transactions_confirmed`] for the corresponding
10330  * block.
10331  *
10332  * Must be called after new blocks become available for the most recent block. Intermediary
10333  * blocks, however, may be safely skipped. In the event of a chain re-organization, this only
10334  * needs to be called for the most recent block assuming `transaction_unconfirmed` is called
10335  * for any affected transactions.
10336  *
10337  * [`block_connected`]: Self::block_connected
10338  * [`transactions_confirmed`]: Self::transactions_confirmed
10339  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10340  */
10341 void ChainMonitor_update_best_block(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height);
10342
10343 /**
10344  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10345  * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
10346  * details.
10347  */
10348 void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
10349
10350 /**
10351  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10352  * of a channel based on transactions unconfirmed as a result of a chain reorganization. See
10353  * [`ChannelMonitor::transaction_unconfirmed`] for details.
10354  *
10355  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
10356  * than blocks. May be called before or after [`update_best_block`] for transactions in the
10357  * corresponding block. See [`update_best_block`] for further calling expectations.
10358  *
10359  * [`block_disconnected`]: Self::block_disconnected
10360  * [`update_best_block`]: Self::update_best_block
10361  */
10362 void ChainMonitor_transaction_unconfirmed(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32]);
10363
10364 /**
10365  * Returns the set of txids that should be monitored for re-organization out of the chain.
10366  */
10367 MUST_USE_RES struct LDKCVec_TxidZ ChainMonitor_get_relevant_txids(const struct LDKChainMonitor *NONNULL_PTR this_arg);
10368
10369 /**
10370  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
10371  *
10372  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
10373  * will call back to it indicating transactions and outputs of interest. This allows clients to
10374  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
10375  * always need to fetch full blocks absent another means for determining which blocks contain
10376  * transactions relevant to the watched channels.
10377  */
10378 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
10379
10380 /**
10381  * Constructs a new Watch which calls the relevant methods on this_arg.
10382  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
10383  */
10384 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
10385
10386 /**
10387  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
10388  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
10389  */
10390 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
10391
10392 /**
10393  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
10394  */
10395 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
10396
10397 /**
10398  * The sequence number of this update. Updates *must* be replayed in-order according to this
10399  * sequence number (and updates may panic if they are not). The update_id values are strictly
10400  * increasing and increase by one for each new update, with one exception specified below.
10401  *
10402  * This sequence number is also used to track up to which points updates which returned
10403  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
10404  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
10405  *
10406  * The only instance where update_id values are not strictly increasing is the case where we
10407  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
10408  * its docs for more details.
10409  */
10410 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
10411
10412 /**
10413  * The sequence number of this update. Updates *must* be replayed in-order according to this
10414  * sequence number (and updates may panic if they are not). The update_id values are strictly
10415  * increasing and increase by one for each new update, with one exception specified below.
10416  *
10417  * This sequence number is also used to track up to which points updates which returned
10418  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
10419  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
10420  *
10421  * The only instance where update_id values are not strictly increasing is the case where we
10422  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
10423  * its docs for more details.
10424  */
10425 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
10426
10427 /**
10428  * Creates a copy of the ChannelMonitorUpdate
10429  */
10430 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
10431
10432 /**
10433  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
10434  */
10435 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
10436
10437 /**
10438  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
10439  */
10440 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
10441
10442 /**
10443  * Creates a copy of the ChannelMonitorUpdateErr
10444  */
10445 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
10446
10447 /**
10448  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
10449  */
10450 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
10451
10452 /**
10453  * Creates a copy of the MonitorUpdateError
10454  */
10455 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
10456
10457 /**
10458  * Frees any resources used by the MonitorEvent
10459  */
10460 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
10461
10462 /**
10463  * Creates a copy of the MonitorEvent
10464  */
10465 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
10466
10467 /**
10468  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
10469  */
10470 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
10471
10472 /**
10473  * Creates a copy of the HTLCUpdate
10474  */
10475 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
10476
10477 /**
10478  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
10479  */
10480 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
10481
10482 /**
10483  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
10484  */
10485 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
10486
10487 /**
10488  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
10489  */
10490 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
10491
10492 /**
10493  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
10494  */
10495 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
10496
10497 /**
10498  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
10499  * itself.
10500  *
10501  * panics if the given update is not the next update by update_id.
10502  */
10503 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);
10504
10505 /**
10506  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
10507  * ChannelMonitor.
10508  */
10509 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10510
10511 /**
10512  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
10513  */
10514 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10515
10516 /**
10517  * Gets a list of txids, with their output scripts (in the order they appear in the
10518  * transaction), which we must learn about spends of via block_connected().
10519  */
10520 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10521
10522 /**
10523  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
10524  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
10525  * have been registered.
10526  */
10527 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
10528
10529 /**
10530  * Get the list of HTLCs who's status has been updated on chain. This should be called by
10531  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
10532  */
10533 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10534
10535 /**
10536  * Gets the list of pending events which were generated by previous actions, clearing the list
10537  * in the process.
10538  *
10539  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
10540  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
10541  * no internal locking in ChannelMonitors.
10542  */
10543 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10544
10545 /**
10546  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
10547  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
10548  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
10549  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
10550  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
10551  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
10552  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
10553  * out-of-band the other node operator to coordinate with him if option is available to you.
10554  * In any-case, choice is up to the user.
10555  */
10556 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);
10557
10558 /**
10559  * Processes transactions in a newly connected block, which may result in any of the following:
10560  * - update the monitor's state against resolved HTLCs
10561  * - punish the counterparty in the case of seeing a revoked commitment transaction
10562  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
10563  * - detect settled outputs for later spending
10564  * - schedule and bump any in-flight claims
10565  *
10566  * Returns any new outputs to watch from `txdata`; after called, these are also included in
10567  * [`get_outputs_to_watch`].
10568  *
10569  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
10570  */
10571 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);
10572
10573 /**
10574  * Determines if the disconnected block contained any transactions of interest and updates
10575  * appropriately.
10576  */
10577 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);
10578
10579 /**
10580  * Processes transactions confirmed in a block with the given header and height, returning new
10581  * outputs to watch. See [`block_connected`] for details.
10582  *
10583  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10584  * blocks. May be called before or after [`update_best_block`] for transactions in the
10585  * corresponding block. See [`update_best_block`] for further calling expectations.
10586  *
10587  * [`block_connected`]: Self::block_connected
10588  * [`update_best_block`]: Self::update_best_block
10589  */
10590 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);
10591
10592 /**
10593  * Processes a transaction that was reorganized out of the chain.
10594  *
10595  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
10596  * than blocks. May be called before or after [`update_best_block`] for transactions in the
10597  * corresponding block. See [`update_best_block`] for further calling expectations.
10598  *
10599  * [`block_disconnected`]: Self::block_disconnected
10600  * [`update_best_block`]: Self::update_best_block
10601  */
10602 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);
10603
10604 /**
10605  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
10606  * [`block_connected`] for details.
10607  *
10608  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10609  * blocks. May be called before or after [`transactions_confirmed`] for the corresponding
10610  * block.
10611  *
10612  * Must be called after new blocks become available for the most recent block. Intermediary
10613  * blocks, however, may be safely skipped. In the event of a chain re-organization, this only
10614  * needs to be called for the most recent block assuming `transaction_unconfirmed` is called
10615  * for any affected transactions.
10616  *
10617  * [`block_connected`]: Self::block_connected
10618  * [`transactions_confirmed`]: Self::transactions_confirmed
10619  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10620  */
10621 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);
10622
10623 /**
10624  * Returns the set of txids that should be monitored for re-organization out of the chain.
10625  */
10626 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10627
10628 /**
10629  * Calls the free function if one is set
10630  */
10631 void Persist_free(struct LDKPersist this_ptr);
10632
10633 /**
10634  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
10635  */
10636 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
10637
10638 /**
10639  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
10640  */
10641 void OutPoint_free(struct LDKOutPoint this_obj);
10642
10643 /**
10644  * The referenced transaction's txid.
10645  */
10646 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
10647
10648 /**
10649  * The referenced transaction's txid.
10650  */
10651 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10652
10653 /**
10654  * The index of the referenced output in its transaction's vout.
10655  */
10656 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
10657
10658 /**
10659  * The index of the referenced output in its transaction's vout.
10660  */
10661 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
10662
10663 /**
10664  * Constructs a new OutPoint given each field
10665  */
10666 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
10667
10668 /**
10669  * Creates a copy of the OutPoint
10670  */
10671 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
10672
10673 /**
10674  * Convert an `OutPoint` to a lightning channel id.
10675  */
10676 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
10677
10678 /**
10679  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
10680  */
10681 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
10682
10683 /**
10684  * Read a OutPoint from a byte array, created by OutPoint_write
10685  */
10686 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
10687
10688 /**
10689  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
10690  */
10691 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
10692
10693 /**
10694  * The outpoint which is spendable
10695  */
10696 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10697
10698 /**
10699  * The outpoint which is spendable
10700  */
10701 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10702
10703 /**
10704  * Per commitment point to derive delayed_payment_key by key holder
10705  */
10706 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10707
10708 /**
10709  * Per commitment point to derive delayed_payment_key by key holder
10710  */
10711 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10712
10713 /**
10714  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
10715  * the witness_script.
10716  */
10717 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10718
10719 /**
10720  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
10721  * the witness_script.
10722  */
10723 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
10724
10725 /**
10726  * The output which is referenced by the given outpoint
10727  */
10728 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
10729
10730 /**
10731  * The revocation point specific to the commitment transaction which was broadcast. Used to
10732  * derive the witnessScript for this output.
10733  */
10734 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10735
10736 /**
10737  * The revocation point specific to the commitment transaction which was broadcast. Used to
10738  * derive the witnessScript for this output.
10739  */
10740 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10741
10742 /**
10743  * Arbitrary identification information returned by a call to
10744  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10745  * the channel to spend the output.
10746  */
10747 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
10748
10749 /**
10750  * Arbitrary identification information returned by a call to
10751  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10752  * the channel to spend the output.
10753  */
10754 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10755
10756 /**
10757  * The value of the channel which this output originated from, possibly indirectly.
10758  */
10759 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10760
10761 /**
10762  * The value of the channel which this output originated from, possibly indirectly.
10763  */
10764 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
10765
10766 /**
10767  * Constructs a new DelayedPaymentOutputDescriptor given each field
10768  */
10769 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);
10770
10771 /**
10772  * Creates a copy of the DelayedPaymentOutputDescriptor
10773  */
10774 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
10775
10776 /**
10777  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
10778  */
10779 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
10780
10781 /**
10782  * The outpoint which is spendable
10783  */
10784 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10785
10786 /**
10787  * The outpoint which is spendable
10788  */
10789 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10790
10791 /**
10792  * The output which is referenced by the given outpoint
10793  */
10794 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
10795
10796 /**
10797  * Arbitrary identification information returned by a call to
10798  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10799  * the channel to spend the output.
10800  */
10801 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
10802
10803 /**
10804  * Arbitrary identification information returned by a call to
10805  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10806  * the channel to spend the output.
10807  */
10808 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10809
10810 /**
10811  * The value of the channel which this transactions spends.
10812  */
10813 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10814
10815 /**
10816  * The value of the channel which this transactions spends.
10817  */
10818 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
10819
10820 /**
10821  * Constructs a new StaticPaymentOutputDescriptor given each field
10822  */
10823 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);
10824
10825 /**
10826  * Creates a copy of the StaticPaymentOutputDescriptor
10827  */
10828 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
10829
10830 /**
10831  * Frees any resources used by the SpendableOutputDescriptor
10832  */
10833 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
10834
10835 /**
10836  * Creates a copy of the SpendableOutputDescriptor
10837  */
10838 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
10839
10840 /**
10841  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
10842  */
10843 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
10844
10845 /**
10846  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
10847  */
10848 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
10849
10850 /**
10851  * Calls the free function if one is set
10852  */
10853 void BaseSign_free(struct LDKBaseSign this_ptr);
10854
10855 /**
10856  * Creates a copy of a Sign
10857  */
10858 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
10859
10860 /**
10861  * Calls the free function if one is set
10862  */
10863 void Sign_free(struct LDKSign this_ptr);
10864
10865 /**
10866  * Calls the free function if one is set
10867  */
10868 void KeysInterface_free(struct LDKKeysInterface this_ptr);
10869
10870 /**
10871  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
10872  */
10873 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
10874
10875 /**
10876  * Private key of anchor tx
10877  */
10878 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10879
10880 /**
10881  * Private key of anchor tx
10882  */
10883 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10884
10885 /**
10886  * Holder secret key for blinded revocation pubkey
10887  */
10888 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10889
10890 /**
10891  * Holder secret key for blinded revocation pubkey
10892  */
10893 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10894
10895 /**
10896  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
10897  */
10898 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10899
10900 /**
10901  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
10902  */
10903 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10904
10905 /**
10906  * Holder secret key used in HTLC tx
10907  */
10908 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10909
10910 /**
10911  * Holder secret key used in HTLC tx
10912  */
10913 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10914
10915 /**
10916  * Holder htlc secret key used in commitment tx htlc outputs
10917  */
10918 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10919
10920 /**
10921  * Holder htlc secret key used in commitment tx htlc outputs
10922  */
10923 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10924
10925 /**
10926  * Commitment seed
10927  */
10928 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10929
10930 /**
10931  * Commitment seed
10932  */
10933 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10934
10935 /**
10936  * Creates a copy of the InMemorySigner
10937  */
10938 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
10939
10940 /**
10941  * Create a new InMemorySigner
10942  */
10943 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);
10944
10945 /**
10946  * Counterparty pubkeys.
10947  * Will panic if ready_channel wasn't called.
10948  */
10949 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10950
10951 /**
10952  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
10953  * transactions, ie the amount of time that we have to wait to recover our funds if we
10954  * broadcast a transaction.
10955  * Will panic if ready_channel wasn't called.
10956  */
10957 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10958
10959 /**
10960  * The contest_delay value specified by us and applied on transactions broadcastable
10961  * by our counterparty, ie the amount of time that they have to wait to recover their funds
10962  * if they broadcast a transaction.
10963  * Will panic if ready_channel wasn't called.
10964  */
10965 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10966
10967 /**
10968  * Whether the holder is the initiator
10969  * Will panic if ready_channel wasn't called.
10970  */
10971 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10972
10973 /**
10974  * Funding outpoint
10975  * Will panic if ready_channel wasn't called.
10976  */
10977 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10978
10979 /**
10980  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
10981  * building transactions.
10982  *
10983  * Will panic if ready_channel wasn't called.
10984  */
10985 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10986
10987 /**
10988  * Sign the single input of spend_tx at index `input_idx` which spends the output
10989  * described by descriptor, returning the witness stack for the input.
10990  *
10991  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
10992  * or is not spending the outpoint described by `descriptor.outpoint`.
10993  */
10994 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);
10995
10996 /**
10997  * Sign the single input of spend_tx at index `input_idx` which spends the output
10998  * described by descriptor, returning the witness stack for the input.
10999  *
11000  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
11001  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
11002  * sequence set to `descriptor.to_self_delay`.
11003  */
11004 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);
11005
11006 /**
11007  * Constructs a new BaseSign which calls the relevant methods on this_arg.
11008  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
11009  */
11010 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11011
11012 /**
11013  * Constructs a new Sign which calls the relevant methods on this_arg.
11014  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
11015  */
11016 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
11017
11018 /**
11019  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
11020  */
11021 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
11022
11023 /**
11024  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
11025  */
11026 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
11027
11028 /**
11029  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
11030  */
11031 void KeysManager_free(struct LDKKeysManager this_obj);
11032
11033 /**
11034  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
11035  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
11036  * starting_time isn't strictly required to actually be a time, but it must absolutely,
11037  * without a doubt, be unique to this instance. ie if you start multiple times with the same
11038  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
11039  * simply use the current time (with very high precision).
11040  *
11041  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
11042  * obviously, starting_time should be unique every time you reload the library - it is only
11043  * used to generate new ephemeral key data (which will be stored by the individual channel if
11044  * necessary).
11045  *
11046  * Note that the seed is required to recover certain on-chain funds independent of
11047  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
11048  * channel, and some on-chain during-closing funds.
11049  *
11050  * Note that until the 0.1 release there is no guarantee of backward compatibility between
11051  * versions. Once the library is more fully supported, the docs will be updated to include a
11052  * detailed description of the guarantee.
11053  */
11054 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
11055
11056 /**
11057  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
11058  *
11059  * Key derivation parameters are accessible through a per-channel secrets
11060  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
11061  * onchain output detection for which a corresponding delayed_payment_key must be derived.
11062  */
11063 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]);
11064
11065 /**
11066  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
11067  * output to the given change destination (if sufficient change value remains). The
11068  * transaction will have a feerate, at least, of the given value.
11069  *
11070  * Returns `Err(())` if the output value is greater than the input value minus required fee or
11071  * if a descriptor was duplicated.
11072  *
11073  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
11074  *
11075  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
11076  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
11077  */
11078 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);
11079
11080 /**
11081  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
11082  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
11083  */
11084 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
11085
11086 /**
11087  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
11088  */
11089 void ChannelManager_free(struct LDKChannelManager this_obj);
11090
11091 /**
11092  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
11093  */
11094 void ChainParameters_free(struct LDKChainParameters this_obj);
11095
11096 /**
11097  * The network for determining the `chain_hash` in Lightning messages.
11098  */
11099 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
11100
11101 /**
11102  * The network for determining the `chain_hash` in Lightning messages.
11103  */
11104 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
11105
11106 /**
11107  * The hash and height of the latest block successfully connected.
11108  *
11109  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
11110  */
11111 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
11112
11113 /**
11114  * The hash and height of the latest block successfully connected.
11115  *
11116  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
11117  */
11118 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
11119
11120 /**
11121  * Constructs a new ChainParameters given each field
11122  */
11123 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
11124
11125 /**
11126  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
11127  */
11128 void BestBlock_free(struct LDKBestBlock this_obj);
11129
11130 /**
11131  * Creates a copy of the BestBlock
11132  */
11133 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
11134
11135 /**
11136  * Returns the best block from the genesis of the given network.
11137  */
11138 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
11139
11140 /**
11141  * Returns the best block as identified by the given block hash and height.
11142  */
11143 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
11144
11145 /**
11146  * Returns the best block hash.
11147  */
11148 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
11149
11150 /**
11151  * Returns the best block height.
11152  */
11153 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
11154
11155 /**
11156  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
11157  */
11158 void ChannelDetails_free(struct LDKChannelDetails this_obj);
11159
11160 /**
11161  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
11162  * thereafter this is the txid of the funding transaction xor the funding transaction output).
11163  * Note that this means this value is *not* persistent - it can change once during the
11164  * lifetime of the channel.
11165  */
11166 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
11167
11168 /**
11169  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
11170  * thereafter this is the txid of the funding transaction xor the funding transaction output).
11171  * Note that this means this value is *not* persistent - it can change once during the
11172  * lifetime of the channel.
11173  */
11174 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11175
11176 /**
11177  * The position of the funding transaction in the chain. None if the funding transaction has
11178  * not yet been confirmed and the channel fully opened.
11179  */
11180 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11181
11182 /**
11183  * The position of the funding transaction in the chain. None if the funding transaction has
11184  * not yet been confirmed and the channel fully opened.
11185  */
11186 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
11187
11188 /**
11189  * The node_id of our counterparty
11190  */
11191 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11192
11193 /**
11194  * The node_id of our counterparty
11195  */
11196 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11197
11198 /**
11199  * The Features the channel counterparty provided upon last connection.
11200  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
11201  * many routing-relevant features are present in the init context.
11202  */
11203 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11204
11205 /**
11206  * The Features the channel counterparty provided upon last connection.
11207  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
11208  * many routing-relevant features are present in the init context.
11209  */
11210 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
11211
11212 /**
11213  * The value, in satoshis, of this channel as appears in the funding output
11214  */
11215 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11216
11217 /**
11218  * The value, in satoshis, of this channel as appears in the funding output
11219  */
11220 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11221
11222 /**
11223  * The user_id passed in to create_channel, or 0 if the channel was inbound.
11224  */
11225 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11226
11227 /**
11228  * The user_id passed in to create_channel, or 0 if the channel was inbound.
11229  */
11230 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11231
11232 /**
11233  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
11234  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11235  * available for inclusion in new outbound HTLCs). This further does not include any pending
11236  * outgoing HTLCs which are awaiting some other resolution to be sent.
11237  */
11238 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11239
11240 /**
11241  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
11242  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11243  * available for inclusion in new outbound HTLCs). This further does not include any pending
11244  * outgoing HTLCs which are awaiting some other resolution to be sent.
11245  */
11246 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11247
11248 /**
11249  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
11250  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11251  * available for inclusion in new inbound HTLCs).
11252  * Note that there are some corner cases not fully handled here, so the actual available
11253  * inbound capacity may be slightly higher than this.
11254  */
11255 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11256
11257 /**
11258  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
11259  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11260  * available for inclusion in new inbound HTLCs).
11261  * Note that there are some corner cases not fully handled here, so the actual available
11262  * inbound capacity may be slightly higher than this.
11263  */
11264 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11265
11266 /**
11267  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
11268  * the peer is connected, and (c) no monitor update failure is pending resolution.
11269  */
11270 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11271
11272 /**
11273  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
11274  * the peer is connected, and (c) no monitor update failure is pending resolution.
11275  */
11276 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
11277
11278 /**
11279  * Creates a copy of the ChannelDetails
11280  */
11281 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
11282
11283 /**
11284  * Frees any resources used by the PaymentSendFailure
11285  */
11286 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
11287
11288 /**
11289  * Creates a copy of the PaymentSendFailure
11290  */
11291 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
11292
11293 /**
11294  * Constructs a new ChannelManager to hold several channels and route between them.
11295  *
11296  * This is the main \"logic hub\" for all channel-related actions, and implements
11297  * ChannelMessageHandler.
11298  *
11299  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
11300  *
11301  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
11302  *
11303  * Users need to notify the new ChannelManager when a new block is connected or
11304  * disconnected using its `block_connected` and `block_disconnected` methods, starting
11305  * from after `params.latest_hash`.
11306  */
11307 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);
11308
11309 /**
11310  * Gets the current configuration applied to all new channels,  as
11311  */
11312 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
11313
11314 /**
11315  * Creates a new outbound channel to the given remote node and with the given value.
11316  *
11317  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
11318  * tracking of which events correspond with which create_channel call. Note that the
11319  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
11320  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
11321  * otherwise ignored.
11322  *
11323  * If successful, will generate a SendOpenChannel message event, so you should probably poll
11324  * PeerManager::process_events afterwards.
11325  *
11326  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
11327  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
11328  */
11329 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);
11330
11331 /**
11332  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
11333  * more information.
11334  */
11335 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11336
11337 /**
11338  * Gets the list of usable channels, in random order. Useful as an argument to
11339  * get_route to ensure non-announced channels are used.
11340  *
11341  * These are guaranteed to have their is_live value set to true, see the documentation for
11342  * ChannelDetails::is_live for more info on exactly what the criteria are.
11343  */
11344 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11345
11346 /**
11347  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
11348  * will be accepted on the given channel, and after additional timeout/the closing of all
11349  * pending HTLCs, the channel will be closed on chain.
11350  *
11351  * May generate a SendShutdown message event on success, which should be relayed.
11352  */
11353 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
11354
11355 /**
11356  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
11357  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
11358  */
11359 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
11360
11361 /**
11362  * Force close all channels, immediately broadcasting the latest local commitment transaction
11363  * for each to the chain and rejecting new HTLCs on each.
11364  */
11365 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11366
11367 /**
11368  * Sends a payment along a given route.
11369  *
11370  * Value parameters are provided via the last hop in route, see documentation for RouteHop
11371  * fields for more info.
11372  *
11373  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
11374  * payment), we don't do anything to stop you! We always try to ensure that if the provided
11375  * next hop knows the preimage to payment_hash they can claim an additional amount as
11376  * specified in the last hop in the route! Thus, you should probably do your own
11377  * payment_preimage tracking (which you should already be doing as they represent \"proof of
11378  * payment\") and prevent double-sends yourself.
11379  *
11380  * May generate SendHTLCs message(s) event on success, which should be relayed.
11381  *
11382  * Each path may have a different return value, and PaymentSendValue may return a Vec with
11383  * each entry matching the corresponding-index entry in the route paths, see
11384  * PaymentSendFailure for more info.
11385  *
11386  * In general, a path may raise:
11387  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
11388  *    node public key) is specified.
11389  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
11390  *    (including due to previous monitor update failure or new permanent monitor update
11391  *    failure).
11392  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
11393  *    relevant updates.
11394  *
11395  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
11396  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
11397  * different route unless you intend to pay twice!
11398  *
11399  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
11400  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
11401  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
11402  * must not contain multiple paths as multi-path payments require a recipient-provided
11403  * payment_secret.
11404  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
11405  * bit set (either as required or as available). If multiple paths are present in the Route,
11406  * we assume the invoice had the basic_mpp feature set.
11407  */
11408 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);
11409
11410 /**
11411  * Call this upon creation of a funding transaction for the given channel.
11412  *
11413  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
11414  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
11415  *
11416  * Panics if a funding transaction has already been provided for this channel.
11417  *
11418  * May panic if the output found in the funding transaction is duplicative with some other
11419  * channel (note that this should be trivially prevented by using unique funding transaction
11420  * keys per-channel).
11421  *
11422  * Do NOT broadcast the funding transaction yourself. When we have safely received our
11423  * counterparty's signature the funding transaction will automatically be broadcast via the
11424  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
11425  *
11426  * Note that this includes RBF or similar transaction replacement strategies - lightning does
11427  * not currently support replacing a funding transaction on an existing channel. Instead,
11428  * create a new channel with a conflicting funding transaction.
11429  */
11430 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);
11431
11432 /**
11433  * Generates a signed node_announcement from the given arguments and creates a
11434  * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
11435  * seen a channel_announcement from us (ie unless we have public channels open).
11436  *
11437  * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
11438  * to humans. They carry no in-protocol meaning.
11439  *
11440  * addresses represent the set (possibly empty) of socket addresses on which this node accepts
11441  * incoming connections. These will be broadcast to the network, publicly tying these
11442  * addresses together. If you wish to preserve user privacy, addresses should likely contain
11443  * only Tor Onion addresses.
11444  *
11445  * Panics if addresses is absurdly large (more than 500).
11446  */
11447 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
11448
11449 /**
11450  * Processes HTLCs which are pending waiting on random forward delay.
11451  *
11452  * Should only really ever be called in response to a PendingHTLCsForwardable event.
11453  * Will likely generate further events.
11454  */
11455 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
11456
11457 /**
11458  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
11459  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
11460  * to inform the network about the uselessness of these channels.
11461  *
11462  * This method handles all the details, and must be called roughly once per minute.
11463  *
11464  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
11465  */
11466 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
11467
11468 /**
11469  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
11470  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
11471  * along the path (including in our own channel on which we received it).
11472  * Returns false if no payment was found to fail backwards, true if the process of failing the
11473  * HTLC backwards has been started.
11474  */
11475 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);
11476
11477 /**
11478  * Provides a payment preimage in response to a PaymentReceived event, returning true and
11479  * generating message events for the net layer to claim the payment, if possible. Thus, you
11480  * should probably kick the net layer to go send messages if this returns true!
11481  *
11482  * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
11483  * available within a few percent of the expected amount. This is critical for several
11484  * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
11485  * payment_preimage without having provided the full value and b) it avoids certain
11486  * privacy-breaking recipient-probing attacks which may reveal payment activity to
11487  * motivated attackers.
11488  *
11489  * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
11490  * set. Thus, for such payments we will claim any payments which do not under-pay.
11491  *
11492  * May panic if called except in response to a PaymentReceived event.
11493  */
11494 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);
11495
11496 /**
11497  * Gets the node_id held by this ChannelManager
11498  */
11499 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
11500
11501 /**
11502  * Restores a single, given channel to normal operation after a
11503  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
11504  * operation.
11505  *
11506  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
11507  * fully committed in every copy of the given channels' ChannelMonitors.
11508  *
11509  * Note that there is no effect to calling with a highest_applied_update_id other than the
11510  * current latest ChannelMonitorUpdate and one call to this function after multiple
11511  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
11512  * exists largely only to prevent races between this and concurrent update_monitor calls.
11513  *
11514  * Thus, the anticipated use is, at a high level:
11515  *  1) You register a chain::Watch with this ChannelManager,
11516  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
11517  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
11518  *     any time it cannot do so instantly,
11519  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
11520  *  4) once all remote copies are updated, you call this function with the update_id that
11521  *     completed, and once it is the latest the Channel will be re-enabled.
11522  */
11523 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);
11524
11525 /**
11526  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
11527  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
11528  */
11529 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
11530
11531 /**
11532  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
11533  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
11534  */
11535 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
11536
11537 /**
11538  * Constructs a new Listen which calls the relevant methods on this_arg.
11539  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
11540  */
11541 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
11542
11543 /**
11544  * Updates channel state to take note of transactions which were confirmed in the given block
11545  * at the given height.
11546  *
11547  * Note that you must still call (or have called) [`update_best_block`] with the block
11548  * information which is included here.
11549  *
11550  * This method may be called before or after [`update_best_block`] for a given block's
11551  * transaction data and may be called multiple times with additional transaction data for a
11552  * given block.
11553  *
11554  * This method may be called for a previous block after an [`update_best_block`] call has
11555  * been made for a later block, however it must *not* be called with transaction data from a
11556  * block which is no longer in the best chain (ie where [`update_best_block`] has already
11557  * been informed about a blockchain reorganization which no longer includes the block which
11558  * corresponds to `header`).
11559  *
11560  * [`update_best_block`]: `Self::update_best_block`
11561  */
11562 void ChannelManager_transactions_confirmed(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKCVec_C2Tuple_usizeTransactionZZ txdata);
11563
11564 /**
11565  * Updates channel state with the current best blockchain tip. You should attempt to call this
11566  * quickly after a new block becomes available, however if multiple new blocks become
11567  * available at the same time, only a single `update_best_block()` call needs to be made.
11568  *
11569  * This method should also be called immediately after any block disconnections, once at the
11570  * reorganization fork point, and once with the new chain tip. Calling this method at the
11571  * blockchain reorganization fork point ensures we learn when a funding transaction which was
11572  * previously confirmed is reorganized out of the blockchain, ensuring we do not continue to
11573  * accept payments which cannot be enforced on-chain.
11574  *
11575  * In both the block-connection and block-disconnection case, this method may be called either
11576  * once per block connected or disconnected, or simply at the fork point and new tip(s),
11577  * skipping any intermediary blocks.
11578  */
11579 void ChannelManager_update_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height);
11580
11581 /**
11582  * Gets the set of txids which should be monitored for their confirmation state.
11583  *
11584  * If you're providing information about reorganizations via [`transaction_unconfirmed`], this
11585  * is the set of transactions which you may need to call [`transaction_unconfirmed`] for.
11586  *
11587  * This may be useful to poll to determine the set of transactions which must be registered
11588  * with an Electrum server or for which an Electrum server needs to be polled to determine
11589  * transaction confirmation state.
11590  *
11591  * This may update after any [`transactions_confirmed`] or [`block_connected`] call.
11592  *
11593  * Note that this is NOT the set of transactions which must be included in calls to
11594  * [`transactions_confirmed`] if they are confirmed, but a small subset of it.
11595  *
11596  * [`transactions_confirmed`]: Self::transactions_confirmed
11597  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
11598  * [`block_connected`]: chain::Listen::block_connected
11599  */
11600 MUST_USE_RES struct LDKCVec_TxidZ ChannelManager_get_relevant_txids(const struct LDKChannelManager *NONNULL_PTR this_arg);
11601
11602 /**
11603  * Marks a transaction as having been reorganized out of the blockchain.
11604  *
11605  * If a transaction is included in [`get_relevant_txids`], and is no longer in the main branch
11606  * of the blockchain, this function should be called to indicate that the transaction should
11607  * be considered reorganized out.
11608  *
11609  * Once this is called, the given transaction will no longer appear on [`get_relevant_txids`],
11610  * though this may be called repeatedly for a given transaction without issue.
11611  *
11612  * Note that if the transaction is confirmed on the main chain in a different block (indicated
11613  * via a call to [`transactions_confirmed`]), it may re-appear in [`get_relevant_txids`], thus
11614  * be very wary of race-conditions wherein the final state of a transaction indicated via
11615  * these APIs is not the same as its state on the blockchain.
11616  *
11617  * [`transactions_confirmed`]: Self::transactions_confirmed
11618  * [`get_relevant_txids`]: Self::get_relevant_txids
11619  */
11620 void ChannelManager_transaction_unconfirmed(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*txid)[32]);
11621
11622 /**
11623  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
11624  * indicating whether persistence is necessary. Only one listener on
11625  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
11626  * up.
11627  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
11628  */
11629 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
11630
11631 /**
11632  * Blocks until ChannelManager needs to be persisted. Only one listener on
11633  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
11634  * up.
11635  */
11636 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
11637
11638 /**
11639  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
11640  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
11641  */
11642 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
11643
11644 /**
11645  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
11646  */
11647 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
11648
11649 /**
11650  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
11651  */
11652 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
11653
11654 /**
11655  * The keys provider which will give us relevant keys. Some keys will be loaded during
11656  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
11657  * signing data.
11658  */
11659 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11660
11661 /**
11662  * The keys provider which will give us relevant keys. Some keys will be loaded during
11663  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
11664  * signing data.
11665  */
11666 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
11667
11668 /**
11669  * The fee_estimator for use in the ChannelManager in the future.
11670  *
11671  * No calls to the FeeEstimator will be made during deserialization.
11672  */
11673 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11674
11675 /**
11676  * The fee_estimator for use in the ChannelManager in the future.
11677  *
11678  * No calls to the FeeEstimator will be made during deserialization.
11679  */
11680 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
11681
11682 /**
11683  * The chain::Watch for use in the ChannelManager in the future.
11684  *
11685  * No calls to the chain::Watch will be made during deserialization. It is assumed that
11686  * you have deserialized ChannelMonitors separately and will add them to your
11687  * chain::Watch after deserializing this ChannelManager.
11688  */
11689 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11690
11691 /**
11692  * The chain::Watch for use in the ChannelManager in the future.
11693  *
11694  * No calls to the chain::Watch will be made during deserialization. It is assumed that
11695  * you have deserialized ChannelMonitors separately and will add them to your
11696  * chain::Watch after deserializing this ChannelManager.
11697  */
11698 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
11699
11700 /**
11701  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
11702  * used to broadcast the latest local commitment transactions of channels which must be
11703  * force-closed during deserialization.
11704  */
11705 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11706
11707 /**
11708  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
11709  * used to broadcast the latest local commitment transactions of channels which must be
11710  * force-closed during deserialization.
11711  */
11712 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
11713
11714 /**
11715  * The Logger for use in the ChannelManager and which may be used to log information during
11716  * deserialization.
11717  */
11718 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11719
11720 /**
11721  * The Logger for use in the ChannelManager and which may be used to log information during
11722  * deserialization.
11723  */
11724 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
11725
11726 /**
11727  * Default settings used for new channels. Any existing channels will continue to use the
11728  * runtime settings which were stored when the ChannelManager was serialized.
11729  */
11730 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11731
11732 /**
11733  * Default settings used for new channels. Any existing channels will continue to use the
11734  * runtime settings which were stored when the ChannelManager was serialized.
11735  */
11736 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
11737
11738 /**
11739  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
11740  * HashMap for you. This is primarily useful for C bindings where it is not practical to
11741  * populate a HashMap directly from C.
11742  */
11743 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);
11744
11745 /**
11746  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
11747  */
11748 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
11749
11750 /**
11751  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
11752  */
11753 void DecodeError_free(struct LDKDecodeError this_obj);
11754
11755 /**
11756  * Creates a copy of the DecodeError
11757  */
11758 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
11759
11760 /**
11761  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
11762  */
11763 void Init_free(struct LDKInit this_obj);
11764
11765 /**
11766  * The relevant features which the sender supports
11767  */
11768 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
11769
11770 /**
11771  * The relevant features which the sender supports
11772  */
11773 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
11774
11775 /**
11776  * Constructs a new Init given each field
11777  */
11778 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
11779
11780 /**
11781  * Creates a copy of the Init
11782  */
11783 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
11784
11785 /**
11786  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
11787  */
11788 void ErrorMessage_free(struct LDKErrorMessage this_obj);
11789
11790 /**
11791  * The channel ID involved in the error
11792  */
11793 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
11794
11795 /**
11796  * The channel ID involved in the error
11797  */
11798 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11799
11800 /**
11801  * A possibly human-readable error description.
11802  * The string should be sanitized before it is used (e.g. emitted to logs
11803  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
11804  * vulnerability in the terminal emulator or the logging subsystem.
11805  */
11806 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
11807
11808 /**
11809  * A possibly human-readable error description.
11810  * The string should be sanitized before it is used (e.g. emitted to logs
11811  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
11812  * vulnerability in the terminal emulator or the logging subsystem.
11813  */
11814 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
11815
11816 /**
11817  * Constructs a new ErrorMessage given each field
11818  */
11819 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg);
11820
11821 /**
11822  * Creates a copy of the ErrorMessage
11823  */
11824 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
11825
11826 /**
11827  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
11828  */
11829 void Ping_free(struct LDKPing this_obj);
11830
11831 /**
11832  * The desired response length
11833  */
11834 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
11835
11836 /**
11837  * The desired response length
11838  */
11839 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
11840
11841 /**
11842  * The ping packet size.
11843  * This field is not sent on the wire. byteslen zeros are sent.
11844  */
11845 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
11846
11847 /**
11848  * The ping packet size.
11849  * This field is not sent on the wire. byteslen zeros are sent.
11850  */
11851 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
11852
11853 /**
11854  * Constructs a new Ping given each field
11855  */
11856 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
11857
11858 /**
11859  * Creates a copy of the Ping
11860  */
11861 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
11862
11863 /**
11864  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
11865  */
11866 void Pong_free(struct LDKPong this_obj);
11867
11868 /**
11869  * The pong packet size.
11870  * This field is not sent on the wire. byteslen zeros are sent.
11871  */
11872 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
11873
11874 /**
11875  * The pong packet size.
11876  * This field is not sent on the wire. byteslen zeros are sent.
11877  */
11878 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
11879
11880 /**
11881  * Constructs a new Pong given each field
11882  */
11883 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
11884
11885 /**
11886  * Creates a copy of the Pong
11887  */
11888 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
11889
11890 /**
11891  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
11892  */
11893 void OpenChannel_free(struct LDKOpenChannel this_obj);
11894
11895 /**
11896  * The genesis hash of the blockchain where the channel is to be opened
11897  */
11898 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
11899
11900 /**
11901  * The genesis hash of the blockchain where the channel is to be opened
11902  */
11903 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11904
11905 /**
11906  * A temporary channel ID, until the funding outpoint is announced
11907  */
11908 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
11909
11910 /**
11911  * A temporary channel ID, until the funding outpoint is announced
11912  */
11913 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11914
11915 /**
11916  * The channel value
11917  */
11918 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11919
11920 /**
11921  * The channel value
11922  */
11923 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11924
11925 /**
11926  * The amount to push to the counterparty as part of the open, in milli-satoshi
11927  */
11928 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11929
11930 /**
11931  * The amount to push to the counterparty as part of the open, in milli-satoshi
11932  */
11933 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11934
11935 /**
11936  * The threshold below which outputs on transactions broadcast by sender will be omitted
11937  */
11938 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11939
11940 /**
11941  * The threshold below which outputs on transactions broadcast by sender will be omitted
11942  */
11943 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11944
11945 /**
11946  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
11947  */
11948 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11949
11950 /**
11951  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
11952  */
11953 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11954
11955 /**
11956  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
11957  */
11958 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11959
11960 /**
11961  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
11962  */
11963 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11964
11965 /**
11966  * The minimum HTLC size incoming to sender, in milli-satoshi
11967  */
11968 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11969
11970 /**
11971  * The minimum HTLC size incoming to sender, in milli-satoshi
11972  */
11973 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11974
11975 /**
11976  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
11977  */
11978 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11979
11980 /**
11981  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
11982  */
11983 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
11984
11985 /**
11986  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
11987  */
11988 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11989
11990 /**
11991  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
11992  */
11993 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
11994
11995 /**
11996  * The maximum number of inbound HTLCs towards sender
11997  */
11998 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11999
12000 /**
12001  * The maximum number of inbound HTLCs towards sender
12002  */
12003 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
12004
12005 /**
12006  * The sender's key controlling the funding transaction
12007  */
12008 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12009
12010 /**
12011  * The sender's key controlling the funding transaction
12012  */
12013 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12014
12015 /**
12016  * Used to derive a revocation key for transactions broadcast by counterparty
12017  */
12018 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12019
12020 /**
12021  * Used to derive a revocation key for transactions broadcast by counterparty
12022  */
12023 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12024
12025 /**
12026  * A payment key to sender for transactions broadcast by counterparty
12027  */
12028 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12029
12030 /**
12031  * A payment key to sender for transactions broadcast by counterparty
12032  */
12033 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12034
12035 /**
12036  * Used to derive a payment key to sender for transactions broadcast by sender
12037  */
12038 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12039
12040 /**
12041  * Used to derive a payment key to sender for transactions broadcast by sender
12042  */
12043 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12044
12045 /**
12046  * Used to derive an HTLC payment key to sender
12047  */
12048 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12049
12050 /**
12051  * Used to derive an HTLC payment key to sender
12052  */
12053 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12054
12055 /**
12056  * The first to-be-broadcast-by-sender transaction's per commitment point
12057  */
12058 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12059
12060 /**
12061  * The first to-be-broadcast-by-sender transaction's per commitment point
12062  */
12063 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12064
12065 /**
12066  * Channel flags
12067  */
12068 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
12069
12070 /**
12071  * Channel flags
12072  */
12073 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
12074
12075 /**
12076  * Creates a copy of the OpenChannel
12077  */
12078 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
12079
12080 /**
12081  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
12082  */
12083 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
12084
12085 /**
12086  * A temporary channel ID, until the funding outpoint is announced
12087  */
12088 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
12089
12090 /**
12091  * A temporary channel ID, until the funding outpoint is announced
12092  */
12093 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12094
12095 /**
12096  * The threshold below which outputs on transactions broadcast by sender will be omitted
12097  */
12098 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12099
12100 /**
12101  * The threshold below which outputs on transactions broadcast by sender will be omitted
12102  */
12103 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
12104
12105 /**
12106  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
12107  */
12108 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12109
12110 /**
12111  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
12112  */
12113 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
12114
12115 /**
12116  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
12117  */
12118 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12119
12120 /**
12121  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
12122  */
12123 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
12124
12125 /**
12126  * The minimum HTLC size incoming to sender, in milli-satoshi
12127  */
12128 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12129
12130 /**
12131  * The minimum HTLC size incoming to sender, in milli-satoshi
12132  */
12133 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
12134
12135 /**
12136  * Minimum depth of the funding transaction before the channel is considered open
12137  */
12138 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12139
12140 /**
12141  * Minimum depth of the funding transaction before the channel is considered open
12142  */
12143 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
12144
12145 /**
12146  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
12147  */
12148 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12149
12150 /**
12151  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
12152  */
12153 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
12154
12155 /**
12156  * The maximum number of inbound HTLCs towards sender
12157  */
12158 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12159
12160 /**
12161  * The maximum number of inbound HTLCs towards sender
12162  */
12163 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
12164
12165 /**
12166  * The sender's key controlling the funding transaction
12167  */
12168 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12169
12170 /**
12171  * The sender's key controlling the funding transaction
12172  */
12173 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12174
12175 /**
12176  * Used to derive a revocation key for transactions broadcast by counterparty
12177  */
12178 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12179
12180 /**
12181  * Used to derive a revocation key for transactions broadcast by counterparty
12182  */
12183 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12184
12185 /**
12186  * A payment key to sender for transactions broadcast by counterparty
12187  */
12188 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12189
12190 /**
12191  * A payment key to sender for transactions broadcast by counterparty
12192  */
12193 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12194
12195 /**
12196  * Used to derive a payment key to sender for transactions broadcast by sender
12197  */
12198 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12199
12200 /**
12201  * Used to derive a payment key to sender for transactions broadcast by sender
12202  */
12203 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12204
12205 /**
12206  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
12207  */
12208 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12209
12210 /**
12211  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
12212  */
12213 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12214
12215 /**
12216  * The first to-be-broadcast-by-sender transaction's per commitment point
12217  */
12218 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12219
12220 /**
12221  * The first to-be-broadcast-by-sender transaction's per commitment point
12222  */
12223 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12224
12225 /**
12226  * Creates a copy of the AcceptChannel
12227  */
12228 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
12229
12230 /**
12231  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
12232  */
12233 void FundingCreated_free(struct LDKFundingCreated this_obj);
12234
12235 /**
12236  * A temporary channel ID, until the funding is established
12237  */
12238 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
12239
12240 /**
12241  * A temporary channel ID, until the funding is established
12242  */
12243 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12244
12245 /**
12246  * The funding transaction ID
12247  */
12248 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
12249
12250 /**
12251  * The funding transaction ID
12252  */
12253 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12254
12255 /**
12256  * The specific output index funding this channel
12257  */
12258 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
12259
12260 /**
12261  * The specific output index funding this channel
12262  */
12263 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
12264
12265 /**
12266  * The signature of the channel initiator (funder) on the funding transaction
12267  */
12268 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
12269
12270 /**
12271  * The signature of the channel initiator (funder) on the funding transaction
12272  */
12273 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
12274
12275 /**
12276  * Constructs a new FundingCreated given each field
12277  */
12278 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);
12279
12280 /**
12281  * Creates a copy of the FundingCreated
12282  */
12283 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
12284
12285 /**
12286  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
12287  */
12288 void FundingSigned_free(struct LDKFundingSigned this_obj);
12289
12290 /**
12291  * The channel ID
12292  */
12293 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
12294
12295 /**
12296  * The channel ID
12297  */
12298 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12299
12300 /**
12301  * The signature of the channel acceptor (fundee) on the funding transaction
12302  */
12303 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
12304
12305 /**
12306  * The signature of the channel acceptor (fundee) on the funding transaction
12307  */
12308 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12309
12310 /**
12311  * Constructs a new FundingSigned given each field
12312  */
12313 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
12314
12315 /**
12316  * Creates a copy of the FundingSigned
12317  */
12318 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
12319
12320 /**
12321  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
12322  */
12323 void FundingLocked_free(struct LDKFundingLocked this_obj);
12324
12325 /**
12326  * The channel ID
12327  */
12328 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
12329
12330 /**
12331  * The channel ID
12332  */
12333 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12334
12335 /**
12336  * The per-commitment point of the second commitment transaction
12337  */
12338 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
12339
12340 /**
12341  * The per-commitment point of the second commitment transaction
12342  */
12343 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12344
12345 /**
12346  * Constructs a new FundingLocked given each field
12347  */
12348 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
12349
12350 /**
12351  * Creates a copy of the FundingLocked
12352  */
12353 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
12354
12355 /**
12356  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
12357  */
12358 void Shutdown_free(struct LDKShutdown this_obj);
12359
12360 /**
12361  * The channel ID
12362  */
12363 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
12364
12365 /**
12366  * The channel ID
12367  */
12368 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12369
12370 /**
12371  * The destination of this peer's funds on closing.
12372  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
12373  */
12374 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
12375
12376 /**
12377  * The destination of this peer's funds on closing.
12378  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
12379  */
12380 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
12381
12382 /**
12383  * Constructs a new Shutdown given each field
12384  */
12385 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
12386
12387 /**
12388  * Creates a copy of the Shutdown
12389  */
12390 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
12391
12392 /**
12393  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
12394  */
12395 void ClosingSigned_free(struct LDKClosingSigned this_obj);
12396
12397 /**
12398  * The channel ID
12399  */
12400 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
12401
12402 /**
12403  * The channel ID
12404  */
12405 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12406
12407 /**
12408  * The proposed total fee for the closing transaction
12409  */
12410 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
12411
12412 /**
12413  * The proposed total fee for the closing transaction
12414  */
12415 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
12416
12417 /**
12418  * A signature on the closing transaction
12419  */
12420 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
12421
12422 /**
12423  * A signature on the closing transaction
12424  */
12425 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12426
12427 /**
12428  * Constructs a new ClosingSigned given each field
12429  */
12430 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
12431
12432 /**
12433  * Creates a copy of the ClosingSigned
12434  */
12435 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
12436
12437 /**
12438  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
12439  */
12440 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
12441
12442 /**
12443  * The channel ID
12444  */
12445 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
12446
12447 /**
12448  * The channel ID
12449  */
12450 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12451
12452 /**
12453  * The HTLC ID
12454  */
12455 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12456
12457 /**
12458  * The HTLC ID
12459  */
12460 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
12461
12462 /**
12463  * The HTLC value in milli-satoshi
12464  */
12465 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12466
12467 /**
12468  * The HTLC value in milli-satoshi
12469  */
12470 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
12471
12472 /**
12473  * The payment hash, the pre-image of which controls HTLC redemption
12474  */
12475 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
12476
12477 /**
12478  * The payment hash, the pre-image of which controls HTLC redemption
12479  */
12480 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12481
12482 /**
12483  * The expiry height of the HTLC
12484  */
12485 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12486
12487 /**
12488  * The expiry height of the HTLC
12489  */
12490 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
12491
12492 /**
12493  * Creates a copy of the UpdateAddHTLC
12494  */
12495 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
12496
12497 /**
12498  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
12499  */
12500 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
12501
12502 /**
12503  * The channel ID
12504  */
12505 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
12506
12507 /**
12508  * The channel ID
12509  */
12510 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12511
12512 /**
12513  * The HTLC ID
12514  */
12515 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
12516
12517 /**
12518  * The HTLC ID
12519  */
12520 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
12521
12522 /**
12523  * The pre-image of the payment hash, allowing HTLC redemption
12524  */
12525 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
12526
12527 /**
12528  * The pre-image of the payment hash, allowing HTLC redemption
12529  */
12530 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12531
12532 /**
12533  * Constructs a new UpdateFulfillHTLC given each field
12534  */
12535 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
12536
12537 /**
12538  * Creates a copy of the UpdateFulfillHTLC
12539  */
12540 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
12541
12542 /**
12543  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
12544  */
12545 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
12546
12547 /**
12548  * The channel ID
12549  */
12550 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
12551
12552 /**
12553  * The channel ID
12554  */
12555 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12556
12557 /**
12558  * The HTLC ID
12559  */
12560 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
12561
12562 /**
12563  * The HTLC ID
12564  */
12565 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
12566
12567 /**
12568  * Creates a copy of the UpdateFailHTLC
12569  */
12570 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
12571
12572 /**
12573  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
12574  */
12575 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
12576
12577 /**
12578  * The channel ID
12579  */
12580 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
12581
12582 /**
12583  * The channel ID
12584  */
12585 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12586
12587 /**
12588  * The HTLC ID
12589  */
12590 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
12591
12592 /**
12593  * The HTLC ID
12594  */
12595 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
12596
12597 /**
12598  * The failure code
12599  */
12600 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
12601
12602 /**
12603  * The failure code
12604  */
12605 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
12606
12607 /**
12608  * Creates a copy of the UpdateFailMalformedHTLC
12609  */
12610 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
12611
12612 /**
12613  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
12614  */
12615 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
12616
12617 /**
12618  * The channel ID
12619  */
12620 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
12621
12622 /**
12623  * The channel ID
12624  */
12625 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12626
12627 /**
12628  * A signature on the commitment transaction
12629  */
12630 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
12631
12632 /**
12633  * A signature on the commitment transaction
12634  */
12635 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12636
12637 /**
12638  * Signatures on the HTLC transactions
12639  */
12640 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
12641
12642 /**
12643  * Constructs a new CommitmentSigned given each field
12644  */
12645 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
12646
12647 /**
12648  * Creates a copy of the CommitmentSigned
12649  */
12650 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
12651
12652 /**
12653  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
12654  */
12655 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
12656
12657 /**
12658  * The channel ID
12659  */
12660 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
12661
12662 /**
12663  * The channel ID
12664  */
12665 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12666
12667 /**
12668  * The secret corresponding to the per-commitment point
12669  */
12670 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
12671
12672 /**
12673  * The secret corresponding to the per-commitment point
12674  */
12675 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12676
12677 /**
12678  * The next sender-broadcast commitment transaction's per-commitment point
12679  */
12680 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
12681
12682 /**
12683  * The next sender-broadcast commitment transaction's per-commitment point
12684  */
12685 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12686
12687 /**
12688  * Constructs a new RevokeAndACK given each field
12689  */
12690 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);
12691
12692 /**
12693  * Creates a copy of the RevokeAndACK
12694  */
12695 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
12696
12697 /**
12698  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
12699  */
12700 void UpdateFee_free(struct LDKUpdateFee this_obj);
12701
12702 /**
12703  * The channel ID
12704  */
12705 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
12706
12707 /**
12708  * The channel ID
12709  */
12710 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12711
12712 /**
12713  * Fee rate per 1000-weight of the transaction
12714  */
12715 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
12716
12717 /**
12718  * Fee rate per 1000-weight of the transaction
12719  */
12720 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
12721
12722 /**
12723  * Constructs a new UpdateFee given each field
12724  */
12725 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
12726
12727 /**
12728  * Creates a copy of the UpdateFee
12729  */
12730 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
12731
12732 /**
12733  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
12734  */
12735 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
12736
12737 /**
12738  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
12739  * belonging to the recipient
12740  */
12741 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
12742
12743 /**
12744  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
12745  * belonging to the recipient
12746  */
12747 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12748
12749 /**
12750  * The sender's per-commitment point for their current commitment transaction
12751  */
12752 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
12753
12754 /**
12755  * The sender's per-commitment point for their current commitment transaction
12756  */
12757 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12758
12759 /**
12760  * Constructs a new DataLossProtect given each field
12761  */
12762 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
12763
12764 /**
12765  * Creates a copy of the DataLossProtect
12766  */
12767 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
12768
12769 /**
12770  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
12771  */
12772 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
12773
12774 /**
12775  * The channel ID
12776  */
12777 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
12778
12779 /**
12780  * The channel ID
12781  */
12782 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12783
12784 /**
12785  * The next commitment number for the sender
12786  */
12787 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
12788
12789 /**
12790  * The next commitment number for the sender
12791  */
12792 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
12793
12794 /**
12795  * The next commitment number for the recipient
12796  */
12797 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
12798
12799 /**
12800  * The next commitment number for the recipient
12801  */
12802 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
12803
12804 /**
12805  * Creates a copy of the ChannelReestablish
12806  */
12807 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
12808
12809 /**
12810  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
12811  */
12812 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
12813
12814 /**
12815  * The channel ID
12816  */
12817 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
12818
12819 /**
12820  * The channel ID
12821  */
12822 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12823
12824 /**
12825  * The short channel ID
12826  */
12827 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12828
12829 /**
12830  * The short channel ID
12831  */
12832 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
12833
12834 /**
12835  * A signature by the node key
12836  */
12837 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12838
12839 /**
12840  * A signature by the node key
12841  */
12842 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
12843
12844 /**
12845  * A signature by the funding key
12846  */
12847 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12848
12849 /**
12850  * A signature by the funding key
12851  */
12852 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
12853
12854 /**
12855  * Constructs a new AnnouncementSignatures given each field
12856  */
12857 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);
12858
12859 /**
12860  * Creates a copy of the AnnouncementSignatures
12861  */
12862 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
12863
12864 /**
12865  * Frees any resources used by the NetAddress
12866  */
12867 void NetAddress_free(struct LDKNetAddress this_ptr);
12868
12869 /**
12870  * Creates a copy of the NetAddress
12871  */
12872 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
12873
12874 /**
12875  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
12876  */
12877 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
12878
12879 /**
12880  * Read a Result from a byte array, created by Result_write
12881  */
12882 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
12883
12884 /**
12885  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
12886  */
12887 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
12888
12889 /**
12890  * The advertised features
12891  */
12892 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12893
12894 /**
12895  * The advertised features
12896  */
12897 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
12898
12899 /**
12900  * A strictly monotonic announcement counter, with gaps allowed
12901  */
12902 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12903
12904 /**
12905  * A strictly monotonic announcement counter, with gaps allowed
12906  */
12907 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
12908
12909 /**
12910  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
12911  * to this node).
12912  */
12913 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12914
12915 /**
12916  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
12917  * to this node).
12918  */
12919 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12920
12921 /**
12922  * An RGB color for UI purposes
12923  */
12924 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
12925
12926 /**
12927  * An RGB color for UI purposes
12928  */
12929 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
12930
12931 /**
12932  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
12933  * of uniqueness.
12934  */
12935 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
12936
12937 /**
12938  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
12939  * of uniqueness.
12940  */
12941 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12942
12943 /**
12944  * List of addresses on which this node is reachable
12945  */
12946 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
12947
12948 /**
12949  * Creates a copy of the UnsignedNodeAnnouncement
12950  */
12951 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
12952
12953 /**
12954  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
12955  */
12956 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
12957
12958 /**
12959  * The signature by the node key
12960  */
12961 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
12962
12963 /**
12964  * The signature by the node key
12965  */
12966 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
12967
12968 /**
12969  * The actual content of the announcement
12970  */
12971 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
12972
12973 /**
12974  * The actual content of the announcement
12975  */
12976 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
12977
12978 /**
12979  * Constructs a new NodeAnnouncement given each field
12980  */
12981 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
12982
12983 /**
12984  * Creates a copy of the NodeAnnouncement
12985  */
12986 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
12987
12988 /**
12989  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
12990  */
12991 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
12992
12993 /**
12994  * The advertised channel features
12995  */
12996 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
12997
12998 /**
12999  * The advertised channel features
13000  */
13001 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
13002
13003 /**
13004  * The genesis hash of the blockchain where the channel is to be opened
13005  */
13006 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
13007
13008 /**
13009  * The genesis hash of the blockchain where the channel is to be opened
13010  */
13011 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13012
13013 /**
13014  * The short channel ID
13015  */
13016 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13017
13018 /**
13019  * The short channel ID
13020  */
13021 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
13022
13023 /**
13024  * One of the two node_ids which are endpoints of this channel
13025  */
13026 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13027
13028 /**
13029  * One of the two node_ids which are endpoints of this channel
13030  */
13031 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13032
13033 /**
13034  * The other of the two node_ids which are endpoints of this channel
13035  */
13036 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13037
13038 /**
13039  * The other of the two node_ids which are endpoints of this channel
13040  */
13041 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13042
13043 /**
13044  * The funding key for the first node
13045  */
13046 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13047
13048 /**
13049  * The funding key for the first node
13050  */
13051 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13052
13053 /**
13054  * The funding key for the second node
13055  */
13056 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
13057
13058 /**
13059  * The funding key for the second node
13060  */
13061 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13062
13063 /**
13064  * Creates a copy of the UnsignedChannelAnnouncement
13065  */
13066 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
13067
13068 /**
13069  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
13070  */
13071 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
13072
13073 /**
13074  * Authentication of the announcement by the first public node
13075  */
13076 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13077
13078 /**
13079  * Authentication of the announcement by the first public node
13080  */
13081 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
13082
13083 /**
13084  * Authentication of the announcement by the second public node
13085  */
13086 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13087
13088 /**
13089  * Authentication of the announcement by the second public node
13090  */
13091 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
13092
13093 /**
13094  * Proof of funding UTXO ownership by the first public node
13095  */
13096 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13097
13098 /**
13099  * Proof of funding UTXO ownership by the first public node
13100  */
13101 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
13102
13103 /**
13104  * Proof of funding UTXO ownership by the second public node
13105  */
13106 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13107
13108 /**
13109  * Proof of funding UTXO ownership by the second public node
13110  */
13111 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
13112
13113 /**
13114  * The actual announcement
13115  */
13116 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
13117
13118 /**
13119  * The actual announcement
13120  */
13121 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
13122
13123 /**
13124  * Constructs a new ChannelAnnouncement given each field
13125  */
13126 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);
13127
13128 /**
13129  * Creates a copy of the ChannelAnnouncement
13130  */
13131 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
13132
13133 /**
13134  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
13135  */
13136 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
13137
13138 /**
13139  * The genesis hash of the blockchain where the channel is to be opened
13140  */
13141 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
13142
13143 /**
13144  * The genesis hash of the blockchain where the channel is to be opened
13145  */
13146 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13147
13148 /**
13149  * The short channel ID
13150  */
13151 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13152
13153 /**
13154  * The short channel ID
13155  */
13156 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
13157
13158 /**
13159  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
13160  */
13161 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13162
13163 /**
13164  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
13165  */
13166 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
13167
13168 /**
13169  * Channel flags
13170  */
13171 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13172
13173 /**
13174  * Channel flags
13175  */
13176 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
13177
13178 /**
13179  * The number of blocks such that if:
13180  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
13181  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
13182  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
13183  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
13184  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
13185  * forwarding. Note that the HTLC sender is the one who originally sets this value when
13186  * constructing the route.
13187  */
13188 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13189
13190 /**
13191  * The number of blocks such that if:
13192  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
13193  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
13194  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
13195  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
13196  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
13197  * forwarding. Note that the HTLC sender is the one who originally sets this value when
13198  * constructing the route.
13199  */
13200 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
13201
13202 /**
13203  * The minimum HTLC size incoming to sender, in milli-satoshi
13204  */
13205 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13206
13207 /**
13208  * The minimum HTLC size incoming to sender, in milli-satoshi
13209  */
13210 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
13211
13212 /**
13213  * The base HTLC fee charged by sender, in milli-satoshi
13214  */
13215 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13216
13217 /**
13218  * The base HTLC fee charged by sender, in milli-satoshi
13219  */
13220 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
13221
13222 /**
13223  * The amount to fee multiplier, in micro-satoshi
13224  */
13225 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13226
13227 /**
13228  * The amount to fee multiplier, in micro-satoshi
13229  */
13230 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
13231
13232 /**
13233  * Creates a copy of the UnsignedChannelUpdate
13234  */
13235 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
13236
13237 /**
13238  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
13239  */
13240 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
13241
13242 /**
13243  * A signature of the channel update
13244  */
13245 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
13246
13247 /**
13248  * A signature of the channel update
13249  */
13250 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
13251
13252 /**
13253  * The actual channel update
13254  */
13255 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
13256
13257 /**
13258  * The actual channel update
13259  */
13260 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
13261
13262 /**
13263  * Constructs a new ChannelUpdate given each field
13264  */
13265 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
13266
13267 /**
13268  * Creates a copy of the ChannelUpdate
13269  */
13270 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
13271
13272 /**
13273  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
13274  */
13275 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
13276
13277 /**
13278  * The genesis hash of the blockchain being queried
13279  */
13280 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
13281
13282 /**
13283  * The genesis hash of the blockchain being queried
13284  */
13285 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13286
13287 /**
13288  * The height of the first block for the channel UTXOs being queried
13289  */
13290 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
13291
13292 /**
13293  * The height of the first block for the channel UTXOs being queried
13294  */
13295 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13296
13297 /**
13298  * The number of blocks to include in the query results
13299  */
13300 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
13301
13302 /**
13303  * The number of blocks to include in the query results
13304  */
13305 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13306
13307 /**
13308  * Constructs a new QueryChannelRange given each field
13309  */
13310 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
13311
13312 /**
13313  * Creates a copy of the QueryChannelRange
13314  */
13315 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
13316
13317 /**
13318  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
13319  */
13320 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
13321
13322 /**
13323  * The genesis hash of the blockchain being queried
13324  */
13325 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
13326
13327 /**
13328  * The genesis hash of the blockchain being queried
13329  */
13330 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13331
13332 /**
13333  * The height of the first block in the range of the reply
13334  */
13335 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13336
13337 /**
13338  * The height of the first block in the range of the reply
13339  */
13340 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13341
13342 /**
13343  * The number of blocks included in the range of the reply
13344  */
13345 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13346
13347 /**
13348  * The number of blocks included in the range of the reply
13349  */
13350 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13351
13352 /**
13353  * True when this is the final reply for a query
13354  */
13355 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13356
13357 /**
13358  * True when this is the final reply for a query
13359  */
13360 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
13361
13362 /**
13363  * The short_channel_ids in the channel range
13364  */
13365 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
13366
13367 /**
13368  * Constructs a new ReplyChannelRange given each field
13369  */
13370 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);
13371
13372 /**
13373  * Creates a copy of the ReplyChannelRange
13374  */
13375 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
13376
13377 /**
13378  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
13379  */
13380 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
13381
13382 /**
13383  * The genesis hash of the blockchain being queried
13384  */
13385 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
13386
13387 /**
13388  * The genesis hash of the blockchain being queried
13389  */
13390 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13391
13392 /**
13393  * The short_channel_ids that are being queried
13394  */
13395 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
13396
13397 /**
13398  * Constructs a new QueryShortChannelIds given each field
13399  */
13400 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
13401
13402 /**
13403  * Creates a copy of the QueryShortChannelIds
13404  */
13405 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
13406
13407 /**
13408  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
13409  */
13410 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
13411
13412 /**
13413  * The genesis hash of the blockchain that was queried
13414  */
13415 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
13416
13417 /**
13418  * The genesis hash of the blockchain that was queried
13419  */
13420 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13421
13422 /**
13423  * Indicates if the query recipient maintains up-to-date channel
13424  * information for the chain_hash
13425  */
13426 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
13427
13428 /**
13429  * Indicates if the query recipient maintains up-to-date channel
13430  * information for the chain_hash
13431  */
13432 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
13433
13434 /**
13435  * Constructs a new ReplyShortChannelIdsEnd given each field
13436  */
13437 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
13438
13439 /**
13440  * Creates a copy of the ReplyShortChannelIdsEnd
13441  */
13442 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
13443
13444 /**
13445  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
13446  */
13447 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
13448
13449 /**
13450  * The genesis hash of the blockchain for channel and node information
13451  */
13452 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
13453
13454 /**
13455  * The genesis hash of the blockchain for channel and node information
13456  */
13457 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13458
13459 /**
13460  * The starting unix timestamp
13461  */
13462 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
13463
13464 /**
13465  * The starting unix timestamp
13466  */
13467 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
13468
13469 /**
13470  * The range of information in seconds
13471  */
13472 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
13473
13474 /**
13475  * The range of information in seconds
13476  */
13477 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
13478
13479 /**
13480  * Constructs a new GossipTimestampFilter given each field
13481  */
13482 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
13483
13484 /**
13485  * Creates a copy of the GossipTimestampFilter
13486  */
13487 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
13488
13489 /**
13490  * Frees any resources used by the ErrorAction
13491  */
13492 void ErrorAction_free(struct LDKErrorAction this_ptr);
13493
13494 /**
13495  * Creates a copy of the ErrorAction
13496  */
13497 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
13498
13499 /**
13500  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
13501  */
13502 void LightningError_free(struct LDKLightningError this_obj);
13503
13504 /**
13505  * A human-readable message describing the error
13506  */
13507 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
13508
13509 /**
13510  * A human-readable message describing the error
13511  */
13512 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
13513
13514 /**
13515  * The action which should be taken against the offending peer.
13516  */
13517 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
13518
13519 /**
13520  * The action which should be taken against the offending peer.
13521  */
13522 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
13523
13524 /**
13525  * Constructs a new LightningError given each field
13526  */
13527 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
13528
13529 /**
13530  * Creates a copy of the LightningError
13531  */
13532 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
13533
13534 /**
13535  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
13536  */
13537 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
13538
13539 /**
13540  * update_add_htlc messages which should be sent
13541  */
13542 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
13543
13544 /**
13545  * update_fulfill_htlc messages which should be sent
13546  */
13547 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
13548
13549 /**
13550  * update_fail_htlc messages which should be sent
13551  */
13552 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
13553
13554 /**
13555  * update_fail_malformed_htlc messages which should be sent
13556  */
13557 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
13558
13559 /**
13560  * An update_fee message which should be sent
13561  */
13562 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
13563
13564 /**
13565  * An update_fee message which should be sent
13566  */
13567 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
13568
13569 /**
13570  * Finally, the commitment_signed message which should be sent
13571  */
13572 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
13573
13574 /**
13575  * Finally, the commitment_signed message which should be sent
13576  */
13577 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
13578
13579 /**
13580  * Constructs a new CommitmentUpdate given each field
13581  */
13582 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);
13583
13584 /**
13585  * Creates a copy of the CommitmentUpdate
13586  */
13587 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
13588
13589 /**
13590  * Frees any resources used by the HTLCFailChannelUpdate
13591  */
13592 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
13593
13594 /**
13595  * Creates a copy of the HTLCFailChannelUpdate
13596  */
13597 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
13598
13599 /**
13600  * Calls the free function if one is set
13601  */
13602 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
13603
13604 /**
13605  * Calls the free function if one is set
13606  */
13607 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
13608
13609 /**
13610  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
13611  */
13612 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
13613
13614 /**
13615  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
13616  */
13617 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
13618
13619 /**
13620  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
13621  */
13622 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
13623
13624 /**
13625  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
13626  */
13627 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
13628
13629 /**
13630  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
13631  */
13632 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
13633
13634 /**
13635  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
13636  */
13637 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
13638
13639 /**
13640  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
13641  */
13642 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
13643
13644 /**
13645  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
13646  */
13647 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
13648
13649 /**
13650  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
13651  */
13652 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
13653
13654 /**
13655  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
13656  */
13657 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
13658
13659 /**
13660  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
13661  */
13662 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
13663
13664 /**
13665  * Read a FundingCreated from a byte array, created by FundingCreated_write
13666  */
13667 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
13668
13669 /**
13670  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
13671  */
13672 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
13673
13674 /**
13675  * Read a FundingSigned from a byte array, created by FundingSigned_write
13676  */
13677 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
13678
13679 /**
13680  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
13681  */
13682 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
13683
13684 /**
13685  * Read a FundingLocked from a byte array, created by FundingLocked_write
13686  */
13687 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
13688
13689 /**
13690  * Serialize the Init object into a byte array which can be read by Init_read
13691  */
13692 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
13693
13694 /**
13695  * Read a Init from a byte array, created by Init_write
13696  */
13697 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
13698
13699 /**
13700  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
13701  */
13702 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
13703
13704 /**
13705  * Read a OpenChannel from a byte array, created by OpenChannel_write
13706  */
13707 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
13708
13709 /**
13710  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
13711  */
13712 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
13713
13714 /**
13715  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
13716  */
13717 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
13718
13719 /**
13720  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
13721  */
13722 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
13723
13724 /**
13725  * Read a Shutdown from a byte array, created by Shutdown_write
13726  */
13727 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
13728
13729 /**
13730  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
13731  */
13732 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
13733
13734 /**
13735  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
13736  */
13737 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
13738
13739 /**
13740  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
13741  */
13742 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
13743
13744 /**
13745  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
13746  */
13747 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
13748
13749 /**
13750  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
13751  */
13752 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
13753
13754 /**
13755  * Read a UpdateFee from a byte array, created by UpdateFee_write
13756  */
13757 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
13758
13759 /**
13760  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
13761  */
13762 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
13763
13764 /**
13765  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
13766  */
13767 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
13768
13769 /**
13770  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
13771  */
13772 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
13773
13774 /**
13775  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
13776  */
13777 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
13778
13779 /**
13780  * Serialize the Ping object into a byte array which can be read by Ping_read
13781  */
13782 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
13783
13784 /**
13785  * Read a Ping from a byte array, created by Ping_write
13786  */
13787 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
13788
13789 /**
13790  * Serialize the Pong object into a byte array which can be read by Pong_read
13791  */
13792 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
13793
13794 /**
13795  * Read a Pong from a byte array, created by Pong_write
13796  */
13797 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
13798
13799 /**
13800  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
13801  */
13802 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
13803
13804 /**
13805  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
13806  */
13807 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
13808
13809 /**
13810  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
13811  */
13812 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
13813
13814 /**
13815  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
13816  */
13817 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
13818
13819 /**
13820  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
13821  */
13822 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
13823
13824 /**
13825  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
13826  */
13827 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
13828
13829 /**
13830  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
13831  */
13832 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
13833
13834 /**
13835  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
13836  */
13837 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
13838
13839 /**
13840  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
13841  */
13842 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
13843
13844 /**
13845  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
13846  */
13847 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
13848
13849 /**
13850  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
13851  */
13852 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
13853
13854 /**
13855  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
13856  */
13857 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
13858
13859 /**
13860  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
13861  */
13862 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
13863
13864 /**
13865  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
13866  */
13867 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
13868
13869 /**
13870  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
13871  */
13872 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
13873
13874 /**
13875  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
13876  */
13877 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
13878
13879 /**
13880  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
13881  */
13882 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
13883
13884 /**
13885  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
13886  */
13887 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
13888
13889 /**
13890  *\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
13891  */
13892 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
13893
13894 /**
13895  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
13896  */
13897 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
13898
13899 /**
13900  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
13901  */
13902 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
13903
13904 /**
13905  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
13906  */
13907 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
13908
13909 /**
13910  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
13911  */
13912 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
13913
13914 /**
13915  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
13916  */
13917 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
13918
13919 /**
13920  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
13921  */
13922 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
13923
13924 /**
13925  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
13926  */
13927 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
13928
13929 /**
13930  * Constructs a new IgnoringMessageHandler given each field
13931  */
13932 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
13933
13934 /**
13935  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
13936  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
13937  */
13938 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
13939
13940 /**
13941  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
13942  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
13943  */
13944 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
13945
13946 /**
13947  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
13948  */
13949 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
13950
13951 /**
13952  * Constructs a new ErroringMessageHandler
13953  */
13954 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
13955
13956 /**
13957  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
13958  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
13959  */
13960 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
13961
13962 /**
13963  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
13964  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
13965  */
13966 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
13967
13968 /**
13969  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
13970  */
13971 void MessageHandler_free(struct LDKMessageHandler this_obj);
13972
13973 /**
13974  * A message handler which handles messages specific to channels. Usually this is just a
13975  * ChannelManager object or a ErroringMessageHandler.
13976  */
13977 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
13978
13979 /**
13980  * A message handler which handles messages specific to channels. Usually this is just a
13981  * ChannelManager object or a ErroringMessageHandler.
13982  */
13983 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
13984
13985 /**
13986  * A message handler which handles messages updating our knowledge of the network channel
13987  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
13988  */
13989 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
13990
13991 /**
13992  * A message handler which handles messages updating our knowledge of the network channel
13993  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
13994  */
13995 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
13996
13997 /**
13998  * Constructs a new MessageHandler given each field
13999  */
14000 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
14001
14002 /**
14003  * Creates a copy of a SocketDescriptor
14004  */
14005 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
14006
14007 /**
14008  * Calls the free function if one is set
14009  */
14010 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
14011
14012 /**
14013  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
14014  */
14015 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
14016
14017 /**
14018  * Used to indicate that we probably can't make any future connections to this peer, implying
14019  * we should go ahead and force-close any channels we have with it.
14020  */
14021 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
14022
14023 /**
14024  * Used to indicate that we probably can't make any future connections to this peer, implying
14025  * we should go ahead and force-close any channels we have with it.
14026  */
14027 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
14028
14029 /**
14030  * Constructs a new PeerHandleError given each field
14031  */
14032 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
14033
14034 /**
14035  * Creates a copy of the PeerHandleError
14036  */
14037 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
14038
14039 /**
14040  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
14041  */
14042 void PeerManager_free(struct LDKPeerManager this_obj);
14043
14044 /**
14045  * Constructs a new PeerManager with the given message handlers and node_id secret key
14046  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
14047  * cryptographically secure random bytes.
14048  */
14049 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);
14050
14051 /**
14052  * Get the list of node ids for peers which have completed the initial handshake.
14053  *
14054  * For outbound connections, this will be the same as the their_node_id parameter passed in to
14055  * new_outbound_connection, however entries will only appear once the initial handshake has
14056  * completed and we are sure the remote peer has the private key for the given node_id.
14057  */
14058 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
14059
14060 /**
14061  * Indicates a new outbound connection has been established to a node with the given node_id.
14062  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
14063  * descriptor but must disconnect the connection immediately.
14064  *
14065  * Returns a small number of bytes to send to the remote node (currently always 50).
14066  *
14067  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
14068  * socket_disconnected().
14069  */
14070 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);
14071
14072 /**
14073  * Indicates a new inbound connection has been established.
14074  *
14075  * May refuse the connection by returning an Err, but will never write bytes to the remote end
14076  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
14077  * call socket_disconnected for the new descriptor but must disconnect the connection
14078  * immediately.
14079  *
14080  * Panics if descriptor is duplicative with some other descriptor which has not yet had
14081  * socket_disconnected called.
14082  */
14083 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
14084
14085 /**
14086  * Indicates that there is room to write data to the given socket descriptor.
14087  *
14088  * May return an Err to indicate that the connection should be closed.
14089  *
14090  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
14091  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
14092  * invariants around calling write_buffer_space_avail in case a write did not fully complete
14093  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
14094  * here isn't sufficient! Panics if the descriptor was not previously registered in a
14095  * new_\\*_connection event.
14096  */
14097 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
14098
14099 /**
14100  * Indicates that data was read from the given socket descriptor.
14101  *
14102  * May return an Err to indicate that the connection should be closed.
14103  *
14104  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
14105  * Thus, however, you almost certainly want to call process_events() after any read_event to
14106  * generate send_data calls to handle responses.
14107  *
14108  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
14109  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
14110  *
14111  * Panics if the descriptor was not previously registered in a new_*_connection event.
14112  */
14113 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);
14114
14115 /**
14116  * Checks for any events generated by our handlers and processes them. Includes sending most
14117  * response messages as well as messages generated by calls to handler functions directly (eg
14118  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
14119  */
14120 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
14121
14122 /**
14123  * Indicates that the given socket descriptor's connection is now closed.
14124  *
14125  * This must only be called if the socket has been disconnected by the peer or your own
14126  * decision to disconnect it and must NOT be called in any case where other parts of this
14127  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
14128  * the peer.
14129  *
14130  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
14131  */
14132 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
14133
14134 /**
14135  * Disconnect a peer given its node id.
14136  *
14137  * Set no_connection_possible to true to prevent any further connection with this peer,
14138  * force-closing any channels we have with it.
14139  *
14140  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
14141  * so be careful about reentrancy issues.
14142  */
14143 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
14144
14145 /**
14146  * This function should be called roughly once every 30 seconds.
14147  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
14148  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
14149  */
14150 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
14151
14152 /**
14153  * Build the commitment secret from the seed and the commitment number
14154  */
14155 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
14156
14157 /**
14158  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
14159  * from the base secret and the per_commitment_point.
14160  *
14161  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14162  * generated (ie our own).
14163  */
14164 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
14165
14166 /**
14167  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
14168  * from the base point and the per_commitment_key. This is the public equivalent of
14169  * derive_private_key - using only public keys to derive a public key instead of private keys.
14170  *
14171  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14172  * generated (ie our own).
14173  */
14174 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
14175
14176 /**
14177  * Derives a per-commitment-transaction revocation key from its constituent parts.
14178  *
14179  * Only the cheating participant owns a valid witness to propagate a revoked
14180  * commitment transaction, thus per_commitment_secret always come from cheater
14181  * and revocation_base_secret always come from punisher, which is the broadcaster
14182  * of the transaction spending with this key knowledge.
14183  *
14184  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14185  * generated (ie our own).
14186  */
14187 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
14188
14189 /**
14190  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
14191  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
14192  * public key instead of private keys.
14193  *
14194  * Only the cheating participant owns a valid witness to propagate a revoked
14195  * commitment transaction, thus per_commitment_point always come from cheater
14196  * and revocation_base_point always come from punisher, which is the broadcaster
14197  * of the transaction spending with this key knowledge.
14198  *
14199  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14200  * generated (ie our own).
14201  */
14202 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
14203
14204 /**
14205  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
14206  */
14207 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
14208
14209 /**
14210  * The broadcaster's per-commitment public key which was used to derive the other keys.
14211  */
14212 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14213
14214 /**
14215  * The broadcaster's per-commitment public key which was used to derive the other keys.
14216  */
14217 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14218
14219 /**
14220  * The revocation key which is used to allow the broadcaster of the commitment
14221  * transaction to provide their counterparty the ability to punish them if they broadcast
14222  * an old state.
14223  */
14224 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14225
14226 /**
14227  * The revocation key which is used to allow the broadcaster of the commitment
14228  * transaction to provide their counterparty the ability to punish them if they broadcast
14229  * an old state.
14230  */
14231 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14232
14233 /**
14234  * Broadcaster's HTLC Key
14235  */
14236 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14237
14238 /**
14239  * Broadcaster's HTLC Key
14240  */
14241 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14242
14243 /**
14244  * Countersignatory's HTLC Key
14245  */
14246 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14247
14248 /**
14249  * Countersignatory's HTLC Key
14250  */
14251 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14252
14253 /**
14254  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
14255  */
14256 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14257
14258 /**
14259  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
14260  */
14261 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14262
14263 /**
14264  * Constructs a new TxCreationKeys given each field
14265  */
14266 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);
14267
14268 /**
14269  * Creates a copy of the TxCreationKeys
14270  */
14271 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
14272
14273 /**
14274  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
14275  */
14276 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
14277
14278 /**
14279  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
14280  */
14281 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
14282
14283 /**
14284  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
14285  */
14286 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
14287
14288 /**
14289  * The public key which is used to sign all commitment transactions, as it appears in the
14290  * on-chain channel lock-in 2-of-2 multisig output.
14291  */
14292 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14293
14294 /**
14295  * The public key which is used to sign all commitment transactions, as it appears in the
14296  * on-chain channel lock-in 2-of-2 multisig output.
14297  */
14298 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14299
14300 /**
14301  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
14302  * revocation keys. This is combined with the per-commitment-secret generated by the
14303  * counterparty to create a secret which the counterparty can reveal to revoke previous
14304  * states.
14305  */
14306 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14307
14308 /**
14309  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
14310  * revocation keys. This is combined with the per-commitment-secret generated by the
14311  * counterparty to create a secret which the counterparty can reveal to revoke previous
14312  * states.
14313  */
14314 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14315
14316 /**
14317  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
14318  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
14319  * static across every commitment transaction.
14320  */
14321 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14322
14323 /**
14324  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
14325  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
14326  * static across every commitment transaction.
14327  */
14328 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14329
14330 /**
14331  * The base point which is used (with derive_public_key) to derive a per-commitment payment
14332  * public key which receives non-HTLC-encumbered funds which are only available for spending
14333  * after some delay (or can be claimed via the revocation path).
14334  */
14335 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14336
14337 /**
14338  * The base point which is used (with derive_public_key) to derive a per-commitment payment
14339  * public key which receives non-HTLC-encumbered funds which are only available for spending
14340  * after some delay (or can be claimed via the revocation path).
14341  */
14342 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14343
14344 /**
14345  * The base point which is used (with derive_public_key) to derive a per-commitment public key
14346  * which is used to encumber HTLC-in-flight outputs.
14347  */
14348 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14349
14350 /**
14351  * The base point which is used (with derive_public_key) to derive a per-commitment public key
14352  * which is used to encumber HTLC-in-flight outputs.
14353  */
14354 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14355
14356 /**
14357  * Constructs a new ChannelPublicKeys given each field
14358  */
14359 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);
14360
14361 /**
14362  * Creates a copy of the ChannelPublicKeys
14363  */
14364 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
14365
14366 /**
14367  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
14368  */
14369 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
14370
14371 /**
14372  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
14373  */
14374 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
14375
14376 /**
14377  * Create per-state keys from channel base points and the per-commitment point.
14378  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
14379  */
14380 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);
14381
14382 /**
14383  * Generate per-state keys from channel static keys.
14384  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
14385  */
14386 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);
14387
14388 /**
14389  * A script either spendable by the revocation
14390  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
14391  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
14392  */
14393 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
14394
14395 /**
14396  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
14397  */
14398 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
14399
14400 /**
14401  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
14402  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
14403  * need to compare this value to whether the commitment transaction in question is that of
14404  * the counterparty or our own.
14405  */
14406 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14407
14408 /**
14409  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
14410  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
14411  * need to compare this value to whether the commitment transaction in question is that of
14412  * the counterparty or our own.
14413  */
14414 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
14415
14416 /**
14417  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
14418  * this divided by 1000.
14419  */
14420 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14421
14422 /**
14423  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
14424  * this divided by 1000.
14425  */
14426 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
14427
14428 /**
14429  * The CLTV lock-time at which this HTLC expires.
14430  */
14431 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14432
14433 /**
14434  * The CLTV lock-time at which this HTLC expires.
14435  */
14436 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
14437
14438 /**
14439  * The hash of the preimage which unlocks this HTLC.
14440  */
14441 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
14442
14443 /**
14444  * The hash of the preimage which unlocks this HTLC.
14445  */
14446 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14447
14448 /**
14449  * The position within the commitment transactions' outputs. This may be None if the value is
14450  * below the dust limit (in which case no output appears in the commitment transaction and the
14451  * value is spent to additional transaction fees).
14452  */
14453 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14454
14455 /**
14456  * The position within the commitment transactions' outputs. This may be None if the value is
14457  * below the dust limit (in which case no output appears in the commitment transaction and the
14458  * value is spent to additional transaction fees).
14459  */
14460 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
14461
14462 /**
14463  * Constructs a new HTLCOutputInCommitment given each field
14464  */
14465 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);
14466
14467 /**
14468  * Creates a copy of the HTLCOutputInCommitment
14469  */
14470 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
14471
14472 /**
14473  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
14474  */
14475 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
14476
14477 /**
14478  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
14479  */
14480 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
14481
14482 /**
14483  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
14484  * does not need to have its previous_output_index filled.
14485  */
14486 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
14487
14488 /**
14489  * Gets the redeemscript for a funding output from the two funding public keys.
14490  * Note that the order of funding public keys does not matter.
14491  */
14492 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
14493
14494 /**
14495  * panics if htlc.transaction_output_index.is_none()!
14496  */
14497 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);
14498
14499 /**
14500  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14501  */
14502 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
14503
14504 /**
14505  * Holder public keys
14506  */
14507 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14508
14509 /**
14510  * Holder public keys
14511  */
14512 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
14513
14514 /**
14515  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
14516  */
14517 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14518
14519 /**
14520  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
14521  */
14522 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
14523
14524 /**
14525  * Whether the holder is the initiator of this channel.
14526  * This is an input to the commitment number obscure factor computation.
14527  */
14528 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14529
14530 /**
14531  * Whether the holder is the initiator of this channel.
14532  * This is an input to the commitment number obscure factor computation.
14533  */
14534 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
14535
14536 /**
14537  * The late-bound counterparty channel transaction parameters.
14538  * These parameters are populated at the point in the protocol where the counterparty provides them.
14539  */
14540 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14541
14542 /**
14543  * The late-bound counterparty channel transaction parameters.
14544  * These parameters are populated at the point in the protocol where the counterparty provides them.
14545  */
14546 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
14547
14548 /**
14549  * The late-bound funding outpoint
14550  */
14551 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14552
14553 /**
14554  * The late-bound funding outpoint
14555  */
14556 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
14557
14558 /**
14559  * Constructs a new ChannelTransactionParameters given each field
14560  */
14561 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);
14562
14563 /**
14564  * Creates a copy of the ChannelTransactionParameters
14565  */
14566 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
14567
14568 /**
14569  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14570  */
14571 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
14572
14573 /**
14574  * Counter-party public keys
14575  */
14576 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
14577
14578 /**
14579  * Counter-party public keys
14580  */
14581 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
14582
14583 /**
14584  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
14585  */
14586 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
14587
14588 /**
14589  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
14590  */
14591 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
14592
14593 /**
14594  * Constructs a new CounterpartyChannelTransactionParameters given each field
14595  */
14596 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
14597
14598 /**
14599  * Creates a copy of the CounterpartyChannelTransactionParameters
14600  */
14601 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
14602
14603 /**
14604  * Whether the late bound parameters are populated.
14605  */
14606 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14607
14608 /**
14609  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
14610  * given that the holder is the broadcaster.
14611  *
14612  * self.is_populated() must be true before calling this function.
14613  */
14614 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14615
14616 /**
14617  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
14618  * given that the counterparty is the broadcaster.
14619  *
14620  * self.is_populated() must be true before calling this function.
14621  */
14622 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14623
14624 /**
14625  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
14626  */
14627 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
14628
14629 /**
14630  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
14631  */
14632 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
14633
14634 /**
14635  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
14636  */
14637 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
14638
14639 /**
14640  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
14641  */
14642 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
14643
14644 /**
14645  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14646  */
14647 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
14648
14649 /**
14650  * Get the channel pubkeys for the broadcaster
14651  */
14652 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14653
14654 /**
14655  * Get the channel pubkeys for the countersignatory
14656  */
14657 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14658
14659 /**
14660  * Get the contest delay applicable to the transactions.
14661  * Note that the contest delay was selected by the countersignatory.
14662  */
14663 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14664
14665 /**
14666  * Whether the channel is outbound from the broadcaster.
14667  *
14668  * The boolean representing the side that initiated the channel is
14669  * an input to the commitment number obscure factor computation.
14670  */
14671 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14672
14673 /**
14674  * The funding outpoint
14675  */
14676 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14677
14678 /**
14679  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
14680  */
14681 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
14682
14683 /**
14684  * Our counterparty's signature for the transaction
14685  */
14686 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
14687
14688 /**
14689  * Our counterparty's signature for the transaction
14690  */
14691 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
14692
14693 /**
14694  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
14695  */
14696 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
14697
14698 /**
14699  * Creates a copy of the HolderCommitmentTransaction
14700  */
14701 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
14702
14703 /**
14704  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
14705  */
14706 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
14707
14708 /**
14709  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
14710  */
14711 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
14712
14713 /**
14714  * Create a new holder transaction with the given counterparty signatures.
14715  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
14716  */
14717 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);
14718
14719 /**
14720  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
14721  */
14722 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
14723
14724 /**
14725  * The commitment transaction
14726  */
14727 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
14728
14729 /**
14730  * The commitment transaction
14731  */
14732 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
14733
14734 /**
14735  * The txid for the commitment transaction.
14736  *
14737  * This is provided as a performance optimization, instead of calling transaction.txid()
14738  * multiple times.
14739  */
14740 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
14741
14742 /**
14743  * The txid for the commitment transaction.
14744  *
14745  * This is provided as a performance optimization, instead of calling transaction.txid()
14746  * multiple times.
14747  */
14748 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14749
14750 /**
14751  * Constructs a new BuiltCommitmentTransaction given each field
14752  */
14753 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
14754
14755 /**
14756  * Creates a copy of the BuiltCommitmentTransaction
14757  */
14758 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
14759
14760 /**
14761  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
14762  */
14763 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
14764
14765 /**
14766  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
14767  */
14768 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
14769
14770 /**
14771  * Get the SIGHASH_ALL sighash value of the transaction.
14772  *
14773  * This can be used to verify a signature.
14774  */
14775 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);
14776
14777 /**
14778  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
14779  * because we are about to broadcast a holder transaction.
14780  */
14781 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);
14782
14783 /**
14784  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
14785  */
14786 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
14787
14788 /**
14789  * Creates a copy of the CommitmentTransaction
14790  */
14791 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
14792
14793 /**
14794  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
14795  */
14796 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
14797
14798 /**
14799  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
14800  */
14801 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
14802
14803 /**
14804  * The backwards-counting commitment number
14805  */
14806 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14807
14808 /**
14809  * The value to be sent to the broadcaster
14810  */
14811 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14812
14813 /**
14814  * The value to be sent to the counterparty
14815  */
14816 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14817
14818 /**
14819  * The feerate paid per 1000-weight-unit in this commitment transaction.
14820  */
14821 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14822
14823 /**
14824  * Trust our pre-built transaction and derived transaction creation public keys.
14825  *
14826  * Applies a wrapper which allows access to these fields.
14827  *
14828  * This should only be used if you fully trust the builder of this object.  It should not
14829  *\tbe used by an external signer - instead use the verify function.
14830  */
14831 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14832
14833 /**
14834  * Verify our pre-built transaction and derived transaction creation public keys.
14835  *
14836  * Applies a wrapper which allows access to these fields.
14837  *
14838  * An external validating signer must call this method before signing
14839  * or using the built transaction.
14840  */
14841 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);
14842
14843 /**
14844  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
14845  */
14846 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
14847
14848 /**
14849  * The transaction ID of the built Bitcoin transaction
14850  */
14851 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14852
14853 /**
14854  * The pre-built Bitcoin commitment transaction
14855  */
14856 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14857
14858 /**
14859  * The pre-calculated transaction creation public keys.
14860  */
14861 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14862
14863 /**
14864  * Get a signature for each HTLC which was included in the commitment transaction (ie for
14865  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
14866  *
14867  * The returned Vec has one entry for each HTLC, and in the same order.
14868  */
14869 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);
14870
14871 /**
14872  * Get the transaction number obscure factor
14873  */
14874 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
14875
14876 /**
14877  * Creates a copy of the InitFeatures
14878  */
14879 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
14880
14881 /**
14882  * Creates a copy of the NodeFeatures
14883  */
14884 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
14885
14886 /**
14887  * Creates a copy of the ChannelFeatures
14888  */
14889 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
14890
14891 /**
14892  * Creates a copy of the InvoiceFeatures
14893  */
14894 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
14895
14896 /**
14897  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
14898  */
14899 void InitFeatures_free(struct LDKInitFeatures this_obj);
14900
14901 /**
14902  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
14903  */
14904 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
14905
14906 /**
14907  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
14908  */
14909 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
14910
14911 /**
14912  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
14913  */
14914 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
14915
14916 /**
14917  * Create a blank Features with no features set
14918  */
14919 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
14920
14921 /**
14922  * Creates a Features with the bits set which are known by the implementation
14923  */
14924 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
14925
14926 /**
14927  * Create a blank Features with no features set
14928  */
14929 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
14930
14931 /**
14932  * Creates a Features with the bits set which are known by the implementation
14933  */
14934 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
14935
14936 /**
14937  * Create a blank Features with no features set
14938  */
14939 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
14940
14941 /**
14942  * Creates a Features with the bits set which are known by the implementation
14943  */
14944 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
14945
14946 /**
14947  * Create a blank Features with no features set
14948  */
14949 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
14950
14951 /**
14952  * Creates a Features with the bits set which are known by the implementation
14953  */
14954 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
14955
14956 /**
14957  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
14958  */
14959 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
14960
14961 /**
14962  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
14963  */
14964 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
14965
14966 /**
14967  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
14968  */
14969 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
14970
14971 /**
14972  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
14973  */
14974 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
14975
14976 /**
14977  * Read a InitFeatures from a byte array, created by InitFeatures_write
14978  */
14979 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
14980
14981 /**
14982  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
14983  */
14984 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
14985
14986 /**
14987  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
14988  */
14989 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
14990
14991 /**
14992  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
14993  */
14994 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
14995
14996 /**
14997  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
14998  */
14999 void RouteHop_free(struct LDKRouteHop this_obj);
15000
15001 /**
15002  * The node_id of the node at this hop.
15003  */
15004 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15005
15006 /**
15007  * The node_id of the node at this hop.
15008  */
15009 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15010
15011 /**
15012  * The node_announcement features of the node at this hop. For the last hop, these may be
15013  * amended to match the features present in the invoice this node generated.
15014  */
15015 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15016
15017 /**
15018  * The node_announcement features of the node at this hop. For the last hop, these may be
15019  * amended to match the features present in the invoice this node generated.
15020  */
15021 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
15022
15023 /**
15024  * The channel that should be used from the previous hop to reach this node.
15025  */
15026 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15027
15028 /**
15029  * The channel that should be used from the previous hop to reach this node.
15030  */
15031 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
15032
15033 /**
15034  * The channel_announcement features of the channel that should be used from the previous hop
15035  * to reach this node.
15036  */
15037 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15038
15039 /**
15040  * The channel_announcement features of the channel that should be used from the previous hop
15041  * to reach this node.
15042  */
15043 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
15044
15045 /**
15046  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
15047  * For the last hop, this should be the full value of the payment (might be more than
15048  * requested if we had to match htlc_minimum_msat).
15049  */
15050 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15051
15052 /**
15053  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
15054  * For the last hop, this should be the full value of the payment (might be more than
15055  * requested if we had to match htlc_minimum_msat).
15056  */
15057 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
15058
15059 /**
15060  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
15061  * expected at the destination, in excess of the current block height.
15062  */
15063 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
15064
15065 /**
15066  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
15067  * expected at the destination, in excess of the current block height.
15068  */
15069 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
15070
15071 /**
15072  * Constructs a new RouteHop given each field
15073  */
15074 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);
15075
15076 /**
15077  * Creates a copy of the RouteHop
15078  */
15079 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
15080
15081 /**
15082  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
15083  */
15084 void Route_free(struct LDKRoute this_obj);
15085
15086 /**
15087  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
15088  * last RouteHop in each path must be the same.
15089  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
15090  * destination. Thus, this must always be at least length one. While the maximum length of any
15091  * given path is variable, keeping the length of any path to less than 20 should currently
15092  * ensure it is viable.
15093  */
15094 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
15095
15096 /**
15097  * Constructs a new Route given each field
15098  */
15099 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
15100
15101 /**
15102  * Creates a copy of the Route
15103  */
15104 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
15105
15106 /**
15107  * Serialize the Route object into a byte array which can be read by Route_read
15108  */
15109 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
15110
15111 /**
15112  * Read a Route from a byte array, created by Route_write
15113  */
15114 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
15115
15116 /**
15117  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
15118  */
15119 void RouteHint_free(struct LDKRouteHint this_obj);
15120
15121 /**
15122  * The node_id of the non-target end of the route
15123  */
15124 struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
15125
15126 /**
15127  * The node_id of the non-target end of the route
15128  */
15129 void RouteHint_set_src_node_id(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15130
15131 /**
15132  * The short_channel_id of this channel
15133  */
15134 uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
15135
15136 /**
15137  * The short_channel_id of this channel
15138  */
15139 void RouteHint_set_short_channel_id(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
15140
15141 /**
15142  * The fees which must be paid to use this channel
15143  */
15144 struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *NONNULL_PTR this_ptr);
15145
15146 /**
15147  * The fees which must be paid to use this channel
15148  */
15149 void RouteHint_set_fees(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
15150
15151 /**
15152  * The difference in CLTV values between this node and the next node.
15153  */
15154 uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR this_ptr);
15155
15156 /**
15157  * The difference in CLTV values between this node and the next node.
15158  */
15159 void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val);
15160
15161 /**
15162  * The minimum value, in msat, which must be relayed to the next hop.
15163  */
15164 struct LDKCOption_u64Z RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
15165
15166 /**
15167  * The minimum value, in msat, which must be relayed to the next hop.
15168  */
15169 void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15170
15171 /**
15172  * The maximum value in msat available for routing with a single HTLC.
15173  */
15174 struct LDKCOption_u64Z RouteHint_get_htlc_maximum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
15175
15176 /**
15177  * The maximum value in msat available for routing with a single HTLC.
15178  */
15179 void RouteHint_set_htlc_maximum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15180
15181 /**
15182  * Constructs a new RouteHint given each field
15183  */
15184 MUST_USE_RES struct LDKRouteHint RouteHint_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);
15185
15186 /**
15187  * Creates a copy of the RouteHint
15188  */
15189 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
15190
15191 /**
15192  * Gets a route from us (payer) to the given target node (payee).
15193  *
15194  * If the payee provided features in their invoice, they should be provided via payee_features.
15195  * Without this, MPP will only be used if the payee's features are available in the network graph.
15196  *
15197  * Extra routing hops between known nodes and the target will be used if they are included in
15198  * last_hops.
15199  *
15200  * If some channels aren't announced, it may be useful to fill in a first_hops with the
15201  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
15202  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
15203  * in first_hops will be used.
15204  *
15205  * Panics if first_hops contains channels without short_channel_ids
15206  * (ChannelManager::list_usable_channels will never include such channels).
15207  *
15208  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
15209  * equal), however the enabled/disabled bit on such channels as well as the
15210  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
15211  */
15212 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_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
15213
15214 /**
15215  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
15216  */
15217 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
15218
15219 /**
15220  * Creates a copy of the NetworkGraph
15221  */
15222 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
15223
15224 /**
15225  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
15226  */
15227 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
15228
15229 /**
15230  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
15231  */
15232 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
15233
15234 /**
15235  * Creates a new tracker of the actual state of the network of channels and nodes,
15236  * assuming a fresh network graph.
15237  * Chain monitor is used to make sure announced channels exist on-chain,
15238  * channel data is correct, and that the announcement is signed with
15239  * channel owners' keys.
15240  */
15241 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
15242
15243 /**
15244  * Creates a new tracker of the actual state of the network of channels and nodes,
15245  * assuming an existing Network Graph.
15246  */
15247 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
15248
15249 /**
15250  * Adds a provider used to check new announcements. Does not affect
15251  * existing announcements unless they are updated.
15252  * Add, update or remove the provider would replace the current one.
15253  */
15254 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
15255
15256 /**
15257  * Take a read lock on the network_graph and return it in the C-bindings
15258  * newtype helper. This is likely only useful when called via the C
15259  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
15260  * yourself.
15261  */
15262 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15263
15264 /**
15265  * Get a reference to the NetworkGraph which this read-lock contains.
15266  */
15267 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
15268
15269 /**
15270  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
15271  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
15272  */
15273 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15274
15275 /**
15276  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15277  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15278  */
15279 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15280
15281 /**
15282  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
15283  */
15284 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
15285
15286 /**
15287  * When the last update to the channel direction was issued.
15288  * Value is opaque, as set in the announcement.
15289  */
15290 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15291
15292 /**
15293  * When the last update to the channel direction was issued.
15294  * Value is opaque, as set in the announcement.
15295  */
15296 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
15297
15298 /**
15299  * Whether the channel can be currently used for payments (in this one direction).
15300  */
15301 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15302
15303 /**
15304  * Whether the channel can be currently used for payments (in this one direction).
15305  */
15306 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
15307
15308 /**
15309  * The difference in CLTV values that you must have when routing through this channel.
15310  */
15311 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15312
15313 /**
15314  * The difference in CLTV values that you must have when routing through this channel.
15315  */
15316 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
15317
15318 /**
15319  * The minimum value, which must be relayed to the next hop via the channel
15320  */
15321 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15322
15323 /**
15324  * The minimum value, which must be relayed to the next hop via the channel
15325  */
15326 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
15327
15328 /**
15329  * The maximum value which may be relayed to the next hop via the channel.
15330  */
15331 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15332
15333 /**
15334  * The maximum value which may be relayed to the next hop via the channel.
15335  */
15336 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15337
15338 /**
15339  * Fees charged when the channel is used for routing
15340  */
15341 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15342
15343 /**
15344  * Fees charged when the channel is used for routing
15345  */
15346 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
15347
15348 /**
15349  * Most recent update for the channel received from the network
15350  * Mostly redundant with the data we store in fields explicitly.
15351  * Everything else is useful only for sending out for initial routing sync.
15352  * Not stored if contains excess data to prevent DoS.
15353  */
15354 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15355
15356 /**
15357  * Most recent update for the channel received from the network
15358  * Mostly redundant with the data we store in fields explicitly.
15359  * Everything else is useful only for sending out for initial routing sync.
15360  * Not stored if contains excess data to prevent DoS.
15361  */
15362 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
15363
15364 /**
15365  * Constructs a new DirectionalChannelInfo given each field
15366  */
15367 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);
15368
15369 /**
15370  * Creates a copy of the DirectionalChannelInfo
15371  */
15372 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
15373
15374 /**
15375  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
15376  */
15377 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
15378
15379 /**
15380  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
15381  */
15382 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
15383
15384 /**
15385  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
15386  */
15387 void ChannelInfo_free(struct LDKChannelInfo this_obj);
15388
15389 /**
15390  * Protocol features of a channel communicated during its announcement
15391  */
15392 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15393
15394 /**
15395  * Protocol features of a channel communicated during its announcement
15396  */
15397 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
15398
15399 /**
15400  * Source node of the first direction of a channel
15401  */
15402 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15403
15404 /**
15405  * Source node of the first direction of a channel
15406  */
15407 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15408
15409 /**
15410  * Details about the first direction of a channel
15411  */
15412 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15413
15414 /**
15415  * Details about the first direction of a channel
15416  */
15417 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
15418
15419 /**
15420  * Source node of the second direction of a channel
15421  */
15422 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15423
15424 /**
15425  * Source node of the second direction of a channel
15426  */
15427 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15428
15429 /**
15430  * Details about the second direction of a channel
15431  */
15432 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15433
15434 /**
15435  * Details about the second direction of a channel
15436  */
15437 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
15438
15439 /**
15440  * The channel capacity as seen on-chain, if chain lookup is available.
15441  */
15442 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15443
15444 /**
15445  * The channel capacity as seen on-chain, if chain lookup is available.
15446  */
15447 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15448
15449 /**
15450  * An initial announcement of the channel
15451  * Mostly redundant with the data we store in fields explicitly.
15452  * Everything else is useful only for sending out for initial routing sync.
15453  * Not stored if contains excess data to prevent DoS.
15454  */
15455 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15456
15457 /**
15458  * An initial announcement of the channel
15459  * Mostly redundant with the data we store in fields explicitly.
15460  * Everything else is useful only for sending out for initial routing sync.
15461  * Not stored if contains excess data to prevent DoS.
15462  */
15463 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
15464
15465 /**
15466  * Constructs a new ChannelInfo given each field
15467  */
15468 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);
15469
15470 /**
15471  * Creates a copy of the ChannelInfo
15472  */
15473 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
15474
15475 /**
15476  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
15477  */
15478 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
15479
15480 /**
15481  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
15482  */
15483 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
15484
15485 /**
15486  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
15487  */
15488 void RoutingFees_free(struct LDKRoutingFees this_obj);
15489
15490 /**
15491  * Flat routing fee in satoshis
15492  */
15493 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
15494
15495 /**
15496  * Flat routing fee in satoshis
15497  */
15498 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
15499
15500 /**
15501  * Liquidity-based routing fee in millionths of a routed amount.
15502  * In other words, 10000 is 1%.
15503  */
15504 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
15505
15506 /**
15507  * Liquidity-based routing fee in millionths of a routed amount.
15508  * In other words, 10000 is 1%.
15509  */
15510 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
15511
15512 /**
15513  * Constructs a new RoutingFees given each field
15514  */
15515 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
15516
15517 /**
15518  * Creates a copy of the RoutingFees
15519  */
15520 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
15521
15522 /**
15523  * Read a RoutingFees from a byte array, created by RoutingFees_write
15524  */
15525 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
15526
15527 /**
15528  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
15529  */
15530 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
15531
15532 /**
15533  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
15534  */
15535 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
15536
15537 /**
15538  * Protocol features the node announced support for
15539  */
15540 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15541
15542 /**
15543  * Protocol features the node announced support for
15544  */
15545 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
15546
15547 /**
15548  * When the last known update to the node state was issued.
15549  * Value is opaque, as set in the announcement.
15550  */
15551 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15552
15553 /**
15554  * When the last known update to the node state was issued.
15555  * Value is opaque, as set in the announcement.
15556  */
15557 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
15558
15559 /**
15560  * Color assigned to the node
15561  */
15562 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
15563
15564 /**
15565  * Color assigned to the node
15566  */
15567 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
15568
15569 /**
15570  * Moniker assigned to the node.
15571  * May be invalid or malicious (eg control chars),
15572  * should not be exposed to the user.
15573  */
15574 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
15575
15576 /**
15577  * Moniker assigned to the node.
15578  * May be invalid or malicious (eg control chars),
15579  * should not be exposed to the user.
15580  */
15581 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15582
15583 /**
15584  * Internet-level addresses via which one can connect to the node
15585  */
15586 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
15587
15588 /**
15589  * An initial announcement of the node
15590  * Mostly redundant with the data we store in fields explicitly.
15591  * Everything else is useful only for sending out for initial routing sync.
15592  * Not stored if contains excess data to prevent DoS.
15593  */
15594 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15595
15596 /**
15597  * An initial announcement of the node
15598  * Mostly redundant with the data we store in fields explicitly.
15599  * Everything else is useful only for sending out for initial routing sync.
15600  * Not stored if contains excess data to prevent DoS.
15601  */
15602 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
15603
15604 /**
15605  * Constructs a new NodeAnnouncementInfo given each field
15606  */
15607 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);
15608
15609 /**
15610  * Creates a copy of the NodeAnnouncementInfo
15611  */
15612 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
15613
15614 /**
15615  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
15616  */
15617 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
15618
15619 /**
15620  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
15621  */
15622 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
15623
15624 /**
15625  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
15626  */
15627 void NodeInfo_free(struct LDKNodeInfo this_obj);
15628
15629 /**
15630  * All valid channels a node has announced
15631  */
15632 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15633
15634 /**
15635  * Lowest fees enabling routing via any of the enabled, known channels to a node.
15636  * The two fields (flat and proportional fee) are independent,
15637  * meaning they don't have to refer to the same channel.
15638  */
15639 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
15640
15641 /**
15642  * Lowest fees enabling routing via any of the enabled, known channels to a node.
15643  * The two fields (flat and proportional fee) are independent,
15644  * meaning they don't have to refer to the same channel.
15645  */
15646 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
15647
15648 /**
15649  * More information about a node from node_announcement.
15650  * Optional because we store a Node entry after learning about it from
15651  * a channel announcement, but before receiving a node announcement.
15652  */
15653 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
15654
15655 /**
15656  * More information about a node from node_announcement.
15657  * Optional because we store a Node entry after learning about it from
15658  * a channel announcement, but before receiving a node announcement.
15659  */
15660 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
15661
15662 /**
15663  * Constructs a new NodeInfo given each field
15664  */
15665 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
15666
15667 /**
15668  * Creates a copy of the NodeInfo
15669  */
15670 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
15671
15672 /**
15673  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
15674  */
15675 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
15676
15677 /**
15678  * Read a NodeInfo from a byte array, created by NodeInfo_write
15679  */
15680 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
15681
15682 /**
15683  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
15684  */
15685 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
15686
15687 /**
15688  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
15689  */
15690 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
15691
15692 /**
15693  * Creates a new, empty, network graph.
15694  */
15695 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
15696
15697 /**
15698  * For an already known node (from channel announcements), update its stored properties from a
15699  * given node announcement.
15700  *
15701  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15702  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15703  * routing messages from a source using a protocol other than the lightning P2P protocol.
15704  */
15705 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
15706
15707 /**
15708  * For an already known node (from channel announcements), update its stored properties from a
15709  * given node announcement without verifying the associated signatures. Because we aren't
15710  * given the associated signatures here we cannot relay the node announcement to any of our
15711  * peers.
15712  */
15713 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
15714
15715 /**
15716  * Store or update channel info from a channel announcement.
15717  *
15718  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15719  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15720  * routing messages from a source using a protocol other than the lightning P2P protocol.
15721  *
15722  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
15723  * the corresponding UTXO exists on chain and is correctly-formatted.
15724  */
15725 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);
15726
15727 /**
15728  * Store or update channel info from a channel announcement without verifying the associated
15729  * signatures. Because we aren't given the associated signatures here we cannot relay the
15730  * channel announcement to any of our peers.
15731  *
15732  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
15733  * the corresponding UTXO exists on chain and is correctly-formatted.
15734  */
15735 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);
15736
15737 /**
15738  * Close a channel if a corresponding HTLC fail was sent.
15739  * If permanent, removes a channel from the local storage.
15740  * May cause the removal of nodes too, if this was their last channel.
15741  * If not permanent, makes channels unavailable for routing.
15742  */
15743 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
15744
15745 /**
15746  * For an already known (from announcement) channel, update info about one of the directions
15747  * of the channel.
15748  *
15749  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15750  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15751  * routing messages from a source using a protocol other than the lightning P2P protocol.
15752  */
15753 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
15754
15755 /**
15756  * For an already known (from announcement) channel, update info about one of the directions
15757  * of the channel without verifying the associated signatures. Because we aren't given the
15758  * associated signatures here we cannot relay the channel update to any of our peers.
15759  */
15760 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
15761
15762 /**
15763  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
15764  */
15765 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
15766
15767 /**
15768  * Initialize a new FilesystemPersister and set the path to the individual channels'
15769  * files.
15770  */
15771 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKCVec_u8Z path_to_channel_data);
15772
15773 /**
15774  * Get the directory which was provided when this persister was initialized.
15775  */
15776 MUST_USE_RES struct LDKCVec_u8Z FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
15777
15778 /**
15779  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
15780  * initialization, within a file called \"manager\".
15781  */
15782 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKCVec_u8Z data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
15783
15784 /**
15785  * Read `ChannelMonitor`s from disk.
15786  */
15787 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
15788
15789 /**
15790  * Constructs a new Persist which calls the relevant methods on this_arg.
15791  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
15792  */
15793 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
15794
15795 /* Text to put at the end of the generated file */