Update auto-generated bindings to latest upstream
[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  * An enum representing the available verbosity levels of the logger.
125  */
126 typedef enum LDKLevel {
127    /**
128     *Designates logger being silent
129     */
130    LDKLevel_Off,
131    /**
132     * Designates very serious errors
133     */
134    LDKLevel_Error,
135    /**
136     * Designates hazardous situations
137     */
138    LDKLevel_Warn,
139    /**
140     * Designates useful information
141     */
142    LDKLevel_Info,
143    /**
144     * Designates lower priority information
145     */
146    LDKLevel_Debug,
147    /**
148     * Designates very low priority, often extremely verbose, information
149     */
150    LDKLevel_Trace,
151    /**
152     * Must be last for serialization purposes
153     */
154    LDKLevel_Sentinel,
155 } LDKLevel;
156
157 /**
158  * An enum representing the possible Bitcoin or test networks which we can run on
159  */
160 typedef enum LDKNetwork {
161    /**
162     * The main Bitcoin blockchain.
163     */
164    LDKNetwork_Bitcoin,
165    /**
166     * The testnet3 blockchain.
167     */
168    LDKNetwork_Testnet,
169    /**
170     * A local test blockchain.
171     */
172    LDKNetwork_Regtest,
173    /**
174     * A blockchain on which blocks are signed instead of mined.
175     */
176    LDKNetwork_Signet,
177    /**
178     * Must be last for serialization purposes
179     */
180    LDKNetwork_Sentinel,
181 } LDKNetwork;
182
183 /**
184  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
185  */
186 typedef enum LDKSecp256k1Error {
187    /**
188     * Signature failed verification
189     */
190    LDKSecp256k1Error_IncorrectSignature,
191    /**
192     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
193     */
194    LDKSecp256k1Error_InvalidMessage,
195    /**
196     * Bad public key
197     */
198    LDKSecp256k1Error_InvalidPublicKey,
199    /**
200     * Bad signature
201     */
202    LDKSecp256k1Error_InvalidSignature,
203    /**
204     * Bad secret key
205     */
206    LDKSecp256k1Error_InvalidSecretKey,
207    /**
208     * Bad recovery id
209     */
210    LDKSecp256k1Error_InvalidRecoveryId,
211    /**
212     * Invalid tweak for add_assign or mul_assign
213     */
214    LDKSecp256k1Error_InvalidTweak,
215    /**
216     * tweak_add_check failed on an xonly public key
217     */
218    LDKSecp256k1Error_TweakCheckFailed,
219    /**
220     * Didn't pass enough memory to context creation with preallocated memory
221     */
222    LDKSecp256k1Error_NotEnoughMemory,
223    /**
224     * Must be last for serialization purposes
225     */
226    LDKSecp256k1Error_Sentinel,
227 } LDKSecp256k1Error;
228
229 /**
230  * A serialized transaction, in (pointer, length) form.
231  *
232  * This type optionally owns its own memory, and thus the semantics around access change based on
233  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
234  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
235  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
236  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
237  * you would be invalid.
238  *
239  * Note that, while it may change in the future, because transactions on the Rust side are stored
240  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
241  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
242  * `data_is_owned` either set or unset at your discretion.
243  */
244 typedef struct LDKTransaction {
245    /**
246     * The serialized transaction data.
247     *
248     * This is non-const for your convenience, an object passed to Rust is never written to.
249     */
250    uint8_t *data;
251    /**
252     * The length of the serialized transaction
253     */
254    uintptr_t datalen;
255    /**
256     * Whether the data pointed to by `data` should be freed or not.
257     */
258    bool data_is_owned;
259 } LDKTransaction;
260
261 /**
262  * A dynamically-allocated array of u8s of arbitrary size.
263  * This corresponds to std::vector in C++
264  */
265 typedef struct LDKCVec_u8Z {
266    /**
267     * The elements in the array.
268     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
269     */
270    uint8_t *data;
271    /**
272     * The number of elements pointed to by `data`.
273     */
274    uintptr_t datalen;
275 } LDKCVec_u8Z;
276
277 /**
278  * A transaction output including a scriptPubKey and value.
279  * This type *does* own its own memory, so must be free'd appropriately.
280  */
281 typedef struct LDKTxOut {
282    /**
283     * The script_pubkey in this output
284     */
285    struct LDKCVec_u8Z script_pubkey;
286    /**
287     * The value, in satoshis, of this output
288     */
289    uint64_t value;
290 } LDKTxOut;
291
292 /**
293  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
294  */
295 typedef struct LDKSecretKey {
296    /**
297     * The bytes of the secret key
298     */
299    uint8_t bytes[32];
300 } LDKSecretKey;
301
302 /**
303  * The contents of CResult_SecretKeyErrorZ
304  */
305 typedef union LDKCResult_SecretKeyErrorZPtr {
306    /**
307     * A pointer to the contents in the success state.
308     * Reading from this pointer when `result_ok` is not set is undefined.
309     */
310    struct LDKSecretKey *result;
311    /**
312     * A pointer to the contents in the error state.
313     * Reading from this pointer when `result_ok` is set is undefined.
314     */
315    enum LDKSecp256k1Error *err;
316 } LDKCResult_SecretKeyErrorZPtr;
317
318 /**
319  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
320  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
321  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
322  */
323 typedef struct LDKCResult_SecretKeyErrorZ {
324    /**
325     * The contents of this CResult_SecretKeyErrorZ, accessible via either
326     * `err` or `result` depending on the state of `result_ok`.
327     */
328    union LDKCResult_SecretKeyErrorZPtr contents;
329    /**
330     * Whether this CResult_SecretKeyErrorZ represents a success state.
331     */
332    bool result_ok;
333 } LDKCResult_SecretKeyErrorZ;
334
335 /**
336  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
337  */
338 typedef struct LDKPublicKey {
339    /**
340     * The bytes of the public key
341     */
342    uint8_t compressed_form[33];
343 } LDKPublicKey;
344
345 /**
346  * The contents of CResult_PublicKeyErrorZ
347  */
348 typedef union LDKCResult_PublicKeyErrorZPtr {
349    /**
350     * A pointer to the contents in the success state.
351     * Reading from this pointer when `result_ok` is not set is undefined.
352     */
353    struct LDKPublicKey *result;
354    /**
355     * A pointer to the contents in the error state.
356     * Reading from this pointer when `result_ok` is set is undefined.
357     */
358    enum LDKSecp256k1Error *err;
359 } LDKCResult_PublicKeyErrorZPtr;
360
361 /**
362  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
363  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
364  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
365  */
366 typedef struct LDKCResult_PublicKeyErrorZ {
367    /**
368     * The contents of this CResult_PublicKeyErrorZ, accessible via either
369     * `err` or `result` depending on the state of `result_ok`.
370     */
371    union LDKCResult_PublicKeyErrorZPtr contents;
372    /**
373     * Whether this CResult_PublicKeyErrorZ represents a success state.
374     */
375    bool result_ok;
376 } LDKCResult_PublicKeyErrorZ;
377
378
379
380 /**
381  * The set of public keys which are used in the creation of one commitment transaction.
382  * These are derived from the channel base keys and per-commitment data.
383  *
384  * A broadcaster key is provided from potential broadcaster of the computed transaction.
385  * A countersignatory key is coming from a protocol participant unable to broadcast the
386  * transaction.
387  *
388  * These keys are assumed to be good, either because the code derived them from
389  * channel basepoints via the new function, or they were obtained via
390  * CommitmentTransaction.trust().keys() because we trusted the source of the
391  * pre-calculated keys.
392  */
393 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
394    /**
395     * A pointer to the opaque Rust object.
396     * Nearly everywhere, inner must be non-null, however in places where
397     * the Rust equivalent takes an Option, it may be set to null to indicate None.
398     */
399    LDKnativeTxCreationKeys *inner;
400    /**
401     * Indicates that this is the only struct which contains the same pointer.
402     * Rust functions which take ownership of an object provided via an argument require
403     * this to be true and invalidate the object pointed to by inner.
404     */
405    bool is_owned;
406 } LDKTxCreationKeys;
407
408
409
410 /**
411  * An error in decoding a message or struct.
412  */
413 typedef struct MUST_USE_STRUCT LDKDecodeError {
414    /**
415     * A pointer to the opaque Rust object.
416     * Nearly everywhere, inner must be non-null, however in places where
417     * the Rust equivalent takes an Option, it may be set to null to indicate None.
418     */
419    LDKnativeDecodeError *inner;
420    /**
421     * Indicates that this is the only struct which contains the same pointer.
422     * Rust functions which take ownership of an object provided via an argument require
423     * this to be true and invalidate the object pointed to by inner.
424     */
425    bool is_owned;
426 } LDKDecodeError;
427
428 /**
429  * The contents of CResult_TxCreationKeysDecodeErrorZ
430  */
431 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
432    /**
433     * A pointer to the contents in the success state.
434     * Reading from this pointer when `result_ok` is not set is undefined.
435     */
436    struct LDKTxCreationKeys *result;
437    /**
438     * A pointer to the contents in the error state.
439     * Reading from this pointer when `result_ok` is set is undefined.
440     */
441    struct LDKDecodeError *err;
442 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
443
444 /**
445  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
446  * containing a crate::ln::chan_utils::TxCreationKeys on success and a crate::ln::msgs::DecodeError on failure.
447  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
448  */
449 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
450    /**
451     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
452     * `err` or `result` depending on the state of `result_ok`.
453     */
454    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
455    /**
456     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
457     */
458    bool result_ok;
459 } LDKCResult_TxCreationKeysDecodeErrorZ;
460
461
462
463 /**
464  * One counterparty's public keys which do not change over the life of a channel.
465  */
466 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
467    /**
468     * A pointer to the opaque Rust object.
469     * Nearly everywhere, inner must be non-null, however in places where
470     * the Rust equivalent takes an Option, it may be set to null to indicate None.
471     */
472    LDKnativeChannelPublicKeys *inner;
473    /**
474     * Indicates that this is the only struct which contains the same pointer.
475     * Rust functions which take ownership of an object provided via an argument require
476     * this to be true and invalidate the object pointed to by inner.
477     */
478    bool is_owned;
479 } LDKChannelPublicKeys;
480
481 /**
482  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
483  */
484 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
485    /**
486     * A pointer to the contents in the success state.
487     * Reading from this pointer when `result_ok` is not set is undefined.
488     */
489    struct LDKChannelPublicKeys *result;
490    /**
491     * A pointer to the contents in the error state.
492     * Reading from this pointer when `result_ok` is set is undefined.
493     */
494    struct LDKDecodeError *err;
495 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
496
497 /**
498  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
499  * containing a crate::ln::chan_utils::ChannelPublicKeys on success and a crate::ln::msgs::DecodeError on failure.
500  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
501  */
502 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
503    /**
504     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
505     * `err` or `result` depending on the state of `result_ok`.
506     */
507    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
508    /**
509     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
510     */
511    bool result_ok;
512 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
513
514 /**
515  * The contents of CResult_TxCreationKeysErrorZ
516  */
517 typedef union LDKCResult_TxCreationKeysErrorZPtr {
518    /**
519     * A pointer to the contents in the success state.
520     * Reading from this pointer when `result_ok` is not set is undefined.
521     */
522    struct LDKTxCreationKeys *result;
523    /**
524     * A pointer to the contents in the error state.
525     * Reading from this pointer when `result_ok` is set is undefined.
526     */
527    enum LDKSecp256k1Error *err;
528 } LDKCResult_TxCreationKeysErrorZPtr;
529
530 /**
531  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
532  * containing a crate::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
533  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
534  */
535 typedef struct LDKCResult_TxCreationKeysErrorZ {
536    /**
537     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
538     * `err` or `result` depending on the state of `result_ok`.
539     */
540    union LDKCResult_TxCreationKeysErrorZPtr contents;
541    /**
542     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
543     */
544    bool result_ok;
545 } LDKCResult_TxCreationKeysErrorZ;
546
547 /**
548  * An enum which can either contain a u32 or not
549  */
550 typedef enum LDKCOption_u32Z_Tag {
551    /**
552     * When we're in this state, this COption_u32Z contains a u32
553     */
554    LDKCOption_u32Z_Some,
555    /**
556     * When we're in this state, this COption_u32Z contains nothing
557     */
558    LDKCOption_u32Z_None,
559    /**
560     * Must be last for serialization purposes
561     */
562    LDKCOption_u32Z_Sentinel,
563 } LDKCOption_u32Z_Tag;
564
565 typedef struct LDKCOption_u32Z {
566    LDKCOption_u32Z_Tag tag;
567    union {
568       struct {
569          uint32_t some;
570       };
571    };
572 } LDKCOption_u32Z;
573
574
575
576 /**
577  * Information about an HTLC as it appears in a commitment transaction
578  */
579 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
580    /**
581     * A pointer to the opaque Rust object.
582     * Nearly everywhere, inner must be non-null, however in places where
583     * the Rust equivalent takes an Option, it may be set to null to indicate None.
584     */
585    LDKnativeHTLCOutputInCommitment *inner;
586    /**
587     * Indicates that this is the only struct which contains the same pointer.
588     * Rust functions which take ownership of an object provided via an argument require
589     * this to be true and invalidate the object pointed to by inner.
590     */
591    bool is_owned;
592 } LDKHTLCOutputInCommitment;
593
594 /**
595  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
596  */
597 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
598    /**
599     * A pointer to the contents in the success state.
600     * Reading from this pointer when `result_ok` is not set is undefined.
601     */
602    struct LDKHTLCOutputInCommitment *result;
603    /**
604     * A pointer to the contents in the error state.
605     * Reading from this pointer when `result_ok` is set is undefined.
606     */
607    struct LDKDecodeError *err;
608 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
609
610 /**
611  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
612  * containing a crate::ln::chan_utils::HTLCOutputInCommitment on success and a crate::ln::msgs::DecodeError on failure.
613  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
614  */
615 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
616    /**
617     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
618     * `err` or `result` depending on the state of `result_ok`.
619     */
620    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
621    /**
622     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
623     */
624    bool result_ok;
625 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
626
627
628
629 /**
630  * Late-bound per-channel counterparty data used to build transactions.
631  */
632 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
633    /**
634     * A pointer to the opaque Rust object.
635     * Nearly everywhere, inner must be non-null, however in places where
636     * the Rust equivalent takes an Option, it may be set to null to indicate None.
637     */
638    LDKnativeCounterpartyChannelTransactionParameters *inner;
639    /**
640     * Indicates that this is the only struct which contains the same pointer.
641     * Rust functions which take ownership of an object provided via an argument require
642     * this to be true and invalidate the object pointed to by inner.
643     */
644    bool is_owned;
645 } LDKCounterpartyChannelTransactionParameters;
646
647 /**
648  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
649  */
650 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
651    /**
652     * A pointer to the contents in the success state.
653     * Reading from this pointer when `result_ok` is not set is undefined.
654     */
655    struct LDKCounterpartyChannelTransactionParameters *result;
656    /**
657     * A pointer to the contents in the error state.
658     * Reading from this pointer when `result_ok` is set is undefined.
659     */
660    struct LDKDecodeError *err;
661 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
662
663 /**
664  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
665  * containing a crate::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::ln::msgs::DecodeError on failure.
666  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
667  */
668 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
669    /**
670     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
671     * `err` or `result` depending on the state of `result_ok`.
672     */
673    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
674    /**
675     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
676     */
677    bool result_ok;
678 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
679
680
681
682 /**
683  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
684  * The fields are organized by holder/counterparty.
685  *
686  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
687  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
688  */
689 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
690    /**
691     * A pointer to the opaque Rust object.
692     * Nearly everywhere, inner must be non-null, however in places where
693     * the Rust equivalent takes an Option, it may be set to null to indicate None.
694     */
695    LDKnativeChannelTransactionParameters *inner;
696    /**
697     * Indicates that this is the only struct which contains the same pointer.
698     * Rust functions which take ownership of an object provided via an argument require
699     * this to be true and invalidate the object pointed to by inner.
700     */
701    bool is_owned;
702 } LDKChannelTransactionParameters;
703
704 /**
705  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
706  */
707 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
708    /**
709     * A pointer to the contents in the success state.
710     * Reading from this pointer when `result_ok` is not set is undefined.
711     */
712    struct LDKChannelTransactionParameters *result;
713    /**
714     * A pointer to the contents in the error state.
715     * Reading from this pointer when `result_ok` is set is undefined.
716     */
717    struct LDKDecodeError *err;
718 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
719
720 /**
721  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
722  * containing a crate::ln::chan_utils::ChannelTransactionParameters on success and a crate::ln::msgs::DecodeError on failure.
723  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
724  */
725 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
726    /**
727     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
728     * `err` or `result` depending on the state of `result_ok`.
729     */
730    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
731    /**
732     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
733     */
734    bool result_ok;
735 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
736
737 /**
738  * Represents a secp256k1 signature serialized as two 32-byte numbers
739  */
740 typedef struct LDKSignature {
741    /**
742     * The bytes of the signature in "compact" form
743     */
744    uint8_t compact_form[64];
745 } LDKSignature;
746
747 /**
748  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
749  * This corresponds to std::vector in C++
750  */
751 typedef struct LDKCVec_SignatureZ {
752    /**
753     * The elements in the array.
754     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
755     */
756    struct LDKSignature *data;
757    /**
758     * The number of elements pointed to by `data`.
759     */
760    uintptr_t datalen;
761 } LDKCVec_SignatureZ;
762
763
764
765 /**
766  * Information needed to build and sign a holder's commitment transaction.
767  *
768  * The transaction is only signed once we are ready to broadcast.
769  */
770 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
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    LDKnativeHolderCommitmentTransaction *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 } LDKHolderCommitmentTransaction;
784
785 /**
786  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
787  */
788 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
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 LDKHolderCommitmentTransaction *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_HolderCommitmentTransactionDecodeErrorZPtr;
800
801 /**
802  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
803  * containing a crate::ln::chan_utils::HolderCommitmentTransaction on success and a crate::ln::msgs::DecodeError on failure.
804  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
805  */
806 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
807    /**
808     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
809     * `err` or `result` depending on the state of `result_ok`.
810     */
811    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
812    /**
813     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
814     */
815    bool result_ok;
816 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
817
818
819
820 /**
821  * A pre-built Bitcoin commitment transaction and its txid.
822  */
823 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
824    /**
825     * A pointer to the opaque Rust object.
826     * Nearly everywhere, inner must be non-null, however in places where
827     * the Rust equivalent takes an Option, it may be set to null to indicate None.
828     */
829    LDKnativeBuiltCommitmentTransaction *inner;
830    /**
831     * Indicates that this is the only struct which contains the same pointer.
832     * Rust functions which take ownership of an object provided via an argument require
833     * this to be true and invalidate the object pointed to by inner.
834     */
835    bool is_owned;
836 } LDKBuiltCommitmentTransaction;
837
838 /**
839  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
840  */
841 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
842    /**
843     * A pointer to the contents in the success state.
844     * Reading from this pointer when `result_ok` is not set is undefined.
845     */
846    struct LDKBuiltCommitmentTransaction *result;
847    /**
848     * A pointer to the contents in the error state.
849     * Reading from this pointer when `result_ok` is set is undefined.
850     */
851    struct LDKDecodeError *err;
852 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
853
854 /**
855  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
856  * containing a crate::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::ln::msgs::DecodeError on failure.
857  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
858  */
859 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
860    /**
861     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
862     * `err` or `result` depending on the state of `result_ok`.
863     */
864    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
865    /**
866     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
867     */
868    bool result_ok;
869 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
870
871
872
873 /**
874  * This class tracks the per-transaction information needed to build a commitment transaction and to
875  * actually build it and sign.  It is used for holder transactions that we sign only when needed
876  * and for transactions we sign for the counterparty.
877  *
878  * This class can be used inside a signer implementation to generate a signature given the relevant
879  * secret key.
880  */
881 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
882    /**
883     * A pointer to the opaque Rust object.
884     * Nearly everywhere, inner must be non-null, however in places where
885     * the Rust equivalent takes an Option, it may be set to null to indicate None.
886     */
887    LDKnativeCommitmentTransaction *inner;
888    /**
889     * Indicates that this is the only struct which contains the same pointer.
890     * Rust functions which take ownership of an object provided via an argument require
891     * this to be true and invalidate the object pointed to by inner.
892     */
893    bool is_owned;
894 } LDKCommitmentTransaction;
895
896 /**
897  * The contents of CResult_CommitmentTransactionDecodeErrorZ
898  */
899 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
900    /**
901     * A pointer to the contents in the success state.
902     * Reading from this pointer when `result_ok` is not set is undefined.
903     */
904    struct LDKCommitmentTransaction *result;
905    /**
906     * A pointer to the contents in the error state.
907     * Reading from this pointer when `result_ok` is set is undefined.
908     */
909    struct LDKDecodeError *err;
910 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
911
912 /**
913  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
914  * containing a crate::ln::chan_utils::CommitmentTransaction on success and a crate::ln::msgs::DecodeError on failure.
915  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
916  */
917 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
918    /**
919     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
920     * `err` or `result` depending on the state of `result_ok`.
921     */
922    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
923    /**
924     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
925     */
926    bool result_ok;
927 } LDKCResult_CommitmentTransactionDecodeErrorZ;
928
929
930
931 /**
932  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
933  * transaction and the transaction creation keys) are trusted.
934  *
935  * See trust() and verify() functions on CommitmentTransaction.
936  *
937  * This structure implements Deref.
938  */
939 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
940    /**
941     * A pointer to the opaque Rust object.
942     * Nearly everywhere, inner must be non-null, however in places where
943     * the Rust equivalent takes an Option, it may be set to null to indicate None.
944     */
945    LDKnativeTrustedCommitmentTransaction *inner;
946    /**
947     * Indicates that this is the only struct which contains the same pointer.
948     * Rust functions which take ownership of an object provided via an argument require
949     * this to be true and invalidate the object pointed to by inner.
950     */
951    bool is_owned;
952 } LDKTrustedCommitmentTransaction;
953
954 /**
955  * The contents of CResult_TrustedCommitmentTransactionNoneZ
956  */
957 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
958    /**
959     * A pointer to the contents in the success state.
960     * Reading from this pointer when `result_ok` is not set is undefined.
961     */
962    struct LDKTrustedCommitmentTransaction *result;
963    /**
964     * Note that this value is always NULL, as there are no contents in the Err variant
965     */
966    void *err;
967 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
968
969 /**
970  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
971  * containing a crate::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
972  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
973  */
974 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
975    /**
976     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
977     * `err` or `result` depending on the state of `result_ok`.
978     */
979    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
980    /**
981     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
982     */
983    bool result_ok;
984 } LDKCResult_TrustedCommitmentTransactionNoneZ;
985
986 /**
987  * The contents of CResult_CVec_SignatureZNoneZ
988  */
989 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
990    /**
991     * A pointer to the contents in the success state.
992     * Reading from this pointer when `result_ok` is not set is undefined.
993     */
994    struct LDKCVec_SignatureZ *result;
995    /**
996     * Note that this value is always NULL, as there are no contents in the Err variant
997     */
998    void *err;
999 } LDKCResult_CVec_SignatureZNoneZPtr;
1000
1001 /**
1002  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1003  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1004  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1005  */
1006 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1007    /**
1008     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1009     * `err` or `result` depending on the state of `result_ok`.
1010     */
1011    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1012    /**
1013     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1014     */
1015    bool result_ok;
1016 } LDKCResult_CVec_SignatureZNoneZ;
1017
1018
1019
1020 /**
1021  * An accept_channel message to be sent or received from a peer
1022  */
1023 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
1024    /**
1025     * A pointer to the opaque Rust object.
1026     * Nearly everywhere, inner must be non-null, however in places where
1027     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1028     */
1029    LDKnativeAcceptChannel *inner;
1030    /**
1031     * Indicates that this is the only struct which contains the same pointer.
1032     * Rust functions which take ownership of an object provided via an argument require
1033     * this to be true and invalidate the object pointed to by inner.
1034     */
1035    bool is_owned;
1036 } LDKAcceptChannel;
1037
1038
1039
1040 /**
1041  * An open_channel message to be sent or received from a peer
1042  */
1043 typedef struct MUST_USE_STRUCT LDKOpenChannel {
1044    /**
1045     * A pointer to the opaque Rust object.
1046     * Nearly everywhere, inner must be non-null, however in places where
1047     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1048     */
1049    LDKnativeOpenChannel *inner;
1050    /**
1051     * Indicates that this is the only struct which contains the same pointer.
1052     * Rust functions which take ownership of an object provided via an argument require
1053     * this to be true and invalidate the object pointed to by inner.
1054     */
1055    bool is_owned;
1056 } LDKOpenChannel;
1057
1058
1059
1060 /**
1061  * A funding_created message to be sent or received from a peer
1062  */
1063 typedef struct MUST_USE_STRUCT LDKFundingCreated {
1064    /**
1065     * A pointer to the opaque Rust object.
1066     * Nearly everywhere, inner must be non-null, however in places where
1067     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1068     */
1069    LDKnativeFundingCreated *inner;
1070    /**
1071     * Indicates that this is the only struct which contains the same pointer.
1072     * Rust functions which take ownership of an object provided via an argument require
1073     * this to be true and invalidate the object pointed to by inner.
1074     */
1075    bool is_owned;
1076 } LDKFundingCreated;
1077
1078
1079
1080 /**
1081  * A funding_signed message to be sent or received from a peer
1082  */
1083 typedef struct MUST_USE_STRUCT LDKFundingSigned {
1084    /**
1085     * A pointer to the opaque Rust object.
1086     * Nearly everywhere, inner must be non-null, however in places where
1087     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1088     */
1089    LDKnativeFundingSigned *inner;
1090    /**
1091     * Indicates that this is the only struct which contains the same pointer.
1092     * Rust functions which take ownership of an object provided via an argument require
1093     * this to be true and invalidate the object pointed to by inner.
1094     */
1095    bool is_owned;
1096 } LDKFundingSigned;
1097
1098
1099
1100 /**
1101  * A funding_locked message to be sent or received from a peer
1102  */
1103 typedef struct MUST_USE_STRUCT LDKFundingLocked {
1104    /**
1105     * A pointer to the opaque Rust object.
1106     * Nearly everywhere, inner must be non-null, however in places where
1107     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1108     */
1109    LDKnativeFundingLocked *inner;
1110    /**
1111     * Indicates that this is the only struct which contains the same pointer.
1112     * Rust functions which take ownership of an object provided via an argument require
1113     * this to be true and invalidate the object pointed to by inner.
1114     */
1115    bool is_owned;
1116 } LDKFundingLocked;
1117
1118
1119
1120 /**
1121  * An announcement_signatures message to be sent or received from a peer
1122  */
1123 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
1124    /**
1125     * A pointer to the opaque Rust object.
1126     * Nearly everywhere, inner must be non-null, however in places where
1127     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1128     */
1129    LDKnativeAnnouncementSignatures *inner;
1130    /**
1131     * Indicates that this is the only struct which contains the same pointer.
1132     * Rust functions which take ownership of an object provided via an argument require
1133     * this to be true and invalidate the object pointed to by inner.
1134     */
1135    bool is_owned;
1136 } LDKAnnouncementSignatures;
1137
1138
1139
1140 /**
1141  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
1142  * transaction updates if they were pending.
1143  */
1144 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
1145    /**
1146     * A pointer to the opaque Rust object.
1147     * Nearly everywhere, inner must be non-null, however in places where
1148     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1149     */
1150    LDKnativeCommitmentUpdate *inner;
1151    /**
1152     * Indicates that this is the only struct which contains the same pointer.
1153     * Rust functions which take ownership of an object provided via an argument require
1154     * this to be true and invalidate the object pointed to by inner.
1155     */
1156    bool is_owned;
1157 } LDKCommitmentUpdate;
1158
1159
1160
1161 /**
1162  * A revoke_and_ack message to be sent or received from a peer
1163  */
1164 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
1165    /**
1166     * A pointer to the opaque Rust object.
1167     * Nearly everywhere, inner must be non-null, however in places where
1168     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1169     */
1170    LDKnativeRevokeAndACK *inner;
1171    /**
1172     * Indicates that this is the only struct which contains the same pointer.
1173     * Rust functions which take ownership of an object provided via an argument require
1174     * this to be true and invalidate the object pointed to by inner.
1175     */
1176    bool is_owned;
1177 } LDKRevokeAndACK;
1178
1179
1180
1181 /**
1182  * A closing_signed message to be sent or received from a peer
1183  */
1184 typedef struct MUST_USE_STRUCT LDKClosingSigned {
1185    /**
1186     * A pointer to the opaque Rust object.
1187     * Nearly everywhere, inner must be non-null, however in places where
1188     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1189     */
1190    LDKnativeClosingSigned *inner;
1191    /**
1192     * Indicates that this is the only struct which contains the same pointer.
1193     * Rust functions which take ownership of an object provided via an argument require
1194     * this to be true and invalidate the object pointed to by inner.
1195     */
1196    bool is_owned;
1197 } LDKClosingSigned;
1198
1199
1200
1201 /**
1202  * A shutdown message to be sent or received from a peer
1203  */
1204 typedef struct MUST_USE_STRUCT LDKShutdown {
1205    /**
1206     * A pointer to the opaque Rust object.
1207     * Nearly everywhere, inner must be non-null, however in places where
1208     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1209     */
1210    LDKnativeShutdown *inner;
1211    /**
1212     * Indicates that this is the only struct which contains the same pointer.
1213     * Rust functions which take ownership of an object provided via an argument require
1214     * this to be true and invalidate the object pointed to by inner.
1215     */
1216    bool is_owned;
1217 } LDKShutdown;
1218
1219
1220
1221 /**
1222  * A channel_reestablish message to be sent or received from a peer
1223  */
1224 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
1225    /**
1226     * A pointer to the opaque Rust object.
1227     * Nearly everywhere, inner must be non-null, however in places where
1228     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1229     */
1230    LDKnativeChannelReestablish *inner;
1231    /**
1232     * Indicates that this is the only struct which contains the same pointer.
1233     * Rust functions which take ownership of an object provided via an argument require
1234     * this to be true and invalidate the object pointed to by inner.
1235     */
1236    bool is_owned;
1237 } LDKChannelReestablish;
1238
1239
1240
1241 /**
1242  * A channel_announcement message to be sent or received from a peer
1243  */
1244 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
1245    /**
1246     * A pointer to the opaque Rust object.
1247     * Nearly everywhere, inner must be non-null, however in places where
1248     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1249     */
1250    LDKnativeChannelAnnouncement *inner;
1251    /**
1252     * Indicates that this is the only struct which contains the same pointer.
1253     * Rust functions which take ownership of an object provided via an argument require
1254     * this to be true and invalidate the object pointed to by inner.
1255     */
1256    bool is_owned;
1257 } LDKChannelAnnouncement;
1258
1259
1260
1261 /**
1262  * A channel_update message to be sent or received from a peer
1263  */
1264 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
1265    /**
1266     * A pointer to the opaque Rust object.
1267     * Nearly everywhere, inner must be non-null, however in places where
1268     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1269     */
1270    LDKnativeChannelUpdate *inner;
1271    /**
1272     * Indicates that this is the only struct which contains the same pointer.
1273     * Rust functions which take ownership of an object provided via an argument require
1274     * this to be true and invalidate the object pointed to by inner.
1275     */
1276    bool is_owned;
1277 } LDKChannelUpdate;
1278
1279
1280
1281 /**
1282  * A node_announcement message to be sent or received from a peer
1283  */
1284 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
1285    /**
1286     * A pointer to the opaque Rust object.
1287     * Nearly everywhere, inner must be non-null, however in places where
1288     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1289     */
1290    LDKnativeNodeAnnouncement *inner;
1291    /**
1292     * Indicates that this is the only struct which contains the same pointer.
1293     * Rust functions which take ownership of an object provided via an argument require
1294     * this to be true and invalidate the object pointed to by inner.
1295     */
1296    bool is_owned;
1297 } LDKNodeAnnouncement;
1298
1299
1300
1301 /**
1302  * An error message to be sent or received from a peer
1303  */
1304 typedef struct MUST_USE_STRUCT LDKErrorMessage {
1305    /**
1306     * A pointer to the opaque Rust object.
1307     * Nearly everywhere, inner must be non-null, however in places where
1308     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1309     */
1310    LDKnativeErrorMessage *inner;
1311    /**
1312     * Indicates that this is the only struct which contains the same pointer.
1313     * Rust functions which take ownership of an object provided via an argument require
1314     * this to be true and invalidate the object pointed to by inner.
1315     */
1316    bool is_owned;
1317 } LDKErrorMessage;
1318
1319 /**
1320  * Used to put an error message in a LightningError
1321  */
1322 typedef enum LDKErrorAction_Tag {
1323    /**
1324     * The peer took some action which made us think they were useless. Disconnect them.
1325     */
1326    LDKErrorAction_DisconnectPeer,
1327    /**
1328     * The peer did something harmless that we weren't able to process, just log and ignore
1329     */
1330    LDKErrorAction_IgnoreError,
1331    /**
1332     * The peer did something incorrect. Tell them.
1333     */
1334    LDKErrorAction_SendErrorMessage,
1335    /**
1336     * Must be last for serialization purposes
1337     */
1338    LDKErrorAction_Sentinel,
1339 } LDKErrorAction_Tag;
1340
1341 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
1342    /**
1343     * An error message which we should make an effort to send before we disconnect.
1344     */
1345    struct LDKErrorMessage msg;
1346 } LDKErrorAction_LDKDisconnectPeer_Body;
1347
1348 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
1349    /**
1350     * The message to send.
1351     */
1352    struct LDKErrorMessage msg;
1353 } LDKErrorAction_LDKSendErrorMessage_Body;
1354
1355 typedef struct MUST_USE_STRUCT LDKErrorAction {
1356    LDKErrorAction_Tag tag;
1357    union {
1358       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
1359       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
1360    };
1361 } LDKErrorAction;
1362
1363 /**
1364  * The information we received from a peer along the route of a payment we originated. This is
1365  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
1366  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
1367  */
1368 typedef enum LDKHTLCFailChannelUpdate_Tag {
1369    /**
1370     * We received an error which included a full ChannelUpdate message.
1371     */
1372    LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
1373    /**
1374     * We received an error which indicated only that a channel has been closed
1375     */
1376    LDKHTLCFailChannelUpdate_ChannelClosed,
1377    /**
1378     * We received an error which indicated only that a node has failed
1379     */
1380    LDKHTLCFailChannelUpdate_NodeFailure,
1381    /**
1382     * Must be last for serialization purposes
1383     */
1384    LDKHTLCFailChannelUpdate_Sentinel,
1385 } LDKHTLCFailChannelUpdate_Tag;
1386
1387 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
1388    /**
1389     * The unwrapped message we received
1390     */
1391    struct LDKChannelUpdate msg;
1392 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
1393
1394 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
1395    /**
1396     * The short_channel_id which has now closed.
1397     */
1398    uint64_t short_channel_id;
1399    /**
1400     * when this true, this channel should be permanently removed from the
1401     * consideration. Otherwise, this channel can be restored as new channel_update is received
1402     */
1403    bool is_permanent;
1404 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
1405
1406 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
1407    /**
1408     * The node_id that has failed.
1409     */
1410    struct LDKPublicKey node_id;
1411    /**
1412     * when this true, node should be permanently removed from the
1413     * consideration. Otherwise, the channels connected to this node can be
1414     * restored as new channel_update is received
1415     */
1416    bool is_permanent;
1417 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
1418
1419 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
1420    LDKHTLCFailChannelUpdate_Tag tag;
1421    union {
1422       LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
1423       LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
1424       LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
1425    };
1426 } LDKHTLCFailChannelUpdate;
1427
1428
1429
1430 /**
1431  * A query_channel_range message is used to query a peer for channel
1432  * UTXOs in a range of blocks. The recipient of a query makes a best
1433  * effort to reply to the query using one or more reply_channel_range
1434  * messages.
1435  */
1436 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
1437    /**
1438     * A pointer to the opaque Rust object.
1439     * Nearly everywhere, inner must be non-null, however in places where
1440     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1441     */
1442    LDKnativeQueryChannelRange *inner;
1443    /**
1444     * Indicates that this is the only struct which contains the same pointer.
1445     * Rust functions which take ownership of an object provided via an argument require
1446     * this to be true and invalidate the object pointed to by inner.
1447     */
1448    bool is_owned;
1449 } LDKQueryChannelRange;
1450
1451
1452
1453 /**
1454  * A query_short_channel_ids message is used to query a peer for
1455  * routing gossip messages related to one or more short_channel_ids.
1456  * The query recipient will reply with the latest, if available,
1457  * channel_announcement, channel_update and node_announcement messages
1458  * it maintains for the requested short_channel_ids followed by a
1459  * reply_short_channel_ids_end message. The short_channel_ids sent in
1460  * this query are encoded. We only support encoding_type=0 uncompressed
1461  * serialization and do not support encoding_type=1 zlib serialization.
1462  */
1463 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
1464    /**
1465     * A pointer to the opaque Rust object.
1466     * Nearly everywhere, inner must be non-null, however in places where
1467     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1468     */
1469    LDKnativeQueryShortChannelIds *inner;
1470    /**
1471     * Indicates that this is the only struct which contains the same pointer.
1472     * Rust functions which take ownership of an object provided via an argument require
1473     * this to be true and invalidate the object pointed to by inner.
1474     */
1475    bool is_owned;
1476 } LDKQueryShortChannelIds;
1477
1478
1479
1480 /**
1481  * A reply_channel_range message is a reply to a query_channel_range
1482  * message. Multiple reply_channel_range messages can be sent in reply
1483  * to a single query_channel_range message. The query recipient makes a
1484  * best effort to respond based on their local network view which may
1485  * not be a perfect view of the network. The short_channel_ids in the
1486  * reply are encoded. We only support encoding_type=0 uncompressed
1487  * serialization and do not support encoding_type=1 zlib serialization.
1488  */
1489 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
1490    /**
1491     * A pointer to the opaque Rust object.
1492     * Nearly everywhere, inner must be non-null, however in places where
1493     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1494     */
1495    LDKnativeReplyChannelRange *inner;
1496    /**
1497     * Indicates that this is the only struct which contains the same pointer.
1498     * Rust functions which take ownership of an object provided via an argument require
1499     * this to be true and invalidate the object pointed to by inner.
1500     */
1501    bool is_owned;
1502 } LDKReplyChannelRange;
1503
1504 /**
1505  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
1506  * broadcast to most peers).
1507  * These events are handled by PeerManager::process_events if you are using a PeerManager.
1508  */
1509 typedef enum LDKMessageSendEvent_Tag {
1510    /**
1511     * Used to indicate that we've accepted a channel open and should send the accept_channel
1512     * message provided to the given peer.
1513     */
1514    LDKMessageSendEvent_SendAcceptChannel,
1515    /**
1516     * Used to indicate that we've initiated a channel open and should send the open_channel
1517     * message provided to the given peer.
1518     */
1519    LDKMessageSendEvent_SendOpenChannel,
1520    /**
1521     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
1522     */
1523    LDKMessageSendEvent_SendFundingCreated,
1524    /**
1525     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
1526     */
1527    LDKMessageSendEvent_SendFundingSigned,
1528    /**
1529     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
1530     */
1531    LDKMessageSendEvent_SendFundingLocked,
1532    /**
1533     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
1534     */
1535    LDKMessageSendEvent_SendAnnouncementSignatures,
1536    /**
1537     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
1538     * message should be sent to the peer with the given node_id.
1539     */
1540    LDKMessageSendEvent_UpdateHTLCs,
1541    /**
1542     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
1543     */
1544    LDKMessageSendEvent_SendRevokeAndACK,
1545    /**
1546     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
1547     */
1548    LDKMessageSendEvent_SendClosingSigned,
1549    /**
1550     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
1551     */
1552    LDKMessageSendEvent_SendShutdown,
1553    /**
1554     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
1555     */
1556    LDKMessageSendEvent_SendChannelReestablish,
1557    /**
1558     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
1559     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
1560     *
1561     * Note that after doing so, you very likely (unless you did so very recently) want to call
1562     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
1563     * This ensures that any nodes which see our channel_announcement also have a relevant
1564     * node_announcement, including relevant feature flags which may be important for routing
1565     * through or to us.
1566     */
1567    LDKMessageSendEvent_BroadcastChannelAnnouncement,
1568    /**
1569     * Used to indicate that a node_announcement should be broadcast to all peers.
1570     */
1571    LDKMessageSendEvent_BroadcastNodeAnnouncement,
1572    /**
1573     * Used to indicate that a channel_update should be broadcast to all peers.
1574     */
1575    LDKMessageSendEvent_BroadcastChannelUpdate,
1576    /**
1577     * Broadcast an error downstream to be handled
1578     */
1579    LDKMessageSendEvent_HandleError,
1580    /**
1581     * When a payment fails we may receive updates back from the hop where it failed. In such
1582     * cases this event is generated so that we can inform the network graph of this information.
1583     */
1584    LDKMessageSendEvent_PaymentFailureNetworkUpdate,
1585    /**
1586     * Query a peer for channels with funding transaction UTXOs in a block range.
1587     */
1588    LDKMessageSendEvent_SendChannelRangeQuery,
1589    /**
1590     * Request routing gossip messages from a peer for a list of channels identified by
1591     * their short_channel_ids.
1592     */
1593    LDKMessageSendEvent_SendShortIdsQuery,
1594    /**
1595     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
1596     * emitted during processing of the query.
1597     */
1598    LDKMessageSendEvent_SendReplyChannelRange,
1599    /**
1600     * Must be last for serialization purposes
1601     */
1602    LDKMessageSendEvent_Sentinel,
1603 } LDKMessageSendEvent_Tag;
1604
1605 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
1606    /**
1607     * The node_id of the node which should receive this message
1608     */
1609    struct LDKPublicKey node_id;
1610    /**
1611     * The message which should be sent.
1612     */
1613    struct LDKAcceptChannel msg;
1614 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
1615
1616 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
1617    /**
1618     * The node_id of the node which should receive this message
1619     */
1620    struct LDKPublicKey node_id;
1621    /**
1622     * The message which should be sent.
1623     */
1624    struct LDKOpenChannel msg;
1625 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
1626
1627 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
1628    /**
1629     * The node_id of the node which should receive this message
1630     */
1631    struct LDKPublicKey node_id;
1632    /**
1633     * The message which should be sent.
1634     */
1635    struct LDKFundingCreated msg;
1636 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
1637
1638 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
1639    /**
1640     * The node_id of the node which should receive this message
1641     */
1642    struct LDKPublicKey node_id;
1643    /**
1644     * The message which should be sent.
1645     */
1646    struct LDKFundingSigned msg;
1647 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
1648
1649 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
1650    /**
1651     * The node_id of the node which should receive these message(s)
1652     */
1653    struct LDKPublicKey node_id;
1654    /**
1655     * The funding_locked message which should be sent.
1656     */
1657    struct LDKFundingLocked msg;
1658 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
1659
1660 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
1661    /**
1662     * The node_id of the node which should receive these message(s)
1663     */
1664    struct LDKPublicKey node_id;
1665    /**
1666     * The announcement_signatures message which should be sent.
1667     */
1668    struct LDKAnnouncementSignatures msg;
1669 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
1670
1671 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
1672    /**
1673     * The node_id of the node which should receive these message(s)
1674     */
1675    struct LDKPublicKey node_id;
1676    /**
1677     * The update messages which should be sent. ALL messages in the struct should be sent!
1678     */
1679    struct LDKCommitmentUpdate updates;
1680 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
1681
1682 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
1683    /**
1684     * The node_id of the node which should receive this message
1685     */
1686    struct LDKPublicKey node_id;
1687    /**
1688     * The message which should be sent.
1689     */
1690    struct LDKRevokeAndACK msg;
1691 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
1692
1693 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
1694    /**
1695     * The node_id of the node which should receive this message
1696     */
1697    struct LDKPublicKey node_id;
1698    /**
1699     * The message which should be sent.
1700     */
1701    struct LDKClosingSigned msg;
1702 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
1703
1704 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
1705    /**
1706     * The node_id of the node which should receive this message
1707     */
1708    struct LDKPublicKey node_id;
1709    /**
1710     * The message which should be sent.
1711     */
1712    struct LDKShutdown msg;
1713 } LDKMessageSendEvent_LDKSendShutdown_Body;
1714
1715 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
1716    /**
1717     * The node_id of the node which should receive this message
1718     */
1719    struct LDKPublicKey node_id;
1720    /**
1721     * The message which should be sent.
1722     */
1723    struct LDKChannelReestablish msg;
1724 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
1725
1726 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
1727    /**
1728     * The channel_announcement which should be sent.
1729     */
1730    struct LDKChannelAnnouncement msg;
1731    /**
1732     * The followup channel_update which should be sent.
1733     */
1734    struct LDKChannelUpdate update_msg;
1735 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
1736
1737 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
1738    /**
1739     * The node_announcement which should be sent.
1740     */
1741    struct LDKNodeAnnouncement msg;
1742 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
1743
1744 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
1745    /**
1746     * The channel_update which should be sent.
1747     */
1748    struct LDKChannelUpdate msg;
1749 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
1750
1751 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
1752    /**
1753     * The node_id of the node which should receive this message
1754     */
1755    struct LDKPublicKey node_id;
1756    /**
1757     * The action which should be taken.
1758     */
1759    struct LDKErrorAction action;
1760 } LDKMessageSendEvent_LDKHandleError_Body;
1761
1762 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
1763    /**
1764     * The channel/node update which should be sent to NetGraphMsgHandler
1765     */
1766    struct LDKHTLCFailChannelUpdate update;
1767 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
1768
1769 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
1770    /**
1771     * The node_id of this message recipient
1772     */
1773    struct LDKPublicKey node_id;
1774    /**
1775     * The query_channel_range which should be sent.
1776     */
1777    struct LDKQueryChannelRange msg;
1778 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
1779
1780 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
1781    /**
1782     * The node_id of this message recipient
1783     */
1784    struct LDKPublicKey node_id;
1785    /**
1786     * The query_short_channel_ids which should be sent.
1787     */
1788    struct LDKQueryShortChannelIds msg;
1789 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
1790
1791 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
1792    /**
1793     * The node_id of this message recipient
1794     */
1795    struct LDKPublicKey node_id;
1796    /**
1797     * The reply_channel_range which should be sent.
1798     */
1799    struct LDKReplyChannelRange msg;
1800 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
1801
1802 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
1803    LDKMessageSendEvent_Tag tag;
1804    union {
1805       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
1806       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
1807       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
1808       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
1809       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
1810       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
1811       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
1812       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
1813       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
1814       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
1815       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
1816       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
1817       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
1818       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
1819       LDKMessageSendEvent_LDKHandleError_Body handle_error;
1820       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
1821       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
1822       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
1823       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
1824    };
1825 } LDKMessageSendEvent;
1826
1827 /**
1828  * A dynamically-allocated array of crate::util::events::MessageSendEvents of arbitrary size.
1829  * This corresponds to std::vector in C++
1830  */
1831 typedef struct LDKCVec_MessageSendEventZ {
1832    /**
1833     * The elements in the array.
1834     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1835     */
1836    struct LDKMessageSendEvent *data;
1837    /**
1838     * The number of elements pointed to by `data`.
1839     */
1840    uintptr_t datalen;
1841 } LDKCVec_MessageSendEventZ;
1842
1843
1844
1845 /**
1846  * An Err type for failure to process messages.
1847  */
1848 typedef struct MUST_USE_STRUCT LDKLightningError {
1849    /**
1850     * A pointer to the opaque Rust object.
1851     * Nearly everywhere, inner must be non-null, however in places where
1852     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1853     */
1854    LDKnativeLightningError *inner;
1855    /**
1856     * Indicates that this is the only struct which contains the same pointer.
1857     * Rust functions which take ownership of an object provided via an argument require
1858     * this to be true and invalidate the object pointed to by inner.
1859     */
1860    bool is_owned;
1861 } LDKLightningError;
1862
1863 /**
1864  * The contents of CResult_boolLightningErrorZ
1865  */
1866 typedef union LDKCResult_boolLightningErrorZPtr {
1867    /**
1868     * A pointer to the contents in the success state.
1869     * Reading from this pointer when `result_ok` is not set is undefined.
1870     */
1871    bool *result;
1872    /**
1873     * A pointer to the contents in the error state.
1874     * Reading from this pointer when `result_ok` is set is undefined.
1875     */
1876    struct LDKLightningError *err;
1877 } LDKCResult_boolLightningErrorZPtr;
1878
1879 /**
1880  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
1881  * containing a bool on success and a crate::ln::msgs::LightningError on failure.
1882  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1883  */
1884 typedef struct LDKCResult_boolLightningErrorZ {
1885    /**
1886     * The contents of this CResult_boolLightningErrorZ, accessible via either
1887     * `err` or `result` depending on the state of `result_ok`.
1888     */
1889    union LDKCResult_boolLightningErrorZPtr contents;
1890    /**
1891     * Whether this CResult_boolLightningErrorZ represents a success state.
1892     */
1893    bool result_ok;
1894 } LDKCResult_boolLightningErrorZ;
1895
1896 /**
1897  * A tuple of 3 elements. See the individual fields for the types contained.
1898  */
1899 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1900    /**
1901     * The element at position 0
1902     */
1903    struct LDKChannelAnnouncement a;
1904    /**
1905     * The element at position 1
1906     */
1907    struct LDKChannelUpdate b;
1908    /**
1909     * The element at position 2
1910     */
1911    struct LDKChannelUpdate c;
1912 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
1913
1914 /**
1915  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
1916  * This corresponds to std::vector in C++
1917  */
1918 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1919    /**
1920     * The elements in the array.
1921     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1922     */
1923    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
1924    /**
1925     * The number of elements pointed to by `data`.
1926     */
1927    uintptr_t datalen;
1928 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
1929
1930 /**
1931  * A dynamically-allocated array of crate::ln::msgs::NodeAnnouncements of arbitrary size.
1932  * This corresponds to std::vector in C++
1933  */
1934 typedef struct LDKCVec_NodeAnnouncementZ {
1935    /**
1936     * The elements in the array.
1937     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1938     */
1939    struct LDKNodeAnnouncement *data;
1940    /**
1941     * The number of elements pointed to by `data`.
1942     */
1943    uintptr_t datalen;
1944 } LDKCVec_NodeAnnouncementZ;
1945
1946 /**
1947  * The contents of CResult_NoneLightningErrorZ
1948  */
1949 typedef union LDKCResult_NoneLightningErrorZPtr {
1950    /**
1951     * Note that this value is always NULL, as there are no contents in the OK variant
1952     */
1953    void *result;
1954    /**
1955     * A pointer to the contents in the error state.
1956     * Reading from this pointer when `result_ok` is set is undefined.
1957     */
1958    struct LDKLightningError *err;
1959 } LDKCResult_NoneLightningErrorZPtr;
1960
1961 /**
1962  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
1963  * containing a () on success and a crate::ln::msgs::LightningError on failure.
1964  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1965  */
1966 typedef struct LDKCResult_NoneLightningErrorZ {
1967    /**
1968     * The contents of this CResult_NoneLightningErrorZ, accessible via either
1969     * `err` or `result` depending on the state of `result_ok`.
1970     */
1971    union LDKCResult_NoneLightningErrorZPtr contents;
1972    /**
1973     * Whether this CResult_NoneLightningErrorZ represents a success state.
1974     */
1975    bool result_ok;
1976 } LDKCResult_NoneLightningErrorZ;
1977
1978 /**
1979  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
1980  * This corresponds to std::vector in C++
1981  */
1982 typedef struct LDKCVec_PublicKeyZ {
1983    /**
1984     * The elements in the array.
1985     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1986     */
1987    struct LDKPublicKey *data;
1988    /**
1989     * The number of elements pointed to by `data`.
1990     */
1991    uintptr_t datalen;
1992 } LDKCVec_PublicKeyZ;
1993
1994
1995
1996 /**
1997  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
1998  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
1999  * descriptor.
2000  */
2001 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
2002    /**
2003     * A pointer to the opaque Rust object.
2004     * Nearly everywhere, inner must be non-null, however in places where
2005     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2006     */
2007    LDKnativePeerHandleError *inner;
2008    /**
2009     * Indicates that this is the only struct which contains the same pointer.
2010     * Rust functions which take ownership of an object provided via an argument require
2011     * this to be true and invalidate the object pointed to by inner.
2012     */
2013    bool is_owned;
2014 } LDKPeerHandleError;
2015
2016 /**
2017  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
2018  */
2019 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
2020    /**
2021     * A pointer to the contents in the success state.
2022     * Reading from this pointer when `result_ok` is not set is undefined.
2023     */
2024    struct LDKCVec_u8Z *result;
2025    /**
2026     * A pointer to the contents in the error state.
2027     * Reading from this pointer when `result_ok` is set is undefined.
2028     */
2029    struct LDKPeerHandleError *err;
2030 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
2031
2032 /**
2033  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
2034  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::ln::peer_handler::PeerHandleError on failure.
2035  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2036  */
2037 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
2038    /**
2039     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
2040     * `err` or `result` depending on the state of `result_ok`.
2041     */
2042    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
2043    /**
2044     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
2045     */
2046    bool result_ok;
2047 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
2048
2049 /**
2050  * The contents of CResult_NonePeerHandleErrorZ
2051  */
2052 typedef union LDKCResult_NonePeerHandleErrorZPtr {
2053    /**
2054     * Note that this value is always NULL, as there are no contents in the OK variant
2055     */
2056    void *result;
2057    /**
2058     * A pointer to the contents in the error state.
2059     * Reading from this pointer when `result_ok` is set is undefined.
2060     */
2061    struct LDKPeerHandleError *err;
2062 } LDKCResult_NonePeerHandleErrorZPtr;
2063
2064 /**
2065  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
2066  * containing a () on success and a crate::ln::peer_handler::PeerHandleError on failure.
2067  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2068  */
2069 typedef struct LDKCResult_NonePeerHandleErrorZ {
2070    /**
2071     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
2072     * `err` or `result` depending on the state of `result_ok`.
2073     */
2074    union LDKCResult_NonePeerHandleErrorZPtr contents;
2075    /**
2076     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
2077     */
2078    bool result_ok;
2079 } LDKCResult_NonePeerHandleErrorZ;
2080
2081 /**
2082  * The contents of CResult_boolPeerHandleErrorZ
2083  */
2084 typedef union LDKCResult_boolPeerHandleErrorZPtr {
2085    /**
2086     * A pointer to the contents in the success state.
2087     * Reading from this pointer when `result_ok` is not set is undefined.
2088     */
2089    bool *result;
2090    /**
2091     * A pointer to the contents in the error state.
2092     * Reading from this pointer when `result_ok` is set is undefined.
2093     */
2094    struct LDKPeerHandleError *err;
2095 } LDKCResult_boolPeerHandleErrorZPtr;
2096
2097 /**
2098  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
2099  * containing a bool on success and a crate::ln::peer_handler::PeerHandleError on failure.
2100  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2101  */
2102 typedef struct LDKCResult_boolPeerHandleErrorZ {
2103    /**
2104     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
2105     * `err` or `result` depending on the state of `result_ok`.
2106     */
2107    union LDKCResult_boolPeerHandleErrorZPtr contents;
2108    /**
2109     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
2110     */
2111    bool result_ok;
2112 } LDKCResult_boolPeerHandleErrorZ;
2113
2114
2115
2116 /**
2117  * Features used within an `init` message.
2118  */
2119 typedef struct MUST_USE_STRUCT LDKInitFeatures {
2120    /**
2121     * A pointer to the opaque Rust object.
2122     * Nearly everywhere, inner must be non-null, however in places where
2123     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2124     */
2125    LDKnativeInitFeatures *inner;
2126    /**
2127     * Indicates that this is the only struct which contains the same pointer.
2128     * Rust functions which take ownership of an object provided via an argument require
2129     * this to be true and invalidate the object pointed to by inner.
2130     */
2131    bool is_owned;
2132 } LDKInitFeatures;
2133
2134 /**
2135  * The contents of CResult_InitFeaturesDecodeErrorZ
2136  */
2137 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
2138    /**
2139     * A pointer to the contents in the success state.
2140     * Reading from this pointer when `result_ok` is not set is undefined.
2141     */
2142    struct LDKInitFeatures *result;
2143    /**
2144     * A pointer to the contents in the error state.
2145     * Reading from this pointer when `result_ok` is set is undefined.
2146     */
2147    struct LDKDecodeError *err;
2148 } LDKCResult_InitFeaturesDecodeErrorZPtr;
2149
2150 /**
2151  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2152  * containing a crate::ln::features::InitFeatures on success and a crate::ln::msgs::DecodeError on failure.
2153  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2154  */
2155 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
2156    /**
2157     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2158     * `err` or `result` depending on the state of `result_ok`.
2159     */
2160    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
2161    /**
2162     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2163     */
2164    bool result_ok;
2165 } LDKCResult_InitFeaturesDecodeErrorZ;
2166
2167
2168
2169 /**
2170  * Features used within a `node_announcement` message.
2171  */
2172 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
2173    /**
2174     * A pointer to the opaque Rust object.
2175     * Nearly everywhere, inner must be non-null, however in places where
2176     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2177     */
2178    LDKnativeNodeFeatures *inner;
2179    /**
2180     * Indicates that this is the only struct which contains the same pointer.
2181     * Rust functions which take ownership of an object provided via an argument require
2182     * this to be true and invalidate the object pointed to by inner.
2183     */
2184    bool is_owned;
2185 } LDKNodeFeatures;
2186
2187 /**
2188  * The contents of CResult_NodeFeaturesDecodeErrorZ
2189  */
2190 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
2191    /**
2192     * A pointer to the contents in the success state.
2193     * Reading from this pointer when `result_ok` is not set is undefined.
2194     */
2195    struct LDKNodeFeatures *result;
2196    /**
2197     * A pointer to the contents in the error state.
2198     * Reading from this pointer when `result_ok` is set is undefined.
2199     */
2200    struct LDKDecodeError *err;
2201 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
2202
2203 /**
2204  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
2205  * containing a crate::ln::features::NodeFeatures on success and a crate::ln::msgs::DecodeError on failure.
2206  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2207  */
2208 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
2209    /**
2210     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
2211     * `err` or `result` depending on the state of `result_ok`.
2212     */
2213    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
2214    /**
2215     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
2216     */
2217    bool result_ok;
2218 } LDKCResult_NodeFeaturesDecodeErrorZ;
2219
2220
2221
2222 /**
2223  * Features used within a `channel_announcement` message.
2224  */
2225 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
2226    /**
2227     * A pointer to the opaque Rust object.
2228     * Nearly everywhere, inner must be non-null, however in places where
2229     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2230     */
2231    LDKnativeChannelFeatures *inner;
2232    /**
2233     * Indicates that this is the only struct which contains the same pointer.
2234     * Rust functions which take ownership of an object provided via an argument require
2235     * this to be true and invalidate the object pointed to by inner.
2236     */
2237    bool is_owned;
2238 } LDKChannelFeatures;
2239
2240 /**
2241  * The contents of CResult_ChannelFeaturesDecodeErrorZ
2242  */
2243 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
2244    /**
2245     * A pointer to the contents in the success state.
2246     * Reading from this pointer when `result_ok` is not set is undefined.
2247     */
2248    struct LDKChannelFeatures *result;
2249    /**
2250     * A pointer to the contents in the error state.
2251     * Reading from this pointer when `result_ok` is set is undefined.
2252     */
2253    struct LDKDecodeError *err;
2254 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
2255
2256 /**
2257  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
2258  * containing a crate::ln::features::ChannelFeatures on success and a crate::ln::msgs::DecodeError on failure.
2259  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2260  */
2261 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
2262    /**
2263     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
2264     * `err` or `result` depending on the state of `result_ok`.
2265     */
2266    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
2267    /**
2268     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
2269     */
2270    bool result_ok;
2271 } LDKCResult_ChannelFeaturesDecodeErrorZ;
2272
2273
2274
2275 /**
2276  * Features used within an invoice.
2277  */
2278 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
2279    /**
2280     * A pointer to the opaque Rust object.
2281     * Nearly everywhere, inner must be non-null, however in places where
2282     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2283     */
2284    LDKnativeInvoiceFeatures *inner;
2285    /**
2286     * Indicates that this is the only struct which contains the same pointer.
2287     * Rust functions which take ownership of an object provided via an argument require
2288     * this to be true and invalidate the object pointed to by inner.
2289     */
2290    bool is_owned;
2291 } LDKInvoiceFeatures;
2292
2293 /**
2294  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
2295  */
2296 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
2297    /**
2298     * A pointer to the contents in the success state.
2299     * Reading from this pointer when `result_ok` is not set is undefined.
2300     */
2301    struct LDKInvoiceFeatures *result;
2302    /**
2303     * A pointer to the contents in the error state.
2304     * Reading from this pointer when `result_ok` is set is undefined.
2305     */
2306    struct LDKDecodeError *err;
2307 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
2308
2309 /**
2310  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
2311  * containing a crate::ln::features::InvoiceFeatures on success and a crate::ln::msgs::DecodeError on failure.
2312  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2313  */
2314 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
2315    /**
2316     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
2317     * `err` or `result` depending on the state of `result_ok`.
2318     */
2319    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
2320    /**
2321     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
2322     */
2323    bool result_ok;
2324 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
2325
2326
2327
2328 /**
2329  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
2330  * with our counterparty.
2331  */
2332 typedef struct MUST_USE_STRUCT LDKChannelConfig {
2333    /**
2334     * A pointer to the opaque Rust object.
2335     * Nearly everywhere, inner must be non-null, however in places where
2336     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2337     */
2338    LDKnativeChannelConfig *inner;
2339    /**
2340     * Indicates that this is the only struct which contains the same pointer.
2341     * Rust functions which take ownership of an object provided via an argument require
2342     * this to be true and invalidate the object pointed to by inner.
2343     */
2344    bool is_owned;
2345 } LDKChannelConfig;
2346
2347 /**
2348  * The contents of CResult_ChannelConfigDecodeErrorZ
2349  */
2350 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
2351    /**
2352     * A pointer to the contents in the success state.
2353     * Reading from this pointer when `result_ok` is not set is undefined.
2354     */
2355    struct LDKChannelConfig *result;
2356    /**
2357     * A pointer to the contents in the error state.
2358     * Reading from this pointer when `result_ok` is set is undefined.
2359     */
2360    struct LDKDecodeError *err;
2361 } LDKCResult_ChannelConfigDecodeErrorZPtr;
2362
2363 /**
2364  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
2365  * containing a crate::util::config::ChannelConfig on success and a crate::ln::msgs::DecodeError on failure.
2366  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2367  */
2368 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
2369    /**
2370     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
2371     * `err` or `result` depending on the state of `result_ok`.
2372     */
2373    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
2374    /**
2375     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
2376     */
2377    bool result_ok;
2378 } LDKCResult_ChannelConfigDecodeErrorZ;
2379
2380 /**
2381  * An enum which can either contain a u64 or not
2382  */
2383 typedef enum LDKCOption_u64Z_Tag {
2384    /**
2385     * When we're in this state, this COption_u64Z contains a u64
2386     */
2387    LDKCOption_u64Z_Some,
2388    /**
2389     * When we're in this state, this COption_u64Z contains nothing
2390     */
2391    LDKCOption_u64Z_None,
2392    /**
2393     * Must be last for serialization purposes
2394     */
2395    LDKCOption_u64Z_Sentinel,
2396 } LDKCOption_u64Z_Tag;
2397
2398 typedef struct LDKCOption_u64Z {
2399    LDKCOption_u64Z_Tag tag;
2400    union {
2401       struct {
2402          uint64_t some;
2403       };
2404    };
2405 } LDKCOption_u64Z;
2406
2407
2408
2409 /**
2410  * Details about one direction of a channel. Received
2411  * within a channel update.
2412  */
2413 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
2414    /**
2415     * A pointer to the opaque Rust object.
2416     * Nearly everywhere, inner must be non-null, however in places where
2417     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2418     */
2419    LDKnativeDirectionalChannelInfo *inner;
2420    /**
2421     * Indicates that this is the only struct which contains the same pointer.
2422     * Rust functions which take ownership of an object provided via an argument require
2423     * this to be true and invalidate the object pointed to by inner.
2424     */
2425    bool is_owned;
2426 } LDKDirectionalChannelInfo;
2427
2428 /**
2429  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
2430  */
2431 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
2432    /**
2433     * A pointer to the contents in the success state.
2434     * Reading from this pointer when `result_ok` is not set is undefined.
2435     */
2436    struct LDKDirectionalChannelInfo *result;
2437    /**
2438     * A pointer to the contents in the error state.
2439     * Reading from this pointer when `result_ok` is set is undefined.
2440     */
2441    struct LDKDecodeError *err;
2442 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
2443
2444 /**
2445  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
2446  * containing a crate::routing::network_graph::DirectionalChannelInfo on success and a crate::ln::msgs::DecodeError on failure.
2447  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2448  */
2449 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
2450    /**
2451     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
2452     * `err` or `result` depending on the state of `result_ok`.
2453     */
2454    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
2455    /**
2456     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
2457     */
2458    bool result_ok;
2459 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
2460
2461
2462
2463 /**
2464  * Details about a channel (both directions).
2465  * Received within a channel announcement.
2466  */
2467 typedef struct MUST_USE_STRUCT LDKChannelInfo {
2468    /**
2469     * A pointer to the opaque Rust object.
2470     * Nearly everywhere, inner must be non-null, however in places where
2471     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2472     */
2473    LDKnativeChannelInfo *inner;
2474    /**
2475     * Indicates that this is the only struct which contains the same pointer.
2476     * Rust functions which take ownership of an object provided via an argument require
2477     * this to be true and invalidate the object pointed to by inner.
2478     */
2479    bool is_owned;
2480 } LDKChannelInfo;
2481
2482 /**
2483  * The contents of CResult_ChannelInfoDecodeErrorZ
2484  */
2485 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
2486    /**
2487     * A pointer to the contents in the success state.
2488     * Reading from this pointer when `result_ok` is not set is undefined.
2489     */
2490    struct LDKChannelInfo *result;
2491    /**
2492     * A pointer to the contents in the error state.
2493     * Reading from this pointer when `result_ok` is set is undefined.
2494     */
2495    struct LDKDecodeError *err;
2496 } LDKCResult_ChannelInfoDecodeErrorZPtr;
2497
2498 /**
2499  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
2500  * containing a crate::routing::network_graph::ChannelInfo on success and a crate::ln::msgs::DecodeError on failure.
2501  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2502  */
2503 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
2504    /**
2505     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
2506     * `err` or `result` depending on the state of `result_ok`.
2507     */
2508    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
2509    /**
2510     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
2511     */
2512    bool result_ok;
2513 } LDKCResult_ChannelInfoDecodeErrorZ;
2514
2515
2516
2517 /**
2518  * Fees for routing via a given channel or a node
2519  */
2520 typedef struct MUST_USE_STRUCT LDKRoutingFees {
2521    /**
2522     * A pointer to the opaque Rust object.
2523     * Nearly everywhere, inner must be non-null, however in places where
2524     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2525     */
2526    LDKnativeRoutingFees *inner;
2527    /**
2528     * Indicates that this is the only struct which contains the same pointer.
2529     * Rust functions which take ownership of an object provided via an argument require
2530     * this to be true and invalidate the object pointed to by inner.
2531     */
2532    bool is_owned;
2533 } LDKRoutingFees;
2534
2535 /**
2536  * The contents of CResult_RoutingFeesDecodeErrorZ
2537  */
2538 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
2539    /**
2540     * A pointer to the contents in the success state.
2541     * Reading from this pointer when `result_ok` is not set is undefined.
2542     */
2543    struct LDKRoutingFees *result;
2544    /**
2545     * A pointer to the contents in the error state.
2546     * Reading from this pointer when `result_ok` is set is undefined.
2547     */
2548    struct LDKDecodeError *err;
2549 } LDKCResult_RoutingFeesDecodeErrorZPtr;
2550
2551 /**
2552  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
2553  * containing a crate::routing::network_graph::RoutingFees on success and a crate::ln::msgs::DecodeError on failure.
2554  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2555  */
2556 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
2557    /**
2558     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
2559     * `err` or `result` depending on the state of `result_ok`.
2560     */
2561    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
2562    /**
2563     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
2564     */
2565    bool result_ok;
2566 } LDKCResult_RoutingFeesDecodeErrorZ;
2567
2568 /**
2569  * A 4-byte byte array.
2570  */
2571 typedef struct LDKFourBytes {
2572    /**
2573     * The four bytes
2574     */
2575    uint8_t data[4];
2576 } LDKFourBytes;
2577
2578 /**
2579  * A 16-byte byte array.
2580  */
2581 typedef struct LDKSixteenBytes {
2582    /**
2583     * The sixteen bytes
2584     */
2585    uint8_t data[16];
2586 } LDKSixteenBytes;
2587
2588 /**
2589  * A 10-byte byte array.
2590  */
2591 typedef struct LDKTenBytes {
2592    /**
2593     * The ten bytes
2594     */
2595    uint8_t data[10];
2596 } LDKTenBytes;
2597
2598 /**
2599  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
2600  * look up the corresponding function in rust-lightning's docs.
2601  */
2602 typedef struct LDKThirtyTwoBytes {
2603    /**
2604     * The thirty-two bytes
2605     */
2606    uint8_t data[32];
2607 } LDKThirtyTwoBytes;
2608
2609 /**
2610  * An address which can be used to connect to a remote peer
2611  */
2612 typedef enum LDKNetAddress_Tag {
2613    /**
2614     * An IPv4 address/port on which the peer is listening.
2615     */
2616    LDKNetAddress_IPv4,
2617    /**
2618     * An IPv6 address/port on which the peer is listening.
2619     */
2620    LDKNetAddress_IPv6,
2621    /**
2622     * An old-style Tor onion address/port on which the peer is listening.
2623     */
2624    LDKNetAddress_OnionV2,
2625    /**
2626     * A new-style Tor onion address/port on which the peer is listening.
2627     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
2628     * wrap as base32 and append \".onion\".
2629     */
2630    LDKNetAddress_OnionV3,
2631    /**
2632     * Must be last for serialization purposes
2633     */
2634    LDKNetAddress_Sentinel,
2635 } LDKNetAddress_Tag;
2636
2637 typedef struct LDKNetAddress_LDKIPv4_Body {
2638    /**
2639     * The 4-byte IPv4 address
2640     */
2641    struct LDKFourBytes addr;
2642    /**
2643     * The port on which the node is listening
2644     */
2645    uint16_t port;
2646 } LDKNetAddress_LDKIPv4_Body;
2647
2648 typedef struct LDKNetAddress_LDKIPv6_Body {
2649    /**
2650     * The 16-byte IPv6 address
2651     */
2652    struct LDKSixteenBytes addr;
2653    /**
2654     * The port on which the node is listening
2655     */
2656    uint16_t port;
2657 } LDKNetAddress_LDKIPv6_Body;
2658
2659 typedef struct LDKNetAddress_LDKOnionV2_Body {
2660    /**
2661     * The bytes (usually encoded in base32 with \".onion\" appended)
2662     */
2663    struct LDKTenBytes addr;
2664    /**
2665     * The port on which the node is listening
2666     */
2667    uint16_t port;
2668 } LDKNetAddress_LDKOnionV2_Body;
2669
2670 typedef struct LDKNetAddress_LDKOnionV3_Body {
2671    /**
2672     * The ed25519 long-term public key of the peer
2673     */
2674    struct LDKThirtyTwoBytes ed25519_pubkey;
2675    /**
2676     * The checksum of the pubkey and version, as included in the onion address
2677     */
2678    uint16_t checksum;
2679    /**
2680     * The version byte, as defined by the Tor Onion v3 spec.
2681     */
2682    uint8_t version;
2683    /**
2684     * The port on which the node is listening
2685     */
2686    uint16_t port;
2687 } LDKNetAddress_LDKOnionV3_Body;
2688
2689 typedef struct MUST_USE_STRUCT LDKNetAddress {
2690    LDKNetAddress_Tag tag;
2691    union {
2692       LDKNetAddress_LDKIPv4_Body i_pv4;
2693       LDKNetAddress_LDKIPv6_Body i_pv6;
2694       LDKNetAddress_LDKOnionV2_Body onion_v2;
2695       LDKNetAddress_LDKOnionV3_Body onion_v3;
2696    };
2697 } LDKNetAddress;
2698
2699 /**
2700  * A dynamically-allocated array of crate::ln::msgs::NetAddresss of arbitrary size.
2701  * This corresponds to std::vector in C++
2702  */
2703 typedef struct LDKCVec_NetAddressZ {
2704    /**
2705     * The elements in the array.
2706     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2707     */
2708    struct LDKNetAddress *data;
2709    /**
2710     * The number of elements pointed to by `data`.
2711     */
2712    uintptr_t datalen;
2713 } LDKCVec_NetAddressZ;
2714
2715
2716
2717 /**
2718  * Information received in the latest node_announcement from this node.
2719  */
2720 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
2721    /**
2722     * A pointer to the opaque Rust object.
2723     * Nearly everywhere, inner must be non-null, however in places where
2724     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2725     */
2726    LDKnativeNodeAnnouncementInfo *inner;
2727    /**
2728     * Indicates that this is the only struct which contains the same pointer.
2729     * Rust functions which take ownership of an object provided via an argument require
2730     * this to be true and invalidate the object pointed to by inner.
2731     */
2732    bool is_owned;
2733 } LDKNodeAnnouncementInfo;
2734
2735 /**
2736  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
2737  */
2738 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
2739    /**
2740     * A pointer to the contents in the success state.
2741     * Reading from this pointer when `result_ok` is not set is undefined.
2742     */
2743    struct LDKNodeAnnouncementInfo *result;
2744    /**
2745     * A pointer to the contents in the error state.
2746     * Reading from this pointer when `result_ok` is set is undefined.
2747     */
2748    struct LDKDecodeError *err;
2749 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
2750
2751 /**
2752  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
2753  * containing a crate::routing::network_graph::NodeAnnouncementInfo on success and a crate::ln::msgs::DecodeError on failure.
2754  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2755  */
2756 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
2757    /**
2758     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
2759     * `err` or `result` depending on the state of `result_ok`.
2760     */
2761    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
2762    /**
2763     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
2764     */
2765    bool result_ok;
2766 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
2767
2768 /**
2769  * A dynamically-allocated array of u64s of arbitrary size.
2770  * This corresponds to std::vector in C++
2771  */
2772 typedef struct LDKCVec_u64Z {
2773    /**
2774     * The elements in the array.
2775     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2776     */
2777    uint64_t *data;
2778    /**
2779     * The number of elements pointed to by `data`.
2780     */
2781    uintptr_t datalen;
2782 } LDKCVec_u64Z;
2783
2784
2785
2786 /**
2787  * Details about a node in the network, known from the network announcement.
2788  */
2789 typedef struct MUST_USE_STRUCT LDKNodeInfo {
2790    /**
2791     * A pointer to the opaque Rust object.
2792     * Nearly everywhere, inner must be non-null, however in places where
2793     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2794     */
2795    LDKnativeNodeInfo *inner;
2796    /**
2797     * Indicates that this is the only struct which contains the same pointer.
2798     * Rust functions which take ownership of an object provided via an argument require
2799     * this to be true and invalidate the object pointed to by inner.
2800     */
2801    bool is_owned;
2802 } LDKNodeInfo;
2803
2804 /**
2805  * The contents of CResult_NodeInfoDecodeErrorZ
2806  */
2807 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
2808    /**
2809     * A pointer to the contents in the success state.
2810     * Reading from this pointer when `result_ok` is not set is undefined.
2811     */
2812    struct LDKNodeInfo *result;
2813    /**
2814     * A pointer to the contents in the error state.
2815     * Reading from this pointer when `result_ok` is set is undefined.
2816     */
2817    struct LDKDecodeError *err;
2818 } LDKCResult_NodeInfoDecodeErrorZPtr;
2819
2820 /**
2821  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
2822  * containing a crate::routing::network_graph::NodeInfo on success and a crate::ln::msgs::DecodeError on failure.
2823  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2824  */
2825 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
2826    /**
2827     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
2828     * `err` or `result` depending on the state of `result_ok`.
2829     */
2830    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
2831    /**
2832     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
2833     */
2834    bool result_ok;
2835 } LDKCResult_NodeInfoDecodeErrorZ;
2836
2837
2838
2839 /**
2840  * Represents the network as nodes and channels between them
2841  */
2842 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
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    LDKnativeNetworkGraph *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 } LDKNetworkGraph;
2856
2857 /**
2858  * The contents of CResult_NetworkGraphDecodeErrorZ
2859  */
2860 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
2861    /**
2862     * A pointer to the contents in the success state.
2863     * Reading from this pointer when `result_ok` is not set is undefined.
2864     */
2865    struct LDKNetworkGraph *result;
2866    /**
2867     * A pointer to the contents in the error state.
2868     * Reading from this pointer when `result_ok` is set is undefined.
2869     */
2870    struct LDKDecodeError *err;
2871 } LDKCResult_NetworkGraphDecodeErrorZPtr;
2872
2873 /**
2874  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
2875  * containing a crate::routing::network_graph::NetworkGraph on success and a crate::ln::msgs::DecodeError on failure.
2876  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2877  */
2878 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
2879    /**
2880     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
2881     * `err` or `result` depending on the state of `result_ok`.
2882     */
2883    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
2884    /**
2885     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
2886     */
2887    bool result_ok;
2888 } LDKCResult_NetworkGraphDecodeErrorZ;
2889
2890 /**
2891  * A tuple of 2 elements. See the individual fields for the types contained.
2892  */
2893 typedef struct LDKC2Tuple_usizeTransactionZ {
2894    /**
2895     * The element at position 0
2896     */
2897    uintptr_t a;
2898    /**
2899     * The element at position 1
2900     */
2901    struct LDKTransaction b;
2902 } LDKC2Tuple_usizeTransactionZ;
2903
2904 /**
2905  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2906  * This corresponds to std::vector in C++
2907  */
2908 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
2909    /**
2910     * The elements in the array.
2911     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2912     */
2913    struct LDKC2Tuple_usizeTransactionZ *data;
2914    /**
2915     * The number of elements pointed to by `data`.
2916     */
2917    uintptr_t datalen;
2918 } LDKCVec_C2Tuple_usizeTransactionZZ;
2919
2920 /**
2921  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2922  * This corresponds to std::vector in C++
2923  */
2924 typedef struct LDKCVec_TxidZ {
2925    /**
2926     * The elements in the array.
2927     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2928     */
2929    struct LDKThirtyTwoBytes *data;
2930    /**
2931     * The number of elements pointed to by `data`.
2932     */
2933    uintptr_t datalen;
2934 } LDKCVec_TxidZ;
2935
2936 /**
2937  * The contents of CResult_NoneChannelMonitorUpdateErrZ
2938  */
2939 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
2940    /**
2941     * Note that this value is always NULL, as there are no contents in the OK variant
2942     */
2943    void *result;
2944    /**
2945     * A pointer to the contents in the error state.
2946     * Reading from this pointer when `result_ok` is set is undefined.
2947     */
2948    enum LDKChannelMonitorUpdateErr *err;
2949 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
2950
2951 /**
2952  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2953  * containing a () on success and a crate::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
2954  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2955  */
2956 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
2957    /**
2958     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2959     * `err` or `result` depending on the state of `result_ok`.
2960     */
2961    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
2962    /**
2963     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2964     */
2965    bool result_ok;
2966 } LDKCResult_NoneChannelMonitorUpdateErrZ;
2967
2968
2969
2970 /**
2971  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2972  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2973  * preimage claim backward will lead to loss of funds.
2974  */
2975 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2976    /**
2977     * A pointer to the opaque Rust object.
2978     * Nearly everywhere, inner must be non-null, however in places where
2979     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2980     */
2981    LDKnativeHTLCUpdate *inner;
2982    /**
2983     * Indicates that this is the only struct which contains the same pointer.
2984     * Rust functions which take ownership of an object provided via an argument require
2985     * this to be true and invalidate the object pointed to by inner.
2986     */
2987    bool is_owned;
2988 } LDKHTLCUpdate;
2989
2990
2991
2992 /**
2993  * A reference to a transaction output.
2994  *
2995  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
2996  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
2997  */
2998 typedef struct MUST_USE_STRUCT LDKOutPoint {
2999    /**
3000     * A pointer to the opaque Rust object.
3001     * Nearly everywhere, inner must be non-null, however in places where
3002     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3003     */
3004    LDKnativeOutPoint *inner;
3005    /**
3006     * Indicates that this is the only struct which contains the same pointer.
3007     * Rust functions which take ownership of an object provided via an argument require
3008     * this to be true and invalidate the object pointed to by inner.
3009     */
3010    bool is_owned;
3011 } LDKOutPoint;
3012
3013 /**
3014  * An event to be processed by the ChannelManager.
3015  */
3016 typedef enum LDKMonitorEvent_Tag {
3017    /**
3018     * A monitor event containing an HTLCUpdate.
3019     */
3020    LDKMonitorEvent_HTLCEvent,
3021    /**
3022     * A monitor event that the Channel's commitment transaction was broadcasted.
3023     */
3024    LDKMonitorEvent_CommitmentTxBroadcasted,
3025    /**
3026     * Must be last for serialization purposes
3027     */
3028    LDKMonitorEvent_Sentinel,
3029 } LDKMonitorEvent_Tag;
3030
3031 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
3032    LDKMonitorEvent_Tag tag;
3033    union {
3034       struct {
3035          struct LDKHTLCUpdate htlc_event;
3036       };
3037       struct {
3038          struct LDKOutPoint commitment_tx_broadcasted;
3039       };
3040    };
3041 } LDKMonitorEvent;
3042
3043 /**
3044  * A dynamically-allocated array of crate::chain::channelmonitor::MonitorEvents of arbitrary size.
3045  * This corresponds to std::vector in C++
3046  */
3047 typedef struct LDKCVec_MonitorEventZ {
3048    /**
3049     * The elements in the array.
3050     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3051     */
3052    struct LDKMonitorEvent *data;
3053    /**
3054     * The number of elements pointed to by `data`.
3055     */
3056    uintptr_t datalen;
3057 } LDKCVec_MonitorEventZ;
3058
3059
3060
3061 /**
3062  * Information about a spendable output to a P2WSH script. See
3063  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
3064  */
3065 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
3066    /**
3067     * A pointer to the opaque Rust object.
3068     * Nearly everywhere, inner must be non-null, however in places where
3069     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3070     */
3071    LDKnativeDelayedPaymentOutputDescriptor *inner;
3072    /**
3073     * Indicates that this is the only struct which contains the same pointer.
3074     * Rust functions which take ownership of an object provided via an argument require
3075     * this to be true and invalidate the object pointed to by inner.
3076     */
3077    bool is_owned;
3078 } LDKDelayedPaymentOutputDescriptor;
3079
3080
3081
3082 /**
3083  * Information about a spendable output to our \"payment key\". See
3084  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
3085  */
3086 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
3087    /**
3088     * A pointer to the opaque Rust object.
3089     * Nearly everywhere, inner must be non-null, however in places where
3090     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3091     */
3092    LDKnativeStaticPaymentOutputDescriptor *inner;
3093    /**
3094     * Indicates that this is the only struct which contains the same pointer.
3095     * Rust functions which take ownership of an object provided via an argument require
3096     * this to be true and invalidate the object pointed to by inner.
3097     */
3098    bool is_owned;
3099 } LDKStaticPaymentOutputDescriptor;
3100
3101 /**
3102  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
3103  * claim at any point in the future) an event is generated which you must track and be able to
3104  * spend on-chain. The information needed to do this is provided in this enum, including the
3105  * outpoint describing which txid and output index is available, the full output which exists at
3106  * that txid/index, and any keys or other information required to sign.
3107  */
3108 typedef enum LDKSpendableOutputDescriptor_Tag {
3109    /**
3110     * An output to a script which was provided via KeysInterface directly, either from
3111     * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
3112     * spend it. No secret keys are provided as rust-lightning was never given any key.
3113     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
3114     * on-chain using the payment preimage or after it has timed out.
3115     */
3116    LDKSpendableOutputDescriptor_StaticOutput,
3117    /**
3118     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
3119     *
3120     * The witness in the spending input should be:
3121     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
3122     *
3123     * Note that the nSequence field in the spending input must be set to to_self_delay
3124     * (which means the transaction is not broadcastable until at least to_self_delay
3125     * blocks after the outpoint confirms).
3126     *
3127     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
3128     * it is an output from an old state which we broadcast (which should never happen).
3129     *
3130     * To derive the delayed_payment key which is used to sign for this input, you must pass the
3131     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
3132     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
3133     * chan_utils::derive_private_key. The public key can be generated without the secret key
3134     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
3135     * Sign::pubkeys().
3136     *
3137     * To derive the revocation_pubkey provided here (which is used in the witness
3138     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
3139     * call to Sign::ready_channel) and the provided per_commitment point
3140     * to chan_utils::derive_public_revocation_key.
3141     *
3142     * The witness script which is hashed and included in the output script_pubkey may be
3143     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
3144     * (derived as above), and the to_self_delay contained here to
3145     * chan_utils::get_revokeable_redeemscript.
3146     */
3147    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
3148    /**
3149     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
3150     * corresponds to the public key in Sign::pubkeys().payment_point).
3151     * The witness in the spending input, is, thus, simply:
3152     * <BIP 143 signature> <payment key>
3153     *
3154     * These are generally the result of our counterparty having broadcast the current state,
3155     * allowing us to claim the non-HTLC-encumbered outputs immediately.
3156     */
3157    LDKSpendableOutputDescriptor_StaticPaymentOutput,
3158    /**
3159     * Must be last for serialization purposes
3160     */
3161    LDKSpendableOutputDescriptor_Sentinel,
3162 } LDKSpendableOutputDescriptor_Tag;
3163
3164 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
3165    /**
3166     * The outpoint which is spendable
3167     */
3168    struct LDKOutPoint outpoint;
3169    /**
3170     * The output which is referenced by the given outpoint.
3171     */
3172    struct LDKTxOut output;
3173 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
3174
3175 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
3176    LDKSpendableOutputDescriptor_Tag tag;
3177    union {
3178       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
3179       struct {
3180          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
3181       };
3182       struct {
3183          struct LDKStaticPaymentOutputDescriptor static_payment_output;
3184       };
3185    };
3186 } LDKSpendableOutputDescriptor;
3187
3188 /**
3189  * A dynamically-allocated array of crate::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3190  * This corresponds to std::vector in C++
3191  */
3192 typedef struct LDKCVec_SpendableOutputDescriptorZ {
3193    /**
3194     * The elements in the array.
3195     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3196     */
3197    struct LDKSpendableOutputDescriptor *data;
3198    /**
3199     * The number of elements pointed to by `data`.
3200     */
3201    uintptr_t datalen;
3202 } LDKCVec_SpendableOutputDescriptorZ;
3203
3204 /**
3205  * An Event which you should probably take some action in response to.
3206  *
3207  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
3208  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
3209  * written as it makes no sense to respond to it after reconnecting to peers).
3210  */
3211 typedef enum LDKEvent_Tag {
3212    /**
3213     * Used to indicate that the client should generate a funding transaction with the given
3214     * parameters and then call ChannelManager::funding_transaction_generated.
3215     * Generated in ChannelManager message handling.
3216     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
3217     * counterparty can steal your funds!
3218     */
3219    LDKEvent_FundingGenerationReady,
3220    /**
3221     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
3222     * ChannelManager::claim_funds to get it....
3223     * Note that if the preimage is not known or the amount paid is incorrect, you should call
3224     * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
3225     * network congestion.
3226     * The amount paid should be considered 'incorrect' when it is less than or more than twice
3227     * the amount expected.
3228     * If you fail to call either ChannelManager::claim_funds or
3229     * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
3230     * automatically failed.
3231     */
3232    LDKEvent_PaymentReceived,
3233    /**
3234     * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
3235     * and we got back the payment preimage for it).
3236     * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
3237     * deduplicate them by payment_preimage (which MUST be unique)!
3238     */
3239    LDKEvent_PaymentSent,
3240    /**
3241     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
3242     * something. You may wish to retry with a different route.
3243     * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
3244     * deduplicate them by payment_hash (which MUST be unique)!
3245     */
3246    LDKEvent_PaymentFailed,
3247    /**
3248     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
3249     * time in the future.
3250     */
3251    LDKEvent_PendingHTLCsForwardable,
3252    /**
3253     * Used to indicate that an output was generated on-chain which you should know how to spend.
3254     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
3255     * counterparty spending them due to some kind of timeout. Thus, you need to store them
3256     * somewhere and spend them when you create on-chain transactions.
3257     */
3258    LDKEvent_SpendableOutputs,
3259    /**
3260     * Must be last for serialization purposes
3261     */
3262    LDKEvent_Sentinel,
3263 } LDKEvent_Tag;
3264
3265 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
3266    /**
3267     * The random channel_id we picked which you'll need to pass into
3268     * ChannelManager::funding_transaction_generated.
3269     */
3270    struct LDKThirtyTwoBytes temporary_channel_id;
3271    /**
3272     * The value, in satoshis, that the output should have.
3273     */
3274    uint64_t channel_value_satoshis;
3275    /**
3276     * The script which should be used in the transaction output.
3277     */
3278    struct LDKCVec_u8Z output_script;
3279    /**
3280     * The value passed in to ChannelManager::create_channel
3281     */
3282    uint64_t user_channel_id;
3283 } LDKEvent_LDKFundingGenerationReady_Body;
3284
3285 typedef struct LDKEvent_LDKPaymentReceived_Body {
3286    /**
3287     * The hash for which the preimage should be handed to the ChannelManager.
3288     */
3289    struct LDKThirtyTwoBytes payment_hash;
3290    /**
3291     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
3292     * number of deanonymization attacks during the routing process.
3293     * As nodes upgrade, the invoices you provide should likely migrate to setting the
3294     * payment_secret feature to required, at which point you should fail_backwards any HTLCs
3295     * which have a None here.
3296     * Until then, however, values of None should be ignored, and only incorrect Some values
3297     * should result in an HTLC fail_backwards.
3298     * Note that, in any case, this value must be passed as-is to any fail or claim calls as
3299     * the HTLC index includes this value.
3300     */
3301    struct LDKThirtyTwoBytes payment_secret;
3302    /**
3303     * The value, in thousandths of a satoshi, that this payment is for. Note that you must
3304     * compare this to the expected value before accepting the payment (as otherwise you are
3305     * providing proof-of-payment for less than the value you expected!).
3306     */
3307    uint64_t amt;
3308 } LDKEvent_LDKPaymentReceived_Body;
3309
3310 typedef struct LDKEvent_LDKPaymentSent_Body {
3311    /**
3312     * The preimage to the hash given to ChannelManager::send_payment.
3313     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
3314     * store it somehow!
3315     */
3316    struct LDKThirtyTwoBytes payment_preimage;
3317 } LDKEvent_LDKPaymentSent_Body;
3318
3319 typedef struct LDKEvent_LDKPaymentFailed_Body {
3320    /**
3321     * The hash which was given to ChannelManager::send_payment.
3322     */
3323    struct LDKThirtyTwoBytes payment_hash;
3324    /**
3325     * Indicates the payment was rejected for some reason by the recipient. This implies that
3326     * the payment has failed, not just the route in question. If this is not set, you may
3327     * retry the payment via a different route.
3328     */
3329    bool rejected_by_dest;
3330 } LDKEvent_LDKPaymentFailed_Body;
3331
3332 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
3333    /**
3334     * The minimum amount of time that should be waited prior to calling
3335     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
3336     * you should wait a random amount of time in roughly the range (now + time_forwardable,
3337     * now + 5*time_forwardable).
3338     */
3339    uint64_t time_forwardable;
3340 } LDKEvent_LDKPendingHTLCsForwardable_Body;
3341
3342 typedef struct LDKEvent_LDKSpendableOutputs_Body {
3343    /**
3344     * The outputs which you should store as spendable by you.
3345     */
3346    struct LDKCVec_SpendableOutputDescriptorZ outputs;
3347 } LDKEvent_LDKSpendableOutputs_Body;
3348
3349 typedef struct MUST_USE_STRUCT LDKEvent {
3350    LDKEvent_Tag tag;
3351    union {
3352       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
3353       LDKEvent_LDKPaymentReceived_Body payment_received;
3354       LDKEvent_LDKPaymentSent_Body payment_sent;
3355       LDKEvent_LDKPaymentFailed_Body payment_failed;
3356       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
3357       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
3358    };
3359 } LDKEvent;
3360
3361 /**
3362  * A dynamically-allocated array of crate::util::events::Events of arbitrary size.
3363  * This corresponds to std::vector in C++
3364  */
3365 typedef struct LDKCVec_EventZ {
3366    /**
3367     * The elements in the array.
3368     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3369     */
3370    struct LDKEvent *data;
3371    /**
3372     * The number of elements pointed to by `data`.
3373     */
3374    uintptr_t datalen;
3375 } LDKCVec_EventZ;
3376
3377 /**
3378  * The contents of CResult_OutPointDecodeErrorZ
3379  */
3380 typedef union LDKCResult_OutPointDecodeErrorZPtr {
3381    /**
3382     * A pointer to the contents in the success state.
3383     * Reading from this pointer when `result_ok` is not set is undefined.
3384     */
3385    struct LDKOutPoint *result;
3386    /**
3387     * A pointer to the contents in the error state.
3388     * Reading from this pointer when `result_ok` is set is undefined.
3389     */
3390    struct LDKDecodeError *err;
3391 } LDKCResult_OutPointDecodeErrorZPtr;
3392
3393 /**
3394  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
3395  * containing a crate::chain::transaction::OutPoint on success and a crate::ln::msgs::DecodeError on failure.
3396  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3397  */
3398 typedef struct LDKCResult_OutPointDecodeErrorZ {
3399    /**
3400     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
3401     * `err` or `result` depending on the state of `result_ok`.
3402     */
3403    union LDKCResult_OutPointDecodeErrorZPtr contents;
3404    /**
3405     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
3406     */
3407    bool result_ok;
3408 } LDKCResult_OutPointDecodeErrorZ;
3409
3410
3411
3412 /**
3413  * An update generated by the underlying Channel itself which contains some new information the
3414  * ChannelMonitor should be made aware of.
3415  */
3416 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
3417    /**
3418     * A pointer to the opaque Rust object.
3419     * Nearly everywhere, inner must be non-null, however in places where
3420     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3421     */
3422    LDKnativeChannelMonitorUpdate *inner;
3423    /**
3424     * Indicates that this is the only struct which contains the same pointer.
3425     * Rust functions which take ownership of an object provided via an argument require
3426     * this to be true and invalidate the object pointed to by inner.
3427     */
3428    bool is_owned;
3429 } LDKChannelMonitorUpdate;
3430
3431 /**
3432  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
3433  */
3434 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
3435    /**
3436     * A pointer to the contents in the success state.
3437     * Reading from this pointer when `result_ok` is not set is undefined.
3438     */
3439    struct LDKChannelMonitorUpdate *result;
3440    /**
3441     * A pointer to the contents in the error state.
3442     * Reading from this pointer when `result_ok` is set is undefined.
3443     */
3444    struct LDKDecodeError *err;
3445 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
3446
3447 /**
3448  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
3449  * containing a crate::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::ln::msgs::DecodeError on failure.
3450  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3451  */
3452 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
3453    /**
3454     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
3455     * `err` or `result` depending on the state of `result_ok`.
3456     */
3457    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
3458    /**
3459     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
3460     */
3461    bool result_ok;
3462 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
3463
3464 /**
3465  * The contents of CResult_HTLCUpdateDecodeErrorZ
3466  */
3467 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
3468    /**
3469     * A pointer to the contents in the success state.
3470     * Reading from this pointer when `result_ok` is not set is undefined.
3471     */
3472    struct LDKHTLCUpdate *result;
3473    /**
3474     * A pointer to the contents in the error state.
3475     * Reading from this pointer when `result_ok` is set is undefined.
3476     */
3477    struct LDKDecodeError *err;
3478 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
3479
3480 /**
3481  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
3482  * containing a crate::chain::channelmonitor::HTLCUpdate on success and a crate::ln::msgs::DecodeError on failure.
3483  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3484  */
3485 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
3486    /**
3487     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
3488     * `err` or `result` depending on the state of `result_ok`.
3489     */
3490    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
3491    /**
3492     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
3493     */
3494    bool result_ok;
3495 } LDKCResult_HTLCUpdateDecodeErrorZ;
3496
3497
3498
3499 /**
3500  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
3501  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
3502  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
3503  * corrupted.
3504  * Contains a developer-readable error message.
3505  */
3506 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
3507    /**
3508     * A pointer to the opaque Rust object.
3509     * Nearly everywhere, inner must be non-null, however in places where
3510     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3511     */
3512    LDKnativeMonitorUpdateError *inner;
3513    /**
3514     * Indicates that this is the only struct which contains the same pointer.
3515     * Rust functions which take ownership of an object provided via an argument require
3516     * this to be true and invalidate the object pointed to by inner.
3517     */
3518    bool is_owned;
3519 } LDKMonitorUpdateError;
3520
3521 /**
3522  * The contents of CResult_NoneMonitorUpdateErrorZ
3523  */
3524 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
3525    /**
3526     * Note that this value is always NULL, as there are no contents in the OK variant
3527     */
3528    void *result;
3529    /**
3530     * A pointer to the contents in the error state.
3531     * Reading from this pointer when `result_ok` is set is undefined.
3532     */
3533    struct LDKMonitorUpdateError *err;
3534 } LDKCResult_NoneMonitorUpdateErrorZPtr;
3535
3536 /**
3537  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
3538  * containing a () on success and a crate::chain::channelmonitor::MonitorUpdateError on failure.
3539  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3540  */
3541 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
3542    /**
3543     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
3544     * `err` or `result` depending on the state of `result_ok`.
3545     */
3546    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
3547    /**
3548     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
3549     */
3550    bool result_ok;
3551 } LDKCResult_NoneMonitorUpdateErrorZ;
3552
3553 /**
3554  * A tuple of 2 elements. See the individual fields for the types contained.
3555  */
3556 typedef struct LDKC2Tuple_OutPointScriptZ {
3557    /**
3558     * The element at position 0
3559     */
3560    struct LDKOutPoint a;
3561    /**
3562     * The element at position 1
3563     */
3564    struct LDKCVec_u8Z b;
3565 } LDKC2Tuple_OutPointScriptZ;
3566
3567 /**
3568  * A tuple of 2 elements. See the individual fields for the types contained.
3569  */
3570 typedef struct LDKC2Tuple_u32ScriptZ {
3571    /**
3572     * The element at position 0
3573     */
3574    uint32_t a;
3575    /**
3576     * The element at position 1
3577     */
3578    struct LDKCVec_u8Z b;
3579 } LDKC2Tuple_u32ScriptZ;
3580
3581 /**
3582  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
3583  * This corresponds to std::vector in C++
3584  */
3585 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
3586    /**
3587     * The elements in the array.
3588     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3589     */
3590    struct LDKC2Tuple_u32ScriptZ *data;
3591    /**
3592     * The number of elements pointed to by `data`.
3593     */
3594    uintptr_t datalen;
3595 } LDKCVec_C2Tuple_u32ScriptZZ;
3596
3597 /**
3598  * A tuple of 2 elements. See the individual fields for the types contained.
3599  */
3600 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
3601    /**
3602     * The element at position 0
3603     */
3604    struct LDKThirtyTwoBytes a;
3605    /**
3606     * The element at position 1
3607     */
3608    struct LDKCVec_C2Tuple_u32ScriptZZ b;
3609 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
3610
3611 /**
3612  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
3613  * This corresponds to std::vector in C++
3614  */
3615 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3616    /**
3617     * The elements in the array.
3618     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3619     */
3620    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
3621    /**
3622     * The number of elements pointed to by `data`.
3623     */
3624    uintptr_t datalen;
3625 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
3626
3627 /**
3628  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
3629  * This corresponds to std::vector in C++
3630  */
3631 typedef struct LDKCVec_TransactionZ {
3632    /**
3633     * The elements in the array.
3634     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3635     */
3636    struct LDKTransaction *data;
3637    /**
3638     * The number of elements pointed to by `data`.
3639     */
3640    uintptr_t datalen;
3641 } LDKCVec_TransactionZ;
3642
3643 /**
3644  * A tuple of 2 elements. See the individual fields for the types contained.
3645  */
3646 typedef struct LDKC2Tuple_u32TxOutZ {
3647    /**
3648     * The element at position 0
3649     */
3650    uint32_t a;
3651    /**
3652     * The element at position 1
3653     */
3654    struct LDKTxOut b;
3655 } LDKC2Tuple_u32TxOutZ;
3656
3657 /**
3658  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
3659  * This corresponds to std::vector in C++
3660  */
3661 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
3662    /**
3663     * The elements in the array.
3664     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3665     */
3666    struct LDKC2Tuple_u32TxOutZ *data;
3667    /**
3668     * The number of elements pointed to by `data`.
3669     */
3670    uintptr_t datalen;
3671 } LDKCVec_C2Tuple_u32TxOutZZ;
3672
3673 /**
3674  * A tuple of 2 elements. See the individual fields for the types contained.
3675  */
3676 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3677    /**
3678     * The element at position 0
3679     */
3680    struct LDKThirtyTwoBytes a;
3681    /**
3682     * The element at position 1
3683     */
3684    struct LDKCVec_C2Tuple_u32TxOutZZ b;
3685 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
3686
3687 /**
3688  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
3689  * This corresponds to std::vector in C++
3690  */
3691 typedef struct LDKCVec_TransactionOutputsZ {
3692    /**
3693     * The elements in the array.
3694     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3695     */
3696    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
3697    /**
3698     * The number of elements pointed to by `data`.
3699     */
3700    uintptr_t datalen;
3701 } LDKCVec_TransactionOutputsZ;
3702
3703 /**
3704  * A tuple of 2 elements. See the individual fields for the types contained.
3705  */
3706 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
3707    /**
3708     * The element at position 0
3709     */
3710    struct LDKSignature a;
3711    /**
3712     * The element at position 1
3713     */
3714    struct LDKCVec_SignatureZ b;
3715 } LDKC2Tuple_SignatureCVec_SignatureZZ;
3716
3717 /**
3718  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3719  */
3720 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3721    /**
3722     * A pointer to the contents in the success state.
3723     * Reading from this pointer when `result_ok` is not set is undefined.
3724     */
3725    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
3726    /**
3727     * Note that this value is always NULL, as there are no contents in the Err variant
3728     */
3729    void *err;
3730 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
3731
3732 /**
3733  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3734  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3735  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3736  */
3737 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3738    /**
3739     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3740     * `err` or `result` depending on the state of `result_ok`.
3741     */
3742    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
3743    /**
3744     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3745     */
3746    bool result_ok;
3747 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
3748
3749 /**
3750  * The contents of CResult_SignatureNoneZ
3751  */
3752 typedef union LDKCResult_SignatureNoneZPtr {
3753    /**
3754     * A pointer to the contents in the success state.
3755     * Reading from this pointer when `result_ok` is not set is undefined.
3756     */
3757    struct LDKSignature *result;
3758    /**
3759     * Note that this value is always NULL, as there are no contents in the Err variant
3760     */
3761    void *err;
3762 } LDKCResult_SignatureNoneZPtr;
3763
3764 /**
3765  * A CResult_SignatureNoneZ represents the result of a fallible operation,
3766  * containing a crate::c_types::Signature on success and a () on failure.
3767  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3768  */
3769 typedef struct LDKCResult_SignatureNoneZ {
3770    /**
3771     * The contents of this CResult_SignatureNoneZ, accessible via either
3772     * `err` or `result` depending on the state of `result_ok`.
3773     */
3774    union LDKCResult_SignatureNoneZPtr contents;
3775    /**
3776     * Whether this CResult_SignatureNoneZ represents a success state.
3777     */
3778    bool result_ok;
3779 } LDKCResult_SignatureNoneZ;
3780
3781
3782
3783 /**
3784  * The unsigned part of a channel_announcement
3785  */
3786 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
3787    /**
3788     * A pointer to the opaque Rust object.
3789     * Nearly everywhere, inner must be non-null, however in places where
3790     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3791     */
3792    LDKnativeUnsignedChannelAnnouncement *inner;
3793    /**
3794     * Indicates that this is the only struct which contains the same pointer.
3795     * Rust functions which take ownership of an object provided via an argument require
3796     * this to be true and invalidate the object pointed to by inner.
3797     */
3798    bool is_owned;
3799 } LDKUnsignedChannelAnnouncement;
3800
3801 /**
3802  * A trait to sign lightning channel transactions as described in BOLT 3.
3803  *
3804  * Signing services could be implemented on a hardware wallet. In this case,
3805  * the current Sign would be a front-end on top of a communication
3806  * channel connected to your secure device and lightning key material wouldn't
3807  * reside on a hot server. Nevertheless, a this deployment would still need
3808  * to trust the ChannelManager to avoid loss of funds as this latest component
3809  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
3810  *
3811  * A more secure iteration would be to use hashlock (or payment points) to pair
3812  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
3813  * at the price of more state and computation on the hardware wallet side. In the future,
3814  * we are looking forward to design such interface.
3815  *
3816  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
3817  * to act, as liveness and breach reply correctness are always going to be hard requirements
3818  * of LN security model, orthogonal of key management issues.
3819  */
3820 typedef struct LDKBaseSign {
3821    /**
3822     * An opaque pointer which is passed to your function implementations as an argument.
3823     * This has no meaning in the LDK, and can be NULL or any other value.
3824     */
3825    void *this_arg;
3826    /**
3827     * Gets the per-commitment point for a specific commitment number
3828     *
3829     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3830     */
3831    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
3832    /**
3833     * Gets the commitment secret for a specific commitment number as part of the revocation process
3834     *
3835     * An external signer implementation should error here if the commitment was already signed
3836     * and should refuse to sign it in the future.
3837     *
3838     * May be called more than once for the same index.
3839     *
3840     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3841     */
3842    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
3843    /**
3844     * Gets the holder's channel public keys and basepoints
3845     */
3846    struct LDKChannelPublicKeys pubkeys;
3847    /**
3848     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
3849     * Note that this takes a pointer to this object, not the this_ptr like other methods do
3850     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
3851     */
3852    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
3853    /**
3854     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
3855     * some SpendableOutputDescriptor types. This should be sufficient to identify this
3856     * Sign object uniquely and lookup or re-derive its keys.
3857     */
3858    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
3859    /**
3860     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
3861     *
3862     * Note that if signing fails or is rejected, the channel will be force-closed.
3863     */
3864    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
3865    /**
3866     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
3867     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
3868     * latest commitment_tx when we initiate a force-close.
3869     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
3870     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
3871     * the latest.
3872     * This may be called multiple times for the same transaction.
3873     *
3874     * An external signer implementation should check that the commitment has not been revoked.
3875     *
3876     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
3877     */
3878    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
3879    /**
3880     * Create a signature for the given input in a transaction spending an HTLC or commitment
3881     * transaction output when our counterparty broadcasts an old state.
3882     *
3883     * A justice transaction may claim multiples outputs at the same time if timelocks are
3884     * similar, but only a signature for the input at index `input` should be signed for here.
3885     * It may be called multiples time for same output(s) if a fee-bump is needed with regards
3886     * to an upcoming timelock expiration.
3887     *
3888     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3889     *
3890     * per_commitment_key is revocation secret which was provided by our counterparty when they
3891     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3892     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3893     * so).
3894     *
3895     * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
3896     * changing the format of the witness script (which is committed to in the BIP 143
3897     * signatures).
3898     */
3899    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);
3900    /**
3901     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
3902     * transaction, either offered or received.
3903     *
3904     * Such a transaction may claim multiples offered outputs at same time if we know the
3905     * preimage for each when we create it, but only the input at index `input` should be
3906     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
3907     * needed with regards to an upcoming timelock expiration.
3908     *
3909     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
3910     * outputs.
3911     *
3912     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3913     *
3914     * Per_commitment_point is the dynamic point corresponding to the channel state
3915     * detected onchain. It has been generated by our counterparty and is used to derive
3916     * channel state keys, which are then included in the witness script and committed to in the
3917     * BIP 143 signature.
3918     */
3919    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);
3920    /**
3921     * Create a signature for a (proposed) closing transaction.
3922     *
3923     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
3924     * chosen to forgo their output as dust.
3925     */
3926    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
3927    /**
3928     * Signs a channel announcement message with our funding key, proving it comes from one
3929     * of the channel participants.
3930     *
3931     * Note that if this fails or is rejected, the channel will not be publicly announced and
3932     * our counterparty may (though likely will not) close the channel on us for violating the
3933     * protocol.
3934     */
3935    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
3936    /**
3937     * Set the counterparty static channel data, including basepoints,
3938     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
3939     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
3940     * they MUST NOT be allowed to change to different values once set.
3941     *
3942     * channel_parameters.is_populated() MUST be true.
3943     *
3944     * We bind holder_selected_contest_delay late here for API convenience.
3945     *
3946     * Will be called before any signatures are applied.
3947     */
3948    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
3949    /**
3950     * Frees any resources associated with this object given its this_arg pointer.
3951     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3952     */
3953    void (*free)(void *this_arg);
3954 } LDKBaseSign;
3955
3956 /**
3957  * A cloneable signer.
3958  *
3959  * Although we require signers to be cloneable, it may be useful for developers to be able to use
3960  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
3961  * which implies Sized, into this derived trait.
3962  */
3963 typedef struct LDKSign {
3964    /**
3965     * An opaque pointer which is passed to your function implementations as an argument.
3966     * This has no meaning in the LDK, and can be NULL or any other value.
3967     */
3968    void *this_arg;
3969    /**
3970     * Implementation of BaseSign for this object.
3971     */
3972    struct LDKBaseSign BaseSign;
3973    /**
3974     * Creates a copy of the BaseSign, for a copy of this Sign.
3975     * Because BaseSign doesn't natively support copying itself, you have to provide a full copy implementation here.
3976     */
3977    struct LDKBaseSign (*BaseSign_clone)(const struct LDKBaseSign *NONNULL_PTR orig_BaseSign);
3978    /**
3979     * Serialize the object into a byte array
3980     */
3981    struct LDKCVec_u8Z (*write)(const void *this_arg);
3982    /**
3983     * Creates a copy of the object pointed to by this_arg, for a copy of this Sign.
3984     * Note that the ultimate copy of the Sign will have all function pointers the same as the original.
3985     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new Sign.
3986     */
3987    void *(*clone)(const void *this_arg);
3988    /**
3989     * Frees any resources associated with this object given its this_arg pointer.
3990     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3991     */
3992    void (*free)(void *this_arg);
3993 } LDKSign;
3994
3995
3996
3997 /**
3998  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
3999  * on-chain transactions to ensure no loss of funds occurs.
4000  *
4001  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
4002  * information and are actively monitoring the chain.
4003  *
4004  * Pending Events or updated HTLCs which have not yet been read out by
4005  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
4006  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
4007  * gotten are fully handled before re-serializing the new state.
4008  *
4009  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
4010  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
4011  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
4012  * returned block hash and the the current chain and then reconnecting blocks to get to the
4013  * best chain) upon deserializing the object!
4014  */
4015 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
4016    /**
4017     * A pointer to the opaque Rust object.
4018     * Nearly everywhere, inner must be non-null, however in places where
4019     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4020     */
4021    LDKnativeChannelMonitor *inner;
4022    /**
4023     * Indicates that this is the only struct which contains the same pointer.
4024     * Rust functions which take ownership of an object provided via an argument require
4025     * this to be true and invalidate the object pointed to by inner.
4026     */
4027    bool is_owned;
4028 } LDKChannelMonitor;
4029
4030 /**
4031  * A tuple of 2 elements. See the individual fields for the types contained.
4032  */
4033 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
4034    /**
4035     * The element at position 0
4036     */
4037    struct LDKThirtyTwoBytes a;
4038    /**
4039     * The element at position 1
4040     */
4041    struct LDKChannelMonitor b;
4042 } LDKC2Tuple_BlockHashChannelMonitorZ;
4043
4044 /**
4045  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
4046  */
4047 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
4048    /**
4049     * A pointer to the contents in the success state.
4050     * Reading from this pointer when `result_ok` is not set is undefined.
4051     */
4052    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
4053    /**
4054     * A pointer to the contents in the error state.
4055     * Reading from this pointer when `result_ok` is set is undefined.
4056     */
4057    struct LDKDecodeError *err;
4058 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
4059
4060 /**
4061  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
4062  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::ln::msgs::DecodeError on failure.
4063  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4064  */
4065 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4066    /**
4067     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
4068     * `err` or `result` depending on the state of `result_ok`.
4069     */
4070    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
4071    /**
4072     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
4073     */
4074    bool result_ok;
4075 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
4076
4077 /**
4078  * The contents of CResult_TxOutAccessErrorZ
4079  */
4080 typedef union LDKCResult_TxOutAccessErrorZPtr {
4081    /**
4082     * A pointer to the contents in the success state.
4083     * Reading from this pointer when `result_ok` is not set is undefined.
4084     */
4085    struct LDKTxOut *result;
4086    /**
4087     * A pointer to the contents in the error state.
4088     * Reading from this pointer when `result_ok` is set is undefined.
4089     */
4090    enum LDKAccessError *err;
4091 } LDKCResult_TxOutAccessErrorZPtr;
4092
4093 /**
4094  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4095  * containing a crate::c_types::TxOut on success and a crate::chain::AccessError on failure.
4096  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4097  */
4098 typedef struct LDKCResult_TxOutAccessErrorZ {
4099    /**
4100     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
4101     * `err` or `result` depending on the state of `result_ok`.
4102     */
4103    union LDKCResult_TxOutAccessErrorZPtr contents;
4104    /**
4105     * Whether this CResult_TxOutAccessErrorZ represents a success state.
4106     */
4107    bool result_ok;
4108 } LDKCResult_TxOutAccessErrorZ;
4109
4110 /**
4111  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4112  */
4113 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
4114    /**
4115     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4116     */
4117    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
4118    /**
4119     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4120     */
4121    LDKCOption_C2Tuple_usizeTransactionZZ_None,
4122    /**
4123     * Must be last for serialization purposes
4124     */
4125    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
4126 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
4127
4128 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
4129    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
4130    union {
4131       struct {
4132          struct LDKC2Tuple_usizeTransactionZ some;
4133       };
4134    };
4135 } LDKCOption_C2Tuple_usizeTransactionZZ;
4136
4137 /**
4138  * A Rust str object, ie a reference to a UTF8-valid string.
4139  * This is *not* null-terminated so cannot be used directly as a C string!
4140  */
4141 typedef struct LDKStr {
4142    /**
4143     * A pointer to the string's bytes, in UTF8 encoding
4144     */
4145    const uint8_t *chars;
4146    /**
4147     * The number of bytes (not characters!) pointed to by `chars`
4148     */
4149    uintptr_t len;
4150 } LDKStr;
4151
4152 /**
4153  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
4154  * too-high values)
4155  */
4156 typedef enum LDKAPIError_Tag {
4157    /**
4158     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
4159     * are documented, but generally indicates some precondition of a function was violated.
4160     */
4161    LDKAPIError_APIMisuseError,
4162    /**
4163     * Due to a high feerate, we were unable to complete the request.
4164     * For example, this may be returned if the feerate implies we cannot open a channel at the
4165     * requested value, but opening a larger channel would succeed.
4166     */
4167    LDKAPIError_FeeRateTooHigh,
4168    /**
4169     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
4170     * too-many-hops, etc).
4171     */
4172    LDKAPIError_RouteError,
4173    /**
4174     * We were unable to complete the request as the Channel required to do so is unable to
4175     * complete the request (or was not found). This can take many forms, including disconnected
4176     * peer, channel at capacity, channel shutting down, etc.
4177     */
4178    LDKAPIError_ChannelUnavailable,
4179    /**
4180     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
4181     * attempted action to fail.
4182     */
4183    LDKAPIError_MonitorUpdateFailed,
4184    /**
4185     * Must be last for serialization purposes
4186     */
4187    LDKAPIError_Sentinel,
4188 } LDKAPIError_Tag;
4189
4190 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
4191    /**
4192     * A human-readable error message
4193     */
4194    struct LDKCVec_u8Z err;
4195 } LDKAPIError_LDKAPIMisuseError_Body;
4196
4197 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
4198    /**
4199     * A human-readable error message
4200     */
4201    struct LDKCVec_u8Z err;
4202    /**
4203     * The feerate which was too high.
4204     */
4205    uint32_t feerate;
4206 } LDKAPIError_LDKFeeRateTooHigh_Body;
4207
4208 typedef struct LDKAPIError_LDKRouteError_Body {
4209    /**
4210     * A human-readable error message
4211     */
4212    struct LDKStr err;
4213 } LDKAPIError_LDKRouteError_Body;
4214
4215 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
4216    /**
4217     * A human-readable error message
4218     */
4219    struct LDKCVec_u8Z err;
4220 } LDKAPIError_LDKChannelUnavailable_Body;
4221
4222 typedef struct MUST_USE_STRUCT LDKAPIError {
4223    LDKAPIError_Tag tag;
4224    union {
4225       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
4226       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
4227       LDKAPIError_LDKRouteError_Body route_error;
4228       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
4229    };
4230 } LDKAPIError;
4231
4232 /**
4233  * The contents of CResult_NoneAPIErrorZ
4234  */
4235 typedef union LDKCResult_NoneAPIErrorZPtr {
4236    /**
4237     * Note that this value is always NULL, as there are no contents in the OK variant
4238     */
4239    void *result;
4240    /**
4241     * A pointer to the contents in the error state.
4242     * Reading from this pointer when `result_ok` is set is undefined.
4243     */
4244    struct LDKAPIError *err;
4245 } LDKCResult_NoneAPIErrorZPtr;
4246
4247 /**
4248  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4249  * containing a () on success and a crate::util::errors::APIError on failure.
4250  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4251  */
4252 typedef struct LDKCResult_NoneAPIErrorZ {
4253    /**
4254     * The contents of this CResult_NoneAPIErrorZ, accessible via either
4255     * `err` or `result` depending on the state of `result_ok`.
4256     */
4257    union LDKCResult_NoneAPIErrorZPtr contents;
4258    /**
4259     * Whether this CResult_NoneAPIErrorZ represents a success state.
4260     */
4261    bool result_ok;
4262 } LDKCResult_NoneAPIErrorZ;
4263
4264 /**
4265  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4266  * This corresponds to std::vector in C++
4267  */
4268 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
4269    /**
4270     * The elements in the array.
4271     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4272     */
4273    struct LDKCResult_NoneAPIErrorZ *data;
4274    /**
4275     * The number of elements pointed to by `data`.
4276     */
4277    uintptr_t datalen;
4278 } LDKCVec_CResult_NoneAPIErrorZZ;
4279
4280 /**
4281  * A dynamically-allocated array of crate::util::errors::APIErrors of arbitrary size.
4282  * This corresponds to std::vector in C++
4283  */
4284 typedef struct LDKCVec_APIErrorZ {
4285    /**
4286     * The elements in the array.
4287     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4288     */
4289    struct LDKAPIError *data;
4290    /**
4291     * The number of elements pointed to by `data`.
4292     */
4293    uintptr_t datalen;
4294 } LDKCVec_APIErrorZ;
4295
4296
4297
4298 /**
4299  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
4300  */
4301 typedef struct MUST_USE_STRUCT LDKChannelDetails {
4302    /**
4303     * A pointer to the opaque Rust object.
4304     * Nearly everywhere, inner must be non-null, however in places where
4305     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4306     */
4307    LDKnativeChannelDetails *inner;
4308    /**
4309     * Indicates that this is the only struct which contains the same pointer.
4310     * Rust functions which take ownership of an object provided via an argument require
4311     * this to be true and invalidate the object pointed to by inner.
4312     */
4313    bool is_owned;
4314 } LDKChannelDetails;
4315
4316 /**
4317  * A dynamically-allocated array of crate::ln::channelmanager::ChannelDetailss of arbitrary size.
4318  * This corresponds to std::vector in C++
4319  */
4320 typedef struct LDKCVec_ChannelDetailsZ {
4321    /**
4322     * The elements in the array.
4323     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4324     */
4325    struct LDKChannelDetails *data;
4326    /**
4327     * The number of elements pointed to by `data`.
4328     */
4329    uintptr_t datalen;
4330 } LDKCVec_ChannelDetailsZ;
4331
4332 /**
4333  * If a payment fails to send, it can be in one of several states. This enum is returned as the
4334  * Err() type describing which state the payment is in, see the description of individual enum
4335  * states for more.
4336  */
4337 typedef enum LDKPaymentSendFailure_Tag {
4338    /**
4339     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
4340     * send the payment at all. No channel state has been changed or messages sent to peers, and
4341     * once you've changed the parameter at error, you can freely retry the payment in full.
4342     */
4343    LDKPaymentSendFailure_ParameterError,
4344    /**
4345     * A parameter in a single path which was passed to send_payment was invalid, preventing us
4346     * from attempting to send the payment at all. No channel state has been changed or messages
4347     * sent to peers, and once you've changed the parameter at error, you can freely retry the
4348     * payment in full.
4349     *
4350     * The results here are ordered the same as the paths in the route object which was passed to
4351     * send_payment.
4352     */
4353    LDKPaymentSendFailure_PathParameterError,
4354    /**
4355     * All paths which were attempted failed to send, with no channel state change taking place.
4356     * You can freely retry the payment in full (though you probably want to do so over different
4357     * paths than the ones selected).
4358     */
4359    LDKPaymentSendFailure_AllFailedRetrySafe,
4360    /**
4361     * Some paths which were attempted failed to send, though possibly not all. At least some
4362     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
4363     * in over-/re-payment.
4364     *
4365     * The results here are ordered the same as the paths in the route object which was passed to
4366     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
4367     * retried (though there is currently no API with which to do so).
4368     *
4369     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
4370     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
4371     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
4372     * with the latest update_id.
4373     */
4374    LDKPaymentSendFailure_PartialFailure,
4375    /**
4376     * Must be last for serialization purposes
4377     */
4378    LDKPaymentSendFailure_Sentinel,
4379 } LDKPaymentSendFailure_Tag;
4380
4381 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
4382    LDKPaymentSendFailure_Tag tag;
4383    union {
4384       struct {
4385          struct LDKAPIError parameter_error;
4386       };
4387       struct {
4388          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
4389       };
4390       struct {
4391          struct LDKCVec_APIErrorZ all_failed_retry_safe;
4392       };
4393       struct {
4394          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
4395       };
4396    };
4397 } LDKPaymentSendFailure;
4398
4399 /**
4400  * The contents of CResult_NonePaymentSendFailureZ
4401  */
4402 typedef union LDKCResult_NonePaymentSendFailureZPtr {
4403    /**
4404     * Note that this value is always NULL, as there are no contents in the OK variant
4405     */
4406    void *result;
4407    /**
4408     * A pointer to the contents in the error state.
4409     * Reading from this pointer when `result_ok` is set is undefined.
4410     */
4411    struct LDKPaymentSendFailure *err;
4412 } LDKCResult_NonePaymentSendFailureZPtr;
4413
4414 /**
4415  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4416  * containing a () on success and a crate::ln::channelmanager::PaymentSendFailure on failure.
4417  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4418  */
4419 typedef struct LDKCResult_NonePaymentSendFailureZ {
4420    /**
4421     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4422     * `err` or `result` depending on the state of `result_ok`.
4423     */
4424    union LDKCResult_NonePaymentSendFailureZPtr contents;
4425    /**
4426     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
4427     */
4428    bool result_ok;
4429 } LDKCResult_NonePaymentSendFailureZ;
4430
4431 /**
4432  * A dynamically-allocated array of crate::chain::channelmonitor::ChannelMonitors of arbitrary size.
4433  * This corresponds to std::vector in C++
4434  */
4435 typedef struct LDKCVec_ChannelMonitorZ {
4436    /**
4437     * The elements in the array.
4438     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4439     */
4440    struct LDKChannelMonitor *data;
4441    /**
4442     * The number of elements pointed to by `data`.
4443     */
4444    uintptr_t datalen;
4445 } LDKCVec_ChannelMonitorZ;
4446
4447 /**
4448  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
4449  * blocks are connected and disconnected.
4450  *
4451  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
4452  * responsible for maintaining a set of monitors such that they can be updated accordingly as
4453  * channel state changes and HTLCs are resolved. See method documentation for specific
4454  * requirements.
4455  *
4456  * Implementations **must** ensure that updates are successfully applied and persisted upon method
4457  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
4458  * without taking any further action such as persisting the current state.
4459  *
4460  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
4461  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
4462  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
4463  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
4464  * multiple instances.
4465  *
4466  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
4467  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
4468  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
4469  */
4470 typedef struct LDKWatch {
4471    /**
4472     * An opaque pointer which is passed to your function implementations as an argument.
4473     * This has no meaning in the LDK, and can be NULL or any other value.
4474     */
4475    void *this_arg;
4476    /**
4477     * Watches a channel identified by `funding_txo` using `monitor`.
4478     *
4479     * Implementations are responsible for watching the chain for the funding transaction along
4480     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
4481     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
4482     *
4483     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
4484     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
4485     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
4486     */
4487    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
4488    /**
4489     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
4490     *
4491     * Implementations must call [`update_monitor`] with the given update. See
4492     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
4493     *
4494     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
4495     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
4496     */
4497    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
4498    /**
4499     * Returns any monitor events since the last call. Subsequent calls must only return new
4500     * events.
4501     */
4502    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
4503    /**
4504     * Frees any resources associated with this object given its this_arg pointer.
4505     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4506     */
4507    void (*free)(void *this_arg);
4508 } LDKWatch;
4509
4510 /**
4511  * An interface to send a transaction to the Bitcoin network.
4512  */
4513 typedef struct LDKBroadcasterInterface {
4514    /**
4515     * An opaque pointer which is passed to your function implementations as an argument.
4516     * This has no meaning in the LDK, and can be NULL or any other value.
4517     */
4518    void *this_arg;
4519    /**
4520     * Sends a transaction out to (hopefully) be mined.
4521     */
4522    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
4523    /**
4524     * Frees any resources associated with this object given its this_arg pointer.
4525     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4526     */
4527    void (*free)(void *this_arg);
4528 } LDKBroadcasterInterface;
4529
4530 /**
4531  * The contents of CResult_SignDecodeErrorZ
4532  */
4533 typedef union LDKCResult_SignDecodeErrorZPtr {
4534    /**
4535     * A pointer to the contents in the success state.
4536     * Reading from this pointer when `result_ok` is not set is undefined.
4537     */
4538    struct LDKSign *result;
4539    /**
4540     * A pointer to the contents in the error state.
4541     * Reading from this pointer when `result_ok` is set is undefined.
4542     */
4543    struct LDKDecodeError *err;
4544 } LDKCResult_SignDecodeErrorZPtr;
4545
4546 /**
4547  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
4548  * containing a crate::chain::keysinterface::Sign on success and a crate::ln::msgs::DecodeError on failure.
4549  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4550  */
4551 typedef struct LDKCResult_SignDecodeErrorZ {
4552    /**
4553     * The contents of this CResult_SignDecodeErrorZ, accessible via either
4554     * `err` or `result` depending on the state of `result_ok`.
4555     */
4556    union LDKCResult_SignDecodeErrorZPtr contents;
4557    /**
4558     * Whether this CResult_SignDecodeErrorZ represents a success state.
4559     */
4560    bool result_ok;
4561 } LDKCResult_SignDecodeErrorZ;
4562
4563 /**
4564  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
4565  * own the memory pointed to by data.
4566  */
4567 typedef struct LDKu8slice {
4568    /**
4569     * A pointer to the byte buffer
4570     */
4571    const uint8_t *data;
4572    /**
4573     * The number of bytes pointed to by `data`.
4574     */
4575    uintptr_t datalen;
4576 } LDKu8slice;
4577
4578 /**
4579  * A trait to describe an object which can get user secrets and key material.
4580  */
4581 typedef struct LDKKeysInterface {
4582    /**
4583     * An opaque pointer which is passed to your function implementations as an argument.
4584     * This has no meaning in the LDK, and can be NULL or any other value.
4585     */
4586    void *this_arg;
4587    /**
4588     * Get node secret key (aka node_id or network_key).
4589     *
4590     * This method must return the same value each time it is called.
4591     */
4592    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
4593    /**
4594     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
4595     *
4596     * This method should return a different value each time it is called, to avoid linking
4597     * on-chain funds across channels as controlled to the same user.
4598     */
4599    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
4600    /**
4601     * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
4602     * a channel.
4603     *
4604     * This method should return a different value each time it is called, to avoid linking
4605     * on-chain funds across channels as controlled to the same user.
4606     */
4607    struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
4608    /**
4609     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
4610     * restarted with some stale data!
4611     *
4612     * This method must return a different value each time it is called.
4613     */
4614    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
4615    /**
4616     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
4617     * onion packets and for temporary channel IDs. There is no requirement that these be
4618     * persisted anywhere, though they must be unique across restarts.
4619     *
4620     * This method must return a different value each time it is called.
4621     */
4622    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
4623    /**
4624     * Reads a `Signer` for this `KeysInterface` from the given input stream.
4625     * This is only called during deserialization of other objects which contain
4626     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
4627     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
4628     * contain no versioning scheme. You may wish to include your own version prefix and ensure
4629     * you've read all of the provided bytes to ensure no corruption occurred.
4630     */
4631    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
4632    /**
4633     * Frees any resources associated with this object given its this_arg pointer.
4634     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4635     */
4636    void (*free)(void *this_arg);
4637 } LDKKeysInterface;
4638
4639 /**
4640  * A trait which should be implemented to provide feerate information on a number of time
4641  * horizons.
4642  *
4643  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
4644  * called from inside the library in response to chain events, P2P events, or timer events).
4645  */
4646 typedef struct LDKFeeEstimator {
4647    /**
4648     * An opaque pointer which is passed to your function implementations as an argument.
4649     * This has no meaning in the LDK, and can be NULL or any other value.
4650     */
4651    void *this_arg;
4652    /**
4653     * Gets estimated satoshis of fee required per 1000 Weight-Units.
4654     *
4655     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
4656     * don't put us below 1 satoshi-per-byte).
4657     *
4658     * This translates to:
4659     *  * satoshis-per-byte * 250
4660     *  * ceil(satoshis-per-kbyte / 4)
4661     */
4662    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
4663    /**
4664     * Frees any resources associated with this object given its this_arg pointer.
4665     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4666     */
4667    void (*free)(void *this_arg);
4668 } LDKFeeEstimator;
4669
4670 /**
4671  * A trait encapsulating the operations required of a logger
4672  */
4673 typedef struct LDKLogger {
4674    /**
4675     * An opaque pointer which is passed to your function implementations as an argument.
4676     * This has no meaning in the LDK, and can be NULL or any other value.
4677     */
4678    void *this_arg;
4679    /**
4680     * Logs the `Record`
4681     */
4682    void (*log)(const void *this_arg, const char *record);
4683    /**
4684     * Frees any resources associated with this object given its this_arg pointer.
4685     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4686     */
4687    void (*free)(void *this_arg);
4688 } LDKLogger;
4689
4690
4691
4692 /**
4693  * Manager which keeps track of a number of channels and sends messages to the appropriate
4694  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
4695  *
4696  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
4697  * to individual Channels.
4698  *
4699  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
4700  * all peers during write/read (though does not modify this instance, only the instance being
4701  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
4702  * called funding_transaction_generated for outbound channels).
4703  *
4704  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
4705  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
4706  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
4707  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
4708  * the serialization process). If the deserialized version is out-of-date compared to the
4709  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
4710  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
4711  *
4712  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
4713  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
4714  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
4715  * block_connected() to step towards your best block) upon deserialization before using the
4716  * object!
4717  *
4718  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
4719  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
4720  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
4721  * offline for a full minute. In order to track this, you must call
4722  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
4723  *
4724  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
4725  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
4726  * essentially you should default to using a SimpleRefChannelManager, and use a
4727  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
4728  * you're using lightning-net-tokio.
4729  */
4730 typedef struct MUST_USE_STRUCT LDKChannelManager {
4731    /**
4732     * A pointer to the opaque Rust object.
4733     * Nearly everywhere, inner must be non-null, however in places where
4734     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4735     */
4736    LDKnativeChannelManager *inner;
4737    /**
4738     * Indicates that this is the only struct which contains the same pointer.
4739     * Rust functions which take ownership of an object provided via an argument require
4740     * this to be true and invalidate the object pointed to by inner.
4741     */
4742    bool is_owned;
4743 } LDKChannelManager;
4744
4745 /**
4746  * A tuple of 2 elements. See the individual fields for the types contained.
4747  */
4748 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
4749    /**
4750     * The element at position 0
4751     */
4752    struct LDKThirtyTwoBytes a;
4753    /**
4754     * The element at position 1
4755     */
4756    struct LDKChannelManager b;
4757 } LDKC2Tuple_BlockHashChannelManagerZ;
4758
4759 /**
4760  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4761  */
4762 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4763    /**
4764     * A pointer to the contents in the success state.
4765     * Reading from this pointer when `result_ok` is not set is undefined.
4766     */
4767    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
4768    /**
4769     * A pointer to the contents in the error state.
4770     * Reading from this pointer when `result_ok` is set is undefined.
4771     */
4772    struct LDKDecodeError *err;
4773 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
4774
4775 /**
4776  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4777  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::ln::msgs::DecodeError on failure.
4778  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4779  */
4780 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4781    /**
4782     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4783     * `err` or `result` depending on the state of `result_ok`.
4784     */
4785    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
4786    /**
4787     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4788     */
4789    bool result_ok;
4790 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
4791
4792 /**
4793  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4794  */
4795 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
4796    /**
4797     * A pointer to the contents in the success state.
4798     * Reading from this pointer when `result_ok` is not set is undefined.
4799     */
4800    struct LDKSpendableOutputDescriptor *result;
4801    /**
4802     * A pointer to the contents in the error state.
4803     * Reading from this pointer when `result_ok` is set is undefined.
4804     */
4805    struct LDKDecodeError *err;
4806 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
4807
4808 /**
4809  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4810  * containing a crate::chain::keysinterface::SpendableOutputDescriptor on success and a crate::ln::msgs::DecodeError on failure.
4811  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4812  */
4813 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
4814    /**
4815     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4816     * `err` or `result` depending on the state of `result_ok`.
4817     */
4818    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
4819    /**
4820     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4821     */
4822    bool result_ok;
4823 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
4824
4825 /**
4826  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
4827  * This corresponds to std::vector in C++
4828  */
4829 typedef struct LDKCVec_CVec_u8ZZ {
4830    /**
4831     * The elements in the array.
4832     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4833     */
4834    struct LDKCVec_u8Z *data;
4835    /**
4836     * The number of elements pointed to by `data`.
4837     */
4838    uintptr_t datalen;
4839 } LDKCVec_CVec_u8ZZ;
4840
4841 /**
4842  * The contents of CResult_CVec_CVec_u8ZZNoneZ
4843  */
4844 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
4845    /**
4846     * A pointer to the contents in the success state.
4847     * Reading from this pointer when `result_ok` is not set is undefined.
4848     */
4849    struct LDKCVec_CVec_u8ZZ *result;
4850    /**
4851     * Note that this value is always NULL, as there are no contents in the Err variant
4852     */
4853    void *err;
4854 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
4855
4856 /**
4857  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
4858  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
4859  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4860  */
4861 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
4862    /**
4863     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
4864     * `err` or `result` depending on the state of `result_ok`.
4865     */
4866    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
4867    /**
4868     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
4869     */
4870    bool result_ok;
4871 } LDKCResult_CVec_CVec_u8ZZNoneZ;
4872
4873
4874
4875 /**
4876  * A simple implementation of Sign that just keeps the private keys in memory.
4877  *
4878  * This implementation performs no policy checks and is insufficient by itself as
4879  * a secure external signer.
4880  */
4881 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
4882    /**
4883     * A pointer to the opaque Rust object.
4884     * Nearly everywhere, inner must be non-null, however in places where
4885     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4886     */
4887    LDKnativeInMemorySigner *inner;
4888    /**
4889     * Indicates that this is the only struct which contains the same pointer.
4890     * Rust functions which take ownership of an object provided via an argument require
4891     * this to be true and invalidate the object pointed to by inner.
4892     */
4893    bool is_owned;
4894 } LDKInMemorySigner;
4895
4896 /**
4897  * The contents of CResult_InMemorySignerDecodeErrorZ
4898  */
4899 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
4900    /**
4901     * A pointer to the contents in the success state.
4902     * Reading from this pointer when `result_ok` is not set is undefined.
4903     */
4904    struct LDKInMemorySigner *result;
4905    /**
4906     * A pointer to the contents in the error state.
4907     * Reading from this pointer when `result_ok` is set is undefined.
4908     */
4909    struct LDKDecodeError *err;
4910 } LDKCResult_InMemorySignerDecodeErrorZPtr;
4911
4912 /**
4913  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4914  * containing a crate::chain::keysinterface::InMemorySigner on success and a crate::ln::msgs::DecodeError on failure.
4915  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4916  */
4917 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
4918    /**
4919     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4920     * `err` or `result` depending on the state of `result_ok`.
4921     */
4922    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
4923    /**
4924     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4925     */
4926    bool result_ok;
4927 } LDKCResult_InMemorySignerDecodeErrorZ;
4928
4929 /**
4930  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
4931  * This corresponds to std::vector in C++
4932  */
4933 typedef struct LDKCVec_TxOutZ {
4934    /**
4935     * The elements in the array.
4936     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4937     */
4938    struct LDKTxOut *data;
4939    /**
4940     * The number of elements pointed to by `data`.
4941     */
4942    uintptr_t datalen;
4943 } LDKCVec_TxOutZ;
4944
4945 /**
4946  * The contents of CResult_TransactionNoneZ
4947  */
4948 typedef union LDKCResult_TransactionNoneZPtr {
4949    /**
4950     * A pointer to the contents in the success state.
4951     * Reading from this pointer when `result_ok` is not set is undefined.
4952     */
4953    struct LDKTransaction *result;
4954    /**
4955     * Note that this value is always NULL, as there are no contents in the Err variant
4956     */
4957    void *err;
4958 } LDKCResult_TransactionNoneZPtr;
4959
4960 /**
4961  * A CResult_TransactionNoneZ represents the result of a fallible operation,
4962  * containing a crate::c_types::Transaction on success and a () on failure.
4963  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4964  */
4965 typedef struct LDKCResult_TransactionNoneZ {
4966    /**
4967     * The contents of this CResult_TransactionNoneZ, accessible via either
4968     * `err` or `result` depending on the state of `result_ok`.
4969     */
4970    union LDKCResult_TransactionNoneZPtr contents;
4971    /**
4972     * Whether this CResult_TransactionNoneZ represents a success state.
4973     */
4974    bool result_ok;
4975 } LDKCResult_TransactionNoneZ;
4976
4977
4978
4979 /**
4980  * A hop in a route
4981  */
4982 typedef struct MUST_USE_STRUCT LDKRouteHop {
4983    /**
4984     * A pointer to the opaque Rust object.
4985     * Nearly everywhere, inner must be non-null, however in places where
4986     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4987     */
4988    LDKnativeRouteHop *inner;
4989    /**
4990     * Indicates that this is the only struct which contains the same pointer.
4991     * Rust functions which take ownership of an object provided via an argument require
4992     * this to be true and invalidate the object pointed to by inner.
4993     */
4994    bool is_owned;
4995 } LDKRouteHop;
4996
4997 /**
4998  * A dynamically-allocated array of crate::routing::router::RouteHops of arbitrary size.
4999  * This corresponds to std::vector in C++
5000  */
5001 typedef struct LDKCVec_RouteHopZ {
5002    /**
5003     * The elements in the array.
5004     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5005     */
5006    struct LDKRouteHop *data;
5007    /**
5008     * The number of elements pointed to by `data`.
5009     */
5010    uintptr_t datalen;
5011 } LDKCVec_RouteHopZ;
5012
5013 /**
5014  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
5015  * This corresponds to std::vector in C++
5016  */
5017 typedef struct LDKCVec_CVec_RouteHopZZ {
5018    /**
5019     * The elements in the array.
5020     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5021     */
5022    struct LDKCVec_RouteHopZ *data;
5023    /**
5024     * The number of elements pointed to by `data`.
5025     */
5026    uintptr_t datalen;
5027 } LDKCVec_CVec_RouteHopZZ;
5028
5029
5030
5031 /**
5032  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
5033  * it can take multiple paths. Each path is composed of one or more hops through the network.
5034  */
5035 typedef struct MUST_USE_STRUCT LDKRoute {
5036    /**
5037     * A pointer to the opaque Rust object.
5038     * Nearly everywhere, inner must be non-null, however in places where
5039     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5040     */
5041    LDKnativeRoute *inner;
5042    /**
5043     * Indicates that this is the only struct which contains the same pointer.
5044     * Rust functions which take ownership of an object provided via an argument require
5045     * this to be true and invalidate the object pointed to by inner.
5046     */
5047    bool is_owned;
5048 } LDKRoute;
5049
5050 /**
5051  * The contents of CResult_RouteDecodeErrorZ
5052  */
5053 typedef union LDKCResult_RouteDecodeErrorZPtr {
5054    /**
5055     * A pointer to the contents in the success state.
5056     * Reading from this pointer when `result_ok` is not set is undefined.
5057     */
5058    struct LDKRoute *result;
5059    /**
5060     * A pointer to the contents in the error state.
5061     * Reading from this pointer when `result_ok` is set is undefined.
5062     */
5063    struct LDKDecodeError *err;
5064 } LDKCResult_RouteDecodeErrorZPtr;
5065
5066 /**
5067  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
5068  * containing a crate::routing::router::Route on success and a crate::ln::msgs::DecodeError on failure.
5069  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5070  */
5071 typedef struct LDKCResult_RouteDecodeErrorZ {
5072    /**
5073     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
5074     * `err` or `result` depending on the state of `result_ok`.
5075     */
5076    union LDKCResult_RouteDecodeErrorZPtr contents;
5077    /**
5078     * Whether this CResult_RouteDecodeErrorZ represents a success state.
5079     */
5080    bool result_ok;
5081 } LDKCResult_RouteDecodeErrorZ;
5082
5083
5084
5085 /**
5086  * A channel descriptor which provides a last-hop route to get_route
5087  */
5088 typedef struct MUST_USE_STRUCT LDKRouteHint {
5089    /**
5090     * A pointer to the opaque Rust object.
5091     * Nearly everywhere, inner must be non-null, however in places where
5092     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5093     */
5094    LDKnativeRouteHint *inner;
5095    /**
5096     * Indicates that this is the only struct which contains the same pointer.
5097     * Rust functions which take ownership of an object provided via an argument require
5098     * this to be true and invalidate the object pointed to by inner.
5099     */
5100    bool is_owned;
5101 } LDKRouteHint;
5102
5103 /**
5104  * A dynamically-allocated array of crate::routing::router::RouteHints of arbitrary size.
5105  * This corresponds to std::vector in C++
5106  */
5107 typedef struct LDKCVec_RouteHintZ {
5108    /**
5109     * The elements in the array.
5110     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5111     */
5112    struct LDKRouteHint *data;
5113    /**
5114     * The number of elements pointed to by `data`.
5115     */
5116    uintptr_t datalen;
5117 } LDKCVec_RouteHintZ;
5118
5119 /**
5120  * The contents of CResult_RouteLightningErrorZ
5121  */
5122 typedef union LDKCResult_RouteLightningErrorZPtr {
5123    /**
5124     * A pointer to the contents in the success state.
5125     * Reading from this pointer when `result_ok` is not set is undefined.
5126     */
5127    struct LDKRoute *result;
5128    /**
5129     * A pointer to the contents in the error state.
5130     * Reading from this pointer when `result_ok` is set is undefined.
5131     */
5132    struct LDKLightningError *err;
5133 } LDKCResult_RouteLightningErrorZPtr;
5134
5135 /**
5136  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
5137  * containing a crate::routing::router::Route on success and a crate::ln::msgs::LightningError on failure.
5138  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5139  */
5140 typedef struct LDKCResult_RouteLightningErrorZ {
5141    /**
5142     * The contents of this CResult_RouteLightningErrorZ, accessible via either
5143     * `err` or `result` depending on the state of `result_ok`.
5144     */
5145    union LDKCResult_RouteLightningErrorZPtr contents;
5146    /**
5147     * Whether this CResult_RouteLightningErrorZ represents a success state.
5148     */
5149    bool result_ok;
5150 } LDKCResult_RouteLightningErrorZ;
5151
5152 /**
5153  * The contents of CResult_NetAddressu8Z
5154  */
5155 typedef union LDKCResult_NetAddressu8ZPtr {
5156    /**
5157     * A pointer to the contents in the success state.
5158     * Reading from this pointer when `result_ok` is not set is undefined.
5159     */
5160    struct LDKNetAddress *result;
5161    /**
5162     * A pointer to the contents in the error state.
5163     * Reading from this pointer when `result_ok` is set is undefined.
5164     */
5165    uint8_t *err;
5166 } LDKCResult_NetAddressu8ZPtr;
5167
5168 /**
5169  * A CResult_NetAddressu8Z represents the result of a fallible operation,
5170  * containing a crate::ln::msgs::NetAddress on success and a u8 on failure.
5171  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5172  */
5173 typedef struct LDKCResult_NetAddressu8Z {
5174    /**
5175     * The contents of this CResult_NetAddressu8Z, accessible via either
5176     * `err` or `result` depending on the state of `result_ok`.
5177     */
5178    union LDKCResult_NetAddressu8ZPtr contents;
5179    /**
5180     * Whether this CResult_NetAddressu8Z represents a success state.
5181     */
5182    bool result_ok;
5183 } LDKCResult_NetAddressu8Z;
5184
5185 /**
5186  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
5187  */
5188 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5189    /**
5190     * A pointer to the contents in the success state.
5191     * Reading from this pointer when `result_ok` is not set is undefined.
5192     */
5193    struct LDKCResult_NetAddressu8Z *result;
5194    /**
5195     * A pointer to the contents in the error state.
5196     * Reading from this pointer when `result_ok` is set is undefined.
5197     */
5198    struct LDKDecodeError *err;
5199 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
5200
5201 /**
5202  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
5203  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::ln::msgs::DecodeError on failure.
5204  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5205  */
5206 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
5207    /**
5208     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
5209     * `err` or `result` depending on the state of `result_ok`.
5210     */
5211    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
5212    /**
5213     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
5214     */
5215    bool result_ok;
5216 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
5217
5218
5219
5220 /**
5221  * An update_add_htlc message to be sent or received from a peer
5222  */
5223 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
5224    /**
5225     * A pointer to the opaque Rust object.
5226     * Nearly everywhere, inner must be non-null, however in places where
5227     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5228     */
5229    LDKnativeUpdateAddHTLC *inner;
5230    /**
5231     * Indicates that this is the only struct which contains the same pointer.
5232     * Rust functions which take ownership of an object provided via an argument require
5233     * this to be true and invalidate the object pointed to by inner.
5234     */
5235    bool is_owned;
5236 } LDKUpdateAddHTLC;
5237
5238 /**
5239  * A dynamically-allocated array of crate::ln::msgs::UpdateAddHTLCs of arbitrary size.
5240  * This corresponds to std::vector in C++
5241  */
5242 typedef struct LDKCVec_UpdateAddHTLCZ {
5243    /**
5244     * The elements in the array.
5245     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5246     */
5247    struct LDKUpdateAddHTLC *data;
5248    /**
5249     * The number of elements pointed to by `data`.
5250     */
5251    uintptr_t datalen;
5252 } LDKCVec_UpdateAddHTLCZ;
5253
5254
5255
5256 /**
5257  * An update_fulfill_htlc message to be sent or received from a peer
5258  */
5259 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
5260    /**
5261     * A pointer to the opaque Rust object.
5262     * Nearly everywhere, inner must be non-null, however in places where
5263     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5264     */
5265    LDKnativeUpdateFulfillHTLC *inner;
5266    /**
5267     * Indicates that this is the only struct which contains the same pointer.
5268     * Rust functions which take ownership of an object provided via an argument require
5269     * this to be true and invalidate the object pointed to by inner.
5270     */
5271    bool is_owned;
5272 } LDKUpdateFulfillHTLC;
5273
5274 /**
5275  * A dynamically-allocated array of crate::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
5276  * This corresponds to std::vector in C++
5277  */
5278 typedef struct LDKCVec_UpdateFulfillHTLCZ {
5279    /**
5280     * The elements in the array.
5281     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5282     */
5283    struct LDKUpdateFulfillHTLC *data;
5284    /**
5285     * The number of elements pointed to by `data`.
5286     */
5287    uintptr_t datalen;
5288 } LDKCVec_UpdateFulfillHTLCZ;
5289
5290
5291
5292 /**
5293  * An update_fail_htlc message to be sent or received from a peer
5294  */
5295 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
5296    /**
5297     * A pointer to the opaque Rust object.
5298     * Nearly everywhere, inner must be non-null, however in places where
5299     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5300     */
5301    LDKnativeUpdateFailHTLC *inner;
5302    /**
5303     * Indicates that this is the only struct which contains the same pointer.
5304     * Rust functions which take ownership of an object provided via an argument require
5305     * this to be true and invalidate the object pointed to by inner.
5306     */
5307    bool is_owned;
5308 } LDKUpdateFailHTLC;
5309
5310 /**
5311  * A dynamically-allocated array of crate::ln::msgs::UpdateFailHTLCs of arbitrary size.
5312  * This corresponds to std::vector in C++
5313  */
5314 typedef struct LDKCVec_UpdateFailHTLCZ {
5315    /**
5316     * The elements in the array.
5317     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5318     */
5319    struct LDKUpdateFailHTLC *data;
5320    /**
5321     * The number of elements pointed to by `data`.
5322     */
5323    uintptr_t datalen;
5324 } LDKCVec_UpdateFailHTLCZ;
5325
5326
5327
5328 /**
5329  * An update_fail_malformed_htlc message to be sent or received from a peer
5330  */
5331 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
5332    /**
5333     * A pointer to the opaque Rust object.
5334     * Nearly everywhere, inner must be non-null, however in places where
5335     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5336     */
5337    LDKnativeUpdateFailMalformedHTLC *inner;
5338    /**
5339     * Indicates that this is the only struct which contains the same pointer.
5340     * Rust functions which take ownership of an object provided via an argument require
5341     * this to be true and invalidate the object pointed to by inner.
5342     */
5343    bool is_owned;
5344 } LDKUpdateFailMalformedHTLC;
5345
5346 /**
5347  * A dynamically-allocated array of crate::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
5348  * This corresponds to std::vector in C++
5349  */
5350 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
5351    /**
5352     * The elements in the array.
5353     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5354     */
5355    struct LDKUpdateFailMalformedHTLC *data;
5356    /**
5357     * The number of elements pointed to by `data`.
5358     */
5359    uintptr_t datalen;
5360 } LDKCVec_UpdateFailMalformedHTLCZ;
5361
5362 /**
5363  * The contents of CResult_AcceptChannelDecodeErrorZ
5364  */
5365 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
5366    /**
5367     * A pointer to the contents in the success state.
5368     * Reading from this pointer when `result_ok` is not set is undefined.
5369     */
5370    struct LDKAcceptChannel *result;
5371    /**
5372     * A pointer to the contents in the error state.
5373     * Reading from this pointer when `result_ok` is set is undefined.
5374     */
5375    struct LDKDecodeError *err;
5376 } LDKCResult_AcceptChannelDecodeErrorZPtr;
5377
5378 /**
5379  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
5380  * containing a crate::ln::msgs::AcceptChannel on success and a crate::ln::msgs::DecodeError on failure.
5381  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5382  */
5383 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
5384    /**
5385     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
5386     * `err` or `result` depending on the state of `result_ok`.
5387     */
5388    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
5389    /**
5390     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
5391     */
5392    bool result_ok;
5393 } LDKCResult_AcceptChannelDecodeErrorZ;
5394
5395 /**
5396  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
5397  */
5398 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
5399    /**
5400     * A pointer to the contents in the success state.
5401     * Reading from this pointer when `result_ok` is not set is undefined.
5402     */
5403    struct LDKAnnouncementSignatures *result;
5404    /**
5405     * A pointer to the contents in the error state.
5406     * Reading from this pointer when `result_ok` is set is undefined.
5407     */
5408    struct LDKDecodeError *err;
5409 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
5410
5411 /**
5412  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
5413  * containing a crate::ln::msgs::AnnouncementSignatures on success and a crate::ln::msgs::DecodeError on failure.
5414  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5415  */
5416 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
5417    /**
5418     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
5419     * `err` or `result` depending on the state of `result_ok`.
5420     */
5421    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
5422    /**
5423     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
5424     */
5425    bool result_ok;
5426 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
5427
5428 /**
5429  * The contents of CResult_ChannelReestablishDecodeErrorZ
5430  */
5431 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
5432    /**
5433     * A pointer to the contents in the success state.
5434     * Reading from this pointer when `result_ok` is not set is undefined.
5435     */
5436    struct LDKChannelReestablish *result;
5437    /**
5438     * A pointer to the contents in the error state.
5439     * Reading from this pointer when `result_ok` is set is undefined.
5440     */
5441    struct LDKDecodeError *err;
5442 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
5443
5444 /**
5445  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
5446  * containing a crate::ln::msgs::ChannelReestablish on success and a crate::ln::msgs::DecodeError on failure.
5447  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5448  */
5449 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
5450    /**
5451     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
5452     * `err` or `result` depending on the state of `result_ok`.
5453     */
5454    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
5455    /**
5456     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
5457     */
5458    bool result_ok;
5459 } LDKCResult_ChannelReestablishDecodeErrorZ;
5460
5461 /**
5462  * The contents of CResult_ClosingSignedDecodeErrorZ
5463  */
5464 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
5465    /**
5466     * A pointer to the contents in the success state.
5467     * Reading from this pointer when `result_ok` is not set is undefined.
5468     */
5469    struct LDKClosingSigned *result;
5470    /**
5471     * A pointer to the contents in the error state.
5472     * Reading from this pointer when `result_ok` is set is undefined.
5473     */
5474    struct LDKDecodeError *err;
5475 } LDKCResult_ClosingSignedDecodeErrorZPtr;
5476
5477 /**
5478  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
5479  * containing a crate::ln::msgs::ClosingSigned on success and a crate::ln::msgs::DecodeError on failure.
5480  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5481  */
5482 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
5483    /**
5484     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
5485     * `err` or `result` depending on the state of `result_ok`.
5486     */
5487    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
5488    /**
5489     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
5490     */
5491    bool result_ok;
5492 } LDKCResult_ClosingSignedDecodeErrorZ;
5493
5494
5495
5496 /**
5497  * A commitment_signed message to be sent or received from a peer
5498  */
5499 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
5500    /**
5501     * A pointer to the opaque Rust object.
5502     * Nearly everywhere, inner must be non-null, however in places where
5503     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5504     */
5505    LDKnativeCommitmentSigned *inner;
5506    /**
5507     * Indicates that this is the only struct which contains the same pointer.
5508     * Rust functions which take ownership of an object provided via an argument require
5509     * this to be true and invalidate the object pointed to by inner.
5510     */
5511    bool is_owned;
5512 } LDKCommitmentSigned;
5513
5514 /**
5515  * The contents of CResult_CommitmentSignedDecodeErrorZ
5516  */
5517 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
5518    /**
5519     * A pointer to the contents in the success state.
5520     * Reading from this pointer when `result_ok` is not set is undefined.
5521     */
5522    struct LDKCommitmentSigned *result;
5523    /**
5524     * A pointer to the contents in the error state.
5525     * Reading from this pointer when `result_ok` is set is undefined.
5526     */
5527    struct LDKDecodeError *err;
5528 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
5529
5530 /**
5531  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
5532  * containing a crate::ln::msgs::CommitmentSigned on success and a crate::ln::msgs::DecodeError on failure.
5533  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5534  */
5535 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
5536    /**
5537     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
5538     * `err` or `result` depending on the state of `result_ok`.
5539     */
5540    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
5541    /**
5542     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
5543     */
5544    bool result_ok;
5545 } LDKCResult_CommitmentSignedDecodeErrorZ;
5546
5547 /**
5548  * The contents of CResult_FundingCreatedDecodeErrorZ
5549  */
5550 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
5551    /**
5552     * A pointer to the contents in the success state.
5553     * Reading from this pointer when `result_ok` is not set is undefined.
5554     */
5555    struct LDKFundingCreated *result;
5556    /**
5557     * A pointer to the contents in the error state.
5558     * Reading from this pointer when `result_ok` is set is undefined.
5559     */
5560    struct LDKDecodeError *err;
5561 } LDKCResult_FundingCreatedDecodeErrorZPtr;
5562
5563 /**
5564  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
5565  * containing a crate::ln::msgs::FundingCreated on success and a crate::ln::msgs::DecodeError on failure.
5566  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5567  */
5568 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
5569    /**
5570     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
5571     * `err` or `result` depending on the state of `result_ok`.
5572     */
5573    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
5574    /**
5575     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
5576     */
5577    bool result_ok;
5578 } LDKCResult_FundingCreatedDecodeErrorZ;
5579
5580 /**
5581  * The contents of CResult_FundingSignedDecodeErrorZ
5582  */
5583 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
5584    /**
5585     * A pointer to the contents in the success state.
5586     * Reading from this pointer when `result_ok` is not set is undefined.
5587     */
5588    struct LDKFundingSigned *result;
5589    /**
5590     * A pointer to the contents in the error state.
5591     * Reading from this pointer when `result_ok` is set is undefined.
5592     */
5593    struct LDKDecodeError *err;
5594 } LDKCResult_FundingSignedDecodeErrorZPtr;
5595
5596 /**
5597  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
5598  * containing a crate::ln::msgs::FundingSigned on success and a crate::ln::msgs::DecodeError on failure.
5599  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5600  */
5601 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
5602    /**
5603     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
5604     * `err` or `result` depending on the state of `result_ok`.
5605     */
5606    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
5607    /**
5608     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
5609     */
5610    bool result_ok;
5611 } LDKCResult_FundingSignedDecodeErrorZ;
5612
5613 /**
5614  * The contents of CResult_FundingLockedDecodeErrorZ
5615  */
5616 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
5617    /**
5618     * A pointer to the contents in the success state.
5619     * Reading from this pointer when `result_ok` is not set is undefined.
5620     */
5621    struct LDKFundingLocked *result;
5622    /**
5623     * A pointer to the contents in the error state.
5624     * Reading from this pointer when `result_ok` is set is undefined.
5625     */
5626    struct LDKDecodeError *err;
5627 } LDKCResult_FundingLockedDecodeErrorZPtr;
5628
5629 /**
5630  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
5631  * containing a crate::ln::msgs::FundingLocked on success and a crate::ln::msgs::DecodeError on failure.
5632  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5633  */
5634 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
5635    /**
5636     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
5637     * `err` or `result` depending on the state of `result_ok`.
5638     */
5639    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
5640    /**
5641     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
5642     */
5643    bool result_ok;
5644 } LDKCResult_FundingLockedDecodeErrorZ;
5645
5646
5647
5648 /**
5649  * An init message to be sent or received from a peer
5650  */
5651 typedef struct MUST_USE_STRUCT LDKInit {
5652    /**
5653     * A pointer to the opaque Rust object.
5654     * Nearly everywhere, inner must be non-null, however in places where
5655     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5656     */
5657    LDKnativeInit *inner;
5658    /**
5659     * Indicates that this is the only struct which contains the same pointer.
5660     * Rust functions which take ownership of an object provided via an argument require
5661     * this to be true and invalidate the object pointed to by inner.
5662     */
5663    bool is_owned;
5664 } LDKInit;
5665
5666 /**
5667  * The contents of CResult_InitDecodeErrorZ
5668  */
5669 typedef union LDKCResult_InitDecodeErrorZPtr {
5670    /**
5671     * A pointer to the contents in the success state.
5672     * Reading from this pointer when `result_ok` is not set is undefined.
5673     */
5674    struct LDKInit *result;
5675    /**
5676     * A pointer to the contents in the error state.
5677     * Reading from this pointer when `result_ok` is set is undefined.
5678     */
5679    struct LDKDecodeError *err;
5680 } LDKCResult_InitDecodeErrorZPtr;
5681
5682 /**
5683  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
5684  * containing a crate::ln::msgs::Init on success and a crate::ln::msgs::DecodeError on failure.
5685  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5686  */
5687 typedef struct LDKCResult_InitDecodeErrorZ {
5688    /**
5689     * The contents of this CResult_InitDecodeErrorZ, accessible via either
5690     * `err` or `result` depending on the state of `result_ok`.
5691     */
5692    union LDKCResult_InitDecodeErrorZPtr contents;
5693    /**
5694     * Whether this CResult_InitDecodeErrorZ represents a success state.
5695     */
5696    bool result_ok;
5697 } LDKCResult_InitDecodeErrorZ;
5698
5699 /**
5700  * The contents of CResult_OpenChannelDecodeErrorZ
5701  */
5702 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
5703    /**
5704     * A pointer to the contents in the success state.
5705     * Reading from this pointer when `result_ok` is not set is undefined.
5706     */
5707    struct LDKOpenChannel *result;
5708    /**
5709     * A pointer to the contents in the error state.
5710     * Reading from this pointer when `result_ok` is set is undefined.
5711     */
5712    struct LDKDecodeError *err;
5713 } LDKCResult_OpenChannelDecodeErrorZPtr;
5714
5715 /**
5716  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
5717  * containing a crate::ln::msgs::OpenChannel on success and a crate::ln::msgs::DecodeError on failure.
5718  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5719  */
5720 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
5721    /**
5722     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
5723     * `err` or `result` depending on the state of `result_ok`.
5724     */
5725    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
5726    /**
5727     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
5728     */
5729    bool result_ok;
5730 } LDKCResult_OpenChannelDecodeErrorZ;
5731
5732 /**
5733  * The contents of CResult_RevokeAndACKDecodeErrorZ
5734  */
5735 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
5736    /**
5737     * A pointer to the contents in the success state.
5738     * Reading from this pointer when `result_ok` is not set is undefined.
5739     */
5740    struct LDKRevokeAndACK *result;
5741    /**
5742     * A pointer to the contents in the error state.
5743     * Reading from this pointer when `result_ok` is set is undefined.
5744     */
5745    struct LDKDecodeError *err;
5746 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
5747
5748 /**
5749  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
5750  * containing a crate::ln::msgs::RevokeAndACK on success and a crate::ln::msgs::DecodeError on failure.
5751  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5752  */
5753 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
5754    /**
5755     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
5756     * `err` or `result` depending on the state of `result_ok`.
5757     */
5758    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
5759    /**
5760     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
5761     */
5762    bool result_ok;
5763 } LDKCResult_RevokeAndACKDecodeErrorZ;
5764
5765 /**
5766  * The contents of CResult_ShutdownDecodeErrorZ
5767  */
5768 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
5769    /**
5770     * A pointer to the contents in the success state.
5771     * Reading from this pointer when `result_ok` is not set is undefined.
5772     */
5773    struct LDKShutdown *result;
5774    /**
5775     * A pointer to the contents in the error state.
5776     * Reading from this pointer when `result_ok` is set is undefined.
5777     */
5778    struct LDKDecodeError *err;
5779 } LDKCResult_ShutdownDecodeErrorZPtr;
5780
5781 /**
5782  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
5783  * containing a crate::ln::msgs::Shutdown on success and a crate::ln::msgs::DecodeError on failure.
5784  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5785  */
5786 typedef struct LDKCResult_ShutdownDecodeErrorZ {
5787    /**
5788     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
5789     * `err` or `result` depending on the state of `result_ok`.
5790     */
5791    union LDKCResult_ShutdownDecodeErrorZPtr contents;
5792    /**
5793     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
5794     */
5795    bool result_ok;
5796 } LDKCResult_ShutdownDecodeErrorZ;
5797
5798 /**
5799  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
5800  */
5801 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
5802    /**
5803     * A pointer to the contents in the success state.
5804     * Reading from this pointer when `result_ok` is not set is undefined.
5805     */
5806    struct LDKUpdateFailHTLC *result;
5807    /**
5808     * A pointer to the contents in the error state.
5809     * Reading from this pointer when `result_ok` is set is undefined.
5810     */
5811    struct LDKDecodeError *err;
5812 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
5813
5814 /**
5815  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
5816  * containing a crate::ln::msgs::UpdateFailHTLC on success and a crate::ln::msgs::DecodeError on failure.
5817  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5818  */
5819 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
5820    /**
5821     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
5822     * `err` or `result` depending on the state of `result_ok`.
5823     */
5824    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
5825    /**
5826     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
5827     */
5828    bool result_ok;
5829 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
5830
5831 /**
5832  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
5833  */
5834 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5835    /**
5836     * A pointer to the contents in the success state.
5837     * Reading from this pointer when `result_ok` is not set is undefined.
5838     */
5839    struct LDKUpdateFailMalformedHTLC *result;
5840    /**
5841     * A pointer to the contents in the error state.
5842     * Reading from this pointer when `result_ok` is set is undefined.
5843     */
5844    struct LDKDecodeError *err;
5845 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
5846
5847 /**
5848  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
5849  * containing a crate::ln::msgs::UpdateFailMalformedHTLC on success and a crate::ln::msgs::DecodeError on failure.
5850  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5851  */
5852 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
5853    /**
5854     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
5855     * `err` or `result` depending on the state of `result_ok`.
5856     */
5857    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
5858    /**
5859     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
5860     */
5861    bool result_ok;
5862 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
5863
5864
5865
5866 /**
5867  * An update_fee message to be sent or received from a peer
5868  */
5869 typedef struct MUST_USE_STRUCT LDKUpdateFee {
5870    /**
5871     * A pointer to the opaque Rust object.
5872     * Nearly everywhere, inner must be non-null, however in places where
5873     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5874     */
5875    LDKnativeUpdateFee *inner;
5876    /**
5877     * Indicates that this is the only struct which contains the same pointer.
5878     * Rust functions which take ownership of an object provided via an argument require
5879     * this to be true and invalidate the object pointed to by inner.
5880     */
5881    bool is_owned;
5882 } LDKUpdateFee;
5883
5884 /**
5885  * The contents of CResult_UpdateFeeDecodeErrorZ
5886  */
5887 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
5888    /**
5889     * A pointer to the contents in the success state.
5890     * Reading from this pointer when `result_ok` is not set is undefined.
5891     */
5892    struct LDKUpdateFee *result;
5893    /**
5894     * A pointer to the contents in the error state.
5895     * Reading from this pointer when `result_ok` is set is undefined.
5896     */
5897    struct LDKDecodeError *err;
5898 } LDKCResult_UpdateFeeDecodeErrorZPtr;
5899
5900 /**
5901  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
5902  * containing a crate::ln::msgs::UpdateFee on success and a crate::ln::msgs::DecodeError on failure.
5903  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5904  */
5905 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
5906    /**
5907     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
5908     * `err` or `result` depending on the state of `result_ok`.
5909     */
5910    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
5911    /**
5912     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
5913     */
5914    bool result_ok;
5915 } LDKCResult_UpdateFeeDecodeErrorZ;
5916
5917 /**
5918  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
5919  */
5920 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
5921    /**
5922     * A pointer to the contents in the success state.
5923     * Reading from this pointer when `result_ok` is not set is undefined.
5924     */
5925    struct LDKUpdateFulfillHTLC *result;
5926    /**
5927     * A pointer to the contents in the error state.
5928     * Reading from this pointer when `result_ok` is set is undefined.
5929     */
5930    struct LDKDecodeError *err;
5931 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
5932
5933 /**
5934  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
5935  * containing a crate::ln::msgs::UpdateFulfillHTLC on success and a crate::ln::msgs::DecodeError on failure.
5936  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5937  */
5938 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
5939    /**
5940     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
5941     * `err` or `result` depending on the state of `result_ok`.
5942     */
5943    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
5944    /**
5945     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
5946     */
5947    bool result_ok;
5948 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
5949
5950 /**
5951  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
5952  */
5953 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
5954    /**
5955     * A pointer to the contents in the success state.
5956     * Reading from this pointer when `result_ok` is not set is undefined.
5957     */
5958    struct LDKUpdateAddHTLC *result;
5959    /**
5960     * A pointer to the contents in the error state.
5961     * Reading from this pointer when `result_ok` is set is undefined.
5962     */
5963    struct LDKDecodeError *err;
5964 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
5965
5966 /**
5967  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
5968  * containing a crate::ln::msgs::UpdateAddHTLC on success and a crate::ln::msgs::DecodeError on failure.
5969  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5970  */
5971 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
5972    /**
5973     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
5974     * `err` or `result` depending on the state of `result_ok`.
5975     */
5976    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
5977    /**
5978     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
5979     */
5980    bool result_ok;
5981 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
5982
5983
5984
5985 /**
5986  * A ping message to be sent or received from a peer
5987  */
5988 typedef struct MUST_USE_STRUCT LDKPing {
5989    /**
5990     * A pointer to the opaque Rust object.
5991     * Nearly everywhere, inner must be non-null, however in places where
5992     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5993     */
5994    LDKnativePing *inner;
5995    /**
5996     * Indicates that this is the only struct which contains the same pointer.
5997     * Rust functions which take ownership of an object provided via an argument require
5998     * this to be true and invalidate the object pointed to by inner.
5999     */
6000    bool is_owned;
6001 } LDKPing;
6002
6003 /**
6004  * The contents of CResult_PingDecodeErrorZ
6005  */
6006 typedef union LDKCResult_PingDecodeErrorZPtr {
6007    /**
6008     * A pointer to the contents in the success state.
6009     * Reading from this pointer when `result_ok` is not set is undefined.
6010     */
6011    struct LDKPing *result;
6012    /**
6013     * A pointer to the contents in the error state.
6014     * Reading from this pointer when `result_ok` is set is undefined.
6015     */
6016    struct LDKDecodeError *err;
6017 } LDKCResult_PingDecodeErrorZPtr;
6018
6019 /**
6020  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
6021  * containing a crate::ln::msgs::Ping on success and a crate::ln::msgs::DecodeError on failure.
6022  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6023  */
6024 typedef struct LDKCResult_PingDecodeErrorZ {
6025    /**
6026     * The contents of this CResult_PingDecodeErrorZ, accessible via either
6027     * `err` or `result` depending on the state of `result_ok`.
6028     */
6029    union LDKCResult_PingDecodeErrorZPtr contents;
6030    /**
6031     * Whether this CResult_PingDecodeErrorZ represents a success state.
6032     */
6033    bool result_ok;
6034 } LDKCResult_PingDecodeErrorZ;
6035
6036
6037
6038 /**
6039  * A pong message to be sent or received from a peer
6040  */
6041 typedef struct MUST_USE_STRUCT LDKPong {
6042    /**
6043     * A pointer to the opaque Rust object.
6044     * Nearly everywhere, inner must be non-null, however in places where
6045     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6046     */
6047    LDKnativePong *inner;
6048    /**
6049     * Indicates that this is the only struct which contains the same pointer.
6050     * Rust functions which take ownership of an object provided via an argument require
6051     * this to be true and invalidate the object pointed to by inner.
6052     */
6053    bool is_owned;
6054 } LDKPong;
6055
6056 /**
6057  * The contents of CResult_PongDecodeErrorZ
6058  */
6059 typedef union LDKCResult_PongDecodeErrorZPtr {
6060    /**
6061     * A pointer to the contents in the success state.
6062     * Reading from this pointer when `result_ok` is not set is undefined.
6063     */
6064    struct LDKPong *result;
6065    /**
6066     * A pointer to the contents in the error state.
6067     * Reading from this pointer when `result_ok` is set is undefined.
6068     */
6069    struct LDKDecodeError *err;
6070 } LDKCResult_PongDecodeErrorZPtr;
6071
6072 /**
6073  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
6074  * containing a crate::ln::msgs::Pong on success and a crate::ln::msgs::DecodeError on failure.
6075  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6076  */
6077 typedef struct LDKCResult_PongDecodeErrorZ {
6078    /**
6079     * The contents of this CResult_PongDecodeErrorZ, accessible via either
6080     * `err` or `result` depending on the state of `result_ok`.
6081     */
6082    union LDKCResult_PongDecodeErrorZPtr contents;
6083    /**
6084     * Whether this CResult_PongDecodeErrorZ represents a success state.
6085     */
6086    bool result_ok;
6087 } LDKCResult_PongDecodeErrorZ;
6088
6089 /**
6090  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
6091  */
6092 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6093    /**
6094     * A pointer to the contents in the success state.
6095     * Reading from this pointer when `result_ok` is not set is undefined.
6096     */
6097    struct LDKUnsignedChannelAnnouncement *result;
6098    /**
6099     * A pointer to the contents in the error state.
6100     * Reading from this pointer when `result_ok` is set is undefined.
6101     */
6102    struct LDKDecodeError *err;
6103 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
6104
6105 /**
6106  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6107  * containing a crate::ln::msgs::UnsignedChannelAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
6108  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6109  */
6110 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
6111    /**
6112     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
6113     * `err` or `result` depending on the state of `result_ok`.
6114     */
6115    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
6116    /**
6117     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
6118     */
6119    bool result_ok;
6120 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
6121
6122 /**
6123  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
6124  */
6125 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
6126    /**
6127     * A pointer to the contents in the success state.
6128     * Reading from this pointer when `result_ok` is not set is undefined.
6129     */
6130    struct LDKChannelAnnouncement *result;
6131    /**
6132     * A pointer to the contents in the error state.
6133     * Reading from this pointer when `result_ok` is set is undefined.
6134     */
6135    struct LDKDecodeError *err;
6136 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
6137
6138 /**
6139  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6140  * containing a crate::ln::msgs::ChannelAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
6141  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6142  */
6143 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
6144    /**
6145     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
6146     * `err` or `result` depending on the state of `result_ok`.
6147     */
6148    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
6149    /**
6150     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
6151     */
6152    bool result_ok;
6153 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
6154
6155
6156
6157 /**
6158  * The unsigned part of a channel_update
6159  */
6160 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
6161    /**
6162     * A pointer to the opaque Rust object.
6163     * Nearly everywhere, inner must be non-null, however in places where
6164     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6165     */
6166    LDKnativeUnsignedChannelUpdate *inner;
6167    /**
6168     * Indicates that this is the only struct which contains the same pointer.
6169     * Rust functions which take ownership of an object provided via an argument require
6170     * this to be true and invalidate the object pointed to by inner.
6171     */
6172    bool is_owned;
6173 } LDKUnsignedChannelUpdate;
6174
6175 /**
6176  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
6177  */
6178 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
6179    /**
6180     * A pointer to the contents in the success state.
6181     * Reading from this pointer when `result_ok` is not set is undefined.
6182     */
6183    struct LDKUnsignedChannelUpdate *result;
6184    /**
6185     * A pointer to the contents in the error state.
6186     * Reading from this pointer when `result_ok` is set is undefined.
6187     */
6188    struct LDKDecodeError *err;
6189 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
6190
6191 /**
6192  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6193  * containing a crate::ln::msgs::UnsignedChannelUpdate on success and a crate::ln::msgs::DecodeError on failure.
6194  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6195  */
6196 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
6197    /**
6198     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
6199     * `err` or `result` depending on the state of `result_ok`.
6200     */
6201    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
6202    /**
6203     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
6204     */
6205    bool result_ok;
6206 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
6207
6208 /**
6209  * The contents of CResult_ChannelUpdateDecodeErrorZ
6210  */
6211 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
6212    /**
6213     * A pointer to the contents in the success state.
6214     * Reading from this pointer when `result_ok` is not set is undefined.
6215     */
6216    struct LDKChannelUpdate *result;
6217    /**
6218     * A pointer to the contents in the error state.
6219     * Reading from this pointer when `result_ok` is set is undefined.
6220     */
6221    struct LDKDecodeError *err;
6222 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
6223
6224 /**
6225  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6226  * containing a crate::ln::msgs::ChannelUpdate on success and a crate::ln::msgs::DecodeError on failure.
6227  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6228  */
6229 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
6230    /**
6231     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
6232     * `err` or `result` depending on the state of `result_ok`.
6233     */
6234    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
6235    /**
6236     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
6237     */
6238    bool result_ok;
6239 } LDKCResult_ChannelUpdateDecodeErrorZ;
6240
6241 /**
6242  * The contents of CResult_ErrorMessageDecodeErrorZ
6243  */
6244 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
6245    /**
6246     * A pointer to the contents in the success state.
6247     * Reading from this pointer when `result_ok` is not set is undefined.
6248     */
6249    struct LDKErrorMessage *result;
6250    /**
6251     * A pointer to the contents in the error state.
6252     * Reading from this pointer when `result_ok` is set is undefined.
6253     */
6254    struct LDKDecodeError *err;
6255 } LDKCResult_ErrorMessageDecodeErrorZPtr;
6256
6257 /**
6258  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
6259  * containing a crate::ln::msgs::ErrorMessage on success and a crate::ln::msgs::DecodeError on failure.
6260  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6261  */
6262 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
6263    /**
6264     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
6265     * `err` or `result` depending on the state of `result_ok`.
6266     */
6267    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
6268    /**
6269     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
6270     */
6271    bool result_ok;
6272 } LDKCResult_ErrorMessageDecodeErrorZ;
6273
6274
6275
6276 /**
6277  * The unsigned part of a node_announcement
6278  */
6279 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
6280    /**
6281     * A pointer to the opaque Rust object.
6282     * Nearly everywhere, inner must be non-null, however in places where
6283     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6284     */
6285    LDKnativeUnsignedNodeAnnouncement *inner;
6286    /**
6287     * Indicates that this is the only struct which contains the same pointer.
6288     * Rust functions which take ownership of an object provided via an argument require
6289     * this to be true and invalidate the object pointed to by inner.
6290     */
6291    bool is_owned;
6292 } LDKUnsignedNodeAnnouncement;
6293
6294 /**
6295  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
6296  */
6297 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6298    /**
6299     * A pointer to the contents in the success state.
6300     * Reading from this pointer when `result_ok` is not set is undefined.
6301     */
6302    struct LDKUnsignedNodeAnnouncement *result;
6303    /**
6304     * A pointer to the contents in the error state.
6305     * Reading from this pointer when `result_ok` is set is undefined.
6306     */
6307    struct LDKDecodeError *err;
6308 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
6309
6310 /**
6311  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
6312  * containing a crate::ln::msgs::UnsignedNodeAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
6313  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6314  */
6315 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
6316    /**
6317     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
6318     * `err` or `result` depending on the state of `result_ok`.
6319     */
6320    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
6321    /**
6322     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
6323     */
6324    bool result_ok;
6325 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
6326
6327 /**
6328  * The contents of CResult_NodeAnnouncementDecodeErrorZ
6329  */
6330 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
6331    /**
6332     * A pointer to the contents in the success state.
6333     * Reading from this pointer when `result_ok` is not set is undefined.
6334     */
6335    struct LDKNodeAnnouncement *result;
6336    /**
6337     * A pointer to the contents in the error state.
6338     * Reading from this pointer when `result_ok` is set is undefined.
6339     */
6340    struct LDKDecodeError *err;
6341 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
6342
6343 /**
6344  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
6345  * containing a crate::ln::msgs::NodeAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
6346  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6347  */
6348 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
6349    /**
6350     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
6351     * `err` or `result` depending on the state of `result_ok`.
6352     */
6353    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
6354    /**
6355     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
6356     */
6357    bool result_ok;
6358 } LDKCResult_NodeAnnouncementDecodeErrorZ;
6359
6360 /**
6361  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
6362  */
6363 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
6364    /**
6365     * A pointer to the contents in the success state.
6366     * Reading from this pointer when `result_ok` is not set is undefined.
6367     */
6368    struct LDKQueryShortChannelIds *result;
6369    /**
6370     * A pointer to the contents in the error state.
6371     * Reading from this pointer when `result_ok` is set is undefined.
6372     */
6373    struct LDKDecodeError *err;
6374 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
6375
6376 /**
6377  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
6378  * containing a crate::ln::msgs::QueryShortChannelIds on success and a crate::ln::msgs::DecodeError on failure.
6379  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6380  */
6381 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
6382    /**
6383     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
6384     * `err` or `result` depending on the state of `result_ok`.
6385     */
6386    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
6387    /**
6388     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
6389     */
6390    bool result_ok;
6391 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
6392
6393
6394
6395 /**
6396  * A reply_short_channel_ids_end message is sent as a reply to a
6397  * query_short_channel_ids message. The query recipient makes a best
6398  * effort to respond based on their local network view which may not be
6399  * a perfect view of the network.
6400  */
6401 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
6402    /**
6403     * A pointer to the opaque Rust object.
6404     * Nearly everywhere, inner must be non-null, however in places where
6405     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6406     */
6407    LDKnativeReplyShortChannelIdsEnd *inner;
6408    /**
6409     * Indicates that this is the only struct which contains the same pointer.
6410     * Rust functions which take ownership of an object provided via an argument require
6411     * this to be true and invalidate the object pointed to by inner.
6412     */
6413    bool is_owned;
6414 } LDKReplyShortChannelIdsEnd;
6415
6416 /**
6417  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
6418  */
6419 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6420    /**
6421     * A pointer to the contents in the success state.
6422     * Reading from this pointer when `result_ok` is not set is undefined.
6423     */
6424    struct LDKReplyShortChannelIdsEnd *result;
6425    /**
6426     * A pointer to the contents in the error state.
6427     * Reading from this pointer when `result_ok` is set is undefined.
6428     */
6429    struct LDKDecodeError *err;
6430 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
6431
6432 /**
6433  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
6434  * containing a crate::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::ln::msgs::DecodeError on failure.
6435  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6436  */
6437 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
6438    /**
6439     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
6440     * `err` or `result` depending on the state of `result_ok`.
6441     */
6442    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
6443    /**
6444     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
6445     */
6446    bool result_ok;
6447 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
6448
6449 /**
6450  * The contents of CResult_QueryChannelRangeDecodeErrorZ
6451  */
6452 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
6453    /**
6454     * A pointer to the contents in the success state.
6455     * Reading from this pointer when `result_ok` is not set is undefined.
6456     */
6457    struct LDKQueryChannelRange *result;
6458    /**
6459     * A pointer to the contents in the error state.
6460     * Reading from this pointer when `result_ok` is set is undefined.
6461     */
6462    struct LDKDecodeError *err;
6463 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
6464
6465 /**
6466  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
6467  * containing a crate::ln::msgs::QueryChannelRange on success and a crate::ln::msgs::DecodeError on failure.
6468  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6469  */
6470 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
6471    /**
6472     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
6473     * `err` or `result` depending on the state of `result_ok`.
6474     */
6475    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
6476    /**
6477     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
6478     */
6479    bool result_ok;
6480 } LDKCResult_QueryChannelRangeDecodeErrorZ;
6481
6482 /**
6483  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
6484  */
6485 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
6486    /**
6487     * A pointer to the contents in the success state.
6488     * Reading from this pointer when `result_ok` is not set is undefined.
6489     */
6490    struct LDKReplyChannelRange *result;
6491    /**
6492     * A pointer to the contents in the error state.
6493     * Reading from this pointer when `result_ok` is set is undefined.
6494     */
6495    struct LDKDecodeError *err;
6496 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
6497
6498 /**
6499  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
6500  * containing a crate::ln::msgs::ReplyChannelRange on success and a crate::ln::msgs::DecodeError on failure.
6501  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6502  */
6503 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
6504    /**
6505     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
6506     * `err` or `result` depending on the state of `result_ok`.
6507     */
6508    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
6509    /**
6510     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
6511     */
6512    bool result_ok;
6513 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
6514
6515
6516
6517 /**
6518  * A gossip_timestamp_filter message is used by a node to request
6519  * gossip relay for messages in the requested time range when the
6520  * gossip_queries feature has been negotiated.
6521  */
6522 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
6523    /**
6524     * A pointer to the opaque Rust object.
6525     * Nearly everywhere, inner must be non-null, however in places where
6526     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6527     */
6528    LDKnativeGossipTimestampFilter *inner;
6529    /**
6530     * Indicates that this is the only struct which contains the same pointer.
6531     * Rust functions which take ownership of an object provided via an argument require
6532     * this to be true and invalidate the object pointed to by inner.
6533     */
6534    bool is_owned;
6535 } LDKGossipTimestampFilter;
6536
6537 /**
6538  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
6539  */
6540 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
6541    /**
6542     * A pointer to the contents in the success state.
6543     * Reading from this pointer when `result_ok` is not set is undefined.
6544     */
6545    struct LDKGossipTimestampFilter *result;
6546    /**
6547     * A pointer to the contents in the error state.
6548     * Reading from this pointer when `result_ok` is set is undefined.
6549     */
6550    struct LDKDecodeError *err;
6551 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
6552
6553 /**
6554  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
6555  * containing a crate::ln::msgs::GossipTimestampFilter on success and a crate::ln::msgs::DecodeError on failure.
6556  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6557  */
6558 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
6559    /**
6560     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
6561     * `err` or `result` depending on the state of `result_ok`.
6562     */
6563    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
6564    /**
6565     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
6566     */
6567    bool result_ok;
6568 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
6569
6570 /**
6571  * A trait indicating an object may generate message send events
6572  */
6573 typedef struct LDKMessageSendEventsProvider {
6574    /**
6575     * An opaque pointer which is passed to your function implementations as an argument.
6576     * This has no meaning in the LDK, and can be NULL or any other value.
6577     */
6578    void *this_arg;
6579    /**
6580     * Gets the list of pending events which were generated by previous actions, clearing the list
6581     * in the process.
6582     */
6583    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
6584    /**
6585     * Frees any resources associated with this object given its this_arg pointer.
6586     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6587     */
6588    void (*free)(void *this_arg);
6589 } LDKMessageSendEventsProvider;
6590
6591 /**
6592  * A trait indicating an object may generate events
6593  */
6594 typedef struct LDKEventsProvider {
6595    /**
6596     * An opaque pointer which is passed to your function implementations as an argument.
6597     * This has no meaning in the LDK, and can be NULL or any other value.
6598     */
6599    void *this_arg;
6600    /**
6601     * Gets the list of pending events which were generated by previous actions, clearing the list
6602     * in the process.
6603     */
6604    struct LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
6605    /**
6606     * Frees any resources associated with this object given its this_arg pointer.
6607     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6608     */
6609    void (*free)(void *this_arg);
6610 } LDKEventsProvider;
6611
6612
6613
6614 /**
6615  * Configuration we set when applicable.
6616  *
6617  * Default::default() provides sane defaults.
6618  */
6619 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
6620    /**
6621     * A pointer to the opaque Rust object.
6622     * Nearly everywhere, inner must be non-null, however in places where
6623     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6624     */
6625    LDKnativeChannelHandshakeConfig *inner;
6626    /**
6627     * Indicates that this is the only struct which contains the same pointer.
6628     * Rust functions which take ownership of an object provided via an argument require
6629     * this to be true and invalidate the object pointed to by inner.
6630     */
6631    bool is_owned;
6632 } LDKChannelHandshakeConfig;
6633
6634
6635
6636 /**
6637  * Optional channel limits which are applied during channel creation.
6638  *
6639  * These limits are only applied to our counterparty's limits, not our own.
6640  *
6641  * Use 0/<type>::max_value() as appropriate to skip checking.
6642  *
6643  * Provides sane defaults for most configurations.
6644  *
6645  * Most additional limits are disabled except those with which specify a default in individual
6646  * field documentation. Note that this may result in barely-usable channels, but since they
6647  * are applied mostly only to incoming channels that's not much of a problem.
6648  */
6649 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
6650    /**
6651     * A pointer to the opaque Rust object.
6652     * Nearly everywhere, inner must be non-null, however in places where
6653     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6654     */
6655    LDKnativeChannelHandshakeLimits *inner;
6656    /**
6657     * Indicates that this is the only struct which contains the same pointer.
6658     * Rust functions which take ownership of an object provided via an argument require
6659     * this to be true and invalidate the object pointed to by inner.
6660     */
6661    bool is_owned;
6662 } LDKChannelHandshakeLimits;
6663
6664
6665
6666 /**
6667  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
6668  *
6669  * Default::default() provides sane defaults for most configurations
6670  * (but currently with 0 relay fees!)
6671  */
6672 typedef struct MUST_USE_STRUCT LDKUserConfig {
6673    /**
6674     * A pointer to the opaque Rust object.
6675     * Nearly everywhere, inner must be non-null, however in places where
6676     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6677     */
6678    LDKnativeUserConfig *inner;
6679    /**
6680     * Indicates that this is the only struct which contains the same pointer.
6681     * Rust functions which take ownership of an object provided via an argument require
6682     * this to be true and invalidate the object pointed to by inner.
6683     */
6684    bool is_owned;
6685 } LDKUserConfig;
6686
6687 /**
6688  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
6689  * UTXOs.
6690  */
6691 typedef struct LDKAccess {
6692    /**
6693     * An opaque pointer which is passed to your function implementations as an argument.
6694     * This has no meaning in the LDK, and can be NULL or any other value.
6695     */
6696    void *this_arg;
6697    /**
6698     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
6699     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
6700     * is unknown.
6701     *
6702     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
6703     */
6704    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
6705    /**
6706     * Frees any resources associated with this object given its this_arg pointer.
6707     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6708     */
6709    void (*free)(void *this_arg);
6710 } LDKAccess;
6711
6712 /**
6713  * The `Listen` trait is used to be notified of when blocks have been connected or disconnected
6714  * from the chain.
6715  *
6716  * Useful when needing to replay chain data upon startup or as new chain events occur.
6717  */
6718 typedef struct LDKListen {
6719    /**
6720     * An opaque pointer which is passed to your function implementations as an argument.
6721     * This has no meaning in the LDK, and can be NULL or any other value.
6722     */
6723    void *this_arg;
6724    /**
6725     * Notifies the listener that a block was added at the given height.
6726     */
6727    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
6728    /**
6729     * Notifies the listener that a block was removed at the given height.
6730     */
6731    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
6732    /**
6733     * Frees any resources associated with this object given its this_arg pointer.
6734     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6735     */
6736    void (*free)(void *this_arg);
6737 } LDKListen;
6738
6739
6740
6741 /**
6742  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
6743  *
6744  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
6745  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
6746  * the return value of [`Filter::register_output`].
6747  *
6748  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
6749  * may have been spent there. See [`Filter::register_output`] for details.
6750  *
6751  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
6752  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
6753  */
6754 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
6755    /**
6756     * A pointer to the opaque Rust object.
6757     * Nearly everywhere, inner must be non-null, however in places where
6758     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6759     */
6760    LDKnativeWatchedOutput *inner;
6761    /**
6762     * Indicates that this is the only struct which contains the same pointer.
6763     * Rust functions which take ownership of an object provided via an argument require
6764     * this to be true and invalidate the object pointed to by inner.
6765     */
6766    bool is_owned;
6767 } LDKWatchedOutput;
6768
6769 /**
6770  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
6771  * channels.
6772  *
6773  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
6774  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
6775  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
6776  * receiving full blocks from a chain source, any further filtering is unnecessary.
6777  *
6778  * After an output has been registered, subsequent block retrievals from the chain source must not
6779  * exclude any transactions matching the new criteria nor any in-block descendants of such
6780  * transactions.
6781  *
6782  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
6783  * should not block on I/O. Implementations should instead queue the newly monitored data to be
6784  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
6785  * invocation that has called the `Filter` must return [`TemporaryFailure`].
6786  *
6787  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
6788  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
6789  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
6790  */
6791 typedef struct LDKFilter {
6792    /**
6793     * An opaque pointer which is passed to your function implementations as an argument.
6794     * This has no meaning in the LDK, and can be NULL or any other value.
6795     */
6796    void *this_arg;
6797    /**
6798     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
6799     * a spending condition.
6800     */
6801    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
6802    /**
6803     * Registers interest in spends of a transaction output.
6804     *
6805     * Optionally, when `output.block_hash` is set, should return any transaction spending the
6806     * output that is found in the corresponding block along with its index.
6807     *
6808     * This return value is useful for Electrum clients in order to supply in-block descendant
6809     * transactions which otherwise were not included. This is not necessary for other clients if
6810     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
6811     * full block).
6812     */
6813    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
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 } LDKFilter;
6820
6821 /**
6822  * `Persist` defines behavior for persisting channel monitors: this could mean
6823  * writing once to disk, and/or uploading to one or more backup services.
6824  *
6825  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
6826  * to disk/backups. And, on every update, you **must** persist either the
6827  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
6828  * of situations such as revoking a transaction, then crashing before this
6829  * revocation can be persisted, then unintentionally broadcasting a revoked
6830  * transaction and losing money. This is a risk because previous channel states
6831  * are toxic, so it's important that whatever channel state is persisted is
6832  * kept up-to-date.
6833  */
6834 typedef struct LDKPersist {
6835    /**
6836     * An opaque pointer which is passed to your function implementations as an argument.
6837     * This has no meaning in the LDK, and can be NULL or any other value.
6838     */
6839    void *this_arg;
6840    /**
6841     * Persist a new channel's data. The data can be stored any way you want, but
6842     * the identifier provided by Rust-Lightning is the channel's outpoint (and
6843     * it is up to you to maintain a correct mapping between the outpoint and the
6844     * stored channel data). Note that you **must** persist every new monitor to
6845     * disk. See the `Persist` trait documentation for more details.
6846     *
6847     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
6848     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
6849     */
6850    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
6851    /**
6852     * Update one channel's data. The provided `ChannelMonitor` has already
6853     * applied the given update.
6854     *
6855     * Note that on every update, you **must** persist either the
6856     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
6857     * the `Persist` trait documentation for more details.
6858     *
6859     * If an implementer chooses to persist the updates only, they need to make
6860     * sure that all the updates are applied to the `ChannelMonitors` *before*
6861     * the set of channel monitors is given to the `ChannelManager`
6862     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
6863     * applying a monitor update to a monitor. If full `ChannelMonitors` are
6864     * persisted, then there is no need to persist individual updates.
6865     *
6866     * Note that there could be a performance tradeoff between persisting complete
6867     * channel monitors on every update vs. persisting only updates and applying
6868     * them in batches. The size of each monitor grows `O(number of state updates)`
6869     * whereas updates are small and `O(1)`.
6870     *
6871     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
6872     * [`ChannelMonitorUpdate::write`] for writing out an update, and
6873     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
6874     */
6875    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);
6876    /**
6877     * Frees any resources associated with this object given its this_arg pointer.
6878     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6879     */
6880    void (*free)(void *this_arg);
6881 } LDKPersist;
6882
6883
6884
6885 /**
6886  * An implementation of [`chain::Watch`] for monitoring channels.
6887  *
6888  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
6889  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
6890  * or used independently to monitor channels remotely. See the [module-level documentation] for
6891  * details.
6892  *
6893  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
6894  * [module-level documentation]: crate::chain::chainmonitor
6895  */
6896 typedef struct MUST_USE_STRUCT LDKChainMonitor {
6897    /**
6898     * A pointer to the opaque Rust object.
6899     * Nearly everywhere, inner must be non-null, however in places where
6900     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6901     */
6902    LDKnativeChainMonitor *inner;
6903    /**
6904     * Indicates that this is the only struct which contains the same pointer.
6905     * Rust functions which take ownership of an object provided via an argument require
6906     * this to be true and invalidate the object pointed to by inner.
6907     */
6908    bool is_owned;
6909 } LDKChainMonitor;
6910
6911
6912
6913 /**
6914  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
6915  * and derives keys from that.
6916  *
6917  * Your node_id is seed/0'
6918  * ChannelMonitor closes may use seed/1'
6919  * Cooperative closes may use seed/2'
6920  * The two close keys may be needed to claim on-chain funds!
6921  */
6922 typedef struct MUST_USE_STRUCT LDKKeysManager {
6923    /**
6924     * A pointer to the opaque Rust object.
6925     * Nearly everywhere, inner must be non-null, however in places where
6926     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6927     */
6928    LDKnativeKeysManager *inner;
6929    /**
6930     * Indicates that this is the only struct which contains the same pointer.
6931     * Rust functions which take ownership of an object provided via an argument require
6932     * this to be true and invalidate the object pointed to by inner.
6933     */
6934    bool is_owned;
6935 } LDKKeysManager;
6936
6937
6938
6939 /**
6940  * Chain-related parameters used to construct a new `ChannelManager`.
6941  *
6942  * Typically, the block-specific parameters are derived from the best block hash for the network,
6943  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
6944  * are not needed when deserializing a previously constructed `ChannelManager`.
6945  */
6946 typedef struct MUST_USE_STRUCT LDKChainParameters {
6947    /**
6948     * A pointer to the opaque Rust object.
6949     * Nearly everywhere, inner must be non-null, however in places where
6950     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6951     */
6952    LDKnativeChainParameters *inner;
6953    /**
6954     * Indicates that this is the only struct which contains the same pointer.
6955     * Rust functions which take ownership of an object provided via an argument require
6956     * this to be true and invalidate the object pointed to by inner.
6957     */
6958    bool is_owned;
6959 } LDKChainParameters;
6960
6961
6962
6963 /**
6964  * The best known block as identified by its hash and height.
6965  */
6966 typedef struct MUST_USE_STRUCT LDKBestBlock {
6967    /**
6968     * A pointer to the opaque Rust object.
6969     * Nearly everywhere, inner must be non-null, however in places where
6970     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6971     */
6972    LDKnativeBestBlock *inner;
6973    /**
6974     * Indicates that this is the only struct which contains the same pointer.
6975     * Rust functions which take ownership of an object provided via an argument require
6976     * this to be true and invalidate the object pointed to by inner.
6977     */
6978    bool is_owned;
6979 } LDKBestBlock;
6980
6981 /**
6982  * A 3-byte byte array.
6983  */
6984 typedef struct LDKThreeBytes {
6985    /**
6986     * The three bytes
6987     */
6988    uint8_t data[3];
6989 } LDKThreeBytes;
6990
6991 /**
6992  * A trait to describe an object which can receive channel messages.
6993  *
6994  * Messages MAY be called in parallel when they originate from different their_node_ids, however
6995  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
6996  */
6997 typedef struct LDKChannelMessageHandler {
6998    /**
6999     * An opaque pointer which is passed to your function implementations as an argument.
7000     * This has no meaning in the LDK, and can be NULL or any other value.
7001     */
7002    void *this_arg;
7003    /**
7004     * Handle an incoming open_channel message from the given peer.
7005     */
7006    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
7007    /**
7008     * Handle an incoming accept_channel message from the given peer.
7009     */
7010    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
7011    /**
7012     * Handle an incoming funding_created message from the given peer.
7013     */
7014    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
7015    /**
7016     * Handle an incoming funding_signed message from the given peer.
7017     */
7018    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
7019    /**
7020     * Handle an incoming funding_locked message from the given peer.
7021     */
7022    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
7023    /**
7024     * Handle an incoming shutdown message from the given peer.
7025     */
7026    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);
7027    /**
7028     * Handle an incoming closing_signed message from the given peer.
7029     */
7030    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
7031    /**
7032     * Handle an incoming update_add_htlc message from the given peer.
7033     */
7034    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
7035    /**
7036     * Handle an incoming update_fulfill_htlc message from the given peer.
7037     */
7038    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
7039    /**
7040     * Handle an incoming update_fail_htlc message from the given peer.
7041     */
7042    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
7043    /**
7044     * Handle an incoming update_fail_malformed_htlc message from the given peer.
7045     */
7046    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
7047    /**
7048     * Handle an incoming commitment_signed message from the given peer.
7049     */
7050    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
7051    /**
7052     * Handle an incoming revoke_and_ack message from the given peer.
7053     */
7054    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
7055    /**
7056     * Handle an incoming update_fee message from the given peer.
7057     */
7058    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
7059    /**
7060     * Handle an incoming announcement_signatures message from the given peer.
7061     */
7062    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
7063    /**
7064     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
7065     * is believed to be possible in the future (eg they're sending us messages we don't
7066     * understand or indicate they require unknown feature bits), no_connection_possible is set
7067     * and any outstanding channels should be failed.
7068     */
7069    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
7070    /**
7071     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
7072     */
7073    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
7074    /**
7075     * Handle an incoming channel_reestablish message from the given peer.
7076     */
7077    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
7078    /**
7079     * Handle an incoming channel update from the given peer.
7080     */
7081    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
7082    /**
7083     * Handle an incoming error message from the given peer.
7084     */
7085    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
7086    /**
7087     * Implementation of MessageSendEventsProvider for this object.
7088     */
7089    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
7090    /**
7091     * Frees any resources associated with this object given its this_arg pointer.
7092     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7093     */
7094    void (*free)(void *this_arg);
7095 } LDKChannelMessageHandler;
7096
7097
7098
7099 /**
7100  * Arguments for the creation of a ChannelManager that are not deserialized.
7101  *
7102  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
7103  * is:
7104  * 1) Deserialize all stored ChannelMonitors.
7105  * 2) Deserialize the ChannelManager by filling in this struct and calling:
7106  *    <(BlockHash, ChannelManager)>::read(reader, args)
7107  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
7108  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
7109  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
7110  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
7111  *    ChannelMonitor::get_funding_txo().
7112  * 4) Reconnect blocks on your ChannelMonitors.
7113  * 5) Disconnect/connect blocks on the ChannelManager.
7114  * 6) Move the ChannelMonitors into your local chain::Watch.
7115  *
7116  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
7117  * call any other methods on the newly-deserialized ChannelManager.
7118  *
7119  * Note that because some channels may be closed during deserialization, it is critical that you
7120  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
7121  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
7122  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
7123  * not force-close the same channels but consider them live), you may end up revoking a state for
7124  * which you've already broadcasted the transaction.
7125  */
7126 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
7127    /**
7128     * A pointer to the opaque Rust object.
7129     * Nearly everywhere, inner must be non-null, however in places where
7130     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7131     */
7132    LDKnativeChannelManagerReadArgs *inner;
7133    /**
7134     * Indicates that this is the only struct which contains the same pointer.
7135     * Rust functions which take ownership of an object provided via an argument require
7136     * this to be true and invalidate the object pointed to by inner.
7137     */
7138    bool is_owned;
7139 } LDKChannelManagerReadArgs;
7140
7141
7142
7143 /**
7144  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
7145  * This is used to convince the recipient that the channel is at a certain commitment
7146  * number even if they lost that data due to a local failure.  Of course, the peer may lie
7147  * and even later commitments may have been revoked.
7148  */
7149 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
7150    /**
7151     * A pointer to the opaque Rust object.
7152     * Nearly everywhere, inner must be non-null, however in places where
7153     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7154     */
7155    LDKnativeDataLossProtect *inner;
7156    /**
7157     * Indicates that this is the only struct which contains the same pointer.
7158     * Rust functions which take ownership of an object provided via an argument require
7159     * this to be true and invalidate the object pointed to by inner.
7160     */
7161    bool is_owned;
7162 } LDKDataLossProtect;
7163
7164 /**
7165  * A trait to describe an object which can receive routing messages.
7166  *
7167  * # Implementor DoS Warnings
7168  *
7169  * For `gossip_queries` messages there are potential DoS vectors when handling
7170  * inbound queries. Implementors using an on-disk network graph should be aware of
7171  * repeated disk I/O for queries accessing different parts of the network graph.
7172  */
7173 typedef struct LDKRoutingMessageHandler {
7174    /**
7175     * An opaque pointer which is passed to your function implementations as an argument.
7176     * This has no meaning in the LDK, and can be NULL or any other value.
7177     */
7178    void *this_arg;
7179    /**
7180     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
7181     * false or returning an Err otherwise.
7182     */
7183    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
7184    /**
7185     * Handle a channel_announcement message, returning true if it should be forwarded on, false
7186     * or returning an Err otherwise.
7187     */
7188    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
7189    /**
7190     * Handle an incoming channel_update message, returning true if it should be forwarded on,
7191     * false or returning an Err otherwise.
7192     */
7193    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
7194    /**
7195     * Handle some updates to the route graph that we learned due to an outbound failed payment.
7196     */
7197    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
7198    /**
7199     * Gets a subset of the channel announcements and updates required to dump our routing table
7200     * to a remote node, starting at the short_channel_id indicated by starting_point and
7201     * including the batch_amount entries immediately higher in numerical value than starting_point.
7202     */
7203    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
7204    /**
7205     * Gets a subset of the node announcements required to dump our routing table to a remote node,
7206     * starting at the node *after* the provided publickey and including batch_amount entries
7207     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
7208     * If None is provided for starting_point, we start at the first node.
7209     */
7210    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
7211    /**
7212     * Called when a connection is established with a peer. This can be used to
7213     * perform routing table synchronization using a strategy defined by the
7214     * implementor.
7215     */
7216    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
7217    /**
7218     * Handles the reply of a query we initiated to learn about channels
7219     * for a given range of blocks. We can expect to receive one or more
7220     * replies to a single query.
7221     */
7222    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
7223    /**
7224     * Handles the reply of a query we initiated asking for routing gossip
7225     * messages for a list of channels. We should receive this message when
7226     * a node has completed its best effort to send us the pertaining routing
7227     * gossip messages.
7228     */
7229    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
7230    /**
7231     * Handles when a peer asks us to send a list of short_channel_ids
7232     * for the requested range of blocks.
7233     */
7234    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
7235    /**
7236     * Handles when a peer asks us to send routing gossip messages for a
7237     * list of short_channel_ids.
7238     */
7239    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
7240    /**
7241     * Implementation of MessageSendEventsProvider for this object.
7242     */
7243    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
7244    /**
7245     * Frees any resources associated with this object given its this_arg pointer.
7246     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7247     */
7248    void (*free)(void *this_arg);
7249 } LDKRoutingMessageHandler;
7250
7251
7252
7253 /**
7254  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
7255  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
7256  */
7257 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
7258    /**
7259     * A pointer to the opaque Rust object.
7260     * Nearly everywhere, inner must be non-null, however in places where
7261     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7262     */
7263    LDKnativeIgnoringMessageHandler *inner;
7264    /**
7265     * Indicates that this is the only struct which contains the same pointer.
7266     * Rust functions which take ownership of an object provided via an argument require
7267     * this to be true and invalidate the object pointed to by inner.
7268     */
7269    bool is_owned;
7270 } LDKIgnoringMessageHandler;
7271
7272
7273
7274 /**
7275  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
7276  * You can provide one of these as the route_handler in a MessageHandler.
7277  */
7278 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
7279    /**
7280     * A pointer to the opaque Rust object.
7281     * Nearly everywhere, inner must be non-null, however in places where
7282     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7283     */
7284    LDKnativeErroringMessageHandler *inner;
7285    /**
7286     * Indicates that this is the only struct which contains the same pointer.
7287     * Rust functions which take ownership of an object provided via an argument require
7288     * this to be true and invalidate the object pointed to by inner.
7289     */
7290    bool is_owned;
7291 } LDKErroringMessageHandler;
7292
7293
7294
7295 /**
7296  * Provides references to trait impls which handle different types of messages.
7297  */
7298 typedef struct MUST_USE_STRUCT LDKMessageHandler {
7299    /**
7300     * A pointer to the opaque Rust object.
7301     * Nearly everywhere, inner must be non-null, however in places where
7302     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7303     */
7304    LDKnativeMessageHandler *inner;
7305    /**
7306     * Indicates that this is the only struct which contains the same pointer.
7307     * Rust functions which take ownership of an object provided via an argument require
7308     * this to be true and invalidate the object pointed to by inner.
7309     */
7310    bool is_owned;
7311 } LDKMessageHandler;
7312
7313 /**
7314  * Provides an object which can be used to send data to and which uniquely identifies a connection
7315  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
7316  * implement Hash to meet the PeerManager API.
7317  *
7318  * For efficiency, Clone should be relatively cheap for this type.
7319  *
7320  * You probably want to just extend an int and put a file descriptor in a struct and implement
7321  * send_data. Note that if you are using a higher-level net library that may call close() itself,
7322  * be careful to ensure you don't have races whereby you might register a new connection with an
7323  * fd which is the same as a previous one which has yet to be removed via
7324  * PeerManager::socket_disconnected().
7325  */
7326 typedef struct LDKSocketDescriptor {
7327    /**
7328     * An opaque pointer which is passed to your function implementations as an argument.
7329     * This has no meaning in the LDK, and can be NULL or any other value.
7330     */
7331    void *this_arg;
7332    /**
7333     * Attempts to send some data from the given slice to the peer.
7334     *
7335     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
7336     * Note that in the disconnected case, socket_disconnected must still fire and further write
7337     * attempts may occur until that time.
7338     *
7339     * If the returned size is smaller than data.len(), a write_available event must
7340     * trigger the next time more data can be written. Additionally, until the a send_data event
7341     * completes fully, no further read_events should trigger on the same peer!
7342     *
7343     * If a read_event on this descriptor had previously returned true (indicating that read
7344     * events should be paused to prevent DoS in the send buffer), resume_read may be set
7345     * indicating that read events on this descriptor should resume. A resume_read of false does
7346     * *not* imply that further read events should be paused.
7347     */
7348    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
7349    /**
7350     * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
7351     * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
7352     * this descriptor. No socket_disconnected call should be generated as a result of this call,
7353     * though races may occur whereby disconnect_socket is called after a call to
7354     * socket_disconnected but prior to socket_disconnected returning.
7355     */
7356    void (*disconnect_socket)(void *this_arg);
7357    /**
7358     * Checks if two objects are equal given this object's this_arg pointer and another object.
7359     */
7360    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
7361    /**
7362     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
7363     * This is used, for example, for inclusion of this object in a hash map.
7364     */
7365    uint64_t (*hash)(const void *this_arg);
7366    /**
7367     * Creates a copy of the object pointed to by this_arg, for a copy of this SocketDescriptor.
7368     * Note that the ultimate copy of the SocketDescriptor will have all function pointers the same as the original.
7369     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new SocketDescriptor.
7370     */
7371    void *(*clone)(const void *this_arg);
7372    /**
7373     * Frees any resources associated with this object given its this_arg pointer.
7374     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7375     */
7376    void (*free)(void *this_arg);
7377 } LDKSocketDescriptor;
7378
7379
7380
7381 /**
7382  * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
7383  * events into messages which it passes on to its MessageHandlers.
7384  *
7385  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
7386  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
7387  * essentially you should default to using a SimpleRefPeerManager, and use a
7388  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
7389  * you're using lightning-net-tokio.
7390  */
7391 typedef struct MUST_USE_STRUCT LDKPeerManager {
7392    /**
7393     * A pointer to the opaque Rust object.
7394     * Nearly everywhere, inner must be non-null, however in places where
7395     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7396     */
7397    LDKnativePeerManager *inner;
7398    /**
7399     * Indicates that this is the only struct which contains the same pointer.
7400     * Rust functions which take ownership of an object provided via an argument require
7401     * this to be true and invalidate the object pointed to by inner.
7402     */
7403    bool is_owned;
7404 } LDKPeerManager;
7405
7406
7407
7408 /**
7409  * Static channel fields used to build transactions given per-commitment fields, organized by
7410  * broadcaster/countersignatory.
7411  *
7412  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
7413  * as_holder_broadcastable and as_counterparty_broadcastable functions.
7414  */
7415 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
7416    /**
7417     * A pointer to the opaque Rust object.
7418     * Nearly everywhere, inner must be non-null, however in places where
7419     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7420     */
7421    LDKnativeDirectedChannelTransactionParameters *inner;
7422    /**
7423     * Indicates that this is the only struct which contains the same pointer.
7424     * Rust functions which take ownership of an object provided via an argument require
7425     * this to be true and invalidate the object pointed to by inner.
7426     */
7427    bool is_owned;
7428 } LDKDirectedChannelTransactionParameters;
7429
7430
7431
7432 /**
7433  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
7434  * This exists only to make accessing a RwLock<NetworkGraph> possible from
7435  * the C bindings, as it can be done directly in Rust code.
7436  */
7437 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
7438    /**
7439     * A pointer to the opaque Rust object.
7440     * Nearly everywhere, inner must be non-null, however in places where
7441     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7442     */
7443    LDKnativeLockedNetworkGraph *inner;
7444    /**
7445     * Indicates that this is the only struct which contains the same pointer.
7446     * Rust functions which take ownership of an object provided via an argument require
7447     * this to be true and invalidate the object pointed to by inner.
7448     */
7449    bool is_owned;
7450 } LDKLockedNetworkGraph;
7451
7452
7453
7454 /**
7455  * Receives and validates network updates from peers,
7456  * stores authentic and relevant data as a network graph.
7457  * This network graph is then used for routing payments.
7458  * Provides interface to help with initial routing sync by
7459  * serving historical announcements.
7460  */
7461 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
7462    /**
7463     * A pointer to the opaque Rust object.
7464     * Nearly everywhere, inner must be non-null, however in places where
7465     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7466     */
7467    LDKnativeNetGraphMsgHandler *inner;
7468    /**
7469     * Indicates that this is the only struct which contains the same pointer.
7470     * Rust functions which take ownership of an object provided via an argument require
7471     * this to be true and invalidate the object pointed to by inner.
7472     */
7473    bool is_owned;
7474 } LDKNetGraphMsgHandler;
7475
7476 extern const uintptr_t MAX_BUF_SIZE;
7477
7478 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
7479
7480 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
7481
7482 extern const uint16_t BREAKDOWN_TIMEOUT;
7483
7484 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
7485
7486 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
7487
7488 /**
7489  * Frees the data buffer, if data_is_owned is set and datalen > 0.
7490  */
7491 void Transaction_free(struct LDKTransaction _res);
7492
7493 /**
7494  * Frees the data pointed to by script_pubkey.
7495  */
7496 void TxOut_free(struct LDKTxOut _res);
7497
7498 /**
7499  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
7500  */
7501 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
7502
7503 /**
7504  * Creates a new CResult_SecretKeyErrorZ in the success state.
7505  */
7506 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
7507
7508 /**
7509  * Creates a new CResult_SecretKeyErrorZ in the error state.
7510  */
7511 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
7512
7513 /**
7514  * Frees any resources used by the CResult_SecretKeyErrorZ.
7515  */
7516 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
7517
7518 /**
7519  * Creates a new CResult_PublicKeyErrorZ in the success state.
7520  */
7521 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
7522
7523 /**
7524  * Creates a new CResult_PublicKeyErrorZ in the error state.
7525  */
7526 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
7527
7528 /**
7529  * Frees any resources used by the CResult_PublicKeyErrorZ.
7530  */
7531 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
7532
7533 /**
7534  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
7535  */
7536 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
7537
7538 /**
7539  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
7540  */
7541 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
7542
7543 /**
7544  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
7545  */
7546 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
7547
7548 /**
7549  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
7550  * but with all dynamically-allocated buffers duplicated in new buffers.
7551  */
7552 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
7553
7554 /**
7555  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
7556  */
7557 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
7558
7559 /**
7560  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
7561  */
7562 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
7563
7564 /**
7565  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
7566  */
7567 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
7568
7569 /**
7570  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
7571  * but with all dynamically-allocated buffers duplicated in new buffers.
7572  */
7573 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
7574
7575 /**
7576  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
7577  */
7578 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
7579
7580 /**
7581  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
7582  */
7583 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
7584
7585 /**
7586  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
7587  */
7588 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
7589
7590 /**
7591  * Constructs a new COption_u32Z containing a u32
7592  */
7593 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
7594
7595 /**
7596  * Constructs a new COption_u32Z containing nothing
7597  */
7598 struct LDKCOption_u32Z COption_u32Z_none(void);
7599
7600 /**
7601  * Frees any resources associated with the u32, if we are in the Some state
7602  */
7603 void COption_u32Z_free(struct LDKCOption_u32Z _res);
7604
7605 /**
7606  * Creates a new COption_u32Z which has the same data as `orig`
7607  * but with all dynamically-allocated buffers duplicated in new buffers.
7608  */
7609 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
7610
7611 /**
7612  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
7613  */
7614 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
7615
7616 /**
7617  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
7618  */
7619 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
7620
7621 /**
7622  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
7623  */
7624 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
7625
7626 /**
7627  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
7628  * but with all dynamically-allocated buffers duplicated in new buffers.
7629  */
7630 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
7631
7632 /**
7633  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
7634  */
7635 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
7636
7637 /**
7638  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
7639  */
7640 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
7641
7642 /**
7643  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
7644  */
7645 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
7646
7647 /**
7648  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
7649  * but with all dynamically-allocated buffers duplicated in new buffers.
7650  */
7651 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
7652
7653 /**
7654  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
7655  */
7656 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
7657
7658 /**
7659  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
7660  */
7661 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
7662
7663 /**
7664  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
7665  */
7666 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
7667
7668 /**
7669  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
7670  * but with all dynamically-allocated buffers duplicated in new buffers.
7671  */
7672 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
7673
7674 /**
7675  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7676  */
7677 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
7678
7679 /**
7680  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
7681  */
7682 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
7683
7684 /**
7685  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
7686  */
7687 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
7688
7689 /**
7690  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
7691  */
7692 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
7693
7694 /**
7695  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
7696  * but with all dynamically-allocated buffers duplicated in new buffers.
7697  */
7698 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
7699
7700 /**
7701  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
7702  */
7703 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
7704
7705 /**
7706  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
7707  */
7708 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
7709
7710 /**
7711  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
7712  */
7713 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
7714
7715 /**
7716  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
7717  * but with all dynamically-allocated buffers duplicated in new buffers.
7718  */
7719 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
7720
7721 /**
7722  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
7723  */
7724 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
7725
7726 /**
7727  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
7728  */
7729 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
7730
7731 /**
7732  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
7733  */
7734 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
7735
7736 /**
7737  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
7738  * but with all dynamically-allocated buffers duplicated in new buffers.
7739  */
7740 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
7741
7742 /**
7743  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
7744  */
7745 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
7746
7747 /**
7748  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
7749  */
7750 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
7751
7752 /**
7753  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
7754  */
7755 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
7756
7757 /**
7758  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
7759  */
7760 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
7761
7762 /**
7763  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
7764  */
7765 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
7766
7767 /**
7768  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
7769  */
7770 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
7771
7772 /**
7773  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
7774  * but with all dynamically-allocated buffers duplicated in new buffers.
7775  */
7776 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
7777
7778 /**
7779  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7780  */
7781 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
7782
7783 /**
7784  * Creates a new CResult_boolLightningErrorZ in the success state.
7785  */
7786 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
7787
7788 /**
7789  * Creates a new CResult_boolLightningErrorZ in the error state.
7790  */
7791 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
7792
7793 /**
7794  * Frees any resources used by the CResult_boolLightningErrorZ.
7795  */
7796 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
7797
7798 /**
7799  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
7800  * but with all dynamically-allocated buffers duplicated in new buffers.
7801  */
7802 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
7803
7804 /**
7805  * Creates a new tuple which has the same data as `orig`
7806  * but with all dynamically-allocated buffers duplicated in new buffers.
7807  */
7808 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
7809
7810 /**
7811  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
7812  */
7813 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
7814
7815 /**
7816  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
7817  */
7818 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
7819
7820 /**
7821  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7822  */
7823 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
7824
7825 /**
7826  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7827  */
7828 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
7829
7830 /**
7831  * Creates a new CResult_NoneLightningErrorZ in the success state.
7832  */
7833 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
7834
7835 /**
7836  * Creates a new CResult_NoneLightningErrorZ in the error state.
7837  */
7838 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
7839
7840 /**
7841  * Frees any resources used by the CResult_NoneLightningErrorZ.
7842  */
7843 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
7844
7845 /**
7846  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
7847  * but with all dynamically-allocated buffers duplicated in new buffers.
7848  */
7849 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
7850
7851 /**
7852  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7853  */
7854 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
7855
7856 /**
7857  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7858  */
7859 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
7860
7861 /**
7862  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
7863  */
7864 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
7865
7866 /**
7867  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
7868  */
7869 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
7870
7871 /**
7872  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
7873  */
7874 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
7875
7876 /**
7877  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
7878  * but with all dynamically-allocated buffers duplicated in new buffers.
7879  */
7880 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
7881
7882 /**
7883  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
7884  */
7885 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
7886
7887 /**
7888  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
7889  */
7890 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
7891
7892 /**
7893  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
7894  */
7895 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
7896
7897 /**
7898  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
7899  * but with all dynamically-allocated buffers duplicated in new buffers.
7900  */
7901 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
7902
7903 /**
7904  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
7905  */
7906 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
7907
7908 /**
7909  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
7910  */
7911 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
7912
7913 /**
7914  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
7915  */
7916 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
7917
7918 /**
7919  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
7920  * but with all dynamically-allocated buffers duplicated in new buffers.
7921  */
7922 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
7923
7924 /**
7925  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
7926  */
7927 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
7928
7929 /**
7930  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
7931  */
7932 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
7933
7934 /**
7935  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
7936  */
7937 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
7938
7939 /**
7940  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
7941  */
7942 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
7943
7944 /**
7945  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
7946  */
7947 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
7948
7949 /**
7950  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
7951  */
7952 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
7953
7954 /**
7955  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
7956  */
7957 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
7958
7959 /**
7960  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
7961  */
7962 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
7963
7964 /**
7965  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
7966  */
7967 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
7968
7969 /**
7970  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
7971  */
7972 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
7973
7974 /**
7975  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
7976  */
7977 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
7978
7979 /**
7980  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
7981  */
7982 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
7983
7984 /**
7985  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7986  */
7987 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
7988
7989 /**
7990  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7991  */
7992 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
7993
7994 /**
7995  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7996  */
7997 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
7998
7999 /**
8000  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
8001  * but with all dynamically-allocated buffers duplicated in new buffers.
8002  */
8003 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
8004
8005 /**
8006  * Constructs a new COption_u64Z containing a u64
8007  */
8008 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
8009
8010 /**
8011  * Constructs a new COption_u64Z containing nothing
8012  */
8013 struct LDKCOption_u64Z COption_u64Z_none(void);
8014
8015 /**
8016  * Frees any resources associated with the u64, if we are in the Some state
8017  */
8018 void COption_u64Z_free(struct LDKCOption_u64Z _res);
8019
8020 /**
8021  * Creates a new COption_u64Z which has the same data as `orig`
8022  * but with all dynamically-allocated buffers duplicated in new buffers.
8023  */
8024 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
8025
8026 /**
8027  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
8028  */
8029 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
8030
8031 /**
8032  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
8033  */
8034 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
8035
8036 /**
8037  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
8038  */
8039 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
8040
8041 /**
8042  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
8043  * but with all dynamically-allocated buffers duplicated in new buffers.
8044  */
8045 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
8046
8047 /**
8048  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8049  */
8050 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
8051
8052 /**
8053  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8054  */
8055 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
8056
8057 /**
8058  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8059  */
8060 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
8061
8062 /**
8063  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8064  * but with all dynamically-allocated buffers duplicated in new buffers.
8065  */
8066 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
8067
8068 /**
8069  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8070  */
8071 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
8072
8073 /**
8074  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8075  */
8076 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
8077
8078 /**
8079  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8080  */
8081 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
8082
8083 /**
8084  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8085  * but with all dynamically-allocated buffers duplicated in new buffers.
8086  */
8087 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
8088
8089 /**
8090  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8091  */
8092 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
8093
8094 /**
8095  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8096  */
8097 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
8098
8099 /**
8100  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8101  */
8102 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
8103
8104 /**
8105  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8106  */
8107 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
8108
8109 /**
8110  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
8111  * but with all dynamically-allocated buffers duplicated in new buffers.
8112  */
8113 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
8114
8115 /**
8116  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8117  */
8118 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
8119
8120 /**
8121  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
8122  */
8123 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
8124
8125 /**
8126  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
8127  */
8128 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
8129
8130 /**
8131  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
8132  */
8133 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
8134
8135 /**
8136  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
8137  * but with all dynamically-allocated buffers duplicated in new buffers.
8138  */
8139 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
8140
8141 /**
8142  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
8143  */
8144 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
8145
8146 /**
8147  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
8148  */
8149 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
8150
8151 /**
8152  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
8153  */
8154 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
8155
8156 /**
8157  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
8158  * but with all dynamically-allocated buffers duplicated in new buffers.
8159  */
8160 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
8161
8162 /**
8163  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
8164  */
8165 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
8166
8167 /**
8168  * Frees any resources used by the C2Tuple_usizeTransactionZ.
8169  */
8170 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
8171
8172 /**
8173  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8174  */
8175 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
8176
8177 /**
8178  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8179  */
8180 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
8181
8182 /**
8183  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
8184  */
8185 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
8186
8187 /**
8188  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
8189  */
8190 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
8191
8192 /**
8193  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
8194  */
8195 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
8196
8197 /**
8198  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
8199  * but with all dynamically-allocated buffers duplicated in new buffers.
8200  */
8201 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
8202
8203 /**
8204  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8205  */
8206 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
8207
8208 /**
8209  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8210  */
8211 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
8212
8213 /**
8214  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
8215  */
8216 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
8217
8218 /**
8219  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
8220  */
8221 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
8222
8223 /**
8224  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
8225  */
8226 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
8227
8228 /**
8229  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
8230  * but with all dynamically-allocated buffers duplicated in new buffers.
8231  */
8232 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
8233
8234 /**
8235  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
8236  */
8237 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
8238
8239 /**
8240  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
8241  */
8242 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
8243
8244 /**
8245  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
8246  */
8247 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
8248
8249 /**
8250  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
8251  * but with all dynamically-allocated buffers duplicated in new buffers.
8252  */
8253 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
8254
8255 /**
8256  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
8257  */
8258 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
8259
8260 /**
8261  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
8262  */
8263 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
8264
8265 /**
8266  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
8267  */
8268 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
8269
8270 /**
8271  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
8272  * but with all dynamically-allocated buffers duplicated in new buffers.
8273  */
8274 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
8275
8276 /**
8277  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
8278  */
8279 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
8280
8281 /**
8282  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
8283  */
8284 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
8285
8286 /**
8287  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
8288  */
8289 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
8290
8291 /**
8292  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
8293  * but with all dynamically-allocated buffers duplicated in new buffers.
8294  */
8295 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
8296
8297 /**
8298  * Creates a new tuple which has the same data as `orig`
8299  * but with all dynamically-allocated buffers duplicated in new buffers.
8300  */
8301 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
8302
8303 /**
8304  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
8305  */
8306 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
8307
8308 /**
8309  * Frees any resources used by the C2Tuple_OutPointScriptZ.
8310  */
8311 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
8312
8313 /**
8314  * Creates a new tuple which has the same data as `orig`
8315  * but with all dynamically-allocated buffers duplicated in new buffers.
8316  */
8317 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
8318
8319 /**
8320  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
8321  */
8322 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
8323
8324 /**
8325  * Frees any resources used by the C2Tuple_u32ScriptZ.
8326  */
8327 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
8328
8329 /**
8330  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8331  */
8332 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
8333
8334 /**
8335  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
8336  */
8337 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
8338
8339 /**
8340  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
8341  */
8342 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
8343
8344 /**
8345  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8346  */
8347 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
8348
8349 /**
8350  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8351  */
8352 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
8353
8354 /**
8355  * Creates a new tuple which has the same data as `orig`
8356  * but with all dynamically-allocated buffers duplicated in new buffers.
8357  */
8358 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
8359
8360 /**
8361  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
8362  */
8363 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
8364
8365 /**
8366  * Frees any resources used by the C2Tuple_u32TxOutZ.
8367  */
8368 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
8369
8370 /**
8371  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8372  */
8373 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
8374
8375 /**
8376  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
8377  */
8378 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
8379
8380 /**
8381  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
8382  */
8383 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
8384
8385 /**
8386  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8387  */
8388 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
8389
8390 /**
8391  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
8392  */
8393 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
8394
8395 /**
8396  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
8397  */
8398 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
8399
8400 /**
8401  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
8402  */
8403 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
8404
8405 /**
8406  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
8407  */
8408 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
8409
8410 /**
8411  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
8412  */
8413 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
8414
8415 /**
8416  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8417  */
8418 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
8419
8420 /**
8421  * Creates a new CResult_TxOutAccessErrorZ in the success state.
8422  */
8423 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
8424
8425 /**
8426  * Creates a new CResult_TxOutAccessErrorZ in the error state.
8427  */
8428 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
8429
8430 /**
8431  * Frees any resources used by the CResult_TxOutAccessErrorZ.
8432  */
8433 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
8434
8435 /**
8436  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
8437  * but with all dynamically-allocated buffers duplicated in new buffers.
8438  */
8439 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
8440
8441 /**
8442  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
8443  */
8444 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
8445
8446 /**
8447  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
8448  */
8449 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
8450
8451 /**
8452  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
8453  */
8454 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
8455
8456 /**
8457  * Creates a new CResult_NoneAPIErrorZ in the success state.
8458  */
8459 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
8460
8461 /**
8462  * Creates a new CResult_NoneAPIErrorZ in the error state.
8463  */
8464 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
8465
8466 /**
8467  * Frees any resources used by the CResult_NoneAPIErrorZ.
8468  */
8469 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
8470
8471 /**
8472  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
8473  * but with all dynamically-allocated buffers duplicated in new buffers.
8474  */
8475 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
8476
8477 /**
8478  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8479  */
8480 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
8481
8482 /**
8483  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8484  */
8485 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
8486
8487 /**
8488  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8489  */
8490 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
8491
8492 /**
8493  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
8494  */
8495 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
8496
8497 /**
8498  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
8499  */
8500 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
8501
8502 /**
8503  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
8504  */
8505 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
8506
8507 /**
8508  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8509  * but with all dynamically-allocated buffers duplicated in new buffers.
8510  */
8511 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
8512
8513 /**
8514  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8515  */
8516 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
8517
8518 /**
8519  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
8520  */
8521 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
8522
8523 /**
8524  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
8525  */
8526 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
8527
8528 /**
8529  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
8530  */
8531 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
8532
8533 /**
8534  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
8535  */
8536 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
8537
8538 /**
8539  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
8540  */
8541 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
8542
8543 /**
8544  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
8545  */
8546 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
8547
8548 /**
8549  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
8550  */
8551 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
8552
8553 /**
8554  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
8555  */
8556 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
8557
8558 /**
8559  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
8560  * but with all dynamically-allocated buffers duplicated in new buffers.
8561  */
8562 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
8563
8564 /**
8565  * Creates a new tuple which has the same data as `orig`
8566  * but with all dynamically-allocated buffers duplicated in new buffers.
8567  */
8568 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
8569
8570 /**
8571  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
8572  */
8573 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
8574
8575 /**
8576  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
8577  */
8578 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
8579
8580 /**
8581  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
8582  */
8583 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
8584
8585 /**
8586  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
8587  */
8588 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
8589
8590 /**
8591  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
8592  */
8593 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
8594
8595 /**
8596  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
8597  * but with all dynamically-allocated buffers duplicated in new buffers.
8598  */
8599 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
8600
8601 /**
8602  * Creates a new CResult_SignatureNoneZ in the success state.
8603  */
8604 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
8605
8606 /**
8607  * Creates a new CResult_SignatureNoneZ in the error state.
8608  */
8609 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
8610
8611 /**
8612  * Frees any resources used by the CResult_SignatureNoneZ.
8613  */
8614 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
8615
8616 /**
8617  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
8618  * but with all dynamically-allocated buffers duplicated in new buffers.
8619  */
8620 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
8621
8622 /**
8623  * Creates a new CResult_SignDecodeErrorZ in the success state.
8624  */
8625 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
8626
8627 /**
8628  * Creates a new CResult_SignDecodeErrorZ in the error state.
8629  */
8630 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
8631
8632 /**
8633  * Frees any resources used by the CResult_SignDecodeErrorZ.
8634  */
8635 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
8636
8637 /**
8638  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
8639  * but with all dynamically-allocated buffers duplicated in new buffers.
8640  */
8641 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
8642
8643 /**
8644  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8645  */
8646 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
8647
8648 /**
8649  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
8650  */
8651 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
8652
8653 /**
8654  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
8655  */
8656 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
8657
8658 /**
8659  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
8660  */
8661 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
8662
8663 /**
8664  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
8665  * but with all dynamically-allocated buffers duplicated in new buffers.
8666  */
8667 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
8668
8669 /**
8670  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
8671  */
8672 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
8673
8674 /**
8675  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
8676  */
8677 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
8678
8679 /**
8680  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
8681  */
8682 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
8683
8684 /**
8685  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
8686  * but with all dynamically-allocated buffers duplicated in new buffers.
8687  */
8688 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
8689
8690 /**
8691  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8692  */
8693 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
8694
8695 /**
8696  * Creates a new CResult_TransactionNoneZ in the success state.
8697  */
8698 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
8699
8700 /**
8701  * Creates a new CResult_TransactionNoneZ in the error state.
8702  */
8703 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
8704
8705 /**
8706  * Frees any resources used by the CResult_TransactionNoneZ.
8707  */
8708 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
8709
8710 /**
8711  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8712  */
8713 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
8714
8715 /**
8716  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8717  */
8718 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
8719
8720 /**
8721  * Creates a new CResult_RouteDecodeErrorZ in the success state.
8722  */
8723 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
8724
8725 /**
8726  * Creates a new CResult_RouteDecodeErrorZ in the error state.
8727  */
8728 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
8729
8730 /**
8731  * Frees any resources used by the CResult_RouteDecodeErrorZ.
8732  */
8733 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
8734
8735 /**
8736  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
8737  * but with all dynamically-allocated buffers duplicated in new buffers.
8738  */
8739 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
8740
8741 /**
8742  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8743  */
8744 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
8745
8746 /**
8747  * Creates a new CResult_RouteLightningErrorZ in the success state.
8748  */
8749 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
8750
8751 /**
8752  * Creates a new CResult_RouteLightningErrorZ in the error state.
8753  */
8754 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
8755
8756 /**
8757  * Frees any resources used by the CResult_RouteLightningErrorZ.
8758  */
8759 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
8760
8761 /**
8762  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
8763  * but with all dynamically-allocated buffers duplicated in new buffers.
8764  */
8765 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
8766
8767 /**
8768  * Creates a new CResult_NetAddressu8Z in the success state.
8769  */
8770 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
8771
8772 /**
8773  * Creates a new CResult_NetAddressu8Z in the error state.
8774  */
8775 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
8776
8777 /**
8778  * Frees any resources used by the CResult_NetAddressu8Z.
8779  */
8780 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
8781
8782 /**
8783  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
8784  * but with all dynamically-allocated buffers duplicated in new buffers.
8785  */
8786 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
8787
8788 /**
8789  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
8790  */
8791 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
8792
8793 /**
8794  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
8795  */
8796 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
8797
8798 /**
8799  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
8800  */
8801 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
8802
8803 /**
8804  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
8805  * but with all dynamically-allocated buffers duplicated in new buffers.
8806  */
8807 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
8808
8809 /**
8810  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8811  */
8812 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
8813
8814 /**
8815  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8816  */
8817 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
8818
8819 /**
8820  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8821  */
8822 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
8823
8824 /**
8825  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8826  */
8827 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
8828
8829 /**
8830  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8831  */
8832 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
8833
8834 /**
8835  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8836  */
8837 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
8838
8839 /**
8840  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8841  */
8842 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
8843
8844 /**
8845  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8846  * but with all dynamically-allocated buffers duplicated in new buffers.
8847  */
8848 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
8849
8850 /**
8851  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8852  */
8853 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
8854
8855 /**
8856  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8857  */
8858 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
8859
8860 /**
8861  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
8862  */
8863 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
8864
8865 /**
8866  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
8867  * but with all dynamically-allocated buffers duplicated in new buffers.
8868  */
8869 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
8870
8871 /**
8872  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
8873  */
8874 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
8875
8876 /**
8877  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
8878  */
8879 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
8880
8881 /**
8882  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
8883  */
8884 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
8885
8886 /**
8887  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
8888  * but with all dynamically-allocated buffers duplicated in new buffers.
8889  */
8890 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
8891
8892 /**
8893  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
8894  */
8895 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
8896
8897 /**
8898  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
8899  */
8900 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
8901
8902 /**
8903  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
8904  */
8905 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
8906
8907 /**
8908  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
8909  * but with all dynamically-allocated buffers duplicated in new buffers.
8910  */
8911 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
8912
8913 /**
8914  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
8915  */
8916 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
8917
8918 /**
8919  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
8920  */
8921 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
8922
8923 /**
8924  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
8925  */
8926 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
8927
8928 /**
8929  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
8930  * but with all dynamically-allocated buffers duplicated in new buffers.
8931  */
8932 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
8933
8934 /**
8935  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
8936  */
8937 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
8938
8939 /**
8940  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
8941  */
8942 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
8943
8944 /**
8945  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
8946  */
8947 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
8948
8949 /**
8950  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
8951  * but with all dynamically-allocated buffers duplicated in new buffers.
8952  */
8953 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
8954
8955 /**
8956  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
8957  */
8958 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
8959
8960 /**
8961  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
8962  */
8963 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
8964
8965 /**
8966  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
8967  */
8968 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
8969
8970 /**
8971  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
8972  * but with all dynamically-allocated buffers duplicated in new buffers.
8973  */
8974 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
8975
8976 /**
8977  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
8978  */
8979 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
8980
8981 /**
8982  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
8983  */
8984 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
8985
8986 /**
8987  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
8988  */
8989 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
8990
8991 /**
8992  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
8993  * but with all dynamically-allocated buffers duplicated in new buffers.
8994  */
8995 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
8996
8997 /**
8998  * Creates a new CResult_InitDecodeErrorZ in the success state.
8999  */
9000 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
9001
9002 /**
9003  * Creates a new CResult_InitDecodeErrorZ in the error state.
9004  */
9005 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
9006
9007 /**
9008  * Frees any resources used by the CResult_InitDecodeErrorZ.
9009  */
9010 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
9011
9012 /**
9013  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
9014  * but with all dynamically-allocated buffers duplicated in new buffers.
9015  */
9016 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
9017
9018 /**
9019  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
9020  */
9021 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
9022
9023 /**
9024  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
9025  */
9026 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
9027
9028 /**
9029  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
9030  */
9031 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
9032
9033 /**
9034  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
9035  * but with all dynamically-allocated buffers duplicated in new buffers.
9036  */
9037 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
9038
9039 /**
9040  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
9041  */
9042 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
9043
9044 /**
9045  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
9046  */
9047 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
9048
9049 /**
9050  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
9051  */
9052 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
9053
9054 /**
9055  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
9056  * but with all dynamically-allocated buffers duplicated in new buffers.
9057  */
9058 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
9059
9060 /**
9061  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
9062  */
9063 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
9064
9065 /**
9066  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
9067  */
9068 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
9069
9070 /**
9071  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
9072  */
9073 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
9074
9075 /**
9076  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
9077  * but with all dynamically-allocated buffers duplicated in new buffers.
9078  */
9079 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
9080
9081 /**
9082  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
9083  */
9084 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
9085
9086 /**
9087  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
9088  */
9089 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
9090
9091 /**
9092  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
9093  */
9094 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
9095
9096 /**
9097  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
9098  * but with all dynamically-allocated buffers duplicated in new buffers.
9099  */
9100 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
9101
9102 /**
9103  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
9104  */
9105 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
9106
9107 /**
9108  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
9109  */
9110 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
9111
9112 /**
9113  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
9114  */
9115 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
9116
9117 /**
9118  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
9119  * but with all dynamically-allocated buffers duplicated in new buffers.
9120  */
9121 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
9122
9123 /**
9124  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
9125  */
9126 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
9127
9128 /**
9129  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
9130  */
9131 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
9132
9133 /**
9134  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
9135  */
9136 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
9137
9138 /**
9139  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
9140  * but with all dynamically-allocated buffers duplicated in new buffers.
9141  */
9142 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
9143
9144 /**
9145  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
9146  */
9147 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
9148
9149 /**
9150  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
9151  */
9152 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
9153
9154 /**
9155  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
9156  */
9157 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
9158
9159 /**
9160  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
9161  * but with all dynamically-allocated buffers duplicated in new buffers.
9162  */
9163 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
9164
9165 /**
9166  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
9167  */
9168 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
9169
9170 /**
9171  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
9172  */
9173 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
9174
9175 /**
9176  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
9177  */
9178 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
9179
9180 /**
9181  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
9182  * but with all dynamically-allocated buffers duplicated in new buffers.
9183  */
9184 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
9185
9186 /**
9187  * Creates a new CResult_PingDecodeErrorZ in the success state.
9188  */
9189 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
9190
9191 /**
9192  * Creates a new CResult_PingDecodeErrorZ in the error state.
9193  */
9194 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
9195
9196 /**
9197  * Frees any resources used by the CResult_PingDecodeErrorZ.
9198  */
9199 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
9200
9201 /**
9202  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
9203  * but with all dynamically-allocated buffers duplicated in new buffers.
9204  */
9205 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
9206
9207 /**
9208  * Creates a new CResult_PongDecodeErrorZ in the success state.
9209  */
9210 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
9211
9212 /**
9213  * Creates a new CResult_PongDecodeErrorZ in the error state.
9214  */
9215 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
9216
9217 /**
9218  * Frees any resources used by the CResult_PongDecodeErrorZ.
9219  */
9220 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
9221
9222 /**
9223  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
9224  * but with all dynamically-allocated buffers duplicated in new buffers.
9225  */
9226 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
9227
9228 /**
9229  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
9230  */
9231 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
9232
9233 /**
9234  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
9235  */
9236 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9237
9238 /**
9239  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
9240  */
9241 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
9242
9243 /**
9244  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
9245  * but with all dynamically-allocated buffers duplicated in new buffers.
9246  */
9247 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9248
9249 /**
9250  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
9251  */
9252 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
9253
9254 /**
9255  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
9256  */
9257 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9258
9259 /**
9260  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
9261  */
9262 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
9263
9264 /**
9265  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
9266  * but with all dynamically-allocated buffers duplicated in new buffers.
9267  */
9268 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9269
9270 /**
9271  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
9272  */
9273 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
9274
9275 /**
9276  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
9277  */
9278 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9279
9280 /**
9281  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
9282  */
9283 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
9284
9285 /**
9286  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
9287  * but with all dynamically-allocated buffers duplicated in new buffers.
9288  */
9289 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
9290
9291 /**
9292  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
9293  */
9294 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
9295
9296 /**
9297  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
9298  */
9299 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9300
9301 /**
9302  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
9303  */
9304 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
9305
9306 /**
9307  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
9308  * but with all dynamically-allocated buffers duplicated in new buffers.
9309  */
9310 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
9311
9312 /**
9313  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
9314  */
9315 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
9316
9317 /**
9318  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
9319  */
9320 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
9321
9322 /**
9323  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
9324  */
9325 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
9326
9327 /**
9328  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
9329  * but with all dynamically-allocated buffers duplicated in new buffers.
9330  */
9331 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
9332
9333 /**
9334  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
9335  */
9336 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
9337
9338 /**
9339  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
9340  */
9341 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9342
9343 /**
9344  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
9345  */
9346 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
9347
9348 /**
9349  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
9350  * but with all dynamically-allocated buffers duplicated in new buffers.
9351  */
9352 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9353
9354 /**
9355  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
9356  */
9357 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
9358
9359 /**
9360  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
9361  */
9362 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9363
9364 /**
9365  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
9366  */
9367 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
9368
9369 /**
9370  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
9371  * but with all dynamically-allocated buffers duplicated in new buffers.
9372  */
9373 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9374
9375 /**
9376  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
9377  */
9378 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
9379
9380 /**
9381  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
9382  */
9383 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
9384
9385 /**
9386  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
9387  */
9388 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
9389
9390 /**
9391  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
9392  * but with all dynamically-allocated buffers duplicated in new buffers.
9393  */
9394 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
9395
9396 /**
9397  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
9398  */
9399 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
9400
9401 /**
9402  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
9403  */
9404 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
9405
9406 /**
9407  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
9408  */
9409 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
9410
9411 /**
9412  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
9413  * but with all dynamically-allocated buffers duplicated in new buffers.
9414  */
9415 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
9416
9417 /**
9418  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
9419  */
9420 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
9421
9422 /**
9423  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
9424  */
9425 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
9426
9427 /**
9428  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
9429  */
9430 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
9431
9432 /**
9433  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
9434  * but with all dynamically-allocated buffers duplicated in new buffers.
9435  */
9436 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
9437
9438 /**
9439  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
9440  */
9441 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
9442
9443 /**
9444  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
9445  */
9446 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
9447
9448 /**
9449  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
9450  */
9451 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
9452
9453 /**
9454  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
9455  * but with all dynamically-allocated buffers duplicated in new buffers.
9456  */
9457 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
9458
9459 /**
9460  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
9461  */
9462 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
9463
9464 /**
9465  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
9466  */
9467 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
9468
9469 /**
9470  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
9471  */
9472 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
9473
9474 /**
9475  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
9476  * but with all dynamically-allocated buffers duplicated in new buffers.
9477  */
9478 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
9479
9480 /**
9481  * Frees any resources used by the Event
9482  */
9483 void Event_free(struct LDKEvent this_ptr);
9484
9485 /**
9486  * Creates a copy of the Event
9487  */
9488 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
9489
9490 /**
9491  * Serialize the Event object into a byte array which can be read by Event_read
9492  */
9493 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
9494
9495 /**
9496  * Frees any resources used by the MessageSendEvent
9497  */
9498 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
9499
9500 /**
9501  * Creates a copy of the MessageSendEvent
9502  */
9503 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
9504
9505 /**
9506  * Calls the free function if one is set
9507  */
9508 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
9509
9510 /**
9511  * Calls the free function if one is set
9512  */
9513 void EventsProvider_free(struct LDKEventsProvider this_ptr);
9514
9515 /**
9516  * Frees any resources used by the APIError
9517  */
9518 void APIError_free(struct LDKAPIError this_ptr);
9519
9520 /**
9521  * Creates a copy of the APIError
9522  */
9523 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
9524
9525 /**
9526  * Creates a copy of the Level
9527  */
9528 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
9529
9530 /**
9531  * Returns the most verbose logging level.
9532  */
9533 MUST_USE_RES enum LDKLevel Level_max(void);
9534
9535 /**
9536  * Calls the free function if one is set
9537  */
9538 void Logger_free(struct LDKLogger this_ptr);
9539
9540 /**
9541  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
9542  */
9543 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
9544
9545 /**
9546  * Confirmations we will wait for before considering the channel locked in.
9547  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
9548  * equivalent limit applied to outbound channels).
9549  *
9550  * Default value: 6.
9551  */
9552 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9553
9554 /**
9555  * Confirmations we will wait for before considering the channel locked in.
9556  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
9557  * equivalent limit applied to outbound channels).
9558  *
9559  * Default value: 6.
9560  */
9561 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
9562
9563 /**
9564  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
9565  * the number of blocks we have to punish our counterparty if they broadcast a revoked
9566  * transaction).
9567  *
9568  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
9569  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
9570  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
9571  * possibly with time in between to RBF the spending transaction).
9572  *
9573  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
9574  * case of an honest unilateral channel close, which implicitly decrease the economic value of
9575  * our channel.
9576  *
9577  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
9578  * can tweak config to ask for more security, not less.
9579  */
9580 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9581
9582 /**
9583  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
9584  * the number of blocks we have to punish our counterparty if they broadcast a revoked
9585  * transaction).
9586  *
9587  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
9588  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
9589  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
9590  * possibly with time in between to RBF the spending transaction).
9591  *
9592  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
9593  * case of an honest unilateral channel close, which implicitly decrease the economic value of
9594  * our channel.
9595  *
9596  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
9597  * can tweak config to ask for more security, not less.
9598  */
9599 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
9600
9601 /**
9602  * Set to the smallest value HTLC we will accept to process.
9603  *
9604  * This value is sent to our counterparty on channel-open and we close the channel any time
9605  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
9606  *
9607  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
9608  * by the protocol.
9609  */
9610 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9611
9612 /**
9613  * Set to the smallest value HTLC we will accept to process.
9614  *
9615  * This value is sent to our counterparty on channel-open and we close the channel any time
9616  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
9617  *
9618  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
9619  * by the protocol.
9620  */
9621 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
9622
9623 /**
9624  * Constructs a new ChannelHandshakeConfig given each field
9625  */
9626 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);
9627
9628 /**
9629  * Creates a copy of the ChannelHandshakeConfig
9630  */
9631 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
9632
9633 /**
9634  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
9635  */
9636 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
9637
9638 /**
9639  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
9640  */
9641 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
9642
9643 /**
9644  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
9645  * only applies to inbound channels.
9646  *
9647  * Default value: 0.
9648  */
9649 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9650
9651 /**
9652  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
9653  * only applies to inbound channels.
9654  *
9655  * Default value: 0.
9656  */
9657 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9658
9659 /**
9660  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
9661  * you to limit the maximum minimum-size they can require.
9662  *
9663  * Default value: u64::max_value.
9664  */
9665 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9666
9667 /**
9668  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
9669  * you to limit the maximum minimum-size they can require.
9670  *
9671  * Default value: u64::max_value.
9672  */
9673 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9674
9675 /**
9676  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
9677  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
9678  *
9679  * Default value: 0.
9680  */
9681 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9682
9683 /**
9684  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
9685  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
9686  *
9687  * Default value: 0.
9688  */
9689 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9690
9691 /**
9692  * The remote node will require we keep a certain amount in direct payment to ourselves at all
9693  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
9694  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
9695  *
9696  * Default value: u64::max_value.
9697  */
9698 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9699
9700 /**
9701  * The remote node will require we keep a certain amount in direct payment to ourselves at all
9702  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
9703  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
9704  *
9705  * Default value: u64::max_value.
9706  */
9707 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9708
9709 /**
9710  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
9711  * time. This allows you to set a minimum such value.
9712  *
9713  * Default value: 0.
9714  */
9715 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9716
9717 /**
9718  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
9719  * time. This allows you to set a minimum such value.
9720  *
9721  * Default value: 0.
9722  */
9723 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
9724
9725 /**
9726  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
9727  * required to always be higher than this value so this only applies to HTLC outputs (and
9728  * potentially to-self outputs before any payments have been made).
9729  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9730  * This setting allows you to set a minimum dust limit for their commitment transactions,
9731  * reflecting the reality that tiny outputs are not considered standard transactions and will
9732  * not propagate through the Bitcoin network.
9733  *
9734  * Default value: 546, the current dust limit on the Bitcoin network.
9735  */
9736 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9737
9738 /**
9739  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
9740  * required to always be higher than this value so this only applies to HTLC outputs (and
9741  * potentially to-self outputs before any payments have been made).
9742  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9743  * This setting allows you to set a minimum dust limit for their commitment transactions,
9744  * reflecting the reality that tiny outputs are not considered standard transactions and will
9745  * not propagate through the Bitcoin network.
9746  *
9747  * Default value: 546, the current dust limit on the Bitcoin network.
9748  */
9749 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9750
9751 /**
9752  * Maximum allowed threshold above which outputs will not be generated in their commitment
9753  * transactions.
9754  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9755  *
9756  * Default value: u64::max_value.
9757  */
9758 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9759
9760 /**
9761  * Maximum allowed threshold above which outputs will not be generated in their commitment
9762  * transactions.
9763  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9764  *
9765  * Default value: u64::max_value.
9766  */
9767 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9768
9769 /**
9770  * Before a channel is usable the funding transaction will need to be confirmed by at least a
9771  * certain number of blocks, specified by the node which is not the funder (as the funder can
9772  * assume they aren't going to double-spend themselves).
9773  * This config allows you to set a limit on the maximum amount of time to wait.
9774  *
9775  * Default value: 144, or roughly one day and only applies to outbound channels.
9776  */
9777 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9778
9779 /**
9780  * Before a channel is usable the funding transaction will need to be confirmed by at least a
9781  * certain number of blocks, specified by the node which is not the funder (as the funder can
9782  * assume they aren't going to double-spend themselves).
9783  * This config allows you to set a limit on the maximum amount of time to wait.
9784  *
9785  * Default value: 144, or roughly one day and only applies to outbound channels.
9786  */
9787 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
9788
9789 /**
9790  * Set to force the incoming channel to match our announced channel preference in
9791  * ChannelConfig.
9792  *
9793  * Default value: true, to make the default that no announced channels are possible (which is
9794  * appropriate for any nodes which are not online very reliably).
9795  */
9796 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9797
9798 /**
9799  * Set to force the incoming channel to match our announced channel preference in
9800  * ChannelConfig.
9801  *
9802  * Default value: true, to make the default that no announced channels are possible (which is
9803  * appropriate for any nodes which are not online very reliably).
9804  */
9805 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
9806
9807 /**
9808  * Set to the amount of time we're willing to wait to claim money back to us.
9809  *
9810  * Not checking this value would be a security issue, as our peer would be able to set it to
9811  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
9812  *
9813  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
9814  * reduce the loss of having useless locked funds (if your peer accepts)
9815  */
9816 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9817
9818 /**
9819  * Set to the amount of time we're willing to wait to claim money back to us.
9820  *
9821  * Not checking this value would be a security issue, as our peer would be able to set it to
9822  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
9823  *
9824  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
9825  * reduce the loss of having useless locked funds (if your peer accepts)
9826  */
9827 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
9828
9829 /**
9830  * Constructs a new ChannelHandshakeLimits given each field
9831  */
9832 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);
9833
9834 /**
9835  * Creates a copy of the ChannelHandshakeLimits
9836  */
9837 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
9838
9839 /**
9840  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
9841  */
9842 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
9843
9844 /**
9845  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
9846  */
9847 void ChannelConfig_free(struct LDKChannelConfig this_obj);
9848
9849 /**
9850  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
9851  * This may be allowed to change at runtime in a later update, however doing so must result in
9852  * update messages sent to notify all nodes of our updated relay fee.
9853  *
9854  * Default value: 0.
9855  */
9856 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
9857
9858 /**
9859  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
9860  * This may be allowed to change at runtime in a later update, however doing so must result in
9861  * update messages sent to notify all nodes of our updated relay fee.
9862  *
9863  * Default value: 0.
9864  */
9865 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
9866
9867 /**
9868  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
9869  * the channel this config applies to.
9870  *
9871  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
9872  * HTLC balance when a channel appears on-chain whereas
9873  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
9874  * (non-HTLC-encumbered) balance.
9875  *
9876  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
9877  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
9878  * commitment transaction at least once per this many blocks (minus some margin to allow us
9879  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
9880  * the spending transaction).
9881  *
9882  * Default value: 72 (12 hours at an average of 6 blocks/hour).
9883  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
9884  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
9885  *
9886  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
9887  */
9888 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
9889
9890 /**
9891  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
9892  * the channel this config applies to.
9893  *
9894  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
9895  * HTLC balance when a channel appears on-chain whereas
9896  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
9897  * (non-HTLC-encumbered) balance.
9898  *
9899  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
9900  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
9901  * commitment transaction at least once per this many blocks (minus some margin to allow us
9902  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
9903  * the spending transaction).
9904  *
9905  * Default value: 72 (12 hours at an average of 6 blocks/hour).
9906  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
9907  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
9908  *
9909  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
9910  */
9911 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
9912
9913 /**
9914  * Set to announce the channel publicly and notify all nodes that they can route via this
9915  * channel.
9916  *
9917  * This should only be set to true for nodes which expect to be online reliably.
9918  *
9919  * As the node which funds a channel picks this value this will only apply for new outbound
9920  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
9921  *
9922  * This cannot be changed after the initial channel handshake.
9923  *
9924  * Default value: false.
9925  */
9926 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
9927
9928 /**
9929  * Set to announce the channel publicly and notify all nodes that they can route via this
9930  * channel.
9931  *
9932  * This should only be set to true for nodes which expect to be online reliably.
9933  *
9934  * As the node which funds a channel picks this value this will only apply for new outbound
9935  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
9936  *
9937  * This cannot be changed after the initial channel handshake.
9938  *
9939  * Default value: false.
9940  */
9941 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
9942
9943 /**
9944  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
9945  * supports it, they will then enforce the mutual-close output to us matches what we provided
9946  * at intialization, preventing us from closing to an alternate pubkey.
9947  *
9948  * This is set to true by default to provide a slight increase in security, though ultimately
9949  * any attacker who is able to take control of a channel can just as easily send the funds via
9950  * lightning payments, so we never require that our counterparties support this option.
9951  *
9952  * This cannot be changed after a channel has been initialized.
9953  *
9954  * Default value: true.
9955  */
9956 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
9957
9958 /**
9959  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
9960  * supports it, they will then enforce the mutual-close output to us matches what we provided
9961  * at intialization, preventing us from closing to an alternate pubkey.
9962  *
9963  * This is set to true by default to provide a slight increase in security, though ultimately
9964  * any attacker who is able to take control of a channel can just as easily send the funds via
9965  * lightning payments, so we never require that our counterparties support this option.
9966  *
9967  * This cannot be changed after a channel has been initialized.
9968  *
9969  * Default value: true.
9970  */
9971 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
9972
9973 /**
9974  * Constructs a new ChannelConfig given each field
9975  */
9976 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);
9977
9978 /**
9979  * Creates a copy of the ChannelConfig
9980  */
9981 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
9982
9983 /**
9984  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
9985  */
9986 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
9987
9988 /**
9989  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
9990  */
9991 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
9992
9993 /**
9994  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
9995  */
9996 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
9997
9998 /**
9999  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
10000  */
10001 void UserConfig_free(struct LDKUserConfig this_obj);
10002
10003 /**
10004  * Channel config that we propose to our counterparty.
10005  */
10006 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
10007
10008 /**
10009  * Channel config that we propose to our counterparty.
10010  */
10011 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
10012
10013 /**
10014  * Limits applied to our counterparty's proposed channel config settings.
10015  */
10016 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
10017
10018 /**
10019  * Limits applied to our counterparty's proposed channel config settings.
10020  */
10021 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
10022
10023 /**
10024  * Channel config which affects behavior during channel lifetime.
10025  */
10026 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
10027
10028 /**
10029  * Channel config which affects behavior during channel lifetime.
10030  */
10031 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
10032
10033 /**
10034  * Constructs a new UserConfig given each field
10035  */
10036 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);
10037
10038 /**
10039  * Creates a copy of the UserConfig
10040  */
10041 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
10042
10043 /**
10044  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
10045  */
10046 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
10047
10048 /**
10049  * Creates a copy of the AccessError
10050  */
10051 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
10052
10053 /**
10054  * Calls the free function if one is set
10055  */
10056 void Access_free(struct LDKAccess this_ptr);
10057
10058 /**
10059  * Calls the free function if one is set
10060  */
10061 void Listen_free(struct LDKListen this_ptr);
10062
10063 /**
10064  * Calls the free function if one is set
10065  */
10066 void Watch_free(struct LDKWatch this_ptr);
10067
10068 /**
10069  * Calls the free function if one is set
10070  */
10071 void Filter_free(struct LDKFilter this_ptr);
10072
10073 /**
10074  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
10075  */
10076 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
10077
10078 /**
10079  * First block where the transaction output may have been spent.
10080  */
10081 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10082
10083 /**
10084  * First block where the transaction output may have been spent.
10085  */
10086 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10087
10088 /**
10089  * Outpoint identifying the transaction output.
10090  */
10091 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10092
10093 /**
10094  * Outpoint identifying the transaction output.
10095  */
10096 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10097
10098 /**
10099  * Spending condition of the transaction output.
10100  */
10101 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10102
10103 /**
10104  * Spending condition of the transaction output.
10105  */
10106 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
10107
10108 /**
10109  * Constructs a new WatchedOutput given each field
10110  */
10111 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
10112
10113 /**
10114  * Calls the free function if one is set
10115  */
10116 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
10117
10118 /**
10119  * Creates a copy of the ConfirmationTarget
10120  */
10121 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
10122
10123 /**
10124  * Calls the free function if one is set
10125  */
10126 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
10127
10128 /**
10129  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
10130  */
10131 void ChainMonitor_free(struct LDKChainMonitor this_obj);
10132
10133 /**
10134  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10135  * of a channel and reacting accordingly based on transactions in the connected block. See
10136  * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
10137  * be returned by [`chain::Watch::release_pending_monitor_events`].
10138  *
10139  * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
10140  * calls must not exclude any transactions matching the new outputs nor any in-block
10141  * descendants of such transactions. It is not necessary to re-fetch the block to obtain
10142  * updated `txdata`.
10143  */
10144 void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
10145
10146 /**
10147  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10148  * of a channel and reacting accordingly to newly confirmed transactions. For details, see
10149  * [`ChannelMonitor::transactions_confirmed`].
10150  *
10151  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10152  * blocks. May be called before or after [`update_best_block`] for transactions in the
10153  * corresponding block. See [`update_best_block`] for further calling expectations.
10154  *
10155  * [`block_connected`]: Self::block_connected
10156  * [`update_best_block`]: Self::update_best_block
10157  */
10158 void ChainMonitor_transactions_confirmed(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
10159
10160 /**
10161  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10162  * of a channel and reacting accordingly based on the new chain tip. For details, see
10163  * [`ChannelMonitor::update_best_block`].
10164  *
10165  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10166  * blocks. May be called before or after [`transactions_confirmed`] for the corresponding
10167  * block.
10168  *
10169  * Must be called after new blocks become available for the most recent block. Intermediary
10170  * blocks, however, may be safely skipped. In the event of a chain re-organization, this only
10171  * needs to be called for the most recent block assuming `transaction_unconfirmed` is called
10172  * for any affected transactions.
10173  *
10174  * [`block_connected`]: Self::block_connected
10175  * [`transactions_confirmed`]: Self::transactions_confirmed
10176  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10177  */
10178 void ChainMonitor_update_best_block(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height);
10179
10180 /**
10181  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10182  * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
10183  * details.
10184  */
10185 void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
10186
10187 /**
10188  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10189  * of a channel based on transactions unconfirmed as a result of a chain reorganization. See
10190  * [`ChannelMonitor::transaction_unconfirmed`] for details.
10191  *
10192  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
10193  * than blocks. May be called before or after [`update_best_block`] for transactions in the
10194  * corresponding block. See [`update_best_block`] for further calling expectations.
10195  *
10196  * [`block_disconnected`]: Self::block_disconnected
10197  * [`update_best_block`]: Self::update_best_block
10198  */
10199 void ChainMonitor_transaction_unconfirmed(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32]);
10200
10201 /**
10202  * Returns the set of txids that should be monitored for re-organization out of the chain.
10203  */
10204 MUST_USE_RES struct LDKCVec_TxidZ ChainMonitor_get_relevant_txids(const struct LDKChainMonitor *NONNULL_PTR this_arg);
10205
10206 /**
10207  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
10208  *
10209  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
10210  * will call back to it indicating transactions and outputs of interest. This allows clients to
10211  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
10212  * always need to fetch full blocks absent another means for determining which blocks contain
10213  * transactions relevant to the watched channels.
10214  */
10215 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
10216
10217 /**
10218  * Constructs a new Watch which calls the relevant methods on this_arg.
10219  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
10220  */
10221 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
10222
10223 /**
10224  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
10225  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
10226  */
10227 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
10228
10229 /**
10230  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
10231  */
10232 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
10233
10234 /**
10235  * The sequence number of this update. Updates *must* be replayed in-order according to this
10236  * sequence number (and updates may panic if they are not). The update_id values are strictly
10237  * increasing and increase by one for each new update, with one exception specified below.
10238  *
10239  * This sequence number is also used to track up to which points updates which returned
10240  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
10241  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
10242  *
10243  * The only instance where update_id values are not strictly increasing is the case where we
10244  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
10245  * its docs for more details.
10246  */
10247 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
10248
10249 /**
10250  * The sequence number of this update. Updates *must* be replayed in-order according to this
10251  * sequence number (and updates may panic if they are not). The update_id values are strictly
10252  * increasing and increase by one for each new update, with one exception specified below.
10253  *
10254  * This sequence number is also used to track up to which points updates which returned
10255  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
10256  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
10257  *
10258  * The only instance where update_id values are not strictly increasing is the case where we
10259  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
10260  * its docs for more details.
10261  */
10262 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
10263
10264 /**
10265  * Creates a copy of the ChannelMonitorUpdate
10266  */
10267 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
10268
10269 /**
10270  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
10271  */
10272 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
10273
10274 /**
10275  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
10276  */
10277 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
10278
10279 /**
10280  * Creates a copy of the ChannelMonitorUpdateErr
10281  */
10282 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
10283
10284 /**
10285  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
10286  */
10287 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
10288
10289 /**
10290  * Creates a copy of the MonitorUpdateError
10291  */
10292 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
10293
10294 /**
10295  * Frees any resources used by the MonitorEvent
10296  */
10297 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
10298
10299 /**
10300  * Creates a copy of the MonitorEvent
10301  */
10302 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
10303
10304 /**
10305  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
10306  */
10307 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
10308
10309 /**
10310  * Creates a copy of the HTLCUpdate
10311  */
10312 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
10313
10314 /**
10315  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
10316  */
10317 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
10318
10319 /**
10320  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
10321  */
10322 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
10323
10324 /**
10325  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
10326  */
10327 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
10328
10329 /**
10330  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
10331  */
10332 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
10333
10334 /**
10335  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
10336  * itself.
10337  *
10338  * panics if the given update is not the next update by update_id.
10339  */
10340 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);
10341
10342 /**
10343  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
10344  * ChannelMonitor.
10345  */
10346 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10347
10348 /**
10349  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
10350  */
10351 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10352
10353 /**
10354  * Gets a list of txids, with their output scripts (in the order they appear in the
10355  * transaction), which we must learn about spends of via block_connected().
10356  */
10357 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10358
10359 /**
10360  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
10361  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
10362  * have been registered.
10363  */
10364 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
10365
10366 /**
10367  * Get the list of HTLCs who's status has been updated on chain. This should be called by
10368  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
10369  */
10370 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10371
10372 /**
10373  * Gets the list of pending events which were generated by previous actions, clearing the list
10374  * in the process.
10375  *
10376  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
10377  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
10378  * no internal locking in ChannelMonitors.
10379  */
10380 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10381
10382 /**
10383  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
10384  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
10385  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
10386  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
10387  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
10388  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
10389  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
10390  * out-of-band the other node operator to coordinate with him if option is available to you.
10391  * In any-case, choice is up to the user.
10392  */
10393 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);
10394
10395 /**
10396  * Processes transactions in a newly connected block, which may result in any of the following:
10397  * - update the monitor's state against resolved HTLCs
10398  * - punish the counterparty in the case of seeing a revoked commitment transaction
10399  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
10400  * - detect settled outputs for later spending
10401  * - schedule and bump any in-flight claims
10402  *
10403  * Returns any new outputs to watch from `txdata`; after called, these are also included in
10404  * [`get_outputs_to_watch`].
10405  *
10406  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
10407  */
10408 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);
10409
10410 /**
10411  * Determines if the disconnected block contained any transactions of interest and updates
10412  * appropriately.
10413  */
10414 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);
10415
10416 /**
10417  * Processes transactions confirmed in a block with the given header and height, returning new
10418  * outputs to watch. See [`block_connected`] for details.
10419  *
10420  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10421  * blocks. May be called before or after [`update_best_block`] for transactions in the
10422  * corresponding block. See [`update_best_block`] for further calling expectations.
10423  *
10424  * [`block_connected`]: Self::block_connected
10425  * [`update_best_block`]: Self::update_best_block
10426  */
10427 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);
10428
10429 /**
10430  * Processes a transaction that was reorganized out of the chain.
10431  *
10432  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
10433  * than blocks. May be called before or after [`update_best_block`] for transactions in the
10434  * corresponding block. See [`update_best_block`] for further calling expectations.
10435  *
10436  * [`block_disconnected`]: Self::block_disconnected
10437  * [`update_best_block`]: Self::update_best_block
10438  */
10439 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);
10440
10441 /**
10442  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
10443  * [`block_connected`] for details.
10444  *
10445  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10446  * blocks. May be called before or after [`transactions_confirmed`] for the corresponding
10447  * block.
10448  *
10449  * Must be called after new blocks become available for the most recent block. Intermediary
10450  * blocks, however, may be safely skipped. In the event of a chain re-organization, this only
10451  * needs to be called for the most recent block assuming `transaction_unconfirmed` is called
10452  * for any affected transactions.
10453  *
10454  * [`block_connected`]: Self::block_connected
10455  * [`transactions_confirmed`]: Self::transactions_confirmed
10456  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10457  */
10458 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);
10459
10460 /**
10461  * Returns the set of txids that should be monitored for re-organization out of the chain.
10462  */
10463 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10464
10465 /**
10466  * Calls the free function if one is set
10467  */
10468 void Persist_free(struct LDKPersist this_ptr);
10469
10470 /**
10471  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
10472  */
10473 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
10474
10475 /**
10476  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
10477  */
10478 void OutPoint_free(struct LDKOutPoint this_obj);
10479
10480 /**
10481  * The referenced transaction's txid.
10482  */
10483 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
10484
10485 /**
10486  * The referenced transaction's txid.
10487  */
10488 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10489
10490 /**
10491  * The index of the referenced output in its transaction's vout.
10492  */
10493 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
10494
10495 /**
10496  * The index of the referenced output in its transaction's vout.
10497  */
10498 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
10499
10500 /**
10501  * Constructs a new OutPoint given each field
10502  */
10503 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
10504
10505 /**
10506  * Creates a copy of the OutPoint
10507  */
10508 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
10509
10510 /**
10511  * Convert an `OutPoint` to a lightning channel id.
10512  */
10513 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
10514
10515 /**
10516  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
10517  */
10518 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
10519
10520 /**
10521  * Read a OutPoint from a byte array, created by OutPoint_write
10522  */
10523 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
10524
10525 /**
10526  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
10527  */
10528 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
10529
10530 /**
10531  * The outpoint which is spendable
10532  */
10533 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10534
10535 /**
10536  * The outpoint which is spendable
10537  */
10538 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10539
10540 /**
10541  * Per commitment point to derive delayed_payment_key by key holder
10542  */
10543 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10544
10545 /**
10546  * Per commitment point to derive delayed_payment_key by key holder
10547  */
10548 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10549
10550 /**
10551  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
10552  * the witness_script.
10553  */
10554 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10555
10556 /**
10557  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
10558  * the witness_script.
10559  */
10560 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
10561
10562 /**
10563  * The output which is referenced by the given outpoint
10564  */
10565 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
10566
10567 /**
10568  * The revocation point specific to the commitment transaction which was broadcast. Used to
10569  * derive the witnessScript for this output.
10570  */
10571 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10572
10573 /**
10574  * The revocation point specific to the commitment transaction which was broadcast. Used to
10575  * derive the witnessScript for this output.
10576  */
10577 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10578
10579 /**
10580  * Arbitrary identification information returned by a call to
10581  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10582  * the channel to spend the output.
10583  */
10584 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
10585
10586 /**
10587  * Arbitrary identification information returned by a call to
10588  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10589  * the channel to spend the output.
10590  */
10591 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10592
10593 /**
10594  * The value of the channel which this output originated from, possibly indirectly.
10595  */
10596 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10597
10598 /**
10599  * The value of the channel which this output originated from, possibly indirectly.
10600  */
10601 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
10602
10603 /**
10604  * Constructs a new DelayedPaymentOutputDescriptor given each field
10605  */
10606 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);
10607
10608 /**
10609  * Creates a copy of the DelayedPaymentOutputDescriptor
10610  */
10611 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
10612
10613 /**
10614  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
10615  */
10616 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
10617
10618 /**
10619  * The outpoint which is spendable
10620  */
10621 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10622
10623 /**
10624  * The outpoint which is spendable
10625  */
10626 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10627
10628 /**
10629  * The output which is referenced by the given outpoint
10630  */
10631 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
10632
10633 /**
10634  * Arbitrary identification information returned by a call to
10635  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10636  * the channel to spend the output.
10637  */
10638 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
10639
10640 /**
10641  * Arbitrary identification information returned by a call to
10642  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10643  * the channel to spend the output.
10644  */
10645 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10646
10647 /**
10648  * The value of the channel which this transactions spends.
10649  */
10650 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10651
10652 /**
10653  * The value of the channel which this transactions spends.
10654  */
10655 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
10656
10657 /**
10658  * Constructs a new StaticPaymentOutputDescriptor given each field
10659  */
10660 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);
10661
10662 /**
10663  * Creates a copy of the StaticPaymentOutputDescriptor
10664  */
10665 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
10666
10667 /**
10668  * Frees any resources used by the SpendableOutputDescriptor
10669  */
10670 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
10671
10672 /**
10673  * Creates a copy of the SpendableOutputDescriptor
10674  */
10675 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
10676
10677 /**
10678  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
10679  */
10680 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
10681
10682 /**
10683  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
10684  */
10685 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
10686
10687 /**
10688  * Calls the free function if one is set
10689  */
10690 void BaseSign_free(struct LDKBaseSign this_ptr);
10691
10692 /**
10693  * Creates a copy of a Sign
10694  */
10695 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
10696
10697 /**
10698  * Calls the free function if one is set
10699  */
10700 void Sign_free(struct LDKSign this_ptr);
10701
10702 /**
10703  * Calls the free function if one is set
10704  */
10705 void KeysInterface_free(struct LDKKeysInterface this_ptr);
10706
10707 /**
10708  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
10709  */
10710 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
10711
10712 /**
10713  * Private key of anchor tx
10714  */
10715 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10716
10717 /**
10718  * Private key of anchor tx
10719  */
10720 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10721
10722 /**
10723  * Holder secret key for blinded revocation pubkey
10724  */
10725 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10726
10727 /**
10728  * Holder secret key for blinded revocation pubkey
10729  */
10730 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10731
10732 /**
10733  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
10734  */
10735 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10736
10737 /**
10738  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
10739  */
10740 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10741
10742 /**
10743  * Holder secret key used in HTLC tx
10744  */
10745 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10746
10747 /**
10748  * Holder secret key used in HTLC tx
10749  */
10750 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10751
10752 /**
10753  * Holder htlc secret key used in commitment tx htlc outputs
10754  */
10755 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10756
10757 /**
10758  * Holder htlc secret key used in commitment tx htlc outputs
10759  */
10760 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10761
10762 /**
10763  * Commitment seed
10764  */
10765 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10766
10767 /**
10768  * Commitment seed
10769  */
10770 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10771
10772 /**
10773  * Creates a copy of the InMemorySigner
10774  */
10775 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
10776
10777 /**
10778  * Create a new InMemorySigner
10779  */
10780 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);
10781
10782 /**
10783  * Counterparty pubkeys.
10784  * Will panic if ready_channel wasn't called.
10785  */
10786 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10787
10788 /**
10789  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
10790  * transactions, ie the amount of time that we have to wait to recover our funds if we
10791  * broadcast a transaction.
10792  * Will panic if ready_channel wasn't called.
10793  */
10794 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10795
10796 /**
10797  * The contest_delay value specified by us and applied on transactions broadcastable
10798  * by our counterparty, ie the amount of time that they have to wait to recover their funds
10799  * if they broadcast a transaction.
10800  * Will panic if ready_channel wasn't called.
10801  */
10802 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10803
10804 /**
10805  * Whether the holder is the initiator
10806  * Will panic if ready_channel wasn't called.
10807  */
10808 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10809
10810 /**
10811  * Funding outpoint
10812  * Will panic if ready_channel wasn't called.
10813  */
10814 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10815
10816 /**
10817  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
10818  * building transactions.
10819  *
10820  * Will panic if ready_channel wasn't called.
10821  */
10822 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10823
10824 /**
10825  * Sign the single input of spend_tx at index `input_idx` which spends the output
10826  * described by descriptor, returning the witness stack for the input.
10827  *
10828  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
10829  * or is not spending the outpoint described by `descriptor.outpoint`.
10830  */
10831 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);
10832
10833 /**
10834  * Sign the single input of spend_tx at index `input_idx` which spends the output
10835  * described by descriptor, returning the witness stack for the input.
10836  *
10837  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
10838  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
10839  * sequence set to `descriptor.to_self_delay`.
10840  */
10841 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);
10842
10843 /**
10844  * Constructs a new BaseSign which calls the relevant methods on this_arg.
10845  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
10846  */
10847 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10848
10849 /**
10850  * Constructs a new Sign which calls the relevant methods on this_arg.
10851  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
10852  */
10853 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10854
10855 /**
10856  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
10857  */
10858 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
10859
10860 /**
10861  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
10862  */
10863 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
10864
10865 /**
10866  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
10867  */
10868 void KeysManager_free(struct LDKKeysManager this_obj);
10869
10870 /**
10871  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
10872  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
10873  * starting_time isn't strictly required to actually be a time, but it must absolutely,
10874  * without a doubt, be unique to this instance. ie if you start multiple times with the same
10875  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
10876  * simply use the current time (with very high precision).
10877  *
10878  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
10879  * obviously, starting_time should be unique every time you reload the library - it is only
10880  * used to generate new ephemeral key data (which will be stored by the individual channel if
10881  * necessary).
10882  *
10883  * Note that the seed is required to recover certain on-chain funds independent of
10884  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
10885  * channel, and some on-chain during-closing funds.
10886  *
10887  * Note that until the 0.1 release there is no guarantee of backward compatibility between
10888  * versions. Once the library is more fully supported, the docs will be updated to include a
10889  * detailed description of the guarantee.
10890  */
10891 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
10892
10893 /**
10894  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
10895  *
10896  * Key derivation parameters are accessible through a per-channel secrets
10897  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
10898  * onchain output detection for which a corresponding delayed_payment_key must be derived.
10899  */
10900 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]);
10901
10902 /**
10903  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
10904  * output to the given change destination (if sufficient change value remains). The
10905  * transaction will have a feerate, at least, of the given value.
10906  *
10907  * Returns `Err(())` if the output value is greater than the input value minus required fee or
10908  * if a descriptor was duplicated.
10909  *
10910  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
10911  *
10912  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
10913  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
10914  */
10915 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);
10916
10917 /**
10918  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
10919  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
10920  */
10921 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
10922
10923 /**
10924  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
10925  */
10926 void ChannelManager_free(struct LDKChannelManager this_obj);
10927
10928 /**
10929  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
10930  */
10931 void ChainParameters_free(struct LDKChainParameters this_obj);
10932
10933 /**
10934  * The network for determining the `chain_hash` in Lightning messages.
10935  */
10936 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
10937
10938 /**
10939  * The network for determining the `chain_hash` in Lightning messages.
10940  */
10941 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
10942
10943 /**
10944  * The hash and height of the latest block successfully connected.
10945  *
10946  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
10947  */
10948 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
10949
10950 /**
10951  * The hash and height of the latest block successfully connected.
10952  *
10953  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
10954  */
10955 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
10956
10957 /**
10958  * Constructs a new ChainParameters given each field
10959  */
10960 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
10961
10962 /**
10963  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
10964  */
10965 void BestBlock_free(struct LDKBestBlock this_obj);
10966
10967 /**
10968  * Creates a copy of the BestBlock
10969  */
10970 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
10971
10972 /**
10973  * Returns the best block from the genesis of the given network.
10974  */
10975 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
10976
10977 /**
10978  * Returns the best block as identified by the given block hash and height.
10979  */
10980 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
10981
10982 /**
10983  * Returns the best block hash.
10984  */
10985 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
10986
10987 /**
10988  * Returns the best block height.
10989  */
10990 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
10991
10992 /**
10993  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
10994  */
10995 void ChannelDetails_free(struct LDKChannelDetails this_obj);
10996
10997 /**
10998  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
10999  * thereafter this is the txid of the funding transaction xor the funding transaction output).
11000  * Note that this means this value is *not* persistent - it can change once during the
11001  * lifetime of the channel.
11002  */
11003 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
11004
11005 /**
11006  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
11007  * thereafter this is the txid of the funding transaction xor the funding transaction output).
11008  * Note that this means this value is *not* persistent - it can change once during the
11009  * lifetime of the channel.
11010  */
11011 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11012
11013 /**
11014  * The position of the funding transaction in the chain. None if the funding transaction has
11015  * not yet been confirmed and the channel fully opened.
11016  */
11017 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11018
11019 /**
11020  * The position of the funding transaction in the chain. None if the funding transaction has
11021  * not yet been confirmed and the channel fully opened.
11022  */
11023 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
11024
11025 /**
11026  * The node_id of our counterparty
11027  */
11028 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11029
11030 /**
11031  * The node_id of our counterparty
11032  */
11033 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11034
11035 /**
11036  * The Features the channel counterparty provided upon last connection.
11037  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
11038  * many routing-relevant features are present in the init context.
11039  */
11040 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11041
11042 /**
11043  * The Features the channel counterparty provided upon last connection.
11044  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
11045  * many routing-relevant features are present in the init context.
11046  */
11047 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
11048
11049 /**
11050  * The value, in satoshis, of this channel as appears in the funding output
11051  */
11052 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11053
11054 /**
11055  * The value, in satoshis, of this channel as appears in the funding output
11056  */
11057 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11058
11059 /**
11060  * The user_id passed in to create_channel, or 0 if the channel was inbound.
11061  */
11062 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11063
11064 /**
11065  * The user_id passed in to create_channel, or 0 if the channel was inbound.
11066  */
11067 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11068
11069 /**
11070  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
11071  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11072  * available for inclusion in new outbound HTLCs). This further does not include any pending
11073  * outgoing HTLCs which are awaiting some other resolution to be sent.
11074  */
11075 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11076
11077 /**
11078  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
11079  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11080  * available for inclusion in new outbound HTLCs). This further does not include any pending
11081  * outgoing HTLCs which are awaiting some other resolution to be sent.
11082  */
11083 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11084
11085 /**
11086  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
11087  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11088  * available for inclusion in new inbound HTLCs).
11089  * Note that there are some corner cases not fully handled here, so the actual available
11090  * inbound capacity may be slightly higher than this.
11091  */
11092 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11093
11094 /**
11095  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
11096  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11097  * available for inclusion in new inbound HTLCs).
11098  * Note that there are some corner cases not fully handled here, so the actual available
11099  * inbound capacity may be slightly higher than this.
11100  */
11101 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11102
11103 /**
11104  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
11105  * the peer is connected, and (c) no monitor update failure is pending resolution.
11106  */
11107 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11108
11109 /**
11110  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
11111  * the peer is connected, and (c) no monitor update failure is pending resolution.
11112  */
11113 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
11114
11115 /**
11116  * Creates a copy of the ChannelDetails
11117  */
11118 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
11119
11120 /**
11121  * Frees any resources used by the PaymentSendFailure
11122  */
11123 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
11124
11125 /**
11126  * Creates a copy of the PaymentSendFailure
11127  */
11128 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
11129
11130 /**
11131  * Constructs a new ChannelManager to hold several channels and route between them.
11132  *
11133  * This is the main \"logic hub\" for all channel-related actions, and implements
11134  * ChannelMessageHandler.
11135  *
11136  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
11137  *
11138  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
11139  *
11140  * Users need to notify the new ChannelManager when a new block is connected or
11141  * disconnected using its `block_connected` and `block_disconnected` methods, starting
11142  * from after `params.latest_hash`.
11143  */
11144 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);
11145
11146 /**
11147  * Gets the current configuration applied to all new channels,  as
11148  */
11149 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
11150
11151 /**
11152  * Creates a new outbound channel to the given remote node and with the given value.
11153  *
11154  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
11155  * tracking of which events correspond with which create_channel call. Note that the
11156  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
11157  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
11158  * otherwise ignored.
11159  *
11160  * If successful, will generate a SendOpenChannel message event, so you should probably poll
11161  * PeerManager::process_events afterwards.
11162  *
11163  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
11164  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
11165  */
11166 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);
11167
11168 /**
11169  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
11170  * more information.
11171  */
11172 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11173
11174 /**
11175  * Gets the list of usable channels, in random order. Useful as an argument to
11176  * get_route to ensure non-announced channels are used.
11177  *
11178  * These are guaranteed to have their is_live value set to true, see the documentation for
11179  * ChannelDetails::is_live for more info on exactly what the criteria are.
11180  */
11181 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11182
11183 /**
11184  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
11185  * will be accepted on the given channel, and after additional timeout/the closing of all
11186  * pending HTLCs, the channel will be closed on chain.
11187  *
11188  * May generate a SendShutdown message event on success, which should be relayed.
11189  */
11190 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
11191
11192 /**
11193  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
11194  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
11195  */
11196 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
11197
11198 /**
11199  * Force close all channels, immediately broadcasting the latest local commitment transaction
11200  * for each to the chain and rejecting new HTLCs on each.
11201  */
11202 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11203
11204 /**
11205  * Sends a payment along a given route.
11206  *
11207  * Value parameters are provided via the last hop in route, see documentation for RouteHop
11208  * fields for more info.
11209  *
11210  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
11211  * payment), we don't do anything to stop you! We always try to ensure that if the provided
11212  * next hop knows the preimage to payment_hash they can claim an additional amount as
11213  * specified in the last hop in the route! Thus, you should probably do your own
11214  * payment_preimage tracking (which you should already be doing as they represent \"proof of
11215  * payment\") and prevent double-sends yourself.
11216  *
11217  * May generate SendHTLCs message(s) event on success, which should be relayed.
11218  *
11219  * Each path may have a different return value, and PaymentSendValue may return a Vec with
11220  * each entry matching the corresponding-index entry in the route paths, see
11221  * PaymentSendFailure for more info.
11222  *
11223  * In general, a path may raise:
11224  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
11225  *    node public key) is specified.
11226  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
11227  *    (including due to previous monitor update failure or new permanent monitor update
11228  *    failure).
11229  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
11230  *    relevant updates.
11231  *
11232  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
11233  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
11234  * different route unless you intend to pay twice!
11235  *
11236  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
11237  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
11238  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
11239  * must not contain multiple paths as multi-path payments require a recipient-provided
11240  * payment_secret.
11241  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
11242  * bit set (either as required or as available). If multiple paths are present in the Route,
11243  * we assume the invoice had the basic_mpp feature set.
11244  */
11245 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);
11246
11247 /**
11248  * Call this upon creation of a funding transaction for the given channel.
11249  *
11250  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
11251  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
11252  *
11253  * Panics if a funding transaction has already been provided for this channel.
11254  *
11255  * May panic if the output found in the funding transaction is duplicative with some other
11256  * channel (note that this should be trivially prevented by using unique funding transaction
11257  * keys per-channel).
11258  *
11259  * Do NOT broadcast the funding transaction yourself. When we have safely received our
11260  * counterparty's signature the funding transaction will automatically be broadcast via the
11261  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
11262  *
11263  * Note that this includes RBF or similar transaction replacement strategies - lightning does
11264  * not currently support replacing a funding transaction on an existing channel. Instead,
11265  * create a new channel with a conflicting funding transaction.
11266  */
11267 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);
11268
11269 /**
11270  * Generates a signed node_announcement from the given arguments and creates a
11271  * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
11272  * seen a channel_announcement from us (ie unless we have public channels open).
11273  *
11274  * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
11275  * to humans. They carry no in-protocol meaning.
11276  *
11277  * addresses represent the set (possibly empty) of socket addresses on which this node accepts
11278  * incoming connections. These will be broadcast to the network, publicly tying these
11279  * addresses together. If you wish to preserve user privacy, addresses should likely contain
11280  * only Tor Onion addresses.
11281  *
11282  * Panics if addresses is absurdly large (more than 500).
11283  */
11284 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
11285
11286 /**
11287  * Processes HTLCs which are pending waiting on random forward delay.
11288  *
11289  * Should only really ever be called in response to a PendingHTLCsForwardable event.
11290  * Will likely generate further events.
11291  */
11292 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
11293
11294 /**
11295  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
11296  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
11297  * to inform the network about the uselessness of these channels.
11298  *
11299  * This method handles all the details, and must be called roughly once per minute.
11300  *
11301  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
11302  */
11303 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
11304
11305 /**
11306  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
11307  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
11308  * along the path (including in our own channel on which we received it).
11309  * Returns false if no payment was found to fail backwards, true if the process of failing the
11310  * HTLC backwards has been started.
11311  */
11312 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);
11313
11314 /**
11315  * Provides a payment preimage in response to a PaymentReceived event, returning true and
11316  * generating message events for the net layer to claim the payment, if possible. Thus, you
11317  * should probably kick the net layer to go send messages if this returns true!
11318  *
11319  * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
11320  * available within a few percent of the expected amount. This is critical for several
11321  * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
11322  * payment_preimage without having provided the full value and b) it avoids certain
11323  * privacy-breaking recipient-probing attacks which may reveal payment activity to
11324  * motivated attackers.
11325  *
11326  * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
11327  * set. Thus, for such payments we will claim any payments which do not under-pay.
11328  *
11329  * May panic if called except in response to a PaymentReceived event.
11330  */
11331 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);
11332
11333 /**
11334  * Gets the node_id held by this ChannelManager
11335  */
11336 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
11337
11338 /**
11339  * Restores a single, given channel to normal operation after a
11340  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
11341  * operation.
11342  *
11343  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
11344  * fully committed in every copy of the given channels' ChannelMonitors.
11345  *
11346  * Note that there is no effect to calling with a highest_applied_update_id other than the
11347  * current latest ChannelMonitorUpdate and one call to this function after multiple
11348  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
11349  * exists largely only to prevent races between this and concurrent update_monitor calls.
11350  *
11351  * Thus, the anticipated use is, at a high level:
11352  *  1) You register a chain::Watch with this ChannelManager,
11353  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
11354  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
11355  *     any time it cannot do so instantly,
11356  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
11357  *  4) once all remote copies are updated, you call this function with the update_id that
11358  *     completed, and once it is the latest the Channel will be re-enabled.
11359  */
11360 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);
11361
11362 /**
11363  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
11364  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
11365  */
11366 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
11367
11368 /**
11369  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
11370  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
11371  */
11372 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
11373
11374 /**
11375  * Constructs a new Listen which calls the relevant methods on this_arg.
11376  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
11377  */
11378 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
11379
11380 /**
11381  * Updates channel state to take note of transactions which were confirmed in the given block
11382  * at the given height.
11383  *
11384  * Note that you must still call (or have called) [`update_best_block`] with the block
11385  * information which is included here.
11386  *
11387  * This method may be called before or after [`update_best_block`] for a given block's
11388  * transaction data and may be called multiple times with additional transaction data for a
11389  * given block.
11390  *
11391  * This method may be called for a previous block after an [`update_best_block`] call has
11392  * been made for a later block, however it must *not* be called with transaction data from a
11393  * block which is no longer in the best chain (ie where [`update_best_block`] has already
11394  * been informed about a blockchain reorganization which no longer includes the block which
11395  * corresponds to `header`).
11396  *
11397  * [`update_best_block`]: `Self::update_best_block`
11398  */
11399 void ChannelManager_transactions_confirmed(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKCVec_C2Tuple_usizeTransactionZZ txdata);
11400
11401 /**
11402  * Updates channel state with the current best blockchain tip. You should attempt to call this
11403  * quickly after a new block becomes available, however if multiple new blocks become
11404  * available at the same time, only a single `update_best_block()` call needs to be made.
11405  *
11406  * This method should also be called immediately after any block disconnections, once at the
11407  * reorganization fork point, and once with the new chain tip. Calling this method at the
11408  * blockchain reorganization fork point ensures we learn when a funding transaction which was
11409  * previously confirmed is reorganized out of the blockchain, ensuring we do not continue to
11410  * accept payments which cannot be enforced on-chain.
11411  *
11412  * In both the block-connection and block-disconnection case, this method may be called either
11413  * once per block connected or disconnected, or simply at the fork point and new tip(s),
11414  * skipping any intermediary blocks.
11415  */
11416 void ChannelManager_update_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height);
11417
11418 /**
11419  * Gets the set of txids which should be monitored for their confirmation state.
11420  *
11421  * If you're providing information about reorganizations via [`transaction_unconfirmed`], this
11422  * is the set of transactions which you may need to call [`transaction_unconfirmed`] for.
11423  *
11424  * This may be useful to poll to determine the set of transactions which must be registered
11425  * with an Electrum server or for which an Electrum server needs to be polled to determine
11426  * transaction confirmation state.
11427  *
11428  * This may update after any [`transactions_confirmed`] or [`block_connected`] call.
11429  *
11430  * Note that this is NOT the set of transactions which must be included in calls to
11431  * [`transactions_confirmed`] if they are confirmed, but a small subset of it.
11432  *
11433  * [`transactions_confirmed`]: Self::transactions_confirmed
11434  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
11435  * [`block_connected`]: chain::Listen::block_connected
11436  */
11437 MUST_USE_RES struct LDKCVec_TxidZ ChannelManager_get_relevant_txids(const struct LDKChannelManager *NONNULL_PTR this_arg);
11438
11439 /**
11440  * Marks a transaction as having been reorganized out of the blockchain.
11441  *
11442  * If a transaction is included in [`get_relevant_txids`], and is no longer in the main branch
11443  * of the blockchain, this function should be called to indicate that the transaction should
11444  * be considered reorganized out.
11445  *
11446  * Once this is called, the given transaction will no longer appear on [`get_relevant_txids`],
11447  * though this may be called repeatedly for a given transaction without issue.
11448  *
11449  * Note that if the transaction is confirmed on the main chain in a different block (indicated
11450  * via a call to [`transactions_confirmed`]), it may re-appear in [`get_relevant_txids`], thus
11451  * be very wary of race-conditions wherein the final state of a transaction indicated via
11452  * these APIs is not the same as its state on the blockchain.
11453  *
11454  * [`transactions_confirmed`]: Self::transactions_confirmed
11455  * [`get_relevant_txids`]: Self::get_relevant_txids
11456  */
11457 void ChannelManager_transaction_unconfirmed(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*txid)[32]);
11458
11459 /**
11460  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
11461  * indicating whether persistence is necessary. Only one listener on
11462  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
11463  * up.
11464  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
11465  */
11466 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
11467
11468 /**
11469  * Blocks until ChannelManager needs to be persisted. Only one listener on
11470  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
11471  * up.
11472  */
11473 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
11474
11475 /**
11476  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
11477  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
11478  */
11479 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
11480
11481 /**
11482  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
11483  */
11484 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
11485
11486 /**
11487  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
11488  */
11489 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
11490
11491 /**
11492  * The keys provider which will give us relevant keys. Some keys will be loaded during
11493  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
11494  * signing data.
11495  */
11496 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11497
11498 /**
11499  * The keys provider which will give us relevant keys. Some keys will be loaded during
11500  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
11501  * signing data.
11502  */
11503 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
11504
11505 /**
11506  * The fee_estimator for use in the ChannelManager in the future.
11507  *
11508  * No calls to the FeeEstimator will be made during deserialization.
11509  */
11510 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11511
11512 /**
11513  * The fee_estimator for use in the ChannelManager in the future.
11514  *
11515  * No calls to the FeeEstimator will be made during deserialization.
11516  */
11517 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
11518
11519 /**
11520  * The chain::Watch for use in the ChannelManager in the future.
11521  *
11522  * No calls to the chain::Watch will be made during deserialization. It is assumed that
11523  * you have deserialized ChannelMonitors separately and will add them to your
11524  * chain::Watch after deserializing this ChannelManager.
11525  */
11526 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11527
11528 /**
11529  * The chain::Watch for use in the ChannelManager in the future.
11530  *
11531  * No calls to the chain::Watch will be made during deserialization. It is assumed that
11532  * you have deserialized ChannelMonitors separately and will add them to your
11533  * chain::Watch after deserializing this ChannelManager.
11534  */
11535 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
11536
11537 /**
11538  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
11539  * used to broadcast the latest local commitment transactions of channels which must be
11540  * force-closed during deserialization.
11541  */
11542 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11543
11544 /**
11545  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
11546  * used to broadcast the latest local commitment transactions of channels which must be
11547  * force-closed during deserialization.
11548  */
11549 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
11550
11551 /**
11552  * The Logger for use in the ChannelManager and which may be used to log information during
11553  * deserialization.
11554  */
11555 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11556
11557 /**
11558  * The Logger for use in the ChannelManager and which may be used to log information during
11559  * deserialization.
11560  */
11561 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
11562
11563 /**
11564  * Default settings used for new channels. Any existing channels will continue to use the
11565  * runtime settings which were stored when the ChannelManager was serialized.
11566  */
11567 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11568
11569 /**
11570  * Default settings used for new channels. Any existing channels will continue to use the
11571  * runtime settings which were stored when the ChannelManager was serialized.
11572  */
11573 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
11574
11575 /**
11576  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
11577  * HashMap for you. This is primarily useful for C bindings where it is not practical to
11578  * populate a HashMap directly from C.
11579  */
11580 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);
11581
11582 /**
11583  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
11584  */
11585 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
11586
11587 /**
11588  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
11589  */
11590 void DecodeError_free(struct LDKDecodeError this_obj);
11591
11592 /**
11593  * Creates a copy of the DecodeError
11594  */
11595 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
11596
11597 /**
11598  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
11599  */
11600 void Init_free(struct LDKInit this_obj);
11601
11602 /**
11603  * The relevant features which the sender supports
11604  */
11605 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
11606
11607 /**
11608  * The relevant features which the sender supports
11609  */
11610 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
11611
11612 /**
11613  * Constructs a new Init given each field
11614  */
11615 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
11616
11617 /**
11618  * Creates a copy of the Init
11619  */
11620 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
11621
11622 /**
11623  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
11624  */
11625 void ErrorMessage_free(struct LDKErrorMessage this_obj);
11626
11627 /**
11628  * The channel ID involved in the error
11629  */
11630 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
11631
11632 /**
11633  * The channel ID involved in the error
11634  */
11635 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11636
11637 /**
11638  * A possibly human-readable error description.
11639  * The string should be sanitized before it is used (e.g. emitted to logs
11640  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
11641  * vulnerability in the terminal emulator or the logging subsystem.
11642  */
11643 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
11644
11645 /**
11646  * A possibly human-readable error description.
11647  * The string should be sanitized before it is used (e.g. emitted to logs
11648  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
11649  * vulnerability in the terminal emulator or the logging subsystem.
11650  */
11651 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
11652
11653 /**
11654  * Constructs a new ErrorMessage given each field
11655  */
11656 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg);
11657
11658 /**
11659  * Creates a copy of the ErrorMessage
11660  */
11661 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
11662
11663 /**
11664  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
11665  */
11666 void Ping_free(struct LDKPing this_obj);
11667
11668 /**
11669  * The desired response length
11670  */
11671 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
11672
11673 /**
11674  * The desired response length
11675  */
11676 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
11677
11678 /**
11679  * The ping packet size.
11680  * This field is not sent on the wire. byteslen zeros are sent.
11681  */
11682 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
11683
11684 /**
11685  * The ping packet size.
11686  * This field is not sent on the wire. byteslen zeros are sent.
11687  */
11688 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
11689
11690 /**
11691  * Constructs a new Ping given each field
11692  */
11693 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
11694
11695 /**
11696  * Creates a copy of the Ping
11697  */
11698 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
11699
11700 /**
11701  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
11702  */
11703 void Pong_free(struct LDKPong this_obj);
11704
11705 /**
11706  * The pong packet size.
11707  * This field is not sent on the wire. byteslen zeros are sent.
11708  */
11709 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
11710
11711 /**
11712  * The pong packet size.
11713  * This field is not sent on the wire. byteslen zeros are sent.
11714  */
11715 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
11716
11717 /**
11718  * Constructs a new Pong given each field
11719  */
11720 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
11721
11722 /**
11723  * Creates a copy of the Pong
11724  */
11725 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
11726
11727 /**
11728  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
11729  */
11730 void OpenChannel_free(struct LDKOpenChannel this_obj);
11731
11732 /**
11733  * The genesis hash of the blockchain where the channel is to be opened
11734  */
11735 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
11736
11737 /**
11738  * The genesis hash of the blockchain where the channel is to be opened
11739  */
11740 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11741
11742 /**
11743  * A temporary channel ID, until the funding outpoint is announced
11744  */
11745 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
11746
11747 /**
11748  * A temporary channel ID, until the funding outpoint is announced
11749  */
11750 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11751
11752 /**
11753  * The channel value
11754  */
11755 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11756
11757 /**
11758  * The channel value
11759  */
11760 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11761
11762 /**
11763  * The amount to push to the counterparty as part of the open, in milli-satoshi
11764  */
11765 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11766
11767 /**
11768  * The amount to push to the counterparty as part of the open, in milli-satoshi
11769  */
11770 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11771
11772 /**
11773  * The threshold below which outputs on transactions broadcast by sender will be omitted
11774  */
11775 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11776
11777 /**
11778  * The threshold below which outputs on transactions broadcast by sender will be omitted
11779  */
11780 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11781
11782 /**
11783  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
11784  */
11785 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11786
11787 /**
11788  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
11789  */
11790 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11791
11792 /**
11793  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
11794  */
11795 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11796
11797 /**
11798  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
11799  */
11800 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11801
11802 /**
11803  * The minimum HTLC size incoming to sender, in milli-satoshi
11804  */
11805 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11806
11807 /**
11808  * The minimum HTLC size incoming to sender, in milli-satoshi
11809  */
11810 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11811
11812 /**
11813  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
11814  */
11815 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11816
11817 /**
11818  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
11819  */
11820 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
11821
11822 /**
11823  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
11824  */
11825 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11826
11827 /**
11828  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
11829  */
11830 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
11831
11832 /**
11833  * The maximum number of inbound HTLCs towards sender
11834  */
11835 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11836
11837 /**
11838  * The maximum number of inbound HTLCs towards sender
11839  */
11840 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
11841
11842 /**
11843  * The sender's key controlling the funding transaction
11844  */
11845 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11846
11847 /**
11848  * The sender's key controlling the funding transaction
11849  */
11850 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11851
11852 /**
11853  * Used to derive a revocation key for transactions broadcast by counterparty
11854  */
11855 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11856
11857 /**
11858  * Used to derive a revocation key for transactions broadcast by counterparty
11859  */
11860 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11861
11862 /**
11863  * A payment key to sender for transactions broadcast by counterparty
11864  */
11865 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11866
11867 /**
11868  * A payment key to sender for transactions broadcast by counterparty
11869  */
11870 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11871
11872 /**
11873  * Used to derive a payment key to sender for transactions broadcast by sender
11874  */
11875 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11876
11877 /**
11878  * Used to derive a payment key to sender for transactions broadcast by sender
11879  */
11880 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11881
11882 /**
11883  * Used to derive an HTLC payment key to sender
11884  */
11885 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11886
11887 /**
11888  * Used to derive an HTLC payment key to sender
11889  */
11890 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11891
11892 /**
11893  * The first to-be-broadcast-by-sender transaction's per commitment point
11894  */
11895 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11896
11897 /**
11898  * The first to-be-broadcast-by-sender transaction's per commitment point
11899  */
11900 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11901
11902 /**
11903  * Channel flags
11904  */
11905 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11906
11907 /**
11908  * Channel flags
11909  */
11910 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
11911
11912 /**
11913  * Creates a copy of the OpenChannel
11914  */
11915 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
11916
11917 /**
11918  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
11919  */
11920 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
11921
11922 /**
11923  * A temporary channel ID, until the funding outpoint is announced
11924  */
11925 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
11926
11927 /**
11928  * A temporary channel ID, until the funding outpoint is announced
11929  */
11930 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11931
11932 /**
11933  * The threshold below which outputs on transactions broadcast by sender will be omitted
11934  */
11935 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11936
11937 /**
11938  * The threshold below which outputs on transactions broadcast by sender will be omitted
11939  */
11940 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
11941
11942 /**
11943  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
11944  */
11945 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11946
11947 /**
11948  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
11949  */
11950 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
11951
11952 /**
11953  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
11954  */
11955 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11956
11957 /**
11958  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
11959  */
11960 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
11961
11962 /**
11963  * The minimum HTLC size incoming to sender, in milli-satoshi
11964  */
11965 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11966
11967 /**
11968  * The minimum HTLC size incoming to sender, in milli-satoshi
11969  */
11970 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
11971
11972 /**
11973  * Minimum depth of the funding transaction before the channel is considered open
11974  */
11975 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11976
11977 /**
11978  * Minimum depth of the funding transaction before the channel is considered open
11979  */
11980 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
11981
11982 /**
11983  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
11984  */
11985 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11986
11987 /**
11988  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
11989  */
11990 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
11991
11992 /**
11993  * The maximum number of inbound HTLCs towards sender
11994  */
11995 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11996
11997 /**
11998  * The maximum number of inbound HTLCs towards sender
11999  */
12000 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
12001
12002 /**
12003  * The sender's key controlling the funding transaction
12004  */
12005 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12006
12007 /**
12008  * The sender's key controlling the funding transaction
12009  */
12010 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12011
12012 /**
12013  * Used to derive a revocation key for transactions broadcast by counterparty
12014  */
12015 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12016
12017 /**
12018  * Used to derive a revocation key for transactions broadcast by counterparty
12019  */
12020 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12021
12022 /**
12023  * A payment key to sender for transactions broadcast by counterparty
12024  */
12025 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12026
12027 /**
12028  * A payment key to sender for transactions broadcast by counterparty
12029  */
12030 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12031
12032 /**
12033  * Used to derive a payment key to sender for transactions broadcast by sender
12034  */
12035 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12036
12037 /**
12038  * Used to derive a payment key to sender for transactions broadcast by sender
12039  */
12040 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12041
12042 /**
12043  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
12044  */
12045 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12046
12047 /**
12048  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
12049  */
12050 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12051
12052 /**
12053  * The first to-be-broadcast-by-sender transaction's per commitment point
12054  */
12055 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12056
12057 /**
12058  * The first to-be-broadcast-by-sender transaction's per commitment point
12059  */
12060 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12061
12062 /**
12063  * Creates a copy of the AcceptChannel
12064  */
12065 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
12066
12067 /**
12068  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
12069  */
12070 void FundingCreated_free(struct LDKFundingCreated this_obj);
12071
12072 /**
12073  * A temporary channel ID, until the funding is established
12074  */
12075 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
12076
12077 /**
12078  * A temporary channel ID, until the funding is established
12079  */
12080 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12081
12082 /**
12083  * The funding transaction ID
12084  */
12085 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
12086
12087 /**
12088  * The funding transaction ID
12089  */
12090 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12091
12092 /**
12093  * The specific output index funding this channel
12094  */
12095 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
12096
12097 /**
12098  * The specific output index funding this channel
12099  */
12100 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
12101
12102 /**
12103  * The signature of the channel initiator (funder) on the funding transaction
12104  */
12105 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
12106
12107 /**
12108  * The signature of the channel initiator (funder) on the funding transaction
12109  */
12110 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
12111
12112 /**
12113  * Constructs a new FundingCreated given each field
12114  */
12115 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);
12116
12117 /**
12118  * Creates a copy of the FundingCreated
12119  */
12120 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
12121
12122 /**
12123  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
12124  */
12125 void FundingSigned_free(struct LDKFundingSigned this_obj);
12126
12127 /**
12128  * The channel ID
12129  */
12130 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
12131
12132 /**
12133  * The channel ID
12134  */
12135 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12136
12137 /**
12138  * The signature of the channel acceptor (fundee) on the funding transaction
12139  */
12140 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
12141
12142 /**
12143  * The signature of the channel acceptor (fundee) on the funding transaction
12144  */
12145 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12146
12147 /**
12148  * Constructs a new FundingSigned given each field
12149  */
12150 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
12151
12152 /**
12153  * Creates a copy of the FundingSigned
12154  */
12155 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
12156
12157 /**
12158  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
12159  */
12160 void FundingLocked_free(struct LDKFundingLocked this_obj);
12161
12162 /**
12163  * The channel ID
12164  */
12165 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
12166
12167 /**
12168  * The channel ID
12169  */
12170 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12171
12172 /**
12173  * The per-commitment point of the second commitment transaction
12174  */
12175 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
12176
12177 /**
12178  * The per-commitment point of the second commitment transaction
12179  */
12180 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12181
12182 /**
12183  * Constructs a new FundingLocked given each field
12184  */
12185 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
12186
12187 /**
12188  * Creates a copy of the FundingLocked
12189  */
12190 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
12191
12192 /**
12193  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
12194  */
12195 void Shutdown_free(struct LDKShutdown this_obj);
12196
12197 /**
12198  * The channel ID
12199  */
12200 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
12201
12202 /**
12203  * The channel ID
12204  */
12205 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12206
12207 /**
12208  * The destination of this peer's funds on closing.
12209  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
12210  */
12211 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
12212
12213 /**
12214  * The destination of this peer's funds on closing.
12215  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
12216  */
12217 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
12218
12219 /**
12220  * Constructs a new Shutdown given each field
12221  */
12222 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
12223
12224 /**
12225  * Creates a copy of the Shutdown
12226  */
12227 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
12228
12229 /**
12230  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
12231  */
12232 void ClosingSigned_free(struct LDKClosingSigned this_obj);
12233
12234 /**
12235  * The channel ID
12236  */
12237 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
12238
12239 /**
12240  * The channel ID
12241  */
12242 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12243
12244 /**
12245  * The proposed total fee for the closing transaction
12246  */
12247 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
12248
12249 /**
12250  * The proposed total fee for the closing transaction
12251  */
12252 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
12253
12254 /**
12255  * A signature on the closing transaction
12256  */
12257 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
12258
12259 /**
12260  * A signature on the closing transaction
12261  */
12262 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12263
12264 /**
12265  * Constructs a new ClosingSigned given each field
12266  */
12267 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
12268
12269 /**
12270  * Creates a copy of the ClosingSigned
12271  */
12272 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
12273
12274 /**
12275  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
12276  */
12277 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
12278
12279 /**
12280  * The channel ID
12281  */
12282 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
12283
12284 /**
12285  * The channel ID
12286  */
12287 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12288
12289 /**
12290  * The HTLC ID
12291  */
12292 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12293
12294 /**
12295  * The HTLC ID
12296  */
12297 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
12298
12299 /**
12300  * The HTLC value in milli-satoshi
12301  */
12302 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12303
12304 /**
12305  * The HTLC value in milli-satoshi
12306  */
12307 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
12308
12309 /**
12310  * The payment hash, the pre-image of which controls HTLC redemption
12311  */
12312 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
12313
12314 /**
12315  * The payment hash, the pre-image of which controls HTLC redemption
12316  */
12317 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12318
12319 /**
12320  * The expiry height of the HTLC
12321  */
12322 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12323
12324 /**
12325  * The expiry height of the HTLC
12326  */
12327 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
12328
12329 /**
12330  * Creates a copy of the UpdateAddHTLC
12331  */
12332 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
12333
12334 /**
12335  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
12336  */
12337 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
12338
12339 /**
12340  * The channel ID
12341  */
12342 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
12343
12344 /**
12345  * The channel ID
12346  */
12347 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12348
12349 /**
12350  * The HTLC ID
12351  */
12352 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
12353
12354 /**
12355  * The HTLC ID
12356  */
12357 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
12358
12359 /**
12360  * The pre-image of the payment hash, allowing HTLC redemption
12361  */
12362 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
12363
12364 /**
12365  * The pre-image of the payment hash, allowing HTLC redemption
12366  */
12367 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12368
12369 /**
12370  * Constructs a new UpdateFulfillHTLC given each field
12371  */
12372 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
12373
12374 /**
12375  * Creates a copy of the UpdateFulfillHTLC
12376  */
12377 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
12378
12379 /**
12380  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
12381  */
12382 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
12383
12384 /**
12385  * The channel ID
12386  */
12387 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
12388
12389 /**
12390  * The channel ID
12391  */
12392 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12393
12394 /**
12395  * The HTLC ID
12396  */
12397 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
12398
12399 /**
12400  * The HTLC ID
12401  */
12402 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
12403
12404 /**
12405  * Creates a copy of the UpdateFailHTLC
12406  */
12407 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
12408
12409 /**
12410  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
12411  */
12412 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
12413
12414 /**
12415  * The channel ID
12416  */
12417 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
12418
12419 /**
12420  * The channel ID
12421  */
12422 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12423
12424 /**
12425  * The HTLC ID
12426  */
12427 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
12428
12429 /**
12430  * The HTLC ID
12431  */
12432 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
12433
12434 /**
12435  * The failure code
12436  */
12437 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
12438
12439 /**
12440  * The failure code
12441  */
12442 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
12443
12444 /**
12445  * Creates a copy of the UpdateFailMalformedHTLC
12446  */
12447 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
12448
12449 /**
12450  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
12451  */
12452 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
12453
12454 /**
12455  * The channel ID
12456  */
12457 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
12458
12459 /**
12460  * The channel ID
12461  */
12462 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12463
12464 /**
12465  * A signature on the commitment transaction
12466  */
12467 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
12468
12469 /**
12470  * A signature on the commitment transaction
12471  */
12472 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12473
12474 /**
12475  * Signatures on the HTLC transactions
12476  */
12477 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
12478
12479 /**
12480  * Constructs a new CommitmentSigned given each field
12481  */
12482 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
12483
12484 /**
12485  * Creates a copy of the CommitmentSigned
12486  */
12487 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
12488
12489 /**
12490  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
12491  */
12492 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
12493
12494 /**
12495  * The channel ID
12496  */
12497 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
12498
12499 /**
12500  * The channel ID
12501  */
12502 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12503
12504 /**
12505  * The secret corresponding to the per-commitment point
12506  */
12507 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
12508
12509 /**
12510  * The secret corresponding to the per-commitment point
12511  */
12512 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12513
12514 /**
12515  * The next sender-broadcast commitment transaction's per-commitment point
12516  */
12517 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
12518
12519 /**
12520  * The next sender-broadcast commitment transaction's per-commitment point
12521  */
12522 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12523
12524 /**
12525  * Constructs a new RevokeAndACK given each field
12526  */
12527 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);
12528
12529 /**
12530  * Creates a copy of the RevokeAndACK
12531  */
12532 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
12533
12534 /**
12535  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
12536  */
12537 void UpdateFee_free(struct LDKUpdateFee this_obj);
12538
12539 /**
12540  * The channel ID
12541  */
12542 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
12543
12544 /**
12545  * The channel ID
12546  */
12547 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12548
12549 /**
12550  * Fee rate per 1000-weight of the transaction
12551  */
12552 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
12553
12554 /**
12555  * Fee rate per 1000-weight of the transaction
12556  */
12557 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
12558
12559 /**
12560  * Constructs a new UpdateFee given each field
12561  */
12562 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
12563
12564 /**
12565  * Creates a copy of the UpdateFee
12566  */
12567 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
12568
12569 /**
12570  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
12571  */
12572 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
12573
12574 /**
12575  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
12576  * belonging to the recipient
12577  */
12578 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
12579
12580 /**
12581  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
12582  * belonging to the recipient
12583  */
12584 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12585
12586 /**
12587  * The sender's per-commitment point for their current commitment transaction
12588  */
12589 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
12590
12591 /**
12592  * The sender's per-commitment point for their current commitment transaction
12593  */
12594 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12595
12596 /**
12597  * Constructs a new DataLossProtect given each field
12598  */
12599 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
12600
12601 /**
12602  * Creates a copy of the DataLossProtect
12603  */
12604 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
12605
12606 /**
12607  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
12608  */
12609 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
12610
12611 /**
12612  * The channel ID
12613  */
12614 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
12615
12616 /**
12617  * The channel ID
12618  */
12619 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12620
12621 /**
12622  * The next commitment number for the sender
12623  */
12624 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
12625
12626 /**
12627  * The next commitment number for the sender
12628  */
12629 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
12630
12631 /**
12632  * The next commitment number for the recipient
12633  */
12634 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
12635
12636 /**
12637  * The next commitment number for the recipient
12638  */
12639 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
12640
12641 /**
12642  * Creates a copy of the ChannelReestablish
12643  */
12644 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
12645
12646 /**
12647  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
12648  */
12649 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
12650
12651 /**
12652  * The channel ID
12653  */
12654 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
12655
12656 /**
12657  * The channel ID
12658  */
12659 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12660
12661 /**
12662  * The short channel ID
12663  */
12664 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12665
12666 /**
12667  * The short channel ID
12668  */
12669 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
12670
12671 /**
12672  * A signature by the node key
12673  */
12674 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12675
12676 /**
12677  * A signature by the node key
12678  */
12679 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
12680
12681 /**
12682  * A signature by the funding key
12683  */
12684 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12685
12686 /**
12687  * A signature by the funding key
12688  */
12689 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
12690
12691 /**
12692  * Constructs a new AnnouncementSignatures given each field
12693  */
12694 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);
12695
12696 /**
12697  * Creates a copy of the AnnouncementSignatures
12698  */
12699 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
12700
12701 /**
12702  * Frees any resources used by the NetAddress
12703  */
12704 void NetAddress_free(struct LDKNetAddress this_ptr);
12705
12706 /**
12707  * Creates a copy of the NetAddress
12708  */
12709 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
12710
12711 /**
12712  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
12713  */
12714 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
12715
12716 /**
12717  * Read a Result from a byte array, created by Result_write
12718  */
12719 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
12720
12721 /**
12722  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
12723  */
12724 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
12725
12726 /**
12727  * The advertised features
12728  */
12729 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12730
12731 /**
12732  * The advertised features
12733  */
12734 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
12735
12736 /**
12737  * A strictly monotonic announcement counter, with gaps allowed
12738  */
12739 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12740
12741 /**
12742  * A strictly monotonic announcement counter, with gaps allowed
12743  */
12744 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
12745
12746 /**
12747  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
12748  * to this node).
12749  */
12750 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12751
12752 /**
12753  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
12754  * to this node).
12755  */
12756 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12757
12758 /**
12759  * An RGB color for UI purposes
12760  */
12761 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
12762
12763 /**
12764  * An RGB color for UI purposes
12765  */
12766 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
12767
12768 /**
12769  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
12770  * of uniqueness.
12771  */
12772 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
12773
12774 /**
12775  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
12776  * of uniqueness.
12777  */
12778 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12779
12780 /**
12781  * List of addresses on which this node is reachable
12782  */
12783 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
12784
12785 /**
12786  * Creates a copy of the UnsignedNodeAnnouncement
12787  */
12788 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
12789
12790 /**
12791  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
12792  */
12793 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
12794
12795 /**
12796  * The signature by the node key
12797  */
12798 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
12799
12800 /**
12801  * The signature by the node key
12802  */
12803 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
12804
12805 /**
12806  * The actual content of the announcement
12807  */
12808 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
12809
12810 /**
12811  * The actual content of the announcement
12812  */
12813 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
12814
12815 /**
12816  * Constructs a new NodeAnnouncement given each field
12817  */
12818 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
12819
12820 /**
12821  * Creates a copy of the NodeAnnouncement
12822  */
12823 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
12824
12825 /**
12826  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
12827  */
12828 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
12829
12830 /**
12831  * The advertised channel features
12832  */
12833 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
12834
12835 /**
12836  * The advertised channel features
12837  */
12838 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
12839
12840 /**
12841  * The genesis hash of the blockchain where the channel is to be opened
12842  */
12843 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
12844
12845 /**
12846  * The genesis hash of the blockchain where the channel is to be opened
12847  */
12848 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12849
12850 /**
12851  * The short channel ID
12852  */
12853 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
12854
12855 /**
12856  * The short channel ID
12857  */
12858 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
12859
12860 /**
12861  * One of the two node_ids which are endpoints of this channel
12862  */
12863 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
12864
12865 /**
12866  * One of the two node_ids which are endpoints of this channel
12867  */
12868 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12869
12870 /**
12871  * The other of the two node_ids which are endpoints of this channel
12872  */
12873 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
12874
12875 /**
12876  * The other of the two node_ids which are endpoints of this channel
12877  */
12878 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12879
12880 /**
12881  * The funding key for the first node
12882  */
12883 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
12884
12885 /**
12886  * The funding key for the first node
12887  */
12888 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12889
12890 /**
12891  * The funding key for the second node
12892  */
12893 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
12894
12895 /**
12896  * The funding key for the second node
12897  */
12898 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12899
12900 /**
12901  * Creates a copy of the UnsignedChannelAnnouncement
12902  */
12903 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
12904
12905 /**
12906  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
12907  */
12908 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
12909
12910 /**
12911  * Authentication of the announcement by the first public node
12912  */
12913 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
12914
12915 /**
12916  * Authentication of the announcement by the first public node
12917  */
12918 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
12919
12920 /**
12921  * Authentication of the announcement by the second public node
12922  */
12923 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
12924
12925 /**
12926  * Authentication of the announcement by the second public node
12927  */
12928 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
12929
12930 /**
12931  * Proof of funding UTXO ownership by the first public node
12932  */
12933 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
12934
12935 /**
12936  * Proof of funding UTXO ownership by the first public node
12937  */
12938 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
12939
12940 /**
12941  * Proof of funding UTXO ownership by the second public node
12942  */
12943 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
12944
12945 /**
12946  * Proof of funding UTXO ownership by the second public node
12947  */
12948 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
12949
12950 /**
12951  * The actual announcement
12952  */
12953 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
12954
12955 /**
12956  * The actual announcement
12957  */
12958 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
12959
12960 /**
12961  * Constructs a new ChannelAnnouncement given each field
12962  */
12963 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);
12964
12965 /**
12966  * Creates a copy of the ChannelAnnouncement
12967  */
12968 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
12969
12970 /**
12971  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
12972  */
12973 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
12974
12975 /**
12976  * The genesis hash of the blockchain where the channel is to be opened
12977  */
12978 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
12979
12980 /**
12981  * The genesis hash of the blockchain where the channel is to be opened
12982  */
12983 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12984
12985 /**
12986  * The short channel ID
12987  */
12988 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
12989
12990 /**
12991  * The short channel ID
12992  */
12993 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
12994
12995 /**
12996  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
12997  */
12998 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
12999
13000 /**
13001  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
13002  */
13003 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
13004
13005 /**
13006  * Channel flags
13007  */
13008 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13009
13010 /**
13011  * Channel flags
13012  */
13013 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
13014
13015 /**
13016  * The number of blocks such that if:
13017  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
13018  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
13019  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
13020  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
13021  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
13022  * forwarding. Note that the HTLC sender is the one who originally sets this value when
13023  * constructing the route.
13024  */
13025 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13026
13027 /**
13028  * The number of blocks such that if:
13029  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
13030  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
13031  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
13032  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
13033  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
13034  * forwarding. Note that the HTLC sender is the one who originally sets this value when
13035  * constructing the route.
13036  */
13037 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
13038
13039 /**
13040  * The minimum HTLC size incoming to sender, in milli-satoshi
13041  */
13042 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13043
13044 /**
13045  * The minimum HTLC size incoming to sender, in milli-satoshi
13046  */
13047 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
13048
13049 /**
13050  * The base HTLC fee charged by sender, in milli-satoshi
13051  */
13052 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13053
13054 /**
13055  * The base HTLC fee charged by sender, in milli-satoshi
13056  */
13057 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
13058
13059 /**
13060  * The amount to fee multiplier, in micro-satoshi
13061  */
13062 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13063
13064 /**
13065  * The amount to fee multiplier, in micro-satoshi
13066  */
13067 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
13068
13069 /**
13070  * Creates a copy of the UnsignedChannelUpdate
13071  */
13072 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
13073
13074 /**
13075  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
13076  */
13077 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
13078
13079 /**
13080  * A signature of the channel update
13081  */
13082 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
13083
13084 /**
13085  * A signature of the channel update
13086  */
13087 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
13088
13089 /**
13090  * The actual channel update
13091  */
13092 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
13093
13094 /**
13095  * The actual channel update
13096  */
13097 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
13098
13099 /**
13100  * Constructs a new ChannelUpdate given each field
13101  */
13102 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
13103
13104 /**
13105  * Creates a copy of the ChannelUpdate
13106  */
13107 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
13108
13109 /**
13110  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
13111  */
13112 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
13113
13114 /**
13115  * The genesis hash of the blockchain being queried
13116  */
13117 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
13118
13119 /**
13120  * The genesis hash of the blockchain being queried
13121  */
13122 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13123
13124 /**
13125  * The height of the first block for the channel UTXOs being queried
13126  */
13127 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
13128
13129 /**
13130  * The height of the first block for the channel UTXOs being queried
13131  */
13132 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13133
13134 /**
13135  * The number of blocks to include in the query results
13136  */
13137 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
13138
13139 /**
13140  * The number of blocks to include in the query results
13141  */
13142 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13143
13144 /**
13145  * Constructs a new QueryChannelRange given each field
13146  */
13147 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
13148
13149 /**
13150  * Creates a copy of the QueryChannelRange
13151  */
13152 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
13153
13154 /**
13155  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
13156  */
13157 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
13158
13159 /**
13160  * The genesis hash of the blockchain being queried
13161  */
13162 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
13163
13164 /**
13165  * The genesis hash of the blockchain being queried
13166  */
13167 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13168
13169 /**
13170  * The height of the first block in the range of the reply
13171  */
13172 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13173
13174 /**
13175  * The height of the first block in the range of the reply
13176  */
13177 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13178
13179 /**
13180  * The number of blocks included in the range of the reply
13181  */
13182 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13183
13184 /**
13185  * The number of blocks included in the range of the reply
13186  */
13187 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13188
13189 /**
13190  * True when this is the final reply for a query
13191  */
13192 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13193
13194 /**
13195  * True when this is the final reply for a query
13196  */
13197 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
13198
13199 /**
13200  * The short_channel_ids in the channel range
13201  */
13202 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
13203
13204 /**
13205  * Constructs a new ReplyChannelRange given each field
13206  */
13207 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);
13208
13209 /**
13210  * Creates a copy of the ReplyChannelRange
13211  */
13212 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
13213
13214 /**
13215  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
13216  */
13217 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
13218
13219 /**
13220  * The genesis hash of the blockchain being queried
13221  */
13222 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
13223
13224 /**
13225  * The genesis hash of the blockchain being queried
13226  */
13227 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13228
13229 /**
13230  * The short_channel_ids that are being queried
13231  */
13232 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
13233
13234 /**
13235  * Constructs a new QueryShortChannelIds given each field
13236  */
13237 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
13238
13239 /**
13240  * Creates a copy of the QueryShortChannelIds
13241  */
13242 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
13243
13244 /**
13245  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
13246  */
13247 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
13248
13249 /**
13250  * The genesis hash of the blockchain that was queried
13251  */
13252 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
13253
13254 /**
13255  * The genesis hash of the blockchain that was queried
13256  */
13257 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13258
13259 /**
13260  * Indicates if the query recipient maintains up-to-date channel
13261  * information for the chain_hash
13262  */
13263 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
13264
13265 /**
13266  * Indicates if the query recipient maintains up-to-date channel
13267  * information for the chain_hash
13268  */
13269 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
13270
13271 /**
13272  * Constructs a new ReplyShortChannelIdsEnd given each field
13273  */
13274 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
13275
13276 /**
13277  * Creates a copy of the ReplyShortChannelIdsEnd
13278  */
13279 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
13280
13281 /**
13282  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
13283  */
13284 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
13285
13286 /**
13287  * The genesis hash of the blockchain for channel and node information
13288  */
13289 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
13290
13291 /**
13292  * The genesis hash of the blockchain for channel and node information
13293  */
13294 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13295
13296 /**
13297  * The starting unix timestamp
13298  */
13299 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
13300
13301 /**
13302  * The starting unix timestamp
13303  */
13304 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
13305
13306 /**
13307  * The range of information in seconds
13308  */
13309 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
13310
13311 /**
13312  * The range of information in seconds
13313  */
13314 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
13315
13316 /**
13317  * Constructs a new GossipTimestampFilter given each field
13318  */
13319 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
13320
13321 /**
13322  * Creates a copy of the GossipTimestampFilter
13323  */
13324 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
13325
13326 /**
13327  * Frees any resources used by the ErrorAction
13328  */
13329 void ErrorAction_free(struct LDKErrorAction this_ptr);
13330
13331 /**
13332  * Creates a copy of the ErrorAction
13333  */
13334 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
13335
13336 /**
13337  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
13338  */
13339 void LightningError_free(struct LDKLightningError this_obj);
13340
13341 /**
13342  * A human-readable message describing the error
13343  */
13344 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
13345
13346 /**
13347  * A human-readable message describing the error
13348  */
13349 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
13350
13351 /**
13352  * The action which should be taken against the offending peer.
13353  */
13354 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
13355
13356 /**
13357  * The action which should be taken against the offending peer.
13358  */
13359 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
13360
13361 /**
13362  * Constructs a new LightningError given each field
13363  */
13364 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
13365
13366 /**
13367  * Creates a copy of the LightningError
13368  */
13369 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
13370
13371 /**
13372  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
13373  */
13374 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
13375
13376 /**
13377  * update_add_htlc messages which should be sent
13378  */
13379 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
13380
13381 /**
13382  * update_fulfill_htlc messages which should be sent
13383  */
13384 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
13385
13386 /**
13387  * update_fail_htlc messages which should be sent
13388  */
13389 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
13390
13391 /**
13392  * update_fail_malformed_htlc messages which should be sent
13393  */
13394 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
13395
13396 /**
13397  * An update_fee message which should be sent
13398  */
13399 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
13400
13401 /**
13402  * An update_fee message which should be sent
13403  */
13404 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
13405
13406 /**
13407  * Finally, the commitment_signed message which should be sent
13408  */
13409 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
13410
13411 /**
13412  * Finally, the commitment_signed message which should be sent
13413  */
13414 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
13415
13416 /**
13417  * Constructs a new CommitmentUpdate given each field
13418  */
13419 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);
13420
13421 /**
13422  * Creates a copy of the CommitmentUpdate
13423  */
13424 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
13425
13426 /**
13427  * Frees any resources used by the HTLCFailChannelUpdate
13428  */
13429 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
13430
13431 /**
13432  * Creates a copy of the HTLCFailChannelUpdate
13433  */
13434 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
13435
13436 /**
13437  * Calls the free function if one is set
13438  */
13439 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
13440
13441 /**
13442  * Calls the free function if one is set
13443  */
13444 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
13445
13446 /**
13447  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
13448  */
13449 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
13450
13451 /**
13452  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
13453  */
13454 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
13455
13456 /**
13457  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
13458  */
13459 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
13460
13461 /**
13462  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
13463  */
13464 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
13465
13466 /**
13467  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
13468  */
13469 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
13470
13471 /**
13472  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
13473  */
13474 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
13475
13476 /**
13477  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
13478  */
13479 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
13480
13481 /**
13482  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
13483  */
13484 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
13485
13486 /**
13487  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
13488  */
13489 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
13490
13491 /**
13492  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
13493  */
13494 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
13495
13496 /**
13497  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
13498  */
13499 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
13500
13501 /**
13502  * Read a FundingCreated from a byte array, created by FundingCreated_write
13503  */
13504 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
13505
13506 /**
13507  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
13508  */
13509 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
13510
13511 /**
13512  * Read a FundingSigned from a byte array, created by FundingSigned_write
13513  */
13514 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
13515
13516 /**
13517  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
13518  */
13519 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
13520
13521 /**
13522  * Read a FundingLocked from a byte array, created by FundingLocked_write
13523  */
13524 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
13525
13526 /**
13527  * Serialize the Init object into a byte array which can be read by Init_read
13528  */
13529 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
13530
13531 /**
13532  * Read a Init from a byte array, created by Init_write
13533  */
13534 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
13535
13536 /**
13537  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
13538  */
13539 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
13540
13541 /**
13542  * Read a OpenChannel from a byte array, created by OpenChannel_write
13543  */
13544 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
13545
13546 /**
13547  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
13548  */
13549 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
13550
13551 /**
13552  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
13553  */
13554 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
13555
13556 /**
13557  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
13558  */
13559 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
13560
13561 /**
13562  * Read a Shutdown from a byte array, created by Shutdown_write
13563  */
13564 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
13565
13566 /**
13567  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
13568  */
13569 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
13570
13571 /**
13572  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
13573  */
13574 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
13575
13576 /**
13577  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
13578  */
13579 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
13580
13581 /**
13582  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
13583  */
13584 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
13585
13586 /**
13587  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
13588  */
13589 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
13590
13591 /**
13592  * Read a UpdateFee from a byte array, created by UpdateFee_write
13593  */
13594 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
13595
13596 /**
13597  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
13598  */
13599 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
13600
13601 /**
13602  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
13603  */
13604 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
13605
13606 /**
13607  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
13608  */
13609 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
13610
13611 /**
13612  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
13613  */
13614 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
13615
13616 /**
13617  * Serialize the Ping object into a byte array which can be read by Ping_read
13618  */
13619 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
13620
13621 /**
13622  * Read a Ping from a byte array, created by Ping_write
13623  */
13624 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
13625
13626 /**
13627  * Serialize the Pong object into a byte array which can be read by Pong_read
13628  */
13629 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
13630
13631 /**
13632  * Read a Pong from a byte array, created by Pong_write
13633  */
13634 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
13635
13636 /**
13637  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
13638  */
13639 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
13640
13641 /**
13642  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
13643  */
13644 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
13645
13646 /**
13647  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
13648  */
13649 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
13650
13651 /**
13652  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
13653  */
13654 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
13655
13656 /**
13657  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
13658  */
13659 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
13660
13661 /**
13662  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
13663  */
13664 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
13665
13666 /**
13667  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
13668  */
13669 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
13670
13671 /**
13672  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
13673  */
13674 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
13675
13676 /**
13677  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
13678  */
13679 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
13680
13681 /**
13682  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
13683  */
13684 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
13685
13686 /**
13687  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
13688  */
13689 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
13690
13691 /**
13692  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
13693  */
13694 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
13695
13696 /**
13697  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
13698  */
13699 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
13700
13701 /**
13702  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
13703  */
13704 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
13705
13706 /**
13707  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
13708  */
13709 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
13710
13711 /**
13712  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
13713  */
13714 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
13715
13716 /**
13717  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
13718  */
13719 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
13720
13721 /**
13722  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
13723  */
13724 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
13725
13726 /**
13727  *\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
13728  */
13729 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
13730
13731 /**
13732  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
13733  */
13734 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
13735
13736 /**
13737  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
13738  */
13739 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
13740
13741 /**
13742  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
13743  */
13744 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
13745
13746 /**
13747  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
13748  */
13749 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
13750
13751 /**
13752  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
13753  */
13754 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
13755
13756 /**
13757  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
13758  */
13759 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
13760
13761 /**
13762  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
13763  */
13764 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
13765
13766 /**
13767  * Constructs a new IgnoringMessageHandler given each field
13768  */
13769 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
13770
13771 /**
13772  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
13773  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
13774  */
13775 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
13776
13777 /**
13778  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
13779  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
13780  */
13781 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
13782
13783 /**
13784  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
13785  */
13786 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
13787
13788 /**
13789  * Constructs a new ErroringMessageHandler
13790  */
13791 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
13792
13793 /**
13794  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
13795  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
13796  */
13797 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
13798
13799 /**
13800  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
13801  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
13802  */
13803 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
13804
13805 /**
13806  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
13807  */
13808 void MessageHandler_free(struct LDKMessageHandler this_obj);
13809
13810 /**
13811  * A message handler which handles messages specific to channels. Usually this is just a
13812  * ChannelManager object or a ErroringMessageHandler.
13813  */
13814 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
13815
13816 /**
13817  * A message handler which handles messages specific to channels. Usually this is just a
13818  * ChannelManager object or a ErroringMessageHandler.
13819  */
13820 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
13821
13822 /**
13823  * A message handler which handles messages updating our knowledge of the network channel
13824  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
13825  */
13826 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
13827
13828 /**
13829  * A message handler which handles messages updating our knowledge of the network channel
13830  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
13831  */
13832 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
13833
13834 /**
13835  * Constructs a new MessageHandler given each field
13836  */
13837 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
13838
13839 /**
13840  * Creates a copy of a SocketDescriptor
13841  */
13842 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
13843
13844 /**
13845  * Calls the free function if one is set
13846  */
13847 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
13848
13849 /**
13850  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
13851  */
13852 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
13853
13854 /**
13855  * Used to indicate that we probably can't make any future connections to this peer, implying
13856  * we should go ahead and force-close any channels we have with it.
13857  */
13858 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
13859
13860 /**
13861  * Used to indicate that we probably can't make any future connections to this peer, implying
13862  * we should go ahead and force-close any channels we have with it.
13863  */
13864 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
13865
13866 /**
13867  * Constructs a new PeerHandleError given each field
13868  */
13869 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
13870
13871 /**
13872  * Creates a copy of the PeerHandleError
13873  */
13874 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
13875
13876 /**
13877  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
13878  */
13879 void PeerManager_free(struct LDKPeerManager this_obj);
13880
13881 /**
13882  * Constructs a new PeerManager with the given message handlers and node_id secret key
13883  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
13884  * cryptographically secure random bytes.
13885  */
13886 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);
13887
13888 /**
13889  * Get the list of node ids for peers which have completed the initial handshake.
13890  *
13891  * For outbound connections, this will be the same as the their_node_id parameter passed in to
13892  * new_outbound_connection, however entries will only appear once the initial handshake has
13893  * completed and we are sure the remote peer has the private key for the given node_id.
13894  */
13895 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
13896
13897 /**
13898  * Indicates a new outbound connection has been established to a node with the given node_id.
13899  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
13900  * descriptor but must disconnect the connection immediately.
13901  *
13902  * Returns a small number of bytes to send to the remote node (currently always 50).
13903  *
13904  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
13905  * socket_disconnected().
13906  */
13907 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);
13908
13909 /**
13910  * Indicates a new inbound connection has been established.
13911  *
13912  * May refuse the connection by returning an Err, but will never write bytes to the remote end
13913  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
13914  * call socket_disconnected for the new descriptor but must disconnect the connection
13915  * immediately.
13916  *
13917  * Panics if descriptor is duplicative with some other descriptor which has not yet had
13918  * socket_disconnected called.
13919  */
13920 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
13921
13922 /**
13923  * Indicates that there is room to write data to the given socket descriptor.
13924  *
13925  * May return an Err to indicate that the connection should be closed.
13926  *
13927  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
13928  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
13929  * invariants around calling write_buffer_space_avail in case a write did not fully complete
13930  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
13931  * here isn't sufficient! Panics if the descriptor was not previously registered in a
13932  * new_\\*_connection event.
13933  */
13934 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
13935
13936 /**
13937  * Indicates that data was read from the given socket descriptor.
13938  *
13939  * May return an Err to indicate that the connection should be closed.
13940  *
13941  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
13942  * Thus, however, you almost certainly want to call process_events() after any read_event to
13943  * generate send_data calls to handle responses.
13944  *
13945  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
13946  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
13947  *
13948  * Panics if the descriptor was not previously registered in a new_*_connection event.
13949  */
13950 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);
13951
13952 /**
13953  * Checks for any events generated by our handlers and processes them. Includes sending most
13954  * response messages as well as messages generated by calls to handler functions directly (eg
13955  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
13956  */
13957 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
13958
13959 /**
13960  * Indicates that the given socket descriptor's connection is now closed.
13961  *
13962  * This must only be called if the socket has been disconnected by the peer or your own
13963  * decision to disconnect it and must NOT be called in any case where other parts of this
13964  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
13965  * the peer.
13966  *
13967  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
13968  */
13969 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
13970
13971 /**
13972  * Disconnect a peer given its node id.
13973  *
13974  * Set no_connection_possible to true to prevent any further connection with this peer,
13975  * force-closing any channels we have with it.
13976  *
13977  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
13978  * so be careful about reentrancy issues.
13979  */
13980 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
13981
13982 /**
13983  * This function should be called roughly once every 30 seconds.
13984  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
13985  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
13986  */
13987 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
13988
13989 /**
13990  * Build the commitment secret from the seed and the commitment number
13991  */
13992 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
13993
13994 /**
13995  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
13996  * from the base secret and the per_commitment_point.
13997  *
13998  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
13999  * generated (ie our own).
14000  */
14001 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
14002
14003 /**
14004  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
14005  * from the base point and the per_commitment_key. This is the public equivalent of
14006  * derive_private_key - using only public keys to derive a public key instead of private keys.
14007  *
14008  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14009  * generated (ie our own).
14010  */
14011 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
14012
14013 /**
14014  * Derives a per-commitment-transaction revocation key from its constituent parts.
14015  *
14016  * Only the cheating participant owns a valid witness to propagate a revoked
14017  * commitment transaction, thus per_commitment_secret always come from cheater
14018  * and revocation_base_secret always come from punisher, which is the broadcaster
14019  * of the transaction spending with this key knowledge.
14020  *
14021  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14022  * generated (ie our own).
14023  */
14024 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
14025
14026 /**
14027  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
14028  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
14029  * public key instead of private keys.
14030  *
14031  * Only the cheating participant owns a valid witness to propagate a revoked
14032  * commitment transaction, thus per_commitment_point always come from cheater
14033  * and revocation_base_point always come from punisher, which is the broadcaster
14034  * of the transaction spending with this key knowledge.
14035  *
14036  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14037  * generated (ie our own).
14038  */
14039 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
14040
14041 /**
14042  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
14043  */
14044 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
14045
14046 /**
14047  * The broadcaster's per-commitment public key which was used to derive the other keys.
14048  */
14049 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14050
14051 /**
14052  * The broadcaster's per-commitment public key which was used to derive the other keys.
14053  */
14054 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14055
14056 /**
14057  * The revocation key which is used to allow the broadcaster of the commitment
14058  * transaction to provide their counterparty the ability to punish them if they broadcast
14059  * an old state.
14060  */
14061 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14062
14063 /**
14064  * The revocation key which is used to allow the broadcaster of the commitment
14065  * transaction to provide their counterparty the ability to punish them if they broadcast
14066  * an old state.
14067  */
14068 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14069
14070 /**
14071  * Broadcaster's HTLC Key
14072  */
14073 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14074
14075 /**
14076  * Broadcaster's HTLC Key
14077  */
14078 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14079
14080 /**
14081  * Countersignatory's HTLC Key
14082  */
14083 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14084
14085 /**
14086  * Countersignatory's HTLC Key
14087  */
14088 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14089
14090 /**
14091  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
14092  */
14093 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14094
14095 /**
14096  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
14097  */
14098 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14099
14100 /**
14101  * Constructs a new TxCreationKeys given each field
14102  */
14103 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);
14104
14105 /**
14106  * Creates a copy of the TxCreationKeys
14107  */
14108 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
14109
14110 /**
14111  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
14112  */
14113 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
14114
14115 /**
14116  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
14117  */
14118 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
14119
14120 /**
14121  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
14122  */
14123 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
14124
14125 /**
14126  * The public key which is used to sign all commitment transactions, as it appears in the
14127  * on-chain channel lock-in 2-of-2 multisig output.
14128  */
14129 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14130
14131 /**
14132  * The public key which is used to sign all commitment transactions, as it appears in the
14133  * on-chain channel lock-in 2-of-2 multisig output.
14134  */
14135 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14136
14137 /**
14138  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
14139  * revocation keys. This is combined with the per-commitment-secret generated by the
14140  * counterparty to create a secret which the counterparty can reveal to revoke previous
14141  * states.
14142  */
14143 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14144
14145 /**
14146  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
14147  * revocation keys. This is combined with the per-commitment-secret generated by the
14148  * counterparty to create a secret which the counterparty can reveal to revoke previous
14149  * states.
14150  */
14151 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14152
14153 /**
14154  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
14155  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
14156  * static across every commitment transaction.
14157  */
14158 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14159
14160 /**
14161  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
14162  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
14163  * static across every commitment transaction.
14164  */
14165 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14166
14167 /**
14168  * The base point which is used (with derive_public_key) to derive a per-commitment payment
14169  * public key which receives non-HTLC-encumbered funds which are only available for spending
14170  * after some delay (or can be claimed via the revocation path).
14171  */
14172 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14173
14174 /**
14175  * The base point which is used (with derive_public_key) to derive a per-commitment payment
14176  * public key which receives non-HTLC-encumbered funds which are only available for spending
14177  * after some delay (or can be claimed via the revocation path).
14178  */
14179 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14180
14181 /**
14182  * The base point which is used (with derive_public_key) to derive a per-commitment public key
14183  * which is used to encumber HTLC-in-flight outputs.
14184  */
14185 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14186
14187 /**
14188  * The base point which is used (with derive_public_key) to derive a per-commitment public key
14189  * which is used to encumber HTLC-in-flight outputs.
14190  */
14191 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14192
14193 /**
14194  * Constructs a new ChannelPublicKeys given each field
14195  */
14196 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);
14197
14198 /**
14199  * Creates a copy of the ChannelPublicKeys
14200  */
14201 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
14202
14203 /**
14204  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
14205  */
14206 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
14207
14208 /**
14209  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
14210  */
14211 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
14212
14213 /**
14214  * Create per-state keys from channel base points and the per-commitment point.
14215  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
14216  */
14217 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);
14218
14219 /**
14220  * Generate per-state keys from channel static keys.
14221  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
14222  */
14223 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);
14224
14225 /**
14226  * A script either spendable by the revocation
14227  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
14228  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
14229  */
14230 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
14231
14232 /**
14233  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
14234  */
14235 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
14236
14237 /**
14238  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
14239  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
14240  * need to compare this value to whether the commitment transaction in question is that of
14241  * the counterparty or our own.
14242  */
14243 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14244
14245 /**
14246  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
14247  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
14248  * need to compare this value to whether the commitment transaction in question is that of
14249  * the counterparty or our own.
14250  */
14251 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
14252
14253 /**
14254  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
14255  * this divided by 1000.
14256  */
14257 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14258
14259 /**
14260  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
14261  * this divided by 1000.
14262  */
14263 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
14264
14265 /**
14266  * The CLTV lock-time at which this HTLC expires.
14267  */
14268 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14269
14270 /**
14271  * The CLTV lock-time at which this HTLC expires.
14272  */
14273 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
14274
14275 /**
14276  * The hash of the preimage which unlocks this HTLC.
14277  */
14278 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
14279
14280 /**
14281  * The hash of the preimage which unlocks this HTLC.
14282  */
14283 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14284
14285 /**
14286  * The position within the commitment transactions' outputs. This may be None if the value is
14287  * below the dust limit (in which case no output appears in the commitment transaction and the
14288  * value is spent to additional transaction fees).
14289  */
14290 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14291
14292 /**
14293  * The position within the commitment transactions' outputs. This may be None if the value is
14294  * below the dust limit (in which case no output appears in the commitment transaction and the
14295  * value is spent to additional transaction fees).
14296  */
14297 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
14298
14299 /**
14300  * Constructs a new HTLCOutputInCommitment given each field
14301  */
14302 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);
14303
14304 /**
14305  * Creates a copy of the HTLCOutputInCommitment
14306  */
14307 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
14308
14309 /**
14310  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
14311  */
14312 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
14313
14314 /**
14315  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
14316  */
14317 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
14318
14319 /**
14320  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
14321  * does not need to have its previous_output_index filled.
14322  */
14323 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
14324
14325 /**
14326  * Gets the redeemscript for a funding output from the two funding public keys.
14327  * Note that the order of funding public keys does not matter.
14328  */
14329 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
14330
14331 /**
14332  * panics if htlc.transaction_output_index.is_none()!
14333  */
14334 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);
14335
14336 /**
14337  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14338  */
14339 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
14340
14341 /**
14342  * Holder public keys
14343  */
14344 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14345
14346 /**
14347  * Holder public keys
14348  */
14349 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
14350
14351 /**
14352  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
14353  */
14354 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14355
14356 /**
14357  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
14358  */
14359 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
14360
14361 /**
14362  * Whether the holder is the initiator of this channel.
14363  * This is an input to the commitment number obscure factor computation.
14364  */
14365 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14366
14367 /**
14368  * Whether the holder is the initiator of this channel.
14369  * This is an input to the commitment number obscure factor computation.
14370  */
14371 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
14372
14373 /**
14374  * The late-bound counterparty channel transaction parameters.
14375  * These parameters are populated at the point in the protocol where the counterparty provides them.
14376  */
14377 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14378
14379 /**
14380  * The late-bound counterparty channel transaction parameters.
14381  * These parameters are populated at the point in the protocol where the counterparty provides them.
14382  */
14383 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
14384
14385 /**
14386  * The late-bound funding outpoint
14387  */
14388 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14389
14390 /**
14391  * The late-bound funding outpoint
14392  */
14393 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
14394
14395 /**
14396  * Constructs a new ChannelTransactionParameters given each field
14397  */
14398 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);
14399
14400 /**
14401  * Creates a copy of the ChannelTransactionParameters
14402  */
14403 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
14404
14405 /**
14406  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14407  */
14408 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
14409
14410 /**
14411  * Counter-party public keys
14412  */
14413 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
14414
14415 /**
14416  * Counter-party public keys
14417  */
14418 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
14419
14420 /**
14421  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
14422  */
14423 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
14424
14425 /**
14426  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
14427  */
14428 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
14429
14430 /**
14431  * Constructs a new CounterpartyChannelTransactionParameters given each field
14432  */
14433 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
14434
14435 /**
14436  * Creates a copy of the CounterpartyChannelTransactionParameters
14437  */
14438 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
14439
14440 /**
14441  * Whether the late bound parameters are populated.
14442  */
14443 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14444
14445 /**
14446  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
14447  * given that the holder is the broadcaster.
14448  *
14449  * self.is_populated() must be true before calling this function.
14450  */
14451 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14452
14453 /**
14454  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
14455  * given that the counterparty is the broadcaster.
14456  *
14457  * self.is_populated() must be true before calling this function.
14458  */
14459 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14460
14461 /**
14462  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
14463  */
14464 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
14465
14466 /**
14467  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
14468  */
14469 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
14470
14471 /**
14472  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
14473  */
14474 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
14475
14476 /**
14477  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
14478  */
14479 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
14480
14481 /**
14482  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14483  */
14484 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
14485
14486 /**
14487  * Get the channel pubkeys for the broadcaster
14488  */
14489 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14490
14491 /**
14492  * Get the channel pubkeys for the countersignatory
14493  */
14494 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14495
14496 /**
14497  * Get the contest delay applicable to the transactions.
14498  * Note that the contest delay was selected by the countersignatory.
14499  */
14500 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14501
14502 /**
14503  * Whether the channel is outbound from the broadcaster.
14504  *
14505  * The boolean representing the side that initiated the channel is
14506  * an input to the commitment number obscure factor computation.
14507  */
14508 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14509
14510 /**
14511  * The funding outpoint
14512  */
14513 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14514
14515 /**
14516  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
14517  */
14518 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
14519
14520 /**
14521  * Our counterparty's signature for the transaction
14522  */
14523 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
14524
14525 /**
14526  * Our counterparty's signature for the transaction
14527  */
14528 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
14529
14530 /**
14531  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
14532  */
14533 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
14534
14535 /**
14536  * Creates a copy of the HolderCommitmentTransaction
14537  */
14538 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
14539
14540 /**
14541  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
14542  */
14543 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
14544
14545 /**
14546  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
14547  */
14548 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
14549
14550 /**
14551  * Create a new holder transaction with the given counterparty signatures.
14552  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
14553  */
14554 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);
14555
14556 /**
14557  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
14558  */
14559 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
14560
14561 /**
14562  * The commitment transaction
14563  */
14564 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
14565
14566 /**
14567  * The commitment transaction
14568  */
14569 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
14570
14571 /**
14572  * The txid for the commitment transaction.
14573  *
14574  * This is provided as a performance optimization, instead of calling transaction.txid()
14575  * multiple times.
14576  */
14577 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
14578
14579 /**
14580  * The txid for the commitment transaction.
14581  *
14582  * This is provided as a performance optimization, instead of calling transaction.txid()
14583  * multiple times.
14584  */
14585 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14586
14587 /**
14588  * Constructs a new BuiltCommitmentTransaction given each field
14589  */
14590 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
14591
14592 /**
14593  * Creates a copy of the BuiltCommitmentTransaction
14594  */
14595 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
14596
14597 /**
14598  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
14599  */
14600 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
14601
14602 /**
14603  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
14604  */
14605 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
14606
14607 /**
14608  * Get the SIGHASH_ALL sighash value of the transaction.
14609  *
14610  * This can be used to verify a signature.
14611  */
14612 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);
14613
14614 /**
14615  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
14616  * because we are about to broadcast a holder transaction.
14617  */
14618 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);
14619
14620 /**
14621  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
14622  */
14623 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
14624
14625 /**
14626  * Creates a copy of the CommitmentTransaction
14627  */
14628 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
14629
14630 /**
14631  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
14632  */
14633 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
14634
14635 /**
14636  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
14637  */
14638 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
14639
14640 /**
14641  * The backwards-counting commitment number
14642  */
14643 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14644
14645 /**
14646  * The value to be sent to the broadcaster
14647  */
14648 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14649
14650 /**
14651  * The value to be sent to the counterparty
14652  */
14653 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14654
14655 /**
14656  * The feerate paid per 1000-weight-unit in this commitment transaction.
14657  */
14658 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14659
14660 /**
14661  * Trust our pre-built transaction and derived transaction creation public keys.
14662  *
14663  * Applies a wrapper which allows access to these fields.
14664  *
14665  * This should only be used if you fully trust the builder of this object.  It should not
14666  *\tbe used by an external signer - instead use the verify function.
14667  */
14668 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14669
14670 /**
14671  * Verify our pre-built transaction and derived transaction creation public keys.
14672  *
14673  * Applies a wrapper which allows access to these fields.
14674  *
14675  * An external validating signer must call this method before signing
14676  * or using the built transaction.
14677  */
14678 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);
14679
14680 /**
14681  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
14682  */
14683 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
14684
14685 /**
14686  * The transaction ID of the built Bitcoin transaction
14687  */
14688 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14689
14690 /**
14691  * The pre-built Bitcoin commitment transaction
14692  */
14693 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14694
14695 /**
14696  * The pre-calculated transaction creation public keys.
14697  */
14698 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14699
14700 /**
14701  * Get a signature for each HTLC which was included in the commitment transaction (ie for
14702  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
14703  *
14704  * The returned Vec has one entry for each HTLC, and in the same order.
14705  */
14706 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);
14707
14708 /**
14709  * Get the transaction number obscure factor
14710  */
14711 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
14712
14713 /**
14714  * Creates a copy of the InitFeatures
14715  */
14716 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
14717
14718 /**
14719  * Creates a copy of the NodeFeatures
14720  */
14721 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
14722
14723 /**
14724  * Creates a copy of the ChannelFeatures
14725  */
14726 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
14727
14728 /**
14729  * Creates a copy of the InvoiceFeatures
14730  */
14731 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
14732
14733 /**
14734  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
14735  */
14736 void InitFeatures_free(struct LDKInitFeatures this_obj);
14737
14738 /**
14739  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
14740  */
14741 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
14742
14743 /**
14744  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
14745  */
14746 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
14747
14748 /**
14749  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
14750  */
14751 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
14752
14753 /**
14754  * Create a blank Features with no features set
14755  */
14756 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
14757
14758 /**
14759  * Creates a Features with the bits set which are known by the implementation
14760  */
14761 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
14762
14763 /**
14764  * Create a blank Features with no features set
14765  */
14766 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
14767
14768 /**
14769  * Creates a Features with the bits set which are known by the implementation
14770  */
14771 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
14772
14773 /**
14774  * Create a blank Features with no features set
14775  */
14776 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
14777
14778 /**
14779  * Creates a Features with the bits set which are known by the implementation
14780  */
14781 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
14782
14783 /**
14784  * Create a blank Features with no features set
14785  */
14786 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
14787
14788 /**
14789  * Creates a Features with the bits set which are known by the implementation
14790  */
14791 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
14792
14793 /**
14794  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
14795  */
14796 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
14797
14798 /**
14799  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
14800  */
14801 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
14802
14803 /**
14804  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
14805  */
14806 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
14807
14808 /**
14809  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
14810  */
14811 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
14812
14813 /**
14814  * Read a InitFeatures from a byte array, created by InitFeatures_write
14815  */
14816 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
14817
14818 /**
14819  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
14820  */
14821 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
14822
14823 /**
14824  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
14825  */
14826 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
14827
14828 /**
14829  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
14830  */
14831 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
14832
14833 /**
14834  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
14835  */
14836 void RouteHop_free(struct LDKRouteHop this_obj);
14837
14838 /**
14839  * The node_id of the node at this hop.
14840  */
14841 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
14842
14843 /**
14844  * The node_id of the node at this hop.
14845  */
14846 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14847
14848 /**
14849  * The node_announcement features of the node at this hop. For the last hop, these may be
14850  * amended to match the features present in the invoice this node generated.
14851  */
14852 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
14853
14854 /**
14855  * The node_announcement features of the node at this hop. For the last hop, these may be
14856  * amended to match the features present in the invoice this node generated.
14857  */
14858 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
14859
14860 /**
14861  * The channel that should be used from the previous hop to reach this node.
14862  */
14863 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
14864
14865 /**
14866  * The channel that should be used from the previous hop to reach this node.
14867  */
14868 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
14869
14870 /**
14871  * The channel_announcement features of the channel that should be used from the previous hop
14872  * to reach this node.
14873  */
14874 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
14875
14876 /**
14877  * The channel_announcement features of the channel that should be used from the previous hop
14878  * to reach this node.
14879  */
14880 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
14881
14882 /**
14883  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
14884  * For the last hop, this should be the full value of the payment (might be more than
14885  * requested if we had to match htlc_minimum_msat).
14886  */
14887 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
14888
14889 /**
14890  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
14891  * For the last hop, this should be the full value of the payment (might be more than
14892  * requested if we had to match htlc_minimum_msat).
14893  */
14894 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
14895
14896 /**
14897  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
14898  * expected at the destination, in excess of the current block height.
14899  */
14900 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
14901
14902 /**
14903  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
14904  * expected at the destination, in excess of the current block height.
14905  */
14906 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
14907
14908 /**
14909  * Constructs a new RouteHop given each field
14910  */
14911 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);
14912
14913 /**
14914  * Creates a copy of the RouteHop
14915  */
14916 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
14917
14918 /**
14919  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
14920  */
14921 void Route_free(struct LDKRoute this_obj);
14922
14923 /**
14924  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
14925  * last RouteHop in each path must be the same.
14926  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
14927  * destination. Thus, this must always be at least length one. While the maximum length of any
14928  * given path is variable, keeping the length of any path to less than 20 should currently
14929  * ensure it is viable.
14930  */
14931 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
14932
14933 /**
14934  * Constructs a new Route given each field
14935  */
14936 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
14937
14938 /**
14939  * Creates a copy of the Route
14940  */
14941 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
14942
14943 /**
14944  * Serialize the Route object into a byte array which can be read by Route_read
14945  */
14946 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
14947
14948 /**
14949  * Read a Route from a byte array, created by Route_write
14950  */
14951 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
14952
14953 /**
14954  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
14955  */
14956 void RouteHint_free(struct LDKRouteHint this_obj);
14957
14958 /**
14959  * The node_id of the non-target end of the route
14960  */
14961 struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
14962
14963 /**
14964  * The node_id of the non-target end of the route
14965  */
14966 void RouteHint_set_src_node_id(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14967
14968 /**
14969  * The short_channel_id of this channel
14970  */
14971 uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
14972
14973 /**
14974  * The short_channel_id of this channel
14975  */
14976 void RouteHint_set_short_channel_id(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
14977
14978 /**
14979  * The fees which must be paid to use this channel
14980  */
14981 struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *NONNULL_PTR this_ptr);
14982
14983 /**
14984  * The fees which must be paid to use this channel
14985  */
14986 void RouteHint_set_fees(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
14987
14988 /**
14989  * The difference in CLTV values between this node and the next node.
14990  */
14991 uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR this_ptr);
14992
14993 /**
14994  * The difference in CLTV values between this node and the next node.
14995  */
14996 void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val);
14997
14998 /**
14999  * The minimum value, in msat, which must be relayed to the next hop.
15000  */
15001 struct LDKCOption_u64Z RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
15002
15003 /**
15004  * The minimum value, in msat, which must be relayed to the next hop.
15005  */
15006 void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15007
15008 /**
15009  * The maximum value in msat available for routing with a single HTLC.
15010  */
15011 struct LDKCOption_u64Z RouteHint_get_htlc_maximum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
15012
15013 /**
15014  * The maximum value in msat available for routing with a single HTLC.
15015  */
15016 void RouteHint_set_htlc_maximum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15017
15018 /**
15019  * Constructs a new RouteHint given each field
15020  */
15021 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);
15022
15023 /**
15024  * Creates a copy of the RouteHint
15025  */
15026 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
15027
15028 /**
15029  * Gets a route from us (payer) to the given target node (payee).
15030  *
15031  * If the payee provided features in their invoice, they should be provided via payee_features.
15032  * Without this, MPP will only be used if the payee's features are available in the network graph.
15033  *
15034  * Extra routing hops between known nodes and the target will be used if they are included in
15035  * last_hops.
15036  *
15037  * If some channels aren't announced, it may be useful to fill in a first_hops with the
15038  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
15039  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
15040  * in first_hops will be used.
15041  *
15042  * Panics if first_hops contains channels without short_channel_ids
15043  * (ChannelManager::list_usable_channels will never include such channels).
15044  *
15045  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
15046  * equal), however the enabled/disabled bit on such channels as well as the
15047  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
15048  */
15049 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);
15050
15051 /**
15052  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
15053  */
15054 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
15055
15056 /**
15057  * Creates a copy of the NetworkGraph
15058  */
15059 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
15060
15061 /**
15062  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
15063  */
15064 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
15065
15066 /**
15067  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
15068  */
15069 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
15070
15071 /**
15072  * Creates a new tracker of the actual state of the network of channels and nodes,
15073  * assuming a fresh network graph.
15074  * Chain monitor is used to make sure announced channels exist on-chain,
15075  * channel data is correct, and that the announcement is signed with
15076  * channel owners' keys.
15077  */
15078 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
15079
15080 /**
15081  * Creates a new tracker of the actual state of the network of channels and nodes,
15082  * assuming an existing Network Graph.
15083  */
15084 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
15085
15086 /**
15087  * Adds a provider used to check new announcements. Does not affect
15088  * existing announcements unless they are updated.
15089  * Add, update or remove the provider would replace the current one.
15090  */
15091 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
15092
15093 /**
15094  * Take a read lock on the network_graph and return it in the C-bindings
15095  * newtype helper. This is likely only useful when called via the C
15096  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
15097  * yourself.
15098  */
15099 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15100
15101 /**
15102  * Get a reference to the NetworkGraph which this read-lock contains.
15103  */
15104 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
15105
15106 /**
15107  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
15108  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
15109  */
15110 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15111
15112 /**
15113  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15114  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15115  */
15116 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15117
15118 /**
15119  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
15120  */
15121 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
15122
15123 /**
15124  * When the last update to the channel direction was issued.
15125  * Value is opaque, as set in the announcement.
15126  */
15127 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15128
15129 /**
15130  * When the last update to the channel direction was issued.
15131  * Value is opaque, as set in the announcement.
15132  */
15133 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
15134
15135 /**
15136  * Whether the channel can be currently used for payments (in this one direction).
15137  */
15138 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15139
15140 /**
15141  * Whether the channel can be currently used for payments (in this one direction).
15142  */
15143 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
15144
15145 /**
15146  * The difference in CLTV values that you must have when routing through this channel.
15147  */
15148 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15149
15150 /**
15151  * The difference in CLTV values that you must have when routing through this channel.
15152  */
15153 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
15154
15155 /**
15156  * The minimum value, which must be relayed to the next hop via the channel
15157  */
15158 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15159
15160 /**
15161  * The minimum value, which must be relayed to the next hop via the channel
15162  */
15163 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
15164
15165 /**
15166  * The maximum value which may be relayed to the next hop via the channel.
15167  */
15168 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15169
15170 /**
15171  * The maximum value which may be relayed to the next hop via the channel.
15172  */
15173 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15174
15175 /**
15176  * Fees charged when the channel is used for routing
15177  */
15178 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15179
15180 /**
15181  * Fees charged when the channel is used for routing
15182  */
15183 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
15184
15185 /**
15186  * Most recent update for the channel received from the network
15187  * Mostly redundant with the data we store in fields explicitly.
15188  * Everything else is useful only for sending out for initial routing sync.
15189  * Not stored if contains excess data to prevent DoS.
15190  */
15191 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15192
15193 /**
15194  * Most recent update for the channel received from the network
15195  * Mostly redundant with the data we store in fields explicitly.
15196  * Everything else is useful only for sending out for initial routing sync.
15197  * Not stored if contains excess data to prevent DoS.
15198  */
15199 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
15200
15201 /**
15202  * Constructs a new DirectionalChannelInfo given each field
15203  */
15204 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);
15205
15206 /**
15207  * Creates a copy of the DirectionalChannelInfo
15208  */
15209 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
15210
15211 /**
15212  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
15213  */
15214 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
15215
15216 /**
15217  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
15218  */
15219 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
15220
15221 /**
15222  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
15223  */
15224 void ChannelInfo_free(struct LDKChannelInfo this_obj);
15225
15226 /**
15227  * Protocol features of a channel communicated during its announcement
15228  */
15229 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15230
15231 /**
15232  * Protocol features of a channel communicated during its announcement
15233  */
15234 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
15235
15236 /**
15237  * Source node of the first direction of a channel
15238  */
15239 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15240
15241 /**
15242  * Source node of the first direction of a channel
15243  */
15244 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15245
15246 /**
15247  * Details about the first direction of a channel
15248  */
15249 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15250
15251 /**
15252  * Details about the first direction of a channel
15253  */
15254 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
15255
15256 /**
15257  * Source node of the second direction of a channel
15258  */
15259 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15260
15261 /**
15262  * Source node of the second direction of a channel
15263  */
15264 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15265
15266 /**
15267  * Details about the second direction of a channel
15268  */
15269 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15270
15271 /**
15272  * Details about the second direction of a channel
15273  */
15274 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
15275
15276 /**
15277  * The channel capacity as seen on-chain, if chain lookup is available.
15278  */
15279 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15280
15281 /**
15282  * The channel capacity as seen on-chain, if chain lookup is available.
15283  */
15284 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15285
15286 /**
15287  * An initial announcement of the channel
15288  * Mostly redundant with the data we store in fields explicitly.
15289  * Everything else is useful only for sending out for initial routing sync.
15290  * Not stored if contains excess data to prevent DoS.
15291  */
15292 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15293
15294 /**
15295  * An initial announcement of the channel
15296  * Mostly redundant with the data we store in fields explicitly.
15297  * Everything else is useful only for sending out for initial routing sync.
15298  * Not stored if contains excess data to prevent DoS.
15299  */
15300 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
15301
15302 /**
15303  * Constructs a new ChannelInfo given each field
15304  */
15305 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);
15306
15307 /**
15308  * Creates a copy of the ChannelInfo
15309  */
15310 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
15311
15312 /**
15313  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
15314  */
15315 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
15316
15317 /**
15318  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
15319  */
15320 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
15321
15322 /**
15323  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
15324  */
15325 void RoutingFees_free(struct LDKRoutingFees this_obj);
15326
15327 /**
15328  * Flat routing fee in satoshis
15329  */
15330 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
15331
15332 /**
15333  * Flat routing fee in satoshis
15334  */
15335 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
15336
15337 /**
15338  * Liquidity-based routing fee in millionths of a routed amount.
15339  * In other words, 10000 is 1%.
15340  */
15341 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
15342
15343 /**
15344  * Liquidity-based routing fee in millionths of a routed amount.
15345  * In other words, 10000 is 1%.
15346  */
15347 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
15348
15349 /**
15350  * Constructs a new RoutingFees given each field
15351  */
15352 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
15353
15354 /**
15355  * Creates a copy of the RoutingFees
15356  */
15357 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
15358
15359 /**
15360  * Read a RoutingFees from a byte array, created by RoutingFees_write
15361  */
15362 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
15363
15364 /**
15365  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
15366  */
15367 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
15368
15369 /**
15370  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
15371  */
15372 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
15373
15374 /**
15375  * Protocol features the node announced support for
15376  */
15377 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15378
15379 /**
15380  * Protocol features the node announced support for
15381  */
15382 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
15383
15384 /**
15385  * When the last known update to the node state was issued.
15386  * Value is opaque, as set in the announcement.
15387  */
15388 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15389
15390 /**
15391  * When the last known update to the node state was issued.
15392  * Value is opaque, as set in the announcement.
15393  */
15394 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
15395
15396 /**
15397  * Color assigned to the node
15398  */
15399 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
15400
15401 /**
15402  * Color assigned to the node
15403  */
15404 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
15405
15406 /**
15407  * Moniker assigned to the node.
15408  * May be invalid or malicious (eg control chars),
15409  * should not be exposed to the user.
15410  */
15411 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
15412
15413 /**
15414  * Moniker assigned to the node.
15415  * May be invalid or malicious (eg control chars),
15416  * should not be exposed to the user.
15417  */
15418 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15419
15420 /**
15421  * Internet-level addresses via which one can connect to the node
15422  */
15423 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
15424
15425 /**
15426  * An initial announcement of the node
15427  * Mostly redundant with the data we store in fields explicitly.
15428  * Everything else is useful only for sending out for initial routing sync.
15429  * Not stored if contains excess data to prevent DoS.
15430  */
15431 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15432
15433 /**
15434  * An initial announcement of the node
15435  * Mostly redundant with the data we store in fields explicitly.
15436  * Everything else is useful only for sending out for initial routing sync.
15437  * Not stored if contains excess data to prevent DoS.
15438  */
15439 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
15440
15441 /**
15442  * Constructs a new NodeAnnouncementInfo given each field
15443  */
15444 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);
15445
15446 /**
15447  * Creates a copy of the NodeAnnouncementInfo
15448  */
15449 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
15450
15451 /**
15452  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
15453  */
15454 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
15455
15456 /**
15457  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
15458  */
15459 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
15460
15461 /**
15462  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
15463  */
15464 void NodeInfo_free(struct LDKNodeInfo this_obj);
15465
15466 /**
15467  * All valid channels a node has announced
15468  */
15469 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15470
15471 /**
15472  * Lowest fees enabling routing via any of the enabled, known channels to a node.
15473  * The two fields (flat and proportional fee) are independent,
15474  * meaning they don't have to refer to the same channel.
15475  */
15476 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
15477
15478 /**
15479  * Lowest fees enabling routing via any of the enabled, known channels to a node.
15480  * The two fields (flat and proportional fee) are independent,
15481  * meaning they don't have to refer to the same channel.
15482  */
15483 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
15484
15485 /**
15486  * More information about a node from node_announcement.
15487  * Optional because we store a Node entry after learning about it from
15488  * a channel announcement, but before receiving a node announcement.
15489  */
15490 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
15491
15492 /**
15493  * More information about a node from node_announcement.
15494  * Optional because we store a Node entry after learning about it from
15495  * a channel announcement, but before receiving a node announcement.
15496  */
15497 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
15498
15499 /**
15500  * Constructs a new NodeInfo given each field
15501  */
15502 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
15503
15504 /**
15505  * Creates a copy of the NodeInfo
15506  */
15507 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
15508
15509 /**
15510  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
15511  */
15512 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
15513
15514 /**
15515  * Read a NodeInfo from a byte array, created by NodeInfo_write
15516  */
15517 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
15518
15519 /**
15520  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
15521  */
15522 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
15523
15524 /**
15525  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
15526  */
15527 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
15528
15529 /**
15530  * Creates a new, empty, network graph.
15531  */
15532 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
15533
15534 /**
15535  * For an already known node (from channel announcements), update its stored properties from a
15536  * given node announcement.
15537  *
15538  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15539  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15540  * routing messages from a source using a protocol other than the lightning P2P protocol.
15541  */
15542 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
15543
15544 /**
15545  * For an already known node (from channel announcements), update its stored properties from a
15546  * given node announcement without verifying the associated signatures. Because we aren't
15547  * given the associated signatures here we cannot relay the node announcement to any of our
15548  * peers.
15549  */
15550 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
15551
15552 /**
15553  * Store or update channel info from a channel announcement.
15554  *
15555  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15556  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15557  * routing messages from a source using a protocol other than the lightning P2P protocol.
15558  *
15559  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
15560  * the corresponding UTXO exists on chain and is correctly-formatted.
15561  */
15562 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);
15563
15564 /**
15565  * Store or update channel info from a channel announcement without verifying the associated
15566  * signatures. Because we aren't given the associated signatures here we cannot relay the
15567  * channel announcement to any of our peers.
15568  *
15569  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
15570  * the corresponding UTXO exists on chain and is correctly-formatted.
15571  */
15572 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);
15573
15574 /**
15575  * Close a channel if a corresponding HTLC fail was sent.
15576  * If permanent, removes a channel from the local storage.
15577  * May cause the removal of nodes too, if this was their last channel.
15578  * If not permanent, makes channels unavailable for routing.
15579  */
15580 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
15581
15582 /**
15583  * For an already known (from announcement) channel, update info about one of the directions
15584  * of the channel.
15585  *
15586  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15587  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15588  * routing messages from a source using a protocol other than the lightning P2P protocol.
15589  */
15590 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
15591
15592 /**
15593  * For an already known (from announcement) channel, update info about one of the directions
15594  * of the channel without verifying the associated signatures. Because we aren't given the
15595  * associated signatures here we cannot relay the channel update to any of our peers.
15596  */
15597 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
15598
15599 /* Text to put at the end of the generated file */