Update auto-generated bindings with new Option<primitive> support
[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 typedef enum LDKNetwork {
158    LDKNetwork_Bitcoin,
159    LDKNetwork_Testnet,
160    LDKNetwork_Regtest,
161    LDKNetwork_Signet,
162    /**
163     * Must be last for serialization purposes
164     */
165    LDKNetwork_Sentinel,
166 } LDKNetwork;
167
168 typedef enum LDKSecp256k1Error {
169    LDKSecp256k1Error_IncorrectSignature,
170    LDKSecp256k1Error_InvalidMessage,
171    LDKSecp256k1Error_InvalidPublicKey,
172    LDKSecp256k1Error_InvalidSignature,
173    LDKSecp256k1Error_InvalidSecretKey,
174    LDKSecp256k1Error_InvalidRecoveryId,
175    LDKSecp256k1Error_InvalidTweak,
176    LDKSecp256k1Error_TweakCheckFailed,
177    LDKSecp256k1Error_NotEnoughMemory,
178    /**
179     * Must be last for serialization purposes
180     */
181    LDKSecp256k1Error_Sentinel,
182 } LDKSecp256k1Error;
183
184 /**
185  * A serialized transaction, in (pointer, length) form.
186  *
187  * This type optionally owns its own memory, and thus the semantics around access change based on
188  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
189  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
190  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
191  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
192  * you would be invalid.
193  *
194  * Note that, while it may change in the future, because transactions on the Rust side are stored
195  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
196  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
197  * `data_is_owned` either set or unset at your discretion.
198  */
199 typedef struct LDKTransaction {
200    /**
201     * This is non-const for your convenience, an object passed to Rust is never written to.
202     */
203    uint8_t *data;
204    uintptr_t datalen;
205    bool data_is_owned;
206 } LDKTransaction;
207
208 typedef struct LDKCVec_u8Z {
209    uint8_t *data;
210    uintptr_t datalen;
211 } LDKCVec_u8Z;
212
213 /**
214  * A transaction output including a scriptPubKey and value.
215  * This type *does* own its own memory, so must be free'd appropriately.
216  */
217 typedef struct LDKTxOut {
218    struct LDKCVec_u8Z script_pubkey;
219    uint64_t value;
220 } LDKTxOut;
221
222 typedef struct LDKSecretKey {
223    uint8_t bytes[32];
224 } LDKSecretKey;
225
226 typedef union LDKCResult_SecretKeyErrorZPtr {
227    struct LDKSecretKey *result;
228    enum LDKSecp256k1Error *err;
229 } LDKCResult_SecretKeyErrorZPtr;
230
231 typedef struct LDKCResult_SecretKeyErrorZ {
232    union LDKCResult_SecretKeyErrorZPtr contents;
233    bool result_ok;
234 } LDKCResult_SecretKeyErrorZ;
235
236 typedef struct LDKPublicKey {
237    uint8_t compressed_form[33];
238 } LDKPublicKey;
239
240 typedef union LDKCResult_PublicKeyErrorZPtr {
241    struct LDKPublicKey *result;
242    enum LDKSecp256k1Error *err;
243 } LDKCResult_PublicKeyErrorZPtr;
244
245 typedef struct LDKCResult_PublicKeyErrorZ {
246    union LDKCResult_PublicKeyErrorZPtr contents;
247    bool result_ok;
248 } LDKCResult_PublicKeyErrorZ;
249
250
251
252 /**
253  * The set of public keys which are used in the creation of one commitment transaction.
254  * These are derived from the channel base keys and per-commitment data.
255  *
256  * A broadcaster key is provided from potential broadcaster of the computed transaction.
257  * A countersignatory key is coming from a protocol participant unable to broadcast the
258  * transaction.
259  *
260  * These keys are assumed to be good, either because the code derived them from
261  * channel basepoints via the new function, or they were obtained via
262  * CommitmentTransaction.trust().keys() because we trusted the source of the
263  * pre-calculated keys.
264  */
265 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
266    /**
267     * A pointer to the opaque Rust object.
268     * Nearly everywhere, inner must be non-null, however in places where
269     * the Rust equivalent takes an Option, it may be set to null to indicate None.
270     */
271    LDKnativeTxCreationKeys *inner;
272    /**
273     * Indicates that this is the only struct which contains the same pointer.
274     * Rust functions which take ownership of an object provided via an argument require
275     * this to be true and invalidate the object pointed to by inner.
276     */
277    bool is_owned;
278 } LDKTxCreationKeys;
279
280
281
282 /**
283  * An error in decoding a message or struct.
284  */
285 typedef struct MUST_USE_STRUCT LDKDecodeError {
286    /**
287     * A pointer to the opaque Rust object.
288     * Nearly everywhere, inner must be non-null, however in places where
289     * the Rust equivalent takes an Option, it may be set to null to indicate None.
290     */
291    LDKnativeDecodeError *inner;
292    /**
293     * Indicates that this is the only struct which contains the same pointer.
294     * Rust functions which take ownership of an object provided via an argument require
295     * this to be true and invalidate the object pointed to by inner.
296     */
297    bool is_owned;
298 } LDKDecodeError;
299
300 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
301    struct LDKTxCreationKeys *result;
302    struct LDKDecodeError *err;
303 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
304
305 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
306    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
307    bool result_ok;
308 } LDKCResult_TxCreationKeysDecodeErrorZ;
309
310
311
312 /**
313  * One counterparty's public keys which do not change over the life of a channel.
314  */
315 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
316    /**
317     * A pointer to the opaque Rust object.
318     * Nearly everywhere, inner must be non-null, however in places where
319     * the Rust equivalent takes an Option, it may be set to null to indicate None.
320     */
321    LDKnativeChannelPublicKeys *inner;
322    /**
323     * Indicates that this is the only struct which contains the same pointer.
324     * Rust functions which take ownership of an object provided via an argument require
325     * this to be true and invalidate the object pointed to by inner.
326     */
327    bool is_owned;
328 } LDKChannelPublicKeys;
329
330 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
331    struct LDKChannelPublicKeys *result;
332    struct LDKDecodeError *err;
333 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
334
335 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
336    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
337    bool result_ok;
338 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
339
340 typedef union LDKCResult_TxCreationKeysErrorZPtr {
341    struct LDKTxCreationKeys *result;
342    enum LDKSecp256k1Error *err;
343 } LDKCResult_TxCreationKeysErrorZPtr;
344
345 typedef struct LDKCResult_TxCreationKeysErrorZ {
346    union LDKCResult_TxCreationKeysErrorZPtr contents;
347    bool result_ok;
348 } LDKCResult_TxCreationKeysErrorZ;
349
350 typedef enum LDKCOption_u32Z_Tag {
351    LDKCOption_u32Z_Some,
352    LDKCOption_u32Z_None,
353    /**
354     * Must be last for serialization purposes
355     */
356    LDKCOption_u32Z_Sentinel,
357 } LDKCOption_u32Z_Tag;
358
359 typedef struct LDKCOption_u32Z {
360    LDKCOption_u32Z_Tag tag;
361    union {
362       struct {
363          uint32_t some;
364       };
365    };
366 } LDKCOption_u32Z;
367
368
369
370 /**
371  * Information about an HTLC as it appears in a commitment transaction
372  */
373 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
374    /**
375     * A pointer to the opaque Rust object.
376     * Nearly everywhere, inner must be non-null, however in places where
377     * the Rust equivalent takes an Option, it may be set to null to indicate None.
378     */
379    LDKnativeHTLCOutputInCommitment *inner;
380    /**
381     * Indicates that this is the only struct which contains the same pointer.
382     * Rust functions which take ownership of an object provided via an argument require
383     * this to be true and invalidate the object pointed to by inner.
384     */
385    bool is_owned;
386 } LDKHTLCOutputInCommitment;
387
388 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
389    struct LDKHTLCOutputInCommitment *result;
390    struct LDKDecodeError *err;
391 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
392
393 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
394    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
395    bool result_ok;
396 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
397
398
399
400 /**
401  * Late-bound per-channel counterparty data used to build transactions.
402  */
403 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
404    /**
405     * A pointer to the opaque Rust object.
406     * Nearly everywhere, inner must be non-null, however in places where
407     * the Rust equivalent takes an Option, it may be set to null to indicate None.
408     */
409    LDKnativeCounterpartyChannelTransactionParameters *inner;
410    /**
411     * Indicates that this is the only struct which contains the same pointer.
412     * Rust functions which take ownership of an object provided via an argument require
413     * this to be true and invalidate the object pointed to by inner.
414     */
415    bool is_owned;
416 } LDKCounterpartyChannelTransactionParameters;
417
418 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
419    struct LDKCounterpartyChannelTransactionParameters *result;
420    struct LDKDecodeError *err;
421 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
422
423 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
424    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
425    bool result_ok;
426 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
427
428
429
430 /**
431  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
432  * The fields are organized by holder/counterparty.
433  *
434  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
435  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
436  */
437 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
438    /**
439     * A pointer to the opaque Rust object.
440     * Nearly everywhere, inner must be non-null, however in places where
441     * the Rust equivalent takes an Option, it may be set to null to indicate None.
442     */
443    LDKnativeChannelTransactionParameters *inner;
444    /**
445     * Indicates that this is the only struct which contains the same pointer.
446     * Rust functions which take ownership of an object provided via an argument require
447     * this to be true and invalidate the object pointed to by inner.
448     */
449    bool is_owned;
450 } LDKChannelTransactionParameters;
451
452 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
453    struct LDKChannelTransactionParameters *result;
454    struct LDKDecodeError *err;
455 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
456
457 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
458    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
459    bool result_ok;
460 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
461
462 typedef struct LDKSignature {
463    uint8_t compact_form[64];
464 } LDKSignature;
465
466 typedef struct LDKCVec_SignatureZ {
467    struct LDKSignature *data;
468    uintptr_t datalen;
469 } LDKCVec_SignatureZ;
470
471
472
473 /**
474  * Information needed to build and sign a holder's commitment transaction.
475  *
476  * The transaction is only signed once we are ready to broadcast.
477  */
478 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
479    /**
480     * A pointer to the opaque Rust object.
481     * Nearly everywhere, inner must be non-null, however in places where
482     * the Rust equivalent takes an Option, it may be set to null to indicate None.
483     */
484    LDKnativeHolderCommitmentTransaction *inner;
485    /**
486     * Indicates that this is the only struct which contains the same pointer.
487     * Rust functions which take ownership of an object provided via an argument require
488     * this to be true and invalidate the object pointed to by inner.
489     */
490    bool is_owned;
491 } LDKHolderCommitmentTransaction;
492
493 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
494    struct LDKHolderCommitmentTransaction *result;
495    struct LDKDecodeError *err;
496 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
497
498 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
499    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
500    bool result_ok;
501 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
502
503
504
505 /**
506  * A pre-built Bitcoin commitment transaction and its txid.
507  */
508 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
509    /**
510     * A pointer to the opaque Rust object.
511     * Nearly everywhere, inner must be non-null, however in places where
512     * the Rust equivalent takes an Option, it may be set to null to indicate None.
513     */
514    LDKnativeBuiltCommitmentTransaction *inner;
515    /**
516     * Indicates that this is the only struct which contains the same pointer.
517     * Rust functions which take ownership of an object provided via an argument require
518     * this to be true and invalidate the object pointed to by inner.
519     */
520    bool is_owned;
521 } LDKBuiltCommitmentTransaction;
522
523 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
524    struct LDKBuiltCommitmentTransaction *result;
525    struct LDKDecodeError *err;
526 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
527
528 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
529    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
530    bool result_ok;
531 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
532
533
534
535 /**
536  * This class tracks the per-transaction information needed to build a commitment transaction and to
537  * actually build it and sign.  It is used for holder transactions that we sign only when needed
538  * and for transactions we sign for the counterparty.
539  *
540  * This class can be used inside a signer implementation to generate a signature given the relevant
541  * secret key.
542  */
543 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
544    /**
545     * A pointer to the opaque Rust object.
546     * Nearly everywhere, inner must be non-null, however in places where
547     * the Rust equivalent takes an Option, it may be set to null to indicate None.
548     */
549    LDKnativeCommitmentTransaction *inner;
550    /**
551     * Indicates that this is the only struct which contains the same pointer.
552     * Rust functions which take ownership of an object provided via an argument require
553     * this to be true and invalidate the object pointed to by inner.
554     */
555    bool is_owned;
556 } LDKCommitmentTransaction;
557
558 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
559    struct LDKCommitmentTransaction *result;
560    struct LDKDecodeError *err;
561 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
562
563 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
564    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
565    bool result_ok;
566 } LDKCResult_CommitmentTransactionDecodeErrorZ;
567
568
569
570 /**
571  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
572  * transaction and the transaction creation keys) are trusted.
573  *
574  * See trust() and verify() functions on CommitmentTransaction.
575  *
576  * This structure implements Deref.
577  */
578 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
579    /**
580     * A pointer to the opaque Rust object.
581     * Nearly everywhere, inner must be non-null, however in places where
582     * the Rust equivalent takes an Option, it may be set to null to indicate None.
583     */
584    LDKnativeTrustedCommitmentTransaction *inner;
585    /**
586     * Indicates that this is the only struct which contains the same pointer.
587     * Rust functions which take ownership of an object provided via an argument require
588     * this to be true and invalidate the object pointed to by inner.
589     */
590    bool is_owned;
591 } LDKTrustedCommitmentTransaction;
592
593 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
594    struct LDKTrustedCommitmentTransaction *result;
595    /**
596     * Note that this value is always NULL, as there are no contents in the Err variant
597     */
598    void *err;
599 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
600
601 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
602    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
603    bool result_ok;
604 } LDKCResult_TrustedCommitmentTransactionNoneZ;
605
606 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
607    struct LDKCVec_SignatureZ *result;
608    /**
609     * Note that this value is always NULL, as there are no contents in the Err variant
610     */
611    void *err;
612 } LDKCResult_CVec_SignatureZNoneZPtr;
613
614 typedef struct LDKCResult_CVec_SignatureZNoneZ {
615    union LDKCResult_CVec_SignatureZNoneZPtr contents;
616    bool result_ok;
617 } LDKCResult_CVec_SignatureZNoneZ;
618
619
620
621 /**
622  * An accept_channel message to be sent or received from a peer
623  */
624 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
625    /**
626     * A pointer to the opaque Rust object.
627     * Nearly everywhere, inner must be non-null, however in places where
628     * the Rust equivalent takes an Option, it may be set to null to indicate None.
629     */
630    LDKnativeAcceptChannel *inner;
631    /**
632     * Indicates that this is the only struct which contains the same pointer.
633     * Rust functions which take ownership of an object provided via an argument require
634     * this to be true and invalidate the object pointed to by inner.
635     */
636    bool is_owned;
637 } LDKAcceptChannel;
638
639
640
641 /**
642  * An open_channel message to be sent or received from a peer
643  */
644 typedef struct MUST_USE_STRUCT LDKOpenChannel {
645    /**
646     * A pointer to the opaque Rust object.
647     * Nearly everywhere, inner must be non-null, however in places where
648     * the Rust equivalent takes an Option, it may be set to null to indicate None.
649     */
650    LDKnativeOpenChannel *inner;
651    /**
652     * Indicates that this is the only struct which contains the same pointer.
653     * Rust functions which take ownership of an object provided via an argument require
654     * this to be true and invalidate the object pointed to by inner.
655     */
656    bool is_owned;
657 } LDKOpenChannel;
658
659
660
661 /**
662  * A funding_created message to be sent or received from a peer
663  */
664 typedef struct MUST_USE_STRUCT LDKFundingCreated {
665    /**
666     * A pointer to the opaque Rust object.
667     * Nearly everywhere, inner must be non-null, however in places where
668     * the Rust equivalent takes an Option, it may be set to null to indicate None.
669     */
670    LDKnativeFundingCreated *inner;
671    /**
672     * Indicates that this is the only struct which contains the same pointer.
673     * Rust functions which take ownership of an object provided via an argument require
674     * this to be true and invalidate the object pointed to by inner.
675     */
676    bool is_owned;
677 } LDKFundingCreated;
678
679
680
681 /**
682  * A funding_signed message to be sent or received from a peer
683  */
684 typedef struct MUST_USE_STRUCT LDKFundingSigned {
685    /**
686     * A pointer to the opaque Rust object.
687     * Nearly everywhere, inner must be non-null, however in places where
688     * the Rust equivalent takes an Option, it may be set to null to indicate None.
689     */
690    LDKnativeFundingSigned *inner;
691    /**
692     * Indicates that this is the only struct which contains the same pointer.
693     * Rust functions which take ownership of an object provided via an argument require
694     * this to be true and invalidate the object pointed to by inner.
695     */
696    bool is_owned;
697 } LDKFundingSigned;
698
699
700
701 /**
702  * A funding_locked message to be sent or received from a peer
703  */
704 typedef struct MUST_USE_STRUCT LDKFundingLocked {
705    /**
706     * A pointer to the opaque Rust object.
707     * Nearly everywhere, inner must be non-null, however in places where
708     * the Rust equivalent takes an Option, it may be set to null to indicate None.
709     */
710    LDKnativeFundingLocked *inner;
711    /**
712     * Indicates that this is the only struct which contains the same pointer.
713     * Rust functions which take ownership of an object provided via an argument require
714     * this to be true and invalidate the object pointed to by inner.
715     */
716    bool is_owned;
717 } LDKFundingLocked;
718
719
720
721 /**
722  * An announcement_signatures message to be sent or received from a peer
723  */
724 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
725    /**
726     * A pointer to the opaque Rust object.
727     * Nearly everywhere, inner must be non-null, however in places where
728     * the Rust equivalent takes an Option, it may be set to null to indicate None.
729     */
730    LDKnativeAnnouncementSignatures *inner;
731    /**
732     * Indicates that this is the only struct which contains the same pointer.
733     * Rust functions which take ownership of an object provided via an argument require
734     * this to be true and invalidate the object pointed to by inner.
735     */
736    bool is_owned;
737 } LDKAnnouncementSignatures;
738
739
740
741 /**
742  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
743  * transaction updates if they were pending.
744  */
745 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
746    /**
747     * A pointer to the opaque Rust object.
748     * Nearly everywhere, inner must be non-null, however in places where
749     * the Rust equivalent takes an Option, it may be set to null to indicate None.
750     */
751    LDKnativeCommitmentUpdate *inner;
752    /**
753     * Indicates that this is the only struct which contains the same pointer.
754     * Rust functions which take ownership of an object provided via an argument require
755     * this to be true and invalidate the object pointed to by inner.
756     */
757    bool is_owned;
758 } LDKCommitmentUpdate;
759
760
761
762 /**
763  * A revoke_and_ack message to be sent or received from a peer
764  */
765 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
766    /**
767     * A pointer to the opaque Rust object.
768     * Nearly everywhere, inner must be non-null, however in places where
769     * the Rust equivalent takes an Option, it may be set to null to indicate None.
770     */
771    LDKnativeRevokeAndACK *inner;
772    /**
773     * Indicates that this is the only struct which contains the same pointer.
774     * Rust functions which take ownership of an object provided via an argument require
775     * this to be true and invalidate the object pointed to by inner.
776     */
777    bool is_owned;
778 } LDKRevokeAndACK;
779
780
781
782 /**
783  * A closing_signed message to be sent or received from a peer
784  */
785 typedef struct MUST_USE_STRUCT LDKClosingSigned {
786    /**
787     * A pointer to the opaque Rust object.
788     * Nearly everywhere, inner must be non-null, however in places where
789     * the Rust equivalent takes an Option, it may be set to null to indicate None.
790     */
791    LDKnativeClosingSigned *inner;
792    /**
793     * Indicates that this is the only struct which contains the same pointer.
794     * Rust functions which take ownership of an object provided via an argument require
795     * this to be true and invalidate the object pointed to by inner.
796     */
797    bool is_owned;
798 } LDKClosingSigned;
799
800
801
802 /**
803  * A shutdown message to be sent or received from a peer
804  */
805 typedef struct MUST_USE_STRUCT LDKShutdown {
806    /**
807     * A pointer to the opaque Rust object.
808     * Nearly everywhere, inner must be non-null, however in places where
809     * the Rust equivalent takes an Option, it may be set to null to indicate None.
810     */
811    LDKnativeShutdown *inner;
812    /**
813     * Indicates that this is the only struct which contains the same pointer.
814     * Rust functions which take ownership of an object provided via an argument require
815     * this to be true and invalidate the object pointed to by inner.
816     */
817    bool is_owned;
818 } LDKShutdown;
819
820
821
822 /**
823  * A channel_reestablish message to be sent or received from a peer
824  */
825 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
826    /**
827     * A pointer to the opaque Rust object.
828     * Nearly everywhere, inner must be non-null, however in places where
829     * the Rust equivalent takes an Option, it may be set to null to indicate None.
830     */
831    LDKnativeChannelReestablish *inner;
832    /**
833     * Indicates that this is the only struct which contains the same pointer.
834     * Rust functions which take ownership of an object provided via an argument require
835     * this to be true and invalidate the object pointed to by inner.
836     */
837    bool is_owned;
838 } LDKChannelReestablish;
839
840
841
842 /**
843  * A channel_announcement message to be sent or received from a peer
844  */
845 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
846    /**
847     * A pointer to the opaque Rust object.
848     * Nearly everywhere, inner must be non-null, however in places where
849     * the Rust equivalent takes an Option, it may be set to null to indicate None.
850     */
851    LDKnativeChannelAnnouncement *inner;
852    /**
853     * Indicates that this is the only struct which contains the same pointer.
854     * Rust functions which take ownership of an object provided via an argument require
855     * this to be true and invalidate the object pointed to by inner.
856     */
857    bool is_owned;
858 } LDKChannelAnnouncement;
859
860
861
862 /**
863  * A channel_update message to be sent or received from a peer
864  */
865 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
866    /**
867     * A pointer to the opaque Rust object.
868     * Nearly everywhere, inner must be non-null, however in places where
869     * the Rust equivalent takes an Option, it may be set to null to indicate None.
870     */
871    LDKnativeChannelUpdate *inner;
872    /**
873     * Indicates that this is the only struct which contains the same pointer.
874     * Rust functions which take ownership of an object provided via an argument require
875     * this to be true and invalidate the object pointed to by inner.
876     */
877    bool is_owned;
878 } LDKChannelUpdate;
879
880
881
882 /**
883  * A node_announcement message to be sent or received from a peer
884  */
885 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
886    /**
887     * A pointer to the opaque Rust object.
888     * Nearly everywhere, inner must be non-null, however in places where
889     * the Rust equivalent takes an Option, it may be set to null to indicate None.
890     */
891    LDKnativeNodeAnnouncement *inner;
892    /**
893     * Indicates that this is the only struct which contains the same pointer.
894     * Rust functions which take ownership of an object provided via an argument require
895     * this to be true and invalidate the object pointed to by inner.
896     */
897    bool is_owned;
898 } LDKNodeAnnouncement;
899
900
901
902 /**
903  * An error message to be sent or received from a peer
904  */
905 typedef struct MUST_USE_STRUCT LDKErrorMessage {
906    /**
907     * A pointer to the opaque Rust object.
908     * Nearly everywhere, inner must be non-null, however in places where
909     * the Rust equivalent takes an Option, it may be set to null to indicate None.
910     */
911    LDKnativeErrorMessage *inner;
912    /**
913     * Indicates that this is the only struct which contains the same pointer.
914     * Rust functions which take ownership of an object provided via an argument require
915     * this to be true and invalidate the object pointed to by inner.
916     */
917    bool is_owned;
918 } LDKErrorMessage;
919
920 /**
921  * Used to put an error message in a LightningError
922  */
923 typedef enum LDKErrorAction_Tag {
924    /**
925     * The peer took some action which made us think they were useless. Disconnect them.
926     */
927    LDKErrorAction_DisconnectPeer,
928    /**
929     * The peer did something harmless that we weren't able to process, just log and ignore
930     */
931    LDKErrorAction_IgnoreError,
932    /**
933     * The peer did something incorrect. Tell them.
934     */
935    LDKErrorAction_SendErrorMessage,
936    /**
937     * Must be last for serialization purposes
938     */
939    LDKErrorAction_Sentinel,
940 } LDKErrorAction_Tag;
941
942 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
943    /**
944     * An error message which we should make an effort to send before we disconnect.
945     */
946    struct LDKErrorMessage msg;
947 } LDKErrorAction_LDKDisconnectPeer_Body;
948
949 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
950    /**
951     * The message to send.
952     */
953    struct LDKErrorMessage msg;
954 } LDKErrorAction_LDKSendErrorMessage_Body;
955
956 typedef struct MUST_USE_STRUCT LDKErrorAction {
957    LDKErrorAction_Tag tag;
958    union {
959       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
960       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
961    };
962 } LDKErrorAction;
963
964 /**
965  * The information we received from a peer along the route of a payment we originated. This is
966  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
967  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
968  */
969 typedef enum LDKHTLCFailChannelUpdate_Tag {
970    /**
971     * We received an error which included a full ChannelUpdate message.
972     */
973    LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
974    /**
975     * We received an error which indicated only that a channel has been closed
976     */
977    LDKHTLCFailChannelUpdate_ChannelClosed,
978    /**
979     * We received an error which indicated only that a node has failed
980     */
981    LDKHTLCFailChannelUpdate_NodeFailure,
982    /**
983     * Must be last for serialization purposes
984     */
985    LDKHTLCFailChannelUpdate_Sentinel,
986 } LDKHTLCFailChannelUpdate_Tag;
987
988 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
989    /**
990     * The unwrapped message we received
991     */
992    struct LDKChannelUpdate msg;
993 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
994
995 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
996    /**
997     * The short_channel_id which has now closed.
998     */
999    uint64_t short_channel_id;
1000    /**
1001     * when this true, this channel should be permanently removed from the
1002     * consideration. Otherwise, this channel can be restored as new channel_update is received
1003     */
1004    bool is_permanent;
1005 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
1006
1007 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
1008    /**
1009     * The node_id that has failed.
1010     */
1011    struct LDKPublicKey node_id;
1012    /**
1013     * when this true, node should be permanently removed from the
1014     * consideration. Otherwise, the channels connected to this node can be
1015     * restored as new channel_update is received
1016     */
1017    bool is_permanent;
1018 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
1019
1020 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
1021    LDKHTLCFailChannelUpdate_Tag tag;
1022    union {
1023       LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
1024       LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
1025       LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
1026    };
1027 } LDKHTLCFailChannelUpdate;
1028
1029
1030
1031 /**
1032  * A query_channel_range message is used to query a peer for channel
1033  * UTXOs in a range of blocks. The recipient of a query makes a best
1034  * effort to reply to the query using one or more reply_channel_range
1035  * messages.
1036  */
1037 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
1038    /**
1039     * A pointer to the opaque Rust object.
1040     * Nearly everywhere, inner must be non-null, however in places where
1041     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1042     */
1043    LDKnativeQueryChannelRange *inner;
1044    /**
1045     * Indicates that this is the only struct which contains the same pointer.
1046     * Rust functions which take ownership of an object provided via an argument require
1047     * this to be true and invalidate the object pointed to by inner.
1048     */
1049    bool is_owned;
1050 } LDKQueryChannelRange;
1051
1052
1053
1054 /**
1055  * A query_short_channel_ids message is used to query a peer for
1056  * routing gossip messages related to one or more short_channel_ids.
1057  * The query recipient will reply with the latest, if available,
1058  * channel_announcement, channel_update and node_announcement messages
1059  * it maintains for the requested short_channel_ids followed by a
1060  * reply_short_channel_ids_end message. The short_channel_ids sent in
1061  * this query are encoded. We only support encoding_type=0 uncompressed
1062  * serialization and do not support encoding_type=1 zlib serialization.
1063  */
1064 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
1065    /**
1066     * A pointer to the opaque Rust object.
1067     * Nearly everywhere, inner must be non-null, however in places where
1068     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1069     */
1070    LDKnativeQueryShortChannelIds *inner;
1071    /**
1072     * Indicates that this is the only struct which contains the same pointer.
1073     * Rust functions which take ownership of an object provided via an argument require
1074     * this to be true and invalidate the object pointed to by inner.
1075     */
1076    bool is_owned;
1077 } LDKQueryShortChannelIds;
1078
1079
1080
1081 /**
1082  * A reply_channel_range message is a reply to a query_channel_range
1083  * message. Multiple reply_channel_range messages can be sent in reply
1084  * to a single query_channel_range message. The query recipient makes a
1085  * best effort to respond based on their local network view which may
1086  * not be a perfect view of the network. The short_channel_ids in the
1087  * reply are encoded. We only support encoding_type=0 uncompressed
1088  * serialization and do not support encoding_type=1 zlib serialization.
1089  */
1090 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
1091    /**
1092     * A pointer to the opaque Rust object.
1093     * Nearly everywhere, inner must be non-null, however in places where
1094     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1095     */
1096    LDKnativeReplyChannelRange *inner;
1097    /**
1098     * Indicates that this is the only struct which contains the same pointer.
1099     * Rust functions which take ownership of an object provided via an argument require
1100     * this to be true and invalidate the object pointed to by inner.
1101     */
1102    bool is_owned;
1103 } LDKReplyChannelRange;
1104
1105 /**
1106  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
1107  * broadcast to most peers).
1108  * These events are handled by PeerManager::process_events if you are using a PeerManager.
1109  */
1110 typedef enum LDKMessageSendEvent_Tag {
1111    /**
1112     * Used to indicate that we've accepted a channel open and should send the accept_channel
1113     * message provided to the given peer.
1114     */
1115    LDKMessageSendEvent_SendAcceptChannel,
1116    /**
1117     * Used to indicate that we've initiated a channel open and should send the open_channel
1118     * message provided to the given peer.
1119     */
1120    LDKMessageSendEvent_SendOpenChannel,
1121    /**
1122     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
1123     */
1124    LDKMessageSendEvent_SendFundingCreated,
1125    /**
1126     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
1127     */
1128    LDKMessageSendEvent_SendFundingSigned,
1129    /**
1130     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
1131     */
1132    LDKMessageSendEvent_SendFundingLocked,
1133    /**
1134     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
1135     */
1136    LDKMessageSendEvent_SendAnnouncementSignatures,
1137    /**
1138     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
1139     * message should be sent to the peer with the given node_id.
1140     */
1141    LDKMessageSendEvent_UpdateHTLCs,
1142    /**
1143     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
1144     */
1145    LDKMessageSendEvent_SendRevokeAndACK,
1146    /**
1147     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
1148     */
1149    LDKMessageSendEvent_SendClosingSigned,
1150    /**
1151     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
1152     */
1153    LDKMessageSendEvent_SendShutdown,
1154    /**
1155     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
1156     */
1157    LDKMessageSendEvent_SendChannelReestablish,
1158    /**
1159     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
1160     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
1161     *
1162     * Note that after doing so, you very likely (unless you did so very recently) want to call
1163     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
1164     * This ensures that any nodes which see our channel_announcement also have a relevant
1165     * node_announcement, including relevant feature flags which may be important for routing
1166     * through or to us.
1167     */
1168    LDKMessageSendEvent_BroadcastChannelAnnouncement,
1169    /**
1170     * Used to indicate that a node_announcement should be broadcast to all peers.
1171     */
1172    LDKMessageSendEvent_BroadcastNodeAnnouncement,
1173    /**
1174     * Used to indicate that a channel_update should be broadcast to all peers.
1175     */
1176    LDKMessageSendEvent_BroadcastChannelUpdate,
1177    /**
1178     * Broadcast an error downstream to be handled
1179     */
1180    LDKMessageSendEvent_HandleError,
1181    /**
1182     * When a payment fails we may receive updates back from the hop where it failed. In such
1183     * cases this event is generated so that we can inform the network graph of this information.
1184     */
1185    LDKMessageSendEvent_PaymentFailureNetworkUpdate,
1186    /**
1187     * Query a peer for channels with funding transaction UTXOs in a block range.
1188     */
1189    LDKMessageSendEvent_SendChannelRangeQuery,
1190    /**
1191     * Request routing gossip messages from a peer for a list of channels identified by
1192     * their short_channel_ids.
1193     */
1194    LDKMessageSendEvent_SendShortIdsQuery,
1195    /**
1196     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
1197     * emitted during processing of the query.
1198     */
1199    LDKMessageSendEvent_SendReplyChannelRange,
1200    /**
1201     * Must be last for serialization purposes
1202     */
1203    LDKMessageSendEvent_Sentinel,
1204 } LDKMessageSendEvent_Tag;
1205
1206 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
1207    /**
1208     * The node_id of the node which should receive this message
1209     */
1210    struct LDKPublicKey node_id;
1211    /**
1212     * The message which should be sent.
1213     */
1214    struct LDKAcceptChannel msg;
1215 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
1216
1217 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
1218    /**
1219     * The node_id of the node which should receive this message
1220     */
1221    struct LDKPublicKey node_id;
1222    /**
1223     * The message which should be sent.
1224     */
1225    struct LDKOpenChannel msg;
1226 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
1227
1228 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
1229    /**
1230     * The node_id of the node which should receive this message
1231     */
1232    struct LDKPublicKey node_id;
1233    /**
1234     * The message which should be sent.
1235     */
1236    struct LDKFundingCreated msg;
1237 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
1238
1239 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
1240    /**
1241     * The node_id of the node which should receive this message
1242     */
1243    struct LDKPublicKey node_id;
1244    /**
1245     * The message which should be sent.
1246     */
1247    struct LDKFundingSigned msg;
1248 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
1249
1250 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
1251    /**
1252     * The node_id of the node which should receive these message(s)
1253     */
1254    struct LDKPublicKey node_id;
1255    /**
1256     * The funding_locked message which should be sent.
1257     */
1258    struct LDKFundingLocked msg;
1259 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
1260
1261 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
1262    /**
1263     * The node_id of the node which should receive these message(s)
1264     */
1265    struct LDKPublicKey node_id;
1266    /**
1267     * The announcement_signatures message which should be sent.
1268     */
1269    struct LDKAnnouncementSignatures msg;
1270 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
1271
1272 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
1273    /**
1274     * The node_id of the node which should receive these message(s)
1275     */
1276    struct LDKPublicKey node_id;
1277    /**
1278     * The update messages which should be sent. ALL messages in the struct should be sent!
1279     */
1280    struct LDKCommitmentUpdate updates;
1281 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
1282
1283 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
1284    /**
1285     * The node_id of the node which should receive this message
1286     */
1287    struct LDKPublicKey node_id;
1288    /**
1289     * The message which should be sent.
1290     */
1291    struct LDKRevokeAndACK msg;
1292 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
1293
1294 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
1295    /**
1296     * The node_id of the node which should receive this message
1297     */
1298    struct LDKPublicKey node_id;
1299    /**
1300     * The message which should be sent.
1301     */
1302    struct LDKClosingSigned msg;
1303 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
1304
1305 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
1306    /**
1307     * The node_id of the node which should receive this message
1308     */
1309    struct LDKPublicKey node_id;
1310    /**
1311     * The message which should be sent.
1312     */
1313    struct LDKShutdown msg;
1314 } LDKMessageSendEvent_LDKSendShutdown_Body;
1315
1316 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
1317    /**
1318     * The node_id of the node which should receive this message
1319     */
1320    struct LDKPublicKey node_id;
1321    /**
1322     * The message which should be sent.
1323     */
1324    struct LDKChannelReestablish msg;
1325 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
1326
1327 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
1328    /**
1329     * The channel_announcement which should be sent.
1330     */
1331    struct LDKChannelAnnouncement msg;
1332    /**
1333     * The followup channel_update which should be sent.
1334     */
1335    struct LDKChannelUpdate update_msg;
1336 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
1337
1338 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
1339    /**
1340     * The node_announcement which should be sent.
1341     */
1342    struct LDKNodeAnnouncement msg;
1343 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
1344
1345 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
1346    /**
1347     * The channel_update which should be sent.
1348     */
1349    struct LDKChannelUpdate msg;
1350 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
1351
1352 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
1353    /**
1354     * The node_id of the node which should receive this message
1355     */
1356    struct LDKPublicKey node_id;
1357    /**
1358     * The action which should be taken.
1359     */
1360    struct LDKErrorAction action;
1361 } LDKMessageSendEvent_LDKHandleError_Body;
1362
1363 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
1364    /**
1365     * The channel/node update which should be sent to NetGraphMsgHandler
1366     */
1367    struct LDKHTLCFailChannelUpdate update;
1368 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
1369
1370 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
1371    /**
1372     * The node_id of this message recipient
1373     */
1374    struct LDKPublicKey node_id;
1375    /**
1376     * The query_channel_range which should be sent.
1377     */
1378    struct LDKQueryChannelRange msg;
1379 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
1380
1381 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
1382    /**
1383     * The node_id of this message recipient
1384     */
1385    struct LDKPublicKey node_id;
1386    /**
1387     * The query_short_channel_ids which should be sent.
1388     */
1389    struct LDKQueryShortChannelIds msg;
1390 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
1391
1392 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
1393    /**
1394     * The node_id of this message recipient
1395     */
1396    struct LDKPublicKey node_id;
1397    /**
1398     * The reply_channel_range which should be sent.
1399     */
1400    struct LDKReplyChannelRange msg;
1401 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
1402
1403 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
1404    LDKMessageSendEvent_Tag tag;
1405    union {
1406       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
1407       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
1408       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
1409       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
1410       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
1411       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
1412       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
1413       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
1414       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
1415       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
1416       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
1417       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
1418       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
1419       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
1420       LDKMessageSendEvent_LDKHandleError_Body handle_error;
1421       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
1422       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
1423       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
1424       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
1425    };
1426 } LDKMessageSendEvent;
1427
1428 typedef struct LDKCVec_MessageSendEventZ {
1429    struct LDKMessageSendEvent *data;
1430    uintptr_t datalen;
1431 } LDKCVec_MessageSendEventZ;
1432
1433
1434
1435 /**
1436  * An Err type for failure to process messages.
1437  */
1438 typedef struct MUST_USE_STRUCT LDKLightningError {
1439    /**
1440     * A pointer to the opaque Rust object.
1441     * Nearly everywhere, inner must be non-null, however in places where
1442     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1443     */
1444    LDKnativeLightningError *inner;
1445    /**
1446     * Indicates that this is the only struct which contains the same pointer.
1447     * Rust functions which take ownership of an object provided via an argument require
1448     * this to be true and invalidate the object pointed to by inner.
1449     */
1450    bool is_owned;
1451 } LDKLightningError;
1452
1453 typedef union LDKCResult_boolLightningErrorZPtr {
1454    bool *result;
1455    struct LDKLightningError *err;
1456 } LDKCResult_boolLightningErrorZPtr;
1457
1458 typedef struct LDKCResult_boolLightningErrorZ {
1459    union LDKCResult_boolLightningErrorZPtr contents;
1460    bool result_ok;
1461 } LDKCResult_boolLightningErrorZ;
1462
1463 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1464    struct LDKChannelAnnouncement a;
1465    struct LDKChannelUpdate b;
1466    struct LDKChannelUpdate c;
1467 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
1468
1469 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1470    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
1471    uintptr_t datalen;
1472 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
1473
1474 typedef struct LDKCVec_NodeAnnouncementZ {
1475    struct LDKNodeAnnouncement *data;
1476    uintptr_t datalen;
1477 } LDKCVec_NodeAnnouncementZ;
1478
1479 typedef union LDKCResult_NoneLightningErrorZPtr {
1480    /**
1481     * Note that this value is always NULL, as there are no contents in the OK variant
1482     */
1483    void *result;
1484    struct LDKLightningError *err;
1485 } LDKCResult_NoneLightningErrorZPtr;
1486
1487 typedef struct LDKCResult_NoneLightningErrorZ {
1488    union LDKCResult_NoneLightningErrorZPtr contents;
1489    bool result_ok;
1490 } LDKCResult_NoneLightningErrorZ;
1491
1492 typedef struct LDKCVec_PublicKeyZ {
1493    struct LDKPublicKey *data;
1494    uintptr_t datalen;
1495 } LDKCVec_PublicKeyZ;
1496
1497
1498
1499 /**
1500  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
1501  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
1502  * descriptor.
1503  */
1504 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
1505    /**
1506     * A pointer to the opaque Rust object.
1507     * Nearly everywhere, inner must be non-null, however in places where
1508     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1509     */
1510    LDKnativePeerHandleError *inner;
1511    /**
1512     * Indicates that this is the only struct which contains the same pointer.
1513     * Rust functions which take ownership of an object provided via an argument require
1514     * this to be true and invalidate the object pointed to by inner.
1515     */
1516    bool is_owned;
1517 } LDKPeerHandleError;
1518
1519 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
1520    struct LDKCVec_u8Z *result;
1521    struct LDKPeerHandleError *err;
1522 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
1523
1524 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
1525    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
1526    bool result_ok;
1527 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
1528
1529 typedef union LDKCResult_NonePeerHandleErrorZPtr {
1530    /**
1531     * Note that this value is always NULL, as there are no contents in the OK variant
1532     */
1533    void *result;
1534    struct LDKPeerHandleError *err;
1535 } LDKCResult_NonePeerHandleErrorZPtr;
1536
1537 typedef struct LDKCResult_NonePeerHandleErrorZ {
1538    union LDKCResult_NonePeerHandleErrorZPtr contents;
1539    bool result_ok;
1540 } LDKCResult_NonePeerHandleErrorZ;
1541
1542 typedef union LDKCResult_boolPeerHandleErrorZPtr {
1543    bool *result;
1544    struct LDKPeerHandleError *err;
1545 } LDKCResult_boolPeerHandleErrorZPtr;
1546
1547 typedef struct LDKCResult_boolPeerHandleErrorZ {
1548    union LDKCResult_boolPeerHandleErrorZPtr contents;
1549    bool result_ok;
1550 } LDKCResult_boolPeerHandleErrorZ;
1551
1552
1553
1554 /**
1555  * Features used within an `init` message.
1556  */
1557 typedef struct MUST_USE_STRUCT LDKInitFeatures {
1558    /**
1559     * A pointer to the opaque Rust object.
1560     * Nearly everywhere, inner must be non-null, however in places where
1561     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1562     */
1563    LDKnativeInitFeatures *inner;
1564    /**
1565     * Indicates that this is the only struct which contains the same pointer.
1566     * Rust functions which take ownership of an object provided via an argument require
1567     * this to be true and invalidate the object pointed to by inner.
1568     */
1569    bool is_owned;
1570 } LDKInitFeatures;
1571
1572 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
1573    struct LDKInitFeatures *result;
1574    struct LDKDecodeError *err;
1575 } LDKCResult_InitFeaturesDecodeErrorZPtr;
1576
1577 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
1578    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
1579    bool result_ok;
1580 } LDKCResult_InitFeaturesDecodeErrorZ;
1581
1582
1583
1584 /**
1585  * Features used within a `node_announcement` message.
1586  */
1587 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
1588    /**
1589     * A pointer to the opaque Rust object.
1590     * Nearly everywhere, inner must be non-null, however in places where
1591     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1592     */
1593    LDKnativeNodeFeatures *inner;
1594    /**
1595     * Indicates that this is the only struct which contains the same pointer.
1596     * Rust functions which take ownership of an object provided via an argument require
1597     * this to be true and invalidate the object pointed to by inner.
1598     */
1599    bool is_owned;
1600 } LDKNodeFeatures;
1601
1602 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
1603    struct LDKNodeFeatures *result;
1604    struct LDKDecodeError *err;
1605 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
1606
1607 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
1608    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
1609    bool result_ok;
1610 } LDKCResult_NodeFeaturesDecodeErrorZ;
1611
1612
1613
1614 /**
1615  * Features used within a `channel_announcement` message.
1616  */
1617 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
1618    /**
1619     * A pointer to the opaque Rust object.
1620     * Nearly everywhere, inner must be non-null, however in places where
1621     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1622     */
1623    LDKnativeChannelFeatures *inner;
1624    /**
1625     * Indicates that this is the only struct which contains the same pointer.
1626     * Rust functions which take ownership of an object provided via an argument require
1627     * this to be true and invalidate the object pointed to by inner.
1628     */
1629    bool is_owned;
1630 } LDKChannelFeatures;
1631
1632 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
1633    struct LDKChannelFeatures *result;
1634    struct LDKDecodeError *err;
1635 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
1636
1637 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
1638    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
1639    bool result_ok;
1640 } LDKCResult_ChannelFeaturesDecodeErrorZ;
1641
1642
1643
1644 /**
1645  * Features used within an invoice.
1646  */
1647 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
1648    /**
1649     * A pointer to the opaque Rust object.
1650     * Nearly everywhere, inner must be non-null, however in places where
1651     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1652     */
1653    LDKnativeInvoiceFeatures *inner;
1654    /**
1655     * Indicates that this is the only struct which contains the same pointer.
1656     * Rust functions which take ownership of an object provided via an argument require
1657     * this to be true and invalidate the object pointed to by inner.
1658     */
1659    bool is_owned;
1660 } LDKInvoiceFeatures;
1661
1662 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
1663    struct LDKInvoiceFeatures *result;
1664    struct LDKDecodeError *err;
1665 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
1666
1667 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
1668    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
1669    bool result_ok;
1670 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
1671
1672
1673
1674 /**
1675  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
1676  * with our counterparty.
1677  */
1678 typedef struct MUST_USE_STRUCT LDKChannelConfig {
1679    /**
1680     * A pointer to the opaque Rust object.
1681     * Nearly everywhere, inner must be non-null, however in places where
1682     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1683     */
1684    LDKnativeChannelConfig *inner;
1685    /**
1686     * Indicates that this is the only struct which contains the same pointer.
1687     * Rust functions which take ownership of an object provided via an argument require
1688     * this to be true and invalidate the object pointed to by inner.
1689     */
1690    bool is_owned;
1691 } LDKChannelConfig;
1692
1693 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
1694    struct LDKChannelConfig *result;
1695    struct LDKDecodeError *err;
1696 } LDKCResult_ChannelConfigDecodeErrorZPtr;
1697
1698 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
1699    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
1700    bool result_ok;
1701 } LDKCResult_ChannelConfigDecodeErrorZ;
1702
1703 typedef enum LDKCOption_u64Z_Tag {
1704    LDKCOption_u64Z_Some,
1705    LDKCOption_u64Z_None,
1706    /**
1707     * Must be last for serialization purposes
1708     */
1709    LDKCOption_u64Z_Sentinel,
1710 } LDKCOption_u64Z_Tag;
1711
1712 typedef struct LDKCOption_u64Z {
1713    LDKCOption_u64Z_Tag tag;
1714    union {
1715       struct {
1716          uint64_t some;
1717       };
1718    };
1719 } LDKCOption_u64Z;
1720
1721
1722
1723 /**
1724  * Details about one direction of a channel. Received
1725  * within a channel update.
1726  */
1727 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
1728    /**
1729     * A pointer to the opaque Rust object.
1730     * Nearly everywhere, inner must be non-null, however in places where
1731     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1732     */
1733    LDKnativeDirectionalChannelInfo *inner;
1734    /**
1735     * Indicates that this is the only struct which contains the same pointer.
1736     * Rust functions which take ownership of an object provided via an argument require
1737     * this to be true and invalidate the object pointed to by inner.
1738     */
1739    bool is_owned;
1740 } LDKDirectionalChannelInfo;
1741
1742 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
1743    struct LDKDirectionalChannelInfo *result;
1744    struct LDKDecodeError *err;
1745 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
1746
1747 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
1748    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
1749    bool result_ok;
1750 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
1751
1752
1753
1754 /**
1755  * Details about a channel (both directions).
1756  * Received within a channel announcement.
1757  */
1758 typedef struct MUST_USE_STRUCT LDKChannelInfo {
1759    /**
1760     * A pointer to the opaque Rust object.
1761     * Nearly everywhere, inner must be non-null, however in places where
1762     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1763     */
1764    LDKnativeChannelInfo *inner;
1765    /**
1766     * Indicates that this is the only struct which contains the same pointer.
1767     * Rust functions which take ownership of an object provided via an argument require
1768     * this to be true and invalidate the object pointed to by inner.
1769     */
1770    bool is_owned;
1771 } LDKChannelInfo;
1772
1773 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
1774    struct LDKChannelInfo *result;
1775    struct LDKDecodeError *err;
1776 } LDKCResult_ChannelInfoDecodeErrorZPtr;
1777
1778 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
1779    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
1780    bool result_ok;
1781 } LDKCResult_ChannelInfoDecodeErrorZ;
1782
1783
1784
1785 /**
1786  * Fees for routing via a given channel or a node
1787  */
1788 typedef struct MUST_USE_STRUCT LDKRoutingFees {
1789    /**
1790     * A pointer to the opaque Rust object.
1791     * Nearly everywhere, inner must be non-null, however in places where
1792     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1793     */
1794    LDKnativeRoutingFees *inner;
1795    /**
1796     * Indicates that this is the only struct which contains the same pointer.
1797     * Rust functions which take ownership of an object provided via an argument require
1798     * this to be true and invalidate the object pointed to by inner.
1799     */
1800    bool is_owned;
1801 } LDKRoutingFees;
1802
1803 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
1804    struct LDKRoutingFees *result;
1805    struct LDKDecodeError *err;
1806 } LDKCResult_RoutingFeesDecodeErrorZPtr;
1807
1808 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
1809    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
1810    bool result_ok;
1811 } LDKCResult_RoutingFeesDecodeErrorZ;
1812
1813 typedef struct LDKFourBytes {
1814    uint8_t data[4];
1815 } LDKFourBytes;
1816
1817 typedef struct LDKSixteenBytes {
1818    uint8_t data[16];
1819 } LDKSixteenBytes;
1820
1821 typedef struct LDKTenBytes {
1822    uint8_t data[10];
1823 } LDKTenBytes;
1824
1825 /**
1826  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1827  * look up the corresponding function in rust-lightning's docs.
1828  */
1829 typedef struct LDKThirtyTwoBytes {
1830    uint8_t data[32];
1831 } LDKThirtyTwoBytes;
1832
1833 /**
1834  * An address which can be used to connect to a remote peer
1835  */
1836 typedef enum LDKNetAddress_Tag {
1837    /**
1838     * An IPv4 address/port on which the peer is listening.
1839     */
1840    LDKNetAddress_IPv4,
1841    /**
1842     * An IPv6 address/port on which the peer is listening.
1843     */
1844    LDKNetAddress_IPv6,
1845    /**
1846     * An old-style Tor onion address/port on which the peer is listening.
1847     */
1848    LDKNetAddress_OnionV2,
1849    /**
1850     * A new-style Tor onion address/port on which the peer is listening.
1851     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
1852     * wrap as base32 and append \".onion\".
1853     */
1854    LDKNetAddress_OnionV3,
1855    /**
1856     * Must be last for serialization purposes
1857     */
1858    LDKNetAddress_Sentinel,
1859 } LDKNetAddress_Tag;
1860
1861 typedef struct LDKNetAddress_LDKIPv4_Body {
1862    /**
1863     * The 4-byte IPv4 address
1864     */
1865    struct LDKFourBytes addr;
1866    /**
1867     * The port on which the node is listening
1868     */
1869    uint16_t port;
1870 } LDKNetAddress_LDKIPv4_Body;
1871
1872 typedef struct LDKNetAddress_LDKIPv6_Body {
1873    /**
1874     * The 16-byte IPv6 address
1875     */
1876    struct LDKSixteenBytes addr;
1877    /**
1878     * The port on which the node is listening
1879     */
1880    uint16_t port;
1881 } LDKNetAddress_LDKIPv6_Body;
1882
1883 typedef struct LDKNetAddress_LDKOnionV2_Body {
1884    /**
1885     * The bytes (usually encoded in base32 with \".onion\" appended)
1886     */
1887    struct LDKTenBytes addr;
1888    /**
1889     * The port on which the node is listening
1890     */
1891    uint16_t port;
1892 } LDKNetAddress_LDKOnionV2_Body;
1893
1894 typedef struct LDKNetAddress_LDKOnionV3_Body {
1895    /**
1896     * The ed25519 long-term public key of the peer
1897     */
1898    struct LDKThirtyTwoBytes ed25519_pubkey;
1899    /**
1900     * The checksum of the pubkey and version, as included in the onion address
1901     */
1902    uint16_t checksum;
1903    /**
1904     * The version byte, as defined by the Tor Onion v3 spec.
1905     */
1906    uint8_t version;
1907    /**
1908     * The port on which the node is listening
1909     */
1910    uint16_t port;
1911 } LDKNetAddress_LDKOnionV3_Body;
1912
1913 typedef struct MUST_USE_STRUCT LDKNetAddress {
1914    LDKNetAddress_Tag tag;
1915    union {
1916       LDKNetAddress_LDKIPv4_Body i_pv4;
1917       LDKNetAddress_LDKIPv6_Body i_pv6;
1918       LDKNetAddress_LDKOnionV2_Body onion_v2;
1919       LDKNetAddress_LDKOnionV3_Body onion_v3;
1920    };
1921 } LDKNetAddress;
1922
1923 typedef struct LDKCVec_NetAddressZ {
1924    struct LDKNetAddress *data;
1925    uintptr_t datalen;
1926 } LDKCVec_NetAddressZ;
1927
1928
1929
1930 /**
1931  * Information received in the latest node_announcement from this node.
1932  */
1933 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
1934    /**
1935     * A pointer to the opaque Rust object.
1936     * Nearly everywhere, inner must be non-null, however in places where
1937     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1938     */
1939    LDKnativeNodeAnnouncementInfo *inner;
1940    /**
1941     * Indicates that this is the only struct which contains the same pointer.
1942     * Rust functions which take ownership of an object provided via an argument require
1943     * this to be true and invalidate the object pointed to by inner.
1944     */
1945    bool is_owned;
1946 } LDKNodeAnnouncementInfo;
1947
1948 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
1949    struct LDKNodeAnnouncementInfo *result;
1950    struct LDKDecodeError *err;
1951 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
1952
1953 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
1954    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
1955    bool result_ok;
1956 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
1957
1958 typedef struct LDKCVec_u64Z {
1959    uint64_t *data;
1960    uintptr_t datalen;
1961 } LDKCVec_u64Z;
1962
1963
1964
1965 /**
1966  * Details about a node in the network, known from the network announcement.
1967  */
1968 typedef struct MUST_USE_STRUCT LDKNodeInfo {
1969    /**
1970     * A pointer to the opaque Rust object.
1971     * Nearly everywhere, inner must be non-null, however in places where
1972     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1973     */
1974    LDKnativeNodeInfo *inner;
1975    /**
1976     * Indicates that this is the only struct which contains the same pointer.
1977     * Rust functions which take ownership of an object provided via an argument require
1978     * this to be true and invalidate the object pointed to by inner.
1979     */
1980    bool is_owned;
1981 } LDKNodeInfo;
1982
1983 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
1984    struct LDKNodeInfo *result;
1985    struct LDKDecodeError *err;
1986 } LDKCResult_NodeInfoDecodeErrorZPtr;
1987
1988 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
1989    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
1990    bool result_ok;
1991 } LDKCResult_NodeInfoDecodeErrorZ;
1992
1993
1994
1995 /**
1996  * Represents the network as nodes and channels between them
1997  */
1998 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
1999    /**
2000     * A pointer to the opaque Rust object.
2001     * Nearly everywhere, inner must be non-null, however in places where
2002     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2003     */
2004    LDKnativeNetworkGraph *inner;
2005    /**
2006     * Indicates that this is the only struct which contains the same pointer.
2007     * Rust functions which take ownership of an object provided via an argument require
2008     * this to be true and invalidate the object pointed to by inner.
2009     */
2010    bool is_owned;
2011 } LDKNetworkGraph;
2012
2013 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
2014    struct LDKNetworkGraph *result;
2015    struct LDKDecodeError *err;
2016 } LDKCResult_NetworkGraphDecodeErrorZPtr;
2017
2018 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
2019    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
2020    bool result_ok;
2021 } LDKCResult_NetworkGraphDecodeErrorZ;
2022
2023 typedef struct LDKC2Tuple_usizeTransactionZ {
2024    uintptr_t a;
2025    struct LDKTransaction b;
2026 } LDKC2Tuple_usizeTransactionZ;
2027
2028 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
2029    struct LDKC2Tuple_usizeTransactionZ *data;
2030    uintptr_t datalen;
2031 } LDKCVec_C2Tuple_usizeTransactionZZ;
2032
2033 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
2034    /**
2035     * Note that this value is always NULL, as there are no contents in the OK variant
2036     */
2037    void *result;
2038    enum LDKChannelMonitorUpdateErr *err;
2039 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
2040
2041 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
2042    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
2043    bool result_ok;
2044 } LDKCResult_NoneChannelMonitorUpdateErrZ;
2045
2046
2047
2048 /**
2049  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2050  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2051  * preimage claim backward will lead to loss of funds.
2052  */
2053 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2054    /**
2055     * A pointer to the opaque Rust object.
2056     * Nearly everywhere, inner must be non-null, however in places where
2057     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2058     */
2059    LDKnativeHTLCUpdate *inner;
2060    /**
2061     * Indicates that this is the only struct which contains the same pointer.
2062     * Rust functions which take ownership of an object provided via an argument require
2063     * this to be true and invalidate the object pointed to by inner.
2064     */
2065    bool is_owned;
2066 } LDKHTLCUpdate;
2067
2068
2069
2070 /**
2071  * A reference to a transaction output.
2072  *
2073  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
2074  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
2075  */
2076 typedef struct MUST_USE_STRUCT LDKOutPoint {
2077    /**
2078     * A pointer to the opaque Rust object.
2079     * Nearly everywhere, inner must be non-null, however in places where
2080     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2081     */
2082    LDKnativeOutPoint *inner;
2083    /**
2084     * Indicates that this is the only struct which contains the same pointer.
2085     * Rust functions which take ownership of an object provided via an argument require
2086     * this to be true and invalidate the object pointed to by inner.
2087     */
2088    bool is_owned;
2089 } LDKOutPoint;
2090
2091 /**
2092  * An event to be processed by the ChannelManager.
2093  */
2094 typedef enum LDKMonitorEvent_Tag {
2095    /**
2096     * A monitor event containing an HTLCUpdate.
2097     */
2098    LDKMonitorEvent_HTLCEvent,
2099    /**
2100     * A monitor event that the Channel's commitment transaction was broadcasted.
2101     */
2102    LDKMonitorEvent_CommitmentTxBroadcasted,
2103    /**
2104     * Must be last for serialization purposes
2105     */
2106    LDKMonitorEvent_Sentinel,
2107 } LDKMonitorEvent_Tag;
2108
2109 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
2110    LDKMonitorEvent_Tag tag;
2111    union {
2112       struct {
2113          struct LDKHTLCUpdate htlc_event;
2114       };
2115       struct {
2116          struct LDKOutPoint commitment_tx_broadcasted;
2117       };
2118    };
2119 } LDKMonitorEvent;
2120
2121 typedef struct LDKCVec_MonitorEventZ {
2122    struct LDKMonitorEvent *data;
2123    uintptr_t datalen;
2124 } LDKCVec_MonitorEventZ;
2125
2126
2127
2128 /**
2129  * Information about a spendable output to a P2WSH script. See
2130  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2131  */
2132 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2133    /**
2134     * A pointer to the opaque Rust object.
2135     * Nearly everywhere, inner must be non-null, however in places where
2136     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2137     */
2138    LDKnativeDelayedPaymentOutputDescriptor *inner;
2139    /**
2140     * Indicates that this is the only struct which contains the same pointer.
2141     * Rust functions which take ownership of an object provided via an argument require
2142     * this to be true and invalidate the object pointed to by inner.
2143     */
2144    bool is_owned;
2145 } LDKDelayedPaymentOutputDescriptor;
2146
2147
2148
2149 /**
2150  * Information about a spendable output to our \"payment key\". See
2151  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2152  */
2153 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2154    /**
2155     * A pointer to the opaque Rust object.
2156     * Nearly everywhere, inner must be non-null, however in places where
2157     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2158     */
2159    LDKnativeStaticPaymentOutputDescriptor *inner;
2160    /**
2161     * Indicates that this is the only struct which contains the same pointer.
2162     * Rust functions which take ownership of an object provided via an argument require
2163     * this to be true and invalidate the object pointed to by inner.
2164     */
2165    bool is_owned;
2166 } LDKStaticPaymentOutputDescriptor;
2167
2168 /**
2169  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2170  * claim at any point in the future) an event is generated which you must track and be able to
2171  * spend on-chain. The information needed to do this is provided in this enum, including the
2172  * outpoint describing which txid and output index is available, the full output which exists at
2173  * that txid/index, and any keys or other information required to sign.
2174  */
2175 typedef enum LDKSpendableOutputDescriptor_Tag {
2176    /**
2177     * An output to a script which was provided via KeysInterface directly, either from
2178     * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
2179     * spend it. No secret keys are provided as rust-lightning was never given any key.
2180     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2181     * on-chain using the payment preimage or after it has timed out.
2182     */
2183    LDKSpendableOutputDescriptor_StaticOutput,
2184    /**
2185     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2186     *
2187     * The witness in the spending input should be:
2188     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2189     *
2190     * Note that the nSequence field in the spending input must be set to to_self_delay
2191     * (which means the transaction is not broadcastable until at least to_self_delay
2192     * blocks after the outpoint confirms).
2193     *
2194     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2195     * it is an output from an old state which we broadcast (which should never happen).
2196     *
2197     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2198     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2199     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2200     * chan_utils::derive_private_key. The public key can be generated without the secret key
2201     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2202     * Sign::pubkeys().
2203     *
2204     * To derive the revocation_pubkey provided here (which is used in the witness
2205     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2206     * call to Sign::ready_channel) and the provided per_commitment point
2207     * to chan_utils::derive_public_revocation_key.
2208     *
2209     * The witness script which is hashed and included in the output script_pubkey may be
2210     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2211     * (derived as above), and the to_self_delay contained here to
2212     * chan_utils::get_revokeable_redeemscript.
2213     */
2214    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2215    /**
2216     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2217     * corresponds to the public key in Sign::pubkeys().payment_point).
2218     * The witness in the spending input, is, thus, simply:
2219     * <BIP 143 signature> <payment key>
2220     *
2221     * These are generally the result of our counterparty having broadcast the current state,
2222     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2223     */
2224    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2225    /**
2226     * Must be last for serialization purposes
2227     */
2228    LDKSpendableOutputDescriptor_Sentinel,
2229 } LDKSpendableOutputDescriptor_Tag;
2230
2231 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2232    /**
2233     * The outpoint which is spendable
2234     */
2235    struct LDKOutPoint outpoint;
2236    /**
2237     * The output which is referenced by the given outpoint.
2238     */
2239    struct LDKTxOut output;
2240 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2241
2242 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2243    LDKSpendableOutputDescriptor_Tag tag;
2244    union {
2245       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2246       struct {
2247          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2248       };
2249       struct {
2250          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2251       };
2252    };
2253 } LDKSpendableOutputDescriptor;
2254
2255 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2256    struct LDKSpendableOutputDescriptor *data;
2257    uintptr_t datalen;
2258 } LDKCVec_SpendableOutputDescriptorZ;
2259
2260 /**
2261  * An Event which you should probably take some action in response to.
2262  *
2263  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2264  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2265  * written as it makes no sense to respond to it after reconnecting to peers).
2266  */
2267 typedef enum LDKEvent_Tag {
2268    /**
2269     * Used to indicate that the client should generate a funding transaction with the given
2270     * parameters and then call ChannelManager::funding_transaction_generated.
2271     * Generated in ChannelManager message handling.
2272     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2273     * counterparty can steal your funds!
2274     */
2275    LDKEvent_FundingGenerationReady,
2276    /**
2277     * Used to indicate that the client may now broadcast the funding transaction it created for a
2278     * channel. Broadcasting such a transaction prior to this event may lead to our counterparty
2279     * trivially stealing all funds in the funding transaction!
2280     */
2281    LDKEvent_FundingBroadcastSafe,
2282    /**
2283     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
2284     * ChannelManager::claim_funds to get it....
2285     * Note that if the preimage is not known or the amount paid is incorrect, you should call
2286     * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
2287     * network congestion.
2288     * The amount paid should be considered 'incorrect' when it is less than or more than twice
2289     * the amount expected.
2290     * If you fail to call either ChannelManager::claim_funds or
2291     * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
2292     * automatically failed.
2293     */
2294    LDKEvent_PaymentReceived,
2295    /**
2296     * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
2297     * and we got back the payment preimage for it).
2298     * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
2299     * deduplicate them by payment_preimage (which MUST be unique)!
2300     */
2301    LDKEvent_PaymentSent,
2302    /**
2303     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
2304     * something. You may wish to retry with a different route.
2305     * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
2306     * deduplicate them by payment_hash (which MUST be unique)!
2307     */
2308    LDKEvent_PaymentFailed,
2309    /**
2310     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
2311     * time in the future.
2312     */
2313    LDKEvent_PendingHTLCsForwardable,
2314    /**
2315     * Used to indicate that an output was generated on-chain which you should know how to spend.
2316     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2317     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2318     * somewhere and spend them when you create on-chain transactions.
2319     */
2320    LDKEvent_SpendableOutputs,
2321    /**
2322     * Must be last for serialization purposes
2323     */
2324    LDKEvent_Sentinel,
2325 } LDKEvent_Tag;
2326
2327 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2328    /**
2329     * The random channel_id we picked which you'll need to pass into
2330     * ChannelManager::funding_transaction_generated.
2331     */
2332    struct LDKThirtyTwoBytes temporary_channel_id;
2333    /**
2334     * The value, in satoshis, that the output should have.
2335     */
2336    uint64_t channel_value_satoshis;
2337    /**
2338     * The script which should be used in the transaction output.
2339     */
2340    struct LDKCVec_u8Z output_script;
2341    /**
2342     * The value passed in to ChannelManager::create_channel
2343     */
2344    uint64_t user_channel_id;
2345 } LDKEvent_LDKFundingGenerationReady_Body;
2346
2347 typedef struct LDKEvent_LDKFundingBroadcastSafe_Body {
2348    /**
2349     * The output, which was passed to ChannelManager::funding_transaction_generated, which is
2350     * now safe to broadcast.
2351     */
2352    struct LDKOutPoint funding_txo;
2353    /**
2354     * The value passed in to ChannelManager::create_channel
2355     */
2356    uint64_t user_channel_id;
2357 } LDKEvent_LDKFundingBroadcastSafe_Body;
2358
2359 typedef struct LDKEvent_LDKPaymentReceived_Body {
2360    /**
2361     * The hash for which the preimage should be handed to the ChannelManager.
2362     */
2363    struct LDKThirtyTwoBytes payment_hash;
2364    /**
2365     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2366     * number of deanonymization attacks during the routing process.
2367     * As nodes upgrade, the invoices you provide should likely migrate to setting the
2368     * payment_secret feature to required, at which point you should fail_backwards any HTLCs
2369     * which have a None here.
2370     * Until then, however, values of None should be ignored, and only incorrect Some values
2371     * should result in an HTLC fail_backwards.
2372     * Note that, in any case, this value must be passed as-is to any fail or claim calls as
2373     * the HTLC index includes this value.
2374     */
2375    struct LDKThirtyTwoBytes payment_secret;
2376    /**
2377     * The value, in thousandths of a satoshi, that this payment is for. Note that you must
2378     * compare this to the expected value before accepting the payment (as otherwise you are
2379     * providing proof-of-payment for less than the value you expected!).
2380     */
2381    uint64_t amt;
2382 } LDKEvent_LDKPaymentReceived_Body;
2383
2384 typedef struct LDKEvent_LDKPaymentSent_Body {
2385    /**
2386     * The preimage to the hash given to ChannelManager::send_payment.
2387     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
2388     * store it somehow!
2389     */
2390    struct LDKThirtyTwoBytes payment_preimage;
2391 } LDKEvent_LDKPaymentSent_Body;
2392
2393 typedef struct LDKEvent_LDKPaymentFailed_Body {
2394    /**
2395     * The hash which was given to ChannelManager::send_payment.
2396     */
2397    struct LDKThirtyTwoBytes payment_hash;
2398    /**
2399     * Indicates the payment was rejected for some reason by the recipient. This implies that
2400     * the payment has failed, not just the route in question. If this is not set, you may
2401     * retry the payment via a different route.
2402     */
2403    bool rejected_by_dest;
2404 } LDKEvent_LDKPaymentFailed_Body;
2405
2406 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
2407    /**
2408     * The minimum amount of time that should be waited prior to calling
2409     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
2410     * you should wait a random amount of time in roughly the range (now + time_forwardable,
2411     * now + 5*time_forwardable).
2412     */
2413    uint64_t time_forwardable;
2414 } LDKEvent_LDKPendingHTLCsForwardable_Body;
2415
2416 typedef struct LDKEvent_LDKSpendableOutputs_Body {
2417    /**
2418     * The outputs which you should store as spendable by you.
2419     */
2420    struct LDKCVec_SpendableOutputDescriptorZ outputs;
2421 } LDKEvent_LDKSpendableOutputs_Body;
2422
2423 typedef struct MUST_USE_STRUCT LDKEvent {
2424    LDKEvent_Tag tag;
2425    union {
2426       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
2427       LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe;
2428       LDKEvent_LDKPaymentReceived_Body payment_received;
2429       LDKEvent_LDKPaymentSent_Body payment_sent;
2430       LDKEvent_LDKPaymentFailed_Body payment_failed;
2431       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
2432       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
2433    };
2434 } LDKEvent;
2435
2436 typedef struct LDKCVec_EventZ {
2437    struct LDKEvent *data;
2438    uintptr_t datalen;
2439 } LDKCVec_EventZ;
2440
2441 typedef union LDKCResult_OutPointDecodeErrorZPtr {
2442    struct LDKOutPoint *result;
2443    struct LDKDecodeError *err;
2444 } LDKCResult_OutPointDecodeErrorZPtr;
2445
2446 typedef struct LDKCResult_OutPointDecodeErrorZ {
2447    union LDKCResult_OutPointDecodeErrorZPtr contents;
2448    bool result_ok;
2449 } LDKCResult_OutPointDecodeErrorZ;
2450
2451
2452
2453 /**
2454  * An update generated by the underlying Channel itself which contains some new information the
2455  * ChannelMonitor should be made aware of.
2456  */
2457 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
2458    /**
2459     * A pointer to the opaque Rust object.
2460     * Nearly everywhere, inner must be non-null, however in places where
2461     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2462     */
2463    LDKnativeChannelMonitorUpdate *inner;
2464    /**
2465     * Indicates that this is the only struct which contains the same pointer.
2466     * Rust functions which take ownership of an object provided via an argument require
2467     * this to be true and invalidate the object pointed to by inner.
2468     */
2469    bool is_owned;
2470 } LDKChannelMonitorUpdate;
2471
2472 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
2473    struct LDKChannelMonitorUpdate *result;
2474    struct LDKDecodeError *err;
2475 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
2476
2477 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
2478    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
2479    bool result_ok;
2480 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
2481
2482 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
2483    struct LDKHTLCUpdate *result;
2484    struct LDKDecodeError *err;
2485 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
2486
2487 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
2488    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
2489    bool result_ok;
2490 } LDKCResult_HTLCUpdateDecodeErrorZ;
2491
2492
2493
2494 /**
2495  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
2496  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
2497  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
2498  * corrupted.
2499  * Contains a developer-readable error message.
2500  */
2501 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
2502    /**
2503     * A pointer to the opaque Rust object.
2504     * Nearly everywhere, inner must be non-null, however in places where
2505     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2506     */
2507    LDKnativeMonitorUpdateError *inner;
2508    /**
2509     * Indicates that this is the only struct which contains the same pointer.
2510     * Rust functions which take ownership of an object provided via an argument require
2511     * this to be true and invalidate the object pointed to by inner.
2512     */
2513    bool is_owned;
2514 } LDKMonitorUpdateError;
2515
2516 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
2517    /**
2518     * Note that this value is always NULL, as there are no contents in the OK variant
2519     */
2520    void *result;
2521    struct LDKMonitorUpdateError *err;
2522 } LDKCResult_NoneMonitorUpdateErrorZPtr;
2523
2524 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
2525    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
2526    bool result_ok;
2527 } LDKCResult_NoneMonitorUpdateErrorZ;
2528
2529 typedef struct LDKC2Tuple_OutPointScriptZ {
2530    struct LDKOutPoint a;
2531    struct LDKCVec_u8Z b;
2532 } LDKC2Tuple_OutPointScriptZ;
2533
2534 typedef struct LDKC2Tuple_u32ScriptZ {
2535    uint32_t a;
2536    struct LDKCVec_u8Z b;
2537 } LDKC2Tuple_u32ScriptZ;
2538
2539 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
2540    struct LDKC2Tuple_u32ScriptZ *data;
2541    uintptr_t datalen;
2542 } LDKCVec_C2Tuple_u32ScriptZZ;
2543
2544 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
2545    struct LDKThirtyTwoBytes a;
2546    struct LDKCVec_C2Tuple_u32ScriptZZ b;
2547 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
2548
2549 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
2550    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
2551    uintptr_t datalen;
2552 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
2553
2554 typedef struct LDKCVec_TransactionZ {
2555    struct LDKTransaction *data;
2556    uintptr_t datalen;
2557 } LDKCVec_TransactionZ;
2558
2559 typedef struct LDKC2Tuple_u32TxOutZ {
2560    uint32_t a;
2561    struct LDKTxOut b;
2562 } LDKC2Tuple_u32TxOutZ;
2563
2564 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
2565    struct LDKC2Tuple_u32TxOutZ *data;
2566    uintptr_t datalen;
2567 } LDKCVec_C2Tuple_u32TxOutZZ;
2568
2569 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2570    struct LDKThirtyTwoBytes a;
2571    struct LDKCVec_C2Tuple_u32TxOutZZ b;
2572 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
2573
2574 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
2575    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
2576    uintptr_t datalen;
2577 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ;
2578
2579 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
2580    struct LDKSignature a;
2581    struct LDKCVec_SignatureZ b;
2582 } LDKC2Tuple_SignatureCVec_SignatureZZ;
2583
2584 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2585    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
2586    /**
2587     * Note that this value is always NULL, as there are no contents in the Err variant
2588     */
2589    void *err;
2590 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
2591
2592 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2593    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
2594    bool result_ok;
2595 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
2596
2597 typedef union LDKCResult_SignatureNoneZPtr {
2598    struct LDKSignature *result;
2599    /**
2600     * Note that this value is always NULL, as there are no contents in the Err variant
2601     */
2602    void *err;
2603 } LDKCResult_SignatureNoneZPtr;
2604
2605 typedef struct LDKCResult_SignatureNoneZ {
2606    union LDKCResult_SignatureNoneZPtr contents;
2607    bool result_ok;
2608 } LDKCResult_SignatureNoneZ;
2609
2610
2611
2612 /**
2613  * The unsigned part of a channel_announcement
2614  */
2615 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
2616    /**
2617     * A pointer to the opaque Rust object.
2618     * Nearly everywhere, inner must be non-null, however in places where
2619     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2620     */
2621    LDKnativeUnsignedChannelAnnouncement *inner;
2622    /**
2623     * Indicates that this is the only struct which contains the same pointer.
2624     * Rust functions which take ownership of an object provided via an argument require
2625     * this to be true and invalidate the object pointed to by inner.
2626     */
2627    bool is_owned;
2628 } LDKUnsignedChannelAnnouncement;
2629
2630 /**
2631  * A trait to sign lightning channel transactions as described in BOLT 3.
2632  *
2633  * Signing services could be implemented on a hardware wallet. In this case,
2634  * the current Sign would be a front-end on top of a communication
2635  * channel connected to your secure device and lightning key material wouldn't
2636  * reside on a hot server. Nevertheless, a this deployment would still need
2637  * to trust the ChannelManager to avoid loss of funds as this latest component
2638  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
2639  *
2640  * A more secure iteration would be to use hashlock (or payment points) to pair
2641  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
2642  * at the price of more state and computation on the hardware wallet side. In the future,
2643  * we are looking forward to design such interface.
2644  *
2645  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
2646  * to act, as liveness and breach reply correctness are always going to be hard requirements
2647  * of LN security model, orthogonal of key management issues.
2648  */
2649 typedef struct LDKSign {
2650    /**
2651     * An opaque pointer which is passed to your function implementations as an argument.
2652     * This has no meaning in the LDK, and can be NULL or any other value.
2653     */
2654    void *this_arg;
2655    /**
2656     * Gets the per-commitment point for a specific commitment number
2657     *
2658     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
2659     */
2660    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
2661    /**
2662     * Gets the commitment secret for a specific commitment number as part of the revocation process
2663     *
2664     * An external signer implementation should error here if the commitment was already signed
2665     * and should refuse to sign it in the future.
2666     *
2667     * May be called more than once for the same index.
2668     *
2669     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
2670     */
2671    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
2672    /**
2673     * Gets the holder's channel public keys and basepoints
2674     */
2675    struct LDKChannelPublicKeys pubkeys;
2676    /**
2677     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
2678     * Note that this takes a pointer to this object, not the this_ptr like other methods do
2679     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
2680     */
2681    void (*set_pubkeys)(const struct LDKSign*NONNULL_PTR );
2682    /**
2683     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
2684     * some SpendableOutputDescriptor types. This should be sufficient to identify this
2685     * Sign object uniquely and lookup or re-derive its keys.
2686     */
2687    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
2688    /**
2689     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
2690     *
2691     * Note that if signing fails or is rejected, the channel will be force-closed.
2692     */
2693    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
2694    /**
2695     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
2696     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
2697     * latest commitment_tx when we initiate a force-close.
2698     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
2699     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
2700     * the latest.
2701     * This may be called multiple times for the same transaction.
2702     *
2703     * An external signer implementation should check that the commitment has not been revoked.
2704     *
2705     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
2706     */
2707    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
2708    /**
2709     * Create a signature for the given input in a transaction spending an HTLC or commitment
2710     * transaction output when our counterparty broadcasts an old state.
2711     *
2712     * A justice transaction may claim multiples outputs at the same time if timelocks are
2713     * similar, but only a signature for the input at index `input` should be signed for here.
2714     * It may be called multiples time for same output(s) if a fee-bump is needed with regards
2715     * to an upcoming timelock expiration.
2716     *
2717     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2718     *
2719     * per_commitment_key is revocation secret which was provided by our counterparty when they
2720     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
2721     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
2722     * so).
2723     *
2724     * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
2725     * changing the format of the witness script (which is committed to in the BIP 143
2726     * signatures).
2727     */
2728    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);
2729    /**
2730     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
2731     * transaction, either offered or received.
2732     *
2733     * Such a transaction may claim multiples offered outputs at same time if we know the
2734     * preimage for each when we create it, but only the input at index `input` should be
2735     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
2736     * needed with regards to an upcoming timelock expiration.
2737     *
2738     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
2739     * outputs.
2740     *
2741     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2742     *
2743     * Per_commitment_point is the dynamic point corresponding to the channel state
2744     * detected onchain. It has been generated by our counterparty and is used to derive
2745     * channel state keys, which are then included in the witness script and committed to in the
2746     * BIP 143 signature.
2747     */
2748    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);
2749    /**
2750     * Create a signature for a (proposed) closing transaction.
2751     *
2752     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
2753     * chosen to forgo their output as dust.
2754     */
2755    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
2756    /**
2757     * Signs a channel announcement message with our funding key, proving it comes from one
2758     * of the channel participants.
2759     *
2760     * Note that if this fails or is rejected, the channel will not be publicly announced and
2761     * our counterparty may (though likely will not) close the channel on us for violating the
2762     * protocol.
2763     */
2764    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
2765    /**
2766     * Set the counterparty static channel data, including basepoints,
2767     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
2768     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
2769     * they MUST NOT be allowed to change to different values once set.
2770     *
2771     * channel_parameters.is_populated() MUST be true.
2772     *
2773     * We bind holder_selected_contest_delay late here for API convenience.
2774     *
2775     * Will be called before any signatures are applied.
2776     */
2777    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
2778    /**
2779     * Creates a copy of the object pointed to by this_arg, for a copy of this Sign.
2780     * Note that the ultimate copy of the Sign will have all function pointers the same as the original.
2781     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new Sign.
2782     */
2783    void *(*clone)(const void *this_arg);
2784    /**
2785     * Serialize the object into a byte array
2786     */
2787    struct LDKCVec_u8Z (*write)(const void *this_arg);
2788    /**
2789     * Frees any resources associated with this object given its this_arg pointer.
2790     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2791     */
2792    void (*free)(void *this_arg);
2793 } LDKSign;
2794
2795
2796
2797 /**
2798  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
2799  * on-chain transactions to ensure no loss of funds occurs.
2800  *
2801  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
2802  * information and are actively monitoring the chain.
2803  *
2804  * Pending Events or updated HTLCs which have not yet been read out by
2805  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
2806  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
2807  * gotten are fully handled before re-serializing the new state.
2808  *
2809  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
2810  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
2811  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
2812  * returned block hash and the the current chain and then reconnecting blocks to get to the
2813  * best chain) upon deserializing the object!
2814  */
2815 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
2816    /**
2817     * A pointer to the opaque Rust object.
2818     * Nearly everywhere, inner must be non-null, however in places where
2819     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2820     */
2821    LDKnativeChannelMonitor *inner;
2822    /**
2823     * Indicates that this is the only struct which contains the same pointer.
2824     * Rust functions which take ownership of an object provided via an argument require
2825     * this to be true and invalidate the object pointed to by inner.
2826     */
2827    bool is_owned;
2828 } LDKChannelMonitor;
2829
2830 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
2831    struct LDKThirtyTwoBytes a;
2832    struct LDKChannelMonitor b;
2833 } LDKC2Tuple_BlockHashChannelMonitorZ;
2834
2835 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2836    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
2837    struct LDKDecodeError *err;
2838 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
2839
2840 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2841    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
2842    bool result_ok;
2843 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
2844
2845 typedef union LDKCResult_TxOutAccessErrorZPtr {
2846    struct LDKTxOut *result;
2847    enum LDKAccessError *err;
2848 } LDKCResult_TxOutAccessErrorZPtr;
2849
2850 typedef struct LDKCResult_TxOutAccessErrorZ {
2851    union LDKCResult_TxOutAccessErrorZPtr contents;
2852    bool result_ok;
2853 } LDKCResult_TxOutAccessErrorZ;
2854
2855 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
2856    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
2857    LDKCOption_C2Tuple_usizeTransactionZZ_None,
2858    /**
2859     * Must be last for serialization purposes
2860     */
2861    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
2862 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
2863
2864 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
2865    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
2866    union {
2867       struct {
2868          struct LDKC2Tuple_usizeTransactionZ some;
2869       };
2870    };
2871 } LDKCOption_C2Tuple_usizeTransactionZZ;
2872
2873 /**
2874  * A Rust str object, ie a reference to a UTF8-valid string.
2875  * This is *not* null-terminated so cannot be used directly as a C string!
2876  */
2877 typedef struct LDKStr {
2878    const uint8_t *chars;
2879    uintptr_t len;
2880 } LDKStr;
2881
2882 /**
2883  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
2884  * too-high values)
2885  */
2886 typedef enum LDKAPIError_Tag {
2887    /**
2888     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
2889     * are documented, but generally indicates some precondition of a function was violated.
2890     */
2891    LDKAPIError_APIMisuseError,
2892    /**
2893     * Due to a high feerate, we were unable to complete the request.
2894     * For example, this may be returned if the feerate implies we cannot open a channel at the
2895     * requested value, but opening a larger channel would succeed.
2896     */
2897    LDKAPIError_FeeRateTooHigh,
2898    /**
2899     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
2900     * too-many-hops, etc).
2901     */
2902    LDKAPIError_RouteError,
2903    /**
2904     * We were unable to complete the request as the Channel required to do so is unable to
2905     * complete the request (or was not found). This can take many forms, including disconnected
2906     * peer, channel at capacity, channel shutting down, etc.
2907     */
2908    LDKAPIError_ChannelUnavailable,
2909    /**
2910     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
2911     * attempted action to fail.
2912     */
2913    LDKAPIError_MonitorUpdateFailed,
2914    /**
2915     * Must be last for serialization purposes
2916     */
2917    LDKAPIError_Sentinel,
2918 } LDKAPIError_Tag;
2919
2920 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
2921    /**
2922     * A human-readable error message
2923     */
2924    struct LDKCVec_u8Z err;
2925 } LDKAPIError_LDKAPIMisuseError_Body;
2926
2927 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
2928    /**
2929     * A human-readable error message
2930     */
2931    struct LDKCVec_u8Z err;
2932    /**
2933     * The feerate which was too high.
2934     */
2935    uint32_t feerate;
2936 } LDKAPIError_LDKFeeRateTooHigh_Body;
2937
2938 typedef struct LDKAPIError_LDKRouteError_Body {
2939    /**
2940     * A human-readable error message
2941     */
2942    struct LDKStr err;
2943 } LDKAPIError_LDKRouteError_Body;
2944
2945 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
2946    /**
2947     * A human-readable error message
2948     */
2949    struct LDKCVec_u8Z err;
2950 } LDKAPIError_LDKChannelUnavailable_Body;
2951
2952 typedef struct MUST_USE_STRUCT LDKAPIError {
2953    LDKAPIError_Tag tag;
2954    union {
2955       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
2956       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
2957       LDKAPIError_LDKRouteError_Body route_error;
2958       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
2959    };
2960 } LDKAPIError;
2961
2962 typedef union LDKCResult_NoneAPIErrorZPtr {
2963    /**
2964     * Note that this value is always NULL, as there are no contents in the OK variant
2965     */
2966    void *result;
2967    struct LDKAPIError *err;
2968 } LDKCResult_NoneAPIErrorZPtr;
2969
2970 typedef struct LDKCResult_NoneAPIErrorZ {
2971    union LDKCResult_NoneAPIErrorZPtr contents;
2972    bool result_ok;
2973 } LDKCResult_NoneAPIErrorZ;
2974
2975 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
2976    struct LDKCResult_NoneAPIErrorZ *data;
2977    uintptr_t datalen;
2978 } LDKCVec_CResult_NoneAPIErrorZZ;
2979
2980 typedef struct LDKCVec_APIErrorZ {
2981    struct LDKAPIError *data;
2982    uintptr_t datalen;
2983 } LDKCVec_APIErrorZ;
2984
2985
2986
2987 /**
2988  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2989  */
2990 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2991    /**
2992     * A pointer to the opaque Rust object.
2993     * Nearly everywhere, inner must be non-null, however in places where
2994     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2995     */
2996    LDKnativeChannelDetails *inner;
2997    /**
2998     * Indicates that this is the only struct which contains the same pointer.
2999     * Rust functions which take ownership of an object provided via an argument require
3000     * this to be true and invalidate the object pointed to by inner.
3001     */
3002    bool is_owned;
3003 } LDKChannelDetails;
3004
3005 typedef struct LDKCVec_ChannelDetailsZ {
3006    struct LDKChannelDetails *data;
3007    uintptr_t datalen;
3008 } LDKCVec_ChannelDetailsZ;
3009
3010 /**
3011  * If a payment fails to send, it can be in one of several states. This enum is returned as the
3012  * Err() type describing which state the payment is in, see the description of individual enum
3013  * states for more.
3014  */
3015 typedef enum LDKPaymentSendFailure_Tag {
3016    /**
3017     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
3018     * send the payment at all. No channel state has been changed or messages sent to peers, and
3019     * once you've changed the parameter at error, you can freely retry the payment in full.
3020     */
3021    LDKPaymentSendFailure_ParameterError,
3022    /**
3023     * A parameter in a single path which was passed to send_payment was invalid, preventing us
3024     * from attempting to send the payment at all. No channel state has been changed or messages
3025     * sent to peers, and once you've changed the parameter at error, you can freely retry the
3026     * payment in full.
3027     *
3028     * The results here are ordered the same as the paths in the route object which was passed to
3029     * send_payment.
3030     */
3031    LDKPaymentSendFailure_PathParameterError,
3032    /**
3033     * All paths which were attempted failed to send, with no channel state change taking place.
3034     * You can freely retry the payment in full (though you probably want to do so over different
3035     * paths than the ones selected).
3036     */
3037    LDKPaymentSendFailure_AllFailedRetrySafe,
3038    /**
3039     * Some paths which were attempted failed to send, though possibly not all. At least some
3040     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
3041     * in over-/re-payment.
3042     *
3043     * The results here are ordered the same as the paths in the route object which was passed to
3044     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
3045     * retried (though there is currently no API with which to do so).
3046     *
3047     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
3048     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
3049     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
3050     * with the latest update_id.
3051     */
3052    LDKPaymentSendFailure_PartialFailure,
3053    /**
3054     * Must be last for serialization purposes
3055     */
3056    LDKPaymentSendFailure_Sentinel,
3057 } LDKPaymentSendFailure_Tag;
3058
3059 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
3060    LDKPaymentSendFailure_Tag tag;
3061    union {
3062       struct {
3063          struct LDKAPIError parameter_error;
3064       };
3065       struct {
3066          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
3067       };
3068       struct {
3069          struct LDKCVec_APIErrorZ all_failed_retry_safe;
3070       };
3071       struct {
3072          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
3073       };
3074    };
3075 } LDKPaymentSendFailure;
3076
3077 typedef union LDKCResult_NonePaymentSendFailureZPtr {
3078    /**
3079     * Note that this value is always NULL, as there are no contents in the OK variant
3080     */
3081    void *result;
3082    struct LDKPaymentSendFailure *err;
3083 } LDKCResult_NonePaymentSendFailureZPtr;
3084
3085 typedef struct LDKCResult_NonePaymentSendFailureZ {
3086    union LDKCResult_NonePaymentSendFailureZPtr contents;
3087    bool result_ok;
3088 } LDKCResult_NonePaymentSendFailureZ;
3089
3090 typedef struct LDKCVec_ChannelMonitorZ {
3091    struct LDKChannelMonitor *data;
3092    uintptr_t datalen;
3093 } LDKCVec_ChannelMonitorZ;
3094
3095 /**
3096  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
3097  * blocks are connected and disconnected.
3098  *
3099  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
3100  * responsible for maintaining a set of monitors such that they can be updated accordingly as
3101  * channel state changes and HTLCs are resolved. See method documentation for specific
3102  * requirements.
3103  *
3104  * Implementations **must** ensure that updates are successfully applied and persisted upon method
3105  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
3106  * without taking any further action such as persisting the current state.
3107  *
3108  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
3109  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
3110  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
3111  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
3112  * multiple instances.
3113  *
3114  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
3115  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
3116  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
3117  */
3118 typedef struct LDKWatch {
3119    /**
3120     * An opaque pointer which is passed to your function implementations as an argument.
3121     * This has no meaning in the LDK, and can be NULL or any other value.
3122     */
3123    void *this_arg;
3124    /**
3125     * Watches a channel identified by `funding_txo` using `monitor`.
3126     *
3127     * Implementations are responsible for watching the chain for the funding transaction along
3128     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
3129     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
3130     *
3131     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
3132     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
3133     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
3134     */
3135    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
3136    /**
3137     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
3138     *
3139     * Implementations must call [`update_monitor`] with the given update. See
3140     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
3141     *
3142     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
3143     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
3144     */
3145    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
3146    /**
3147     * Returns any monitor events since the last call. Subsequent calls must only return new
3148     * events.
3149     */
3150    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
3151    /**
3152     * Frees any resources associated with this object given its this_arg pointer.
3153     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3154     */
3155    void (*free)(void *this_arg);
3156 } LDKWatch;
3157
3158 /**
3159  * An interface to send a transaction to the Bitcoin network.
3160  */
3161 typedef struct LDKBroadcasterInterface {
3162    /**
3163     * An opaque pointer which is passed to your function implementations as an argument.
3164     * This has no meaning in the LDK, and can be NULL or any other value.
3165     */
3166    void *this_arg;
3167    /**
3168     * Sends a transaction out to (hopefully) be mined.
3169     */
3170    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
3171    /**
3172     * Frees any resources associated with this object given its this_arg pointer.
3173     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3174     */
3175    void (*free)(void *this_arg);
3176 } LDKBroadcasterInterface;
3177
3178 typedef union LDKCResult_SignDecodeErrorZPtr {
3179    struct LDKSign *result;
3180    struct LDKDecodeError *err;
3181 } LDKCResult_SignDecodeErrorZPtr;
3182
3183 typedef struct LDKCResult_SignDecodeErrorZ {
3184    union LDKCResult_SignDecodeErrorZPtr contents;
3185    bool result_ok;
3186 } LDKCResult_SignDecodeErrorZ;
3187
3188 typedef struct LDKu8slice {
3189    const uint8_t *data;
3190    uintptr_t datalen;
3191 } LDKu8slice;
3192
3193 /**
3194  * A trait to describe an object which can get user secrets and key material.
3195  */
3196 typedef struct LDKKeysInterface {
3197    /**
3198     * An opaque pointer which is passed to your function implementations as an argument.
3199     * This has no meaning in the LDK, and can be NULL or any other value.
3200     */
3201    void *this_arg;
3202    /**
3203     * Get node secret key (aka node_id or network_key).
3204     *
3205     * This method must return the same value each time it is called.
3206     */
3207    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
3208    /**
3209     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
3210     *
3211     * This method should return a different value each time it is called, to avoid linking
3212     * on-chain funds across channels as controlled to the same user.
3213     */
3214    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
3215    /**
3216     * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
3217     * a channel.
3218     *
3219     * This method should return a different value each time it is called, to avoid linking
3220     * on-chain funds across channels as controlled to the same user.
3221     */
3222    struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
3223    /**
3224     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
3225     * restarted with some stale data!
3226     *
3227     * This method must return a different value each time it is called.
3228     */
3229    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
3230    /**
3231     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
3232     * onion packets and for temporary channel IDs. There is no requirement that these be
3233     * persisted anywhere, though they must be unique across restarts.
3234     *
3235     * This method must return a different value each time it is called.
3236     */
3237    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
3238    /**
3239     * Reads a `Signer` for this `KeysInterface` from the given input stream.
3240     * This is only called during deserialization of other objects which contain
3241     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
3242     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
3243     * contain no versioning scheme. You may wish to include your own version prefix and ensure
3244     * you've read all of the provided bytes to ensure no corruption occurred.
3245     */
3246    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
3247    /**
3248     * Frees any resources associated with this object given its this_arg pointer.
3249     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3250     */
3251    void (*free)(void *this_arg);
3252 } LDKKeysInterface;
3253
3254 /**
3255  * A trait which should be implemented to provide feerate information on a number of time
3256  * horizons.
3257  *
3258  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
3259  * called from inside the library in response to chain events, P2P events, or timer events).
3260  */
3261 typedef struct LDKFeeEstimator {
3262    /**
3263     * An opaque pointer which is passed to your function implementations as an argument.
3264     * This has no meaning in the LDK, and can be NULL or any other value.
3265     */
3266    void *this_arg;
3267    /**
3268     * Gets estimated satoshis of fee required per 1000 Weight-Units.
3269     *
3270     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
3271     * don't put us below 1 satoshi-per-byte).
3272     *
3273     * This translates to:
3274     *  * satoshis-per-byte * 250
3275     *  * ceil(satoshis-per-kbyte / 4)
3276     */
3277    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
3278    /**
3279     * Frees any resources associated with this object given its this_arg pointer.
3280     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3281     */
3282    void (*free)(void *this_arg);
3283 } LDKFeeEstimator;
3284
3285 /**
3286  * A trait encapsulating the operations required of a logger
3287  */
3288 typedef struct LDKLogger {
3289    /**
3290     * An opaque pointer which is passed to your function implementations as an argument.
3291     * This has no meaning in the LDK, and can be NULL or any other value.
3292     */
3293    void *this_arg;
3294    /**
3295     * Logs the `Record`
3296     */
3297    void (*log)(const void *this_arg, const char *record);
3298    /**
3299     * Frees any resources associated with this object given its this_arg pointer.
3300     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3301     */
3302    void (*free)(void *this_arg);
3303 } LDKLogger;
3304
3305
3306
3307 /**
3308  * Manager which keeps track of a number of channels and sends messages to the appropriate
3309  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
3310  *
3311  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
3312  * to individual Channels.
3313  *
3314  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
3315  * all peers during write/read (though does not modify this instance, only the instance being
3316  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
3317  * called funding_transaction_generated for outbound channels).
3318  *
3319  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
3320  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
3321  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
3322  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
3323  * the serialization process). If the deserialized version is out-of-date compared to the
3324  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
3325  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
3326  *
3327  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
3328  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
3329  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
3330  * block_connected() to step towards your best block) upon deserialization before using the
3331  * object!
3332  *
3333  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
3334  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
3335  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
3336  * offline for a full minute. In order to track this, you must call
3337  * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect.
3338  *
3339  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
3340  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
3341  * essentially you should default to using a SimpleRefChannelManager, and use a
3342  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
3343  * you're using lightning-net-tokio.
3344  */
3345 typedef struct MUST_USE_STRUCT LDKChannelManager {
3346    /**
3347     * A pointer to the opaque Rust object.
3348     * Nearly everywhere, inner must be non-null, however in places where
3349     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3350     */
3351    LDKnativeChannelManager *inner;
3352    /**
3353     * Indicates that this is the only struct which contains the same pointer.
3354     * Rust functions which take ownership of an object provided via an argument require
3355     * this to be true and invalidate the object pointed to by inner.
3356     */
3357    bool is_owned;
3358 } LDKChannelManager;
3359
3360 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
3361    struct LDKThirtyTwoBytes a;
3362    struct LDKChannelManager b;
3363 } LDKC2Tuple_BlockHashChannelManagerZ;
3364
3365 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
3366    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
3367    struct LDKDecodeError *err;
3368 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
3369
3370 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3371    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
3372    bool result_ok;
3373 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
3374
3375 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
3376    struct LDKSpendableOutputDescriptor *result;
3377    struct LDKDecodeError *err;
3378 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
3379
3380 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
3381    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
3382    bool result_ok;
3383 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
3384
3385 typedef struct LDKCVec_CVec_u8ZZ {
3386    struct LDKCVec_u8Z *data;
3387    uintptr_t datalen;
3388 } LDKCVec_CVec_u8ZZ;
3389
3390 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
3391    struct LDKCVec_CVec_u8ZZ *result;
3392    /**
3393     * Note that this value is always NULL, as there are no contents in the Err variant
3394     */
3395    void *err;
3396 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
3397
3398 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
3399    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
3400    bool result_ok;
3401 } LDKCResult_CVec_CVec_u8ZZNoneZ;
3402
3403
3404
3405 /**
3406  * A simple implementation of Sign that just keeps the private keys in memory.
3407  *
3408  * This implementation performs no policy checks and is insufficient by itself as
3409  * a secure external signer.
3410  */
3411 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
3412    /**
3413     * A pointer to the opaque Rust object.
3414     * Nearly everywhere, inner must be non-null, however in places where
3415     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3416     */
3417    LDKnativeInMemorySigner *inner;
3418    /**
3419     * Indicates that this is the only struct which contains the same pointer.
3420     * Rust functions which take ownership of an object provided via an argument require
3421     * this to be true and invalidate the object pointed to by inner.
3422     */
3423    bool is_owned;
3424 } LDKInMemorySigner;
3425
3426 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
3427    struct LDKInMemorySigner *result;
3428    struct LDKDecodeError *err;
3429 } LDKCResult_InMemorySignerDecodeErrorZPtr;
3430
3431 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
3432    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
3433    bool result_ok;
3434 } LDKCResult_InMemorySignerDecodeErrorZ;
3435
3436 typedef struct LDKCVec_TxOutZ {
3437    struct LDKTxOut *data;
3438    uintptr_t datalen;
3439 } LDKCVec_TxOutZ;
3440
3441 typedef union LDKCResult_TransactionNoneZPtr {
3442    struct LDKTransaction *result;
3443    /**
3444     * Note that this value is always NULL, as there are no contents in the Err variant
3445     */
3446    void *err;
3447 } LDKCResult_TransactionNoneZPtr;
3448
3449 typedef struct LDKCResult_TransactionNoneZ {
3450    union LDKCResult_TransactionNoneZPtr contents;
3451    bool result_ok;
3452 } LDKCResult_TransactionNoneZ;
3453
3454
3455
3456 /**
3457  * A hop in a route
3458  */
3459 typedef struct MUST_USE_STRUCT LDKRouteHop {
3460    /**
3461     * A pointer to the opaque Rust object.
3462     * Nearly everywhere, inner must be non-null, however in places where
3463     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3464     */
3465    LDKnativeRouteHop *inner;
3466    /**
3467     * Indicates that this is the only struct which contains the same pointer.
3468     * Rust functions which take ownership of an object provided via an argument require
3469     * this to be true and invalidate the object pointed to by inner.
3470     */
3471    bool is_owned;
3472 } LDKRouteHop;
3473
3474 typedef struct LDKCVec_RouteHopZ {
3475    struct LDKRouteHop *data;
3476    uintptr_t datalen;
3477 } LDKCVec_RouteHopZ;
3478
3479 typedef struct LDKCVec_CVec_RouteHopZZ {
3480    struct LDKCVec_RouteHopZ *data;
3481    uintptr_t datalen;
3482 } LDKCVec_CVec_RouteHopZZ;
3483
3484
3485
3486 /**
3487  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
3488  * it can take multiple paths. Each path is composed of one or more hops through the network.
3489  */
3490 typedef struct MUST_USE_STRUCT LDKRoute {
3491    /**
3492     * A pointer to the opaque Rust object.
3493     * Nearly everywhere, inner must be non-null, however in places where
3494     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3495     */
3496    LDKnativeRoute *inner;
3497    /**
3498     * Indicates that this is the only struct which contains the same pointer.
3499     * Rust functions which take ownership of an object provided via an argument require
3500     * this to be true and invalidate the object pointed to by inner.
3501     */
3502    bool is_owned;
3503 } LDKRoute;
3504
3505 typedef union LDKCResult_RouteDecodeErrorZPtr {
3506    struct LDKRoute *result;
3507    struct LDKDecodeError *err;
3508 } LDKCResult_RouteDecodeErrorZPtr;
3509
3510 typedef struct LDKCResult_RouteDecodeErrorZ {
3511    union LDKCResult_RouteDecodeErrorZPtr contents;
3512    bool result_ok;
3513 } LDKCResult_RouteDecodeErrorZ;
3514
3515
3516
3517 /**
3518  * A channel descriptor which provides a last-hop route to get_route
3519  */
3520 typedef struct MUST_USE_STRUCT LDKRouteHint {
3521    /**
3522     * A pointer to the opaque Rust object.
3523     * Nearly everywhere, inner must be non-null, however in places where
3524     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3525     */
3526    LDKnativeRouteHint *inner;
3527    /**
3528     * Indicates that this is the only struct which contains the same pointer.
3529     * Rust functions which take ownership of an object provided via an argument require
3530     * this to be true and invalidate the object pointed to by inner.
3531     */
3532    bool is_owned;
3533 } LDKRouteHint;
3534
3535 typedef struct LDKCVec_RouteHintZ {
3536    struct LDKRouteHint *data;
3537    uintptr_t datalen;
3538 } LDKCVec_RouteHintZ;
3539
3540 typedef union LDKCResult_RouteLightningErrorZPtr {
3541    struct LDKRoute *result;
3542    struct LDKLightningError *err;
3543 } LDKCResult_RouteLightningErrorZPtr;
3544
3545 typedef struct LDKCResult_RouteLightningErrorZ {
3546    union LDKCResult_RouteLightningErrorZPtr contents;
3547    bool result_ok;
3548 } LDKCResult_RouteLightningErrorZ;
3549
3550 typedef union LDKCResult_NetAddressu8ZPtr {
3551    struct LDKNetAddress *result;
3552    uint8_t *err;
3553 } LDKCResult_NetAddressu8ZPtr;
3554
3555 typedef struct LDKCResult_NetAddressu8Z {
3556    union LDKCResult_NetAddressu8ZPtr contents;
3557    bool result_ok;
3558 } LDKCResult_NetAddressu8Z;
3559
3560 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
3561    struct LDKCResult_NetAddressu8Z *result;
3562    struct LDKDecodeError *err;
3563 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
3564
3565 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
3566    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
3567    bool result_ok;
3568 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
3569
3570
3571
3572 /**
3573  * An update_add_htlc message to be sent or received from a peer
3574  */
3575 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
3576    /**
3577     * A pointer to the opaque Rust object.
3578     * Nearly everywhere, inner must be non-null, however in places where
3579     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3580     */
3581    LDKnativeUpdateAddHTLC *inner;
3582    /**
3583     * Indicates that this is the only struct which contains the same pointer.
3584     * Rust functions which take ownership of an object provided via an argument require
3585     * this to be true and invalidate the object pointed to by inner.
3586     */
3587    bool is_owned;
3588 } LDKUpdateAddHTLC;
3589
3590 typedef struct LDKCVec_UpdateAddHTLCZ {
3591    struct LDKUpdateAddHTLC *data;
3592    uintptr_t datalen;
3593 } LDKCVec_UpdateAddHTLCZ;
3594
3595
3596
3597 /**
3598  * An update_fulfill_htlc message to be sent or received from a peer
3599  */
3600 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
3601    /**
3602     * A pointer to the opaque Rust object.
3603     * Nearly everywhere, inner must be non-null, however in places where
3604     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3605     */
3606    LDKnativeUpdateFulfillHTLC *inner;
3607    /**
3608     * Indicates that this is the only struct which contains the same pointer.
3609     * Rust functions which take ownership of an object provided via an argument require
3610     * this to be true and invalidate the object pointed to by inner.
3611     */
3612    bool is_owned;
3613 } LDKUpdateFulfillHTLC;
3614
3615 typedef struct LDKCVec_UpdateFulfillHTLCZ {
3616    struct LDKUpdateFulfillHTLC *data;
3617    uintptr_t datalen;
3618 } LDKCVec_UpdateFulfillHTLCZ;
3619
3620
3621
3622 /**
3623  * An update_fail_htlc message to be sent or received from a peer
3624  */
3625 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
3626    /**
3627     * A pointer to the opaque Rust object.
3628     * Nearly everywhere, inner must be non-null, however in places where
3629     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3630     */
3631    LDKnativeUpdateFailHTLC *inner;
3632    /**
3633     * Indicates that this is the only struct which contains the same pointer.
3634     * Rust functions which take ownership of an object provided via an argument require
3635     * this to be true and invalidate the object pointed to by inner.
3636     */
3637    bool is_owned;
3638 } LDKUpdateFailHTLC;
3639
3640 typedef struct LDKCVec_UpdateFailHTLCZ {
3641    struct LDKUpdateFailHTLC *data;
3642    uintptr_t datalen;
3643 } LDKCVec_UpdateFailHTLCZ;
3644
3645
3646
3647 /**
3648  * An update_fail_malformed_htlc message to be sent or received from a peer
3649  */
3650 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
3651    /**
3652     * A pointer to the opaque Rust object.
3653     * Nearly everywhere, inner must be non-null, however in places where
3654     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3655     */
3656    LDKnativeUpdateFailMalformedHTLC *inner;
3657    /**
3658     * Indicates that this is the only struct which contains the same pointer.
3659     * Rust functions which take ownership of an object provided via an argument require
3660     * this to be true and invalidate the object pointed to by inner.
3661     */
3662    bool is_owned;
3663 } LDKUpdateFailMalformedHTLC;
3664
3665 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
3666    struct LDKUpdateFailMalformedHTLC *data;
3667    uintptr_t datalen;
3668 } LDKCVec_UpdateFailMalformedHTLCZ;
3669
3670 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
3671    struct LDKAcceptChannel *result;
3672    struct LDKDecodeError *err;
3673 } LDKCResult_AcceptChannelDecodeErrorZPtr;
3674
3675 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
3676    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
3677    bool result_ok;
3678 } LDKCResult_AcceptChannelDecodeErrorZ;
3679
3680 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
3681    struct LDKAnnouncementSignatures *result;
3682    struct LDKDecodeError *err;
3683 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
3684
3685 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
3686    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
3687    bool result_ok;
3688 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
3689
3690 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
3691    struct LDKChannelReestablish *result;
3692    struct LDKDecodeError *err;
3693 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
3694
3695 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
3696    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
3697    bool result_ok;
3698 } LDKCResult_ChannelReestablishDecodeErrorZ;
3699
3700 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
3701    struct LDKClosingSigned *result;
3702    struct LDKDecodeError *err;
3703 } LDKCResult_ClosingSignedDecodeErrorZPtr;
3704
3705 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
3706    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
3707    bool result_ok;
3708 } LDKCResult_ClosingSignedDecodeErrorZ;
3709
3710
3711
3712 /**
3713  * A commitment_signed message to be sent or received from a peer
3714  */
3715 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
3716    /**
3717     * A pointer to the opaque Rust object.
3718     * Nearly everywhere, inner must be non-null, however in places where
3719     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3720     */
3721    LDKnativeCommitmentSigned *inner;
3722    /**
3723     * Indicates that this is the only struct which contains the same pointer.
3724     * Rust functions which take ownership of an object provided via an argument require
3725     * this to be true and invalidate the object pointed to by inner.
3726     */
3727    bool is_owned;
3728 } LDKCommitmentSigned;
3729
3730 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
3731    struct LDKCommitmentSigned *result;
3732    struct LDKDecodeError *err;
3733 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
3734
3735 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
3736    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
3737    bool result_ok;
3738 } LDKCResult_CommitmentSignedDecodeErrorZ;
3739
3740 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
3741    struct LDKFundingCreated *result;
3742    struct LDKDecodeError *err;
3743 } LDKCResult_FundingCreatedDecodeErrorZPtr;
3744
3745 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
3746    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
3747    bool result_ok;
3748 } LDKCResult_FundingCreatedDecodeErrorZ;
3749
3750 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
3751    struct LDKFundingSigned *result;
3752    struct LDKDecodeError *err;
3753 } LDKCResult_FundingSignedDecodeErrorZPtr;
3754
3755 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
3756    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
3757    bool result_ok;
3758 } LDKCResult_FundingSignedDecodeErrorZ;
3759
3760 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
3761    struct LDKFundingLocked *result;
3762    struct LDKDecodeError *err;
3763 } LDKCResult_FundingLockedDecodeErrorZPtr;
3764
3765 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
3766    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
3767    bool result_ok;
3768 } LDKCResult_FundingLockedDecodeErrorZ;
3769
3770
3771
3772 /**
3773  * An init message to be sent or received from a peer
3774  */
3775 typedef struct MUST_USE_STRUCT LDKInit {
3776    /**
3777     * A pointer to the opaque Rust object.
3778     * Nearly everywhere, inner must be non-null, however in places where
3779     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3780     */
3781    LDKnativeInit *inner;
3782    /**
3783     * Indicates that this is the only struct which contains the same pointer.
3784     * Rust functions which take ownership of an object provided via an argument require
3785     * this to be true and invalidate the object pointed to by inner.
3786     */
3787    bool is_owned;
3788 } LDKInit;
3789
3790 typedef union LDKCResult_InitDecodeErrorZPtr {
3791    struct LDKInit *result;
3792    struct LDKDecodeError *err;
3793 } LDKCResult_InitDecodeErrorZPtr;
3794
3795 typedef struct LDKCResult_InitDecodeErrorZ {
3796    union LDKCResult_InitDecodeErrorZPtr contents;
3797    bool result_ok;
3798 } LDKCResult_InitDecodeErrorZ;
3799
3800 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
3801    struct LDKOpenChannel *result;
3802    struct LDKDecodeError *err;
3803 } LDKCResult_OpenChannelDecodeErrorZPtr;
3804
3805 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
3806    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
3807    bool result_ok;
3808 } LDKCResult_OpenChannelDecodeErrorZ;
3809
3810 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
3811    struct LDKRevokeAndACK *result;
3812    struct LDKDecodeError *err;
3813 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
3814
3815 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
3816    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
3817    bool result_ok;
3818 } LDKCResult_RevokeAndACKDecodeErrorZ;
3819
3820 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
3821    struct LDKShutdown *result;
3822    struct LDKDecodeError *err;
3823 } LDKCResult_ShutdownDecodeErrorZPtr;
3824
3825 typedef struct LDKCResult_ShutdownDecodeErrorZ {
3826    union LDKCResult_ShutdownDecodeErrorZPtr contents;
3827    bool result_ok;
3828 } LDKCResult_ShutdownDecodeErrorZ;
3829
3830 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
3831    struct LDKUpdateFailHTLC *result;
3832    struct LDKDecodeError *err;
3833 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
3834
3835 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
3836    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
3837    bool result_ok;
3838 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
3839
3840 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
3841    struct LDKUpdateFailMalformedHTLC *result;
3842    struct LDKDecodeError *err;
3843 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
3844
3845 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
3846    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
3847    bool result_ok;
3848 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
3849
3850
3851
3852 /**
3853  * An update_fee message to be sent or received from a peer
3854  */
3855 typedef struct MUST_USE_STRUCT LDKUpdateFee {
3856    /**
3857     * A pointer to the opaque Rust object.
3858     * Nearly everywhere, inner must be non-null, however in places where
3859     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3860     */
3861    LDKnativeUpdateFee *inner;
3862    /**
3863     * Indicates that this is the only struct which contains the same pointer.
3864     * Rust functions which take ownership of an object provided via an argument require
3865     * this to be true and invalidate the object pointed to by inner.
3866     */
3867    bool is_owned;
3868 } LDKUpdateFee;
3869
3870 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
3871    struct LDKUpdateFee *result;
3872    struct LDKDecodeError *err;
3873 } LDKCResult_UpdateFeeDecodeErrorZPtr;
3874
3875 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
3876    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
3877    bool result_ok;
3878 } LDKCResult_UpdateFeeDecodeErrorZ;
3879
3880 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
3881    struct LDKUpdateFulfillHTLC *result;
3882    struct LDKDecodeError *err;
3883 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
3884
3885 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
3886    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
3887    bool result_ok;
3888 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
3889
3890 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
3891    struct LDKUpdateAddHTLC *result;
3892    struct LDKDecodeError *err;
3893 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
3894
3895 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
3896    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
3897    bool result_ok;
3898 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
3899
3900
3901
3902 /**
3903  * A ping message to be sent or received from a peer
3904  */
3905 typedef struct MUST_USE_STRUCT LDKPing {
3906    /**
3907     * A pointer to the opaque Rust object.
3908     * Nearly everywhere, inner must be non-null, however in places where
3909     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3910     */
3911    LDKnativePing *inner;
3912    /**
3913     * Indicates that this is the only struct which contains the same pointer.
3914     * Rust functions which take ownership of an object provided via an argument require
3915     * this to be true and invalidate the object pointed to by inner.
3916     */
3917    bool is_owned;
3918 } LDKPing;
3919
3920 typedef union LDKCResult_PingDecodeErrorZPtr {
3921    struct LDKPing *result;
3922    struct LDKDecodeError *err;
3923 } LDKCResult_PingDecodeErrorZPtr;
3924
3925 typedef struct LDKCResult_PingDecodeErrorZ {
3926    union LDKCResult_PingDecodeErrorZPtr contents;
3927    bool result_ok;
3928 } LDKCResult_PingDecodeErrorZ;
3929
3930
3931
3932 /**
3933  * A pong message to be sent or received from a peer
3934  */
3935 typedef struct MUST_USE_STRUCT LDKPong {
3936    /**
3937     * A pointer to the opaque Rust object.
3938     * Nearly everywhere, inner must be non-null, however in places where
3939     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3940     */
3941    LDKnativePong *inner;
3942    /**
3943     * Indicates that this is the only struct which contains the same pointer.
3944     * Rust functions which take ownership of an object provided via an argument require
3945     * this to be true and invalidate the object pointed to by inner.
3946     */
3947    bool is_owned;
3948 } LDKPong;
3949
3950 typedef union LDKCResult_PongDecodeErrorZPtr {
3951    struct LDKPong *result;
3952    struct LDKDecodeError *err;
3953 } LDKCResult_PongDecodeErrorZPtr;
3954
3955 typedef struct LDKCResult_PongDecodeErrorZ {
3956    union LDKCResult_PongDecodeErrorZPtr contents;
3957    bool result_ok;
3958 } LDKCResult_PongDecodeErrorZ;
3959
3960 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
3961    struct LDKUnsignedChannelAnnouncement *result;
3962    struct LDKDecodeError *err;
3963 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
3964
3965 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
3966    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
3967    bool result_ok;
3968 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
3969
3970 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
3971    struct LDKChannelAnnouncement *result;
3972    struct LDKDecodeError *err;
3973 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
3974
3975 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
3976    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
3977    bool result_ok;
3978 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
3979
3980
3981
3982 /**
3983  * The unsigned part of a channel_update
3984  */
3985 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
3986    /**
3987     * A pointer to the opaque Rust object.
3988     * Nearly everywhere, inner must be non-null, however in places where
3989     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3990     */
3991    LDKnativeUnsignedChannelUpdate *inner;
3992    /**
3993     * Indicates that this is the only struct which contains the same pointer.
3994     * Rust functions which take ownership of an object provided via an argument require
3995     * this to be true and invalidate the object pointed to by inner.
3996     */
3997    bool is_owned;
3998 } LDKUnsignedChannelUpdate;
3999
4000 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
4001    struct LDKUnsignedChannelUpdate *result;
4002    struct LDKDecodeError *err;
4003 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
4004
4005 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
4006    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
4007    bool result_ok;
4008 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
4009
4010 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
4011    struct LDKChannelUpdate *result;
4012    struct LDKDecodeError *err;
4013 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
4014
4015 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
4016    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
4017    bool result_ok;
4018 } LDKCResult_ChannelUpdateDecodeErrorZ;
4019
4020 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
4021    struct LDKErrorMessage *result;
4022    struct LDKDecodeError *err;
4023 } LDKCResult_ErrorMessageDecodeErrorZPtr;
4024
4025 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
4026    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
4027    bool result_ok;
4028 } LDKCResult_ErrorMessageDecodeErrorZ;
4029
4030
4031
4032 /**
4033  * The unsigned part of a node_announcement
4034  */
4035 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
4036    /**
4037     * A pointer to the opaque Rust object.
4038     * Nearly everywhere, inner must be non-null, however in places where
4039     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4040     */
4041    LDKnativeUnsignedNodeAnnouncement *inner;
4042    /**
4043     * Indicates that this is the only struct which contains the same pointer.
4044     * Rust functions which take ownership of an object provided via an argument require
4045     * this to be true and invalidate the object pointed to by inner.
4046     */
4047    bool is_owned;
4048 } LDKUnsignedNodeAnnouncement;
4049
4050 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
4051    struct LDKUnsignedNodeAnnouncement *result;
4052    struct LDKDecodeError *err;
4053 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
4054
4055 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
4056    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
4057    bool result_ok;
4058 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
4059
4060 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
4061    struct LDKNodeAnnouncement *result;
4062    struct LDKDecodeError *err;
4063 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
4064
4065 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
4066    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
4067    bool result_ok;
4068 } LDKCResult_NodeAnnouncementDecodeErrorZ;
4069
4070 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
4071    struct LDKQueryShortChannelIds *result;
4072    struct LDKDecodeError *err;
4073 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
4074
4075 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
4076    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
4077    bool result_ok;
4078 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
4079
4080
4081
4082 /**
4083  * A reply_short_channel_ids_end message is sent as a reply to a
4084  * query_short_channel_ids message. The query recipient makes a best
4085  * effort to respond based on their local network view which may not be
4086  * a perfect view of the network.
4087  */
4088 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
4089    /**
4090     * A pointer to the opaque Rust object.
4091     * Nearly everywhere, inner must be non-null, however in places where
4092     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4093     */
4094    LDKnativeReplyShortChannelIdsEnd *inner;
4095    /**
4096     * Indicates that this is the only struct which contains the same pointer.
4097     * Rust functions which take ownership of an object provided via an argument require
4098     * this to be true and invalidate the object pointed to by inner.
4099     */
4100    bool is_owned;
4101 } LDKReplyShortChannelIdsEnd;
4102
4103 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
4104    struct LDKReplyShortChannelIdsEnd *result;
4105    struct LDKDecodeError *err;
4106 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
4107
4108 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
4109    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
4110    bool result_ok;
4111 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
4112
4113 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
4114    struct LDKQueryChannelRange *result;
4115    struct LDKDecodeError *err;
4116 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
4117
4118 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
4119    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
4120    bool result_ok;
4121 } LDKCResult_QueryChannelRangeDecodeErrorZ;
4122
4123 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
4124    struct LDKReplyChannelRange *result;
4125    struct LDKDecodeError *err;
4126 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
4127
4128 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
4129    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
4130    bool result_ok;
4131 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
4132
4133
4134
4135 /**
4136  * A gossip_timestamp_filter message is used by a node to request
4137  * gossip relay for messages in the requested time range when the
4138  * gossip_queries feature has been negotiated.
4139  */
4140 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
4141    /**
4142     * A pointer to the opaque Rust object.
4143     * Nearly everywhere, inner must be non-null, however in places where
4144     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4145     */
4146    LDKnativeGossipTimestampFilter *inner;
4147    /**
4148     * Indicates that this is the only struct which contains the same pointer.
4149     * Rust functions which take ownership of an object provided via an argument require
4150     * this to be true and invalidate the object pointed to by inner.
4151     */
4152    bool is_owned;
4153 } LDKGossipTimestampFilter;
4154
4155 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
4156    struct LDKGossipTimestampFilter *result;
4157    struct LDKDecodeError *err;
4158 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
4159
4160 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
4161    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
4162    bool result_ok;
4163 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
4164
4165 /**
4166  * A trait indicating an object may generate message send events
4167  */
4168 typedef struct LDKMessageSendEventsProvider {
4169    /**
4170     * An opaque pointer which is passed to your function implementations as an argument.
4171     * This has no meaning in the LDK, and can be NULL or any other value.
4172     */
4173    void *this_arg;
4174    /**
4175     * Gets the list of pending events which were generated by previous actions, clearing the list
4176     * in the process.
4177     */
4178    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
4179    /**
4180     * Frees any resources associated with this object given its this_arg pointer.
4181     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4182     */
4183    void (*free)(void *this_arg);
4184 } LDKMessageSendEventsProvider;
4185
4186 /**
4187  * A trait indicating an object may generate events
4188  */
4189 typedef struct LDKEventsProvider {
4190    /**
4191     * An opaque pointer which is passed to your function implementations as an argument.
4192     * This has no meaning in the LDK, and can be NULL or any other value.
4193     */
4194    void *this_arg;
4195    /**
4196     * Gets the list of pending events which were generated by previous actions, clearing the list
4197     * in the process.
4198     */
4199    struct LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
4200    /**
4201     * Frees any resources associated with this object given its this_arg pointer.
4202     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4203     */
4204    void (*free)(void *this_arg);
4205 } LDKEventsProvider;
4206
4207
4208
4209 /**
4210  * Configuration we set when applicable.
4211  *
4212  * Default::default() provides sane defaults.
4213  */
4214 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
4215    /**
4216     * A pointer to the opaque Rust object.
4217     * Nearly everywhere, inner must be non-null, however in places where
4218     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4219     */
4220    LDKnativeChannelHandshakeConfig *inner;
4221    /**
4222     * Indicates that this is the only struct which contains the same pointer.
4223     * Rust functions which take ownership of an object provided via an argument require
4224     * this to be true and invalidate the object pointed to by inner.
4225     */
4226    bool is_owned;
4227 } LDKChannelHandshakeConfig;
4228
4229
4230
4231 /**
4232  * Optional channel limits which are applied during channel creation.
4233  *
4234  * These limits are only applied to our counterparty's limits, not our own.
4235  *
4236  * Use 0/<type>::max_value() as appropriate to skip checking.
4237  *
4238  * Provides sane defaults for most configurations.
4239  *
4240  * Most additional limits are disabled except those with which specify a default in individual
4241  * field documentation. Note that this may result in barely-usable channels, but since they
4242  * are applied mostly only to incoming channels that's not much of a problem.
4243  */
4244 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
4245    /**
4246     * A pointer to the opaque Rust object.
4247     * Nearly everywhere, inner must be non-null, however in places where
4248     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4249     */
4250    LDKnativeChannelHandshakeLimits *inner;
4251    /**
4252     * Indicates that this is the only struct which contains the same pointer.
4253     * Rust functions which take ownership of an object provided via an argument require
4254     * this to be true and invalidate the object pointed to by inner.
4255     */
4256    bool is_owned;
4257 } LDKChannelHandshakeLimits;
4258
4259
4260
4261 /**
4262  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
4263  *
4264  * Default::default() provides sane defaults for most configurations
4265  * (but currently with 0 relay fees!)
4266  */
4267 typedef struct MUST_USE_STRUCT LDKUserConfig {
4268    /**
4269     * A pointer to the opaque Rust object.
4270     * Nearly everywhere, inner must be non-null, however in places where
4271     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4272     */
4273    LDKnativeUserConfig *inner;
4274    /**
4275     * Indicates that this is the only struct which contains the same pointer.
4276     * Rust functions which take ownership of an object provided via an argument require
4277     * this to be true and invalidate the object pointed to by inner.
4278     */
4279    bool is_owned;
4280 } LDKUserConfig;
4281
4282 /**
4283  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
4284  * UTXOs.
4285  */
4286 typedef struct LDKAccess {
4287    /**
4288     * An opaque pointer which is passed to your function implementations as an argument.
4289     * This has no meaning in the LDK, and can be NULL or any other value.
4290     */
4291    void *this_arg;
4292    /**
4293     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
4294     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
4295     * is unknown.
4296     *
4297     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
4298     */
4299    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
4300    /**
4301     * Frees any resources associated with this object given its this_arg pointer.
4302     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4303     */
4304    void (*free)(void *this_arg);
4305 } LDKAccess;
4306
4307 /**
4308  * The `Listen` trait is used to be notified of when blocks have been connected or disconnected
4309  * from the chain.
4310  *
4311  * Useful when needing to replay chain data upon startup or as new chain events occur.
4312  */
4313 typedef struct LDKListen {
4314    /**
4315     * An opaque pointer which is passed to your function implementations as an argument.
4316     * This has no meaning in the LDK, and can be NULL or any other value.
4317     */
4318    void *this_arg;
4319    /**
4320     * Notifies the listener that a block was added at the given height.
4321     */
4322    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
4323    /**
4324     * Notifies the listener that a block was removed at the given height.
4325     */
4326    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
4327    /**
4328     * Frees any resources associated with this object given its this_arg pointer.
4329     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4330     */
4331    void (*free)(void *this_arg);
4332 } LDKListen;
4333
4334
4335
4336 /**
4337  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
4338  *
4339  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
4340  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
4341  * the return value of [`Filter::register_output`].
4342  *
4343  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
4344  * may have been spent there. See [`Filter::register_output`] for details.
4345  *
4346  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
4347  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
4348  */
4349 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
4350    /**
4351     * A pointer to the opaque Rust object.
4352     * Nearly everywhere, inner must be non-null, however in places where
4353     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4354     */
4355    LDKnativeWatchedOutput *inner;
4356    /**
4357     * Indicates that this is the only struct which contains the same pointer.
4358     * Rust functions which take ownership of an object provided via an argument require
4359     * this to be true and invalidate the object pointed to by inner.
4360     */
4361    bool is_owned;
4362 } LDKWatchedOutput;
4363
4364 /**
4365  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
4366  * channels.
4367  *
4368  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
4369  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
4370  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
4371  * receiving full blocks from a chain source, any further filtering is unnecessary.
4372  *
4373  * After an output has been registered, subsequent block retrievals from the chain source must not
4374  * exclude any transactions matching the new criteria nor any in-block descendants of such
4375  * transactions.
4376  *
4377  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
4378  * should not block on I/O. Implementations should instead queue the newly monitored data to be
4379  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
4380  * invocation that has called the `Filter` must return [`TemporaryFailure`].
4381  *
4382  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
4383  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
4384  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
4385  */
4386 typedef struct LDKFilter {
4387    /**
4388     * An opaque pointer which is passed to your function implementations as an argument.
4389     * This has no meaning in the LDK, and can be NULL or any other value.
4390     */
4391    void *this_arg;
4392    /**
4393     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
4394     * a spending condition.
4395     */
4396    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
4397    /**
4398     * Registers interest in spends of a transaction output.
4399     *
4400     * Optionally, when `output.block_hash` is set, should return any transaction spending the
4401     * output that is found in the corresponding block along with its index.
4402     *
4403     * This return value is useful for Electrum clients in order to supply in-block descendant
4404     * transactions which otherwise were not included. This is not necessary for other clients if
4405     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
4406     * full block).
4407     */
4408    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
4409    /**
4410     * Frees any resources associated with this object given its this_arg pointer.
4411     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4412     */
4413    void (*free)(void *this_arg);
4414 } LDKFilter;
4415
4416 /**
4417  * `Persist` defines behavior for persisting channel monitors: this could mean
4418  * writing once to disk, and/or uploading to one or more backup services.
4419  *
4420  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
4421  * to disk/backups. And, on every update, you **must** persist either the
4422  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
4423  * of situations such as revoking a transaction, then crashing before this
4424  * revocation can be persisted, then unintentionally broadcasting a revoked
4425  * transaction and losing money. This is a risk because previous channel states
4426  * are toxic, so it's important that whatever channel state is persisted is
4427  * kept up-to-date.
4428  */
4429 typedef struct LDKPersist {
4430    /**
4431     * An opaque pointer which is passed to your function implementations as an argument.
4432     * This has no meaning in the LDK, and can be NULL or any other value.
4433     */
4434    void *this_arg;
4435    /**
4436     * Persist a new channel's data. The data can be stored any way you want, but
4437     * the identifier provided by Rust-Lightning is the channel's outpoint (and
4438     * it is up to you to maintain a correct mapping between the outpoint and the
4439     * stored channel data). Note that you **must** persist every new monitor to
4440     * disk. See the `Persist` trait documentation for more details.
4441     *
4442     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
4443     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
4444     */
4445    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
4446    /**
4447     * Update one channel's data. The provided `ChannelMonitor` has already
4448     * applied the given update.
4449     *
4450     * Note that on every update, you **must** persist either the
4451     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
4452     * the `Persist` trait documentation for more details.
4453     *
4454     * If an implementer chooses to persist the updates only, they need to make
4455     * sure that all the updates are applied to the `ChannelMonitors` *before*
4456     * the set of channel monitors is given to the `ChannelManager`
4457     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
4458     * applying a monitor update to a monitor. If full `ChannelMonitors` are
4459     * persisted, then there is no need to persist individual updates.
4460     *
4461     * Note that there could be a performance tradeoff between persisting complete
4462     * channel monitors on every update vs. persisting only updates and applying
4463     * them in batches. The size of each monitor grows `O(number of state updates)`
4464     * whereas updates are small and `O(1)`.
4465     *
4466     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
4467     * [`ChannelMonitorUpdate::write`] for writing out an update, and
4468     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
4469     */
4470    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);
4471    /**
4472     * Frees any resources associated with this object given its this_arg pointer.
4473     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4474     */
4475    void (*free)(void *this_arg);
4476 } LDKPersist;
4477
4478
4479
4480 /**
4481  * An implementation of [`chain::Watch`] for monitoring channels.
4482  *
4483  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
4484  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
4485  * or used independently to monitor channels remotely. See the [module-level documentation] for
4486  * details.
4487  *
4488  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
4489  * [module-level documentation]: crate::chain::chainmonitor
4490  */
4491 typedef struct MUST_USE_STRUCT LDKChainMonitor {
4492    /**
4493     * A pointer to the opaque Rust object.
4494     * Nearly everywhere, inner must be non-null, however in places where
4495     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4496     */
4497    LDKnativeChainMonitor *inner;
4498    /**
4499     * Indicates that this is the only struct which contains the same pointer.
4500     * Rust functions which take ownership of an object provided via an argument require
4501     * this to be true and invalidate the object pointed to by inner.
4502     */
4503    bool is_owned;
4504 } LDKChainMonitor;
4505
4506
4507
4508 /**
4509  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
4510  * and derives keys from that.
4511  *
4512  * Your node_id is seed/0'
4513  * ChannelMonitor closes may use seed/1'
4514  * Cooperative closes may use seed/2'
4515  * The two close keys may be needed to claim on-chain funds!
4516  */
4517 typedef struct MUST_USE_STRUCT LDKKeysManager {
4518    /**
4519     * A pointer to the opaque Rust object.
4520     * Nearly everywhere, inner must be non-null, however in places where
4521     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4522     */
4523    LDKnativeKeysManager *inner;
4524    /**
4525     * Indicates that this is the only struct which contains the same pointer.
4526     * Rust functions which take ownership of an object provided via an argument require
4527     * this to be true and invalidate the object pointed to by inner.
4528     */
4529    bool is_owned;
4530 } LDKKeysManager;
4531
4532
4533
4534 /**
4535  * Chain-related parameters used to construct a new `ChannelManager`.
4536  *
4537  * Typically, the block-specific parameters are derived from the best block hash for the network,
4538  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
4539  * are not needed when deserializing a previously constructed `ChannelManager`.
4540  */
4541 typedef struct MUST_USE_STRUCT LDKChainParameters {
4542    /**
4543     * A pointer to the opaque Rust object.
4544     * Nearly everywhere, inner must be non-null, however in places where
4545     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4546     */
4547    LDKnativeChainParameters *inner;
4548    /**
4549     * Indicates that this is the only struct which contains the same pointer.
4550     * Rust functions which take ownership of an object provided via an argument require
4551     * this to be true and invalidate the object pointed to by inner.
4552     */
4553    bool is_owned;
4554 } LDKChainParameters;
4555
4556 typedef struct LDKThreeBytes {
4557    uint8_t data[3];
4558 } LDKThreeBytes;
4559
4560 /**
4561  * A trait to describe an object which can receive channel messages.
4562  *
4563  * Messages MAY be called in parallel when they originate from different their_node_ids, however
4564  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
4565  */
4566 typedef struct LDKChannelMessageHandler {
4567    /**
4568     * An opaque pointer which is passed to your function implementations as an argument.
4569     * This has no meaning in the LDK, and can be NULL or any other value.
4570     */
4571    void *this_arg;
4572    /**
4573     * Handle an incoming open_channel message from the given peer.
4574     */
4575    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
4576    /**
4577     * Handle an incoming accept_channel message from the given peer.
4578     */
4579    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
4580    /**
4581     * Handle an incoming funding_created message from the given peer.
4582     */
4583    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
4584    /**
4585     * Handle an incoming funding_signed message from the given peer.
4586     */
4587    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
4588    /**
4589     * Handle an incoming funding_locked message from the given peer.
4590     */
4591    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
4592    /**
4593     * Handle an incoming shutdown message from the given peer.
4594     */
4595    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);
4596    /**
4597     * Handle an incoming closing_signed message from the given peer.
4598     */
4599    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
4600    /**
4601     * Handle an incoming update_add_htlc message from the given peer.
4602     */
4603    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
4604    /**
4605     * Handle an incoming update_fulfill_htlc message from the given peer.
4606     */
4607    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
4608    /**
4609     * Handle an incoming update_fail_htlc message from the given peer.
4610     */
4611    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
4612    /**
4613     * Handle an incoming update_fail_malformed_htlc message from the given peer.
4614     */
4615    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
4616    /**
4617     * Handle an incoming commitment_signed message from the given peer.
4618     */
4619    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
4620    /**
4621     * Handle an incoming revoke_and_ack message from the given peer.
4622     */
4623    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
4624    /**
4625     * Handle an incoming update_fee message from the given peer.
4626     */
4627    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
4628    /**
4629     * Handle an incoming announcement_signatures message from the given peer.
4630     */
4631    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
4632    /**
4633     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
4634     * is believed to be possible in the future (eg they're sending us messages we don't
4635     * understand or indicate they require unknown feature bits), no_connection_possible is set
4636     * and any outstanding channels should be failed.
4637     */
4638    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
4639    /**
4640     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
4641     */
4642    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
4643    /**
4644     * Handle an incoming channel_reestablish message from the given peer.
4645     */
4646    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
4647    /**
4648     * Handle an incoming channel update from the given peer.
4649     */
4650    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
4651    /**
4652     * Handle an incoming error message from the given peer.
4653     */
4654    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
4655    /**
4656     * Implementation of MessageSendEventsProvider for this object.
4657     */
4658    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
4659    /**
4660     * Frees any resources associated with this object given its this_arg pointer.
4661     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4662     */
4663    void (*free)(void *this_arg);
4664 } LDKChannelMessageHandler;
4665
4666
4667
4668 /**
4669  * Arguments for the creation of a ChannelManager that are not deserialized.
4670  *
4671  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
4672  * is:
4673  * 1) Deserialize all stored ChannelMonitors.
4674  * 2) Deserialize the ChannelManager by filling in this struct and calling:
4675  *    <(BlockHash, ChannelManager)>::read(reader, args)
4676  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
4677  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
4678  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
4679  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
4680  *    ChannelMonitor::get_funding_txo().
4681  * 4) Reconnect blocks on your ChannelMonitors.
4682  * 5) Disconnect/connect blocks on the ChannelManager.
4683  * 6) Move the ChannelMonitors into your local chain::Watch.
4684  *
4685  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
4686  * call any other methods on the newly-deserialized ChannelManager.
4687  *
4688  * Note that because some channels may be closed during deserialization, it is critical that you
4689  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
4690  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
4691  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
4692  * not force-close the same channels but consider them live), you may end up revoking a state for
4693  * which you've already broadcasted the transaction.
4694  */
4695 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
4696    /**
4697     * A pointer to the opaque Rust object.
4698     * Nearly everywhere, inner must be non-null, however in places where
4699     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4700     */
4701    LDKnativeChannelManagerReadArgs *inner;
4702    /**
4703     * Indicates that this is the only struct which contains the same pointer.
4704     * Rust functions which take ownership of an object provided via an argument require
4705     * this to be true and invalidate the object pointed to by inner.
4706     */
4707    bool is_owned;
4708 } LDKChannelManagerReadArgs;
4709
4710
4711
4712 /**
4713  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
4714  * This is used to convince the recipient that the channel is at a certain commitment
4715  * number even if they lost that data due to a local failure.  Of course, the peer may lie
4716  * and even later commitments may have been revoked.
4717  */
4718 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
4719    /**
4720     * A pointer to the opaque Rust object.
4721     * Nearly everywhere, inner must be non-null, however in places where
4722     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4723     */
4724    LDKnativeDataLossProtect *inner;
4725    /**
4726     * Indicates that this is the only struct which contains the same pointer.
4727     * Rust functions which take ownership of an object provided via an argument require
4728     * this to be true and invalidate the object pointed to by inner.
4729     */
4730    bool is_owned;
4731 } LDKDataLossProtect;
4732
4733 /**
4734  * A trait to describe an object which can receive routing messages.
4735  *
4736  * # Implementor DoS Warnings
4737  *
4738  * For `gossip_queries` messages there are potential DoS vectors when handling
4739  * inbound queries. Implementors using an on-disk network graph should be aware of
4740  * repeated disk I/O for queries accessing different parts of the network graph.
4741  */
4742 typedef struct LDKRoutingMessageHandler {
4743    /**
4744     * An opaque pointer which is passed to your function implementations as an argument.
4745     * This has no meaning in the LDK, and can be NULL or any other value.
4746     */
4747    void *this_arg;
4748    /**
4749     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
4750     * false or returning an Err otherwise.
4751     */
4752    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
4753    /**
4754     * Handle a channel_announcement message, returning true if it should be forwarded on, false
4755     * or returning an Err otherwise.
4756     */
4757    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
4758    /**
4759     * Handle an incoming channel_update message, returning true if it should be forwarded on,
4760     * false or returning an Err otherwise.
4761     */
4762    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
4763    /**
4764     * Handle some updates to the route graph that we learned due to an outbound failed payment.
4765     */
4766    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
4767    /**
4768     * Gets a subset of the channel announcements and updates required to dump our routing table
4769     * to a remote node, starting at the short_channel_id indicated by starting_point and
4770     * including the batch_amount entries immediately higher in numerical value than starting_point.
4771     */
4772    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
4773    /**
4774     * Gets a subset of the node announcements required to dump our routing table to a remote node,
4775     * starting at the node *after* the provided publickey and including batch_amount entries
4776     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
4777     * If None is provided for starting_point, we start at the first node.
4778     */
4779    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
4780    /**
4781     * Called when a connection is established with a peer. This can be used to
4782     * perform routing table synchronization using a strategy defined by the
4783     * implementor.
4784     */
4785    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
4786    /**
4787     * Handles the reply of a query we initiated to learn about channels
4788     * for a given range of blocks. We can expect to receive one or more
4789     * replies to a single query.
4790     */
4791    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
4792    /**
4793     * Handles the reply of a query we initiated asking for routing gossip
4794     * messages for a list of channels. We should receive this message when
4795     * a node has completed its best effort to send us the pertaining routing
4796     * gossip messages.
4797     */
4798    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
4799    /**
4800     * Handles when a peer asks us to send a list of short_channel_ids
4801     * for the requested range of blocks.
4802     */
4803    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
4804    /**
4805     * Handles when a peer asks us to send routing gossip messages for a
4806     * list of short_channel_ids.
4807     */
4808    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
4809    /**
4810     * Implementation of MessageSendEventsProvider for this object.
4811     */
4812    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
4813    /**
4814     * Frees any resources associated with this object given its this_arg pointer.
4815     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4816     */
4817    void (*free)(void *this_arg);
4818 } LDKRoutingMessageHandler;
4819
4820
4821
4822 /**
4823  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
4824  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
4825  */
4826 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
4827    /**
4828     * A pointer to the opaque Rust object.
4829     * Nearly everywhere, inner must be non-null, however in places where
4830     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4831     */
4832    LDKnativeIgnoringMessageHandler *inner;
4833    /**
4834     * Indicates that this is the only struct which contains the same pointer.
4835     * Rust functions which take ownership of an object provided via an argument require
4836     * this to be true and invalidate the object pointed to by inner.
4837     */
4838    bool is_owned;
4839 } LDKIgnoringMessageHandler;
4840
4841
4842
4843 /**
4844  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
4845  * You can provide one of these as the route_handler in a MessageHandler.
4846  */
4847 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
4848    /**
4849     * A pointer to the opaque Rust object.
4850     * Nearly everywhere, inner must be non-null, however in places where
4851     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4852     */
4853    LDKnativeErroringMessageHandler *inner;
4854    /**
4855     * Indicates that this is the only struct which contains the same pointer.
4856     * Rust functions which take ownership of an object provided via an argument require
4857     * this to be true and invalidate the object pointed to by inner.
4858     */
4859    bool is_owned;
4860 } LDKErroringMessageHandler;
4861
4862
4863
4864 /**
4865  * Provides references to trait impls which handle different types of messages.
4866  */
4867 typedef struct MUST_USE_STRUCT LDKMessageHandler {
4868    /**
4869     * A pointer to the opaque Rust object.
4870     * Nearly everywhere, inner must be non-null, however in places where
4871     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4872     */
4873    LDKnativeMessageHandler *inner;
4874    /**
4875     * Indicates that this is the only struct which contains the same pointer.
4876     * Rust functions which take ownership of an object provided via an argument require
4877     * this to be true and invalidate the object pointed to by inner.
4878     */
4879    bool is_owned;
4880 } LDKMessageHandler;
4881
4882 /**
4883  * Provides an object which can be used to send data to and which uniquely identifies a connection
4884  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
4885  * implement Hash to meet the PeerManager API.
4886  *
4887  * For efficiency, Clone should be relatively cheap for this type.
4888  *
4889  * You probably want to just extend an int and put a file descriptor in a struct and implement
4890  * send_data. Note that if you are using a higher-level net library that may call close() itself,
4891  * be careful to ensure you don't have races whereby you might register a new connection with an
4892  * fd which is the same as a previous one which has yet to be removed via
4893  * PeerManager::socket_disconnected().
4894  */
4895 typedef struct LDKSocketDescriptor {
4896    /**
4897     * An opaque pointer which is passed to your function implementations as an argument.
4898     * This has no meaning in the LDK, and can be NULL or any other value.
4899     */
4900    void *this_arg;
4901    /**
4902     * Attempts to send some data from the given slice to the peer.
4903     *
4904     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
4905     * Note that in the disconnected case, socket_disconnected must still fire and further write
4906     * attempts may occur until that time.
4907     *
4908     * If the returned size is smaller than data.len(), a write_available event must
4909     * trigger the next time more data can be written. Additionally, until the a send_data event
4910     * completes fully, no further read_events should trigger on the same peer!
4911     *
4912     * If a read_event on this descriptor had previously returned true (indicating that read
4913     * events should be paused to prevent DoS in the send buffer), resume_read may be set
4914     * indicating that read events on this descriptor should resume. A resume_read of false does
4915     * *not* imply that further read events should be paused.
4916     */
4917    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
4918    /**
4919     * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
4920     * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
4921     * this descriptor. No socket_disconnected call should be generated as a result of this call,
4922     * though races may occur whereby disconnect_socket is called after a call to
4923     * socket_disconnected but prior to socket_disconnected returning.
4924     */
4925    void (*disconnect_socket)(void *this_arg);
4926    /**
4927     * Checks if two objects are equal given this object's this_arg pointer and another object.
4928     */
4929    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
4930    /**
4931     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
4932     * This is used, for example, for inclusion of this object in a hash map.
4933     */
4934    uint64_t (*hash)(const void *this_arg);
4935    /**
4936     * Creates a copy of the object pointed to by this_arg, for a copy of this SocketDescriptor.
4937     * Note that the ultimate copy of the SocketDescriptor will have all function pointers the same as the original.
4938     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new SocketDescriptor.
4939     */
4940    void *(*clone)(const void *this_arg);
4941    /**
4942     * Frees any resources associated with this object given its this_arg pointer.
4943     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4944     */
4945    void (*free)(void *this_arg);
4946 } LDKSocketDescriptor;
4947
4948
4949
4950 /**
4951  * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
4952  * events into messages which it passes on to its MessageHandlers.
4953  *
4954  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
4955  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
4956  * essentially you should default to using a SimpleRefPeerManager, and use a
4957  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
4958  * you're using lightning-net-tokio.
4959  */
4960 typedef struct MUST_USE_STRUCT LDKPeerManager {
4961    /**
4962     * A pointer to the opaque Rust object.
4963     * Nearly everywhere, inner must be non-null, however in places where
4964     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4965     */
4966    LDKnativePeerManager *inner;
4967    /**
4968     * Indicates that this is the only struct which contains the same pointer.
4969     * Rust functions which take ownership of an object provided via an argument require
4970     * this to be true and invalidate the object pointed to by inner.
4971     */
4972    bool is_owned;
4973 } LDKPeerManager;
4974
4975
4976
4977 /**
4978  * Static channel fields used to build transactions given per-commitment fields, organized by
4979  * broadcaster/countersignatory.
4980  *
4981  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
4982  * as_holder_broadcastable and as_counterparty_broadcastable functions.
4983  */
4984 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
4985    /**
4986     * A pointer to the opaque Rust object.
4987     * Nearly everywhere, inner must be non-null, however in places where
4988     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4989     */
4990    LDKnativeDirectedChannelTransactionParameters *inner;
4991    /**
4992     * Indicates that this is the only struct which contains the same pointer.
4993     * Rust functions which take ownership of an object provided via an argument require
4994     * this to be true and invalidate the object pointed to by inner.
4995     */
4996    bool is_owned;
4997 } LDKDirectedChannelTransactionParameters;
4998
4999
5000
5001 /**
5002  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
5003  * This exists only to make accessing a RwLock<NetworkGraph> possible from
5004  * the C bindings, as it can be done directly in Rust code.
5005  */
5006 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
5007    /**
5008     * A pointer to the opaque Rust object.
5009     * Nearly everywhere, inner must be non-null, however in places where
5010     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5011     */
5012    LDKnativeLockedNetworkGraph *inner;
5013    /**
5014     * Indicates that this is the only struct which contains the same pointer.
5015     * Rust functions which take ownership of an object provided via an argument require
5016     * this to be true and invalidate the object pointed to by inner.
5017     */
5018    bool is_owned;
5019 } LDKLockedNetworkGraph;
5020
5021
5022
5023 /**
5024  * Receives and validates network updates from peers,
5025  * stores authentic and relevant data as a network graph.
5026  * This network graph is then used for routing payments.
5027  * Provides interface to help with initial routing sync by
5028  * serving historical announcements.
5029  */
5030 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
5031    /**
5032     * A pointer to the opaque Rust object.
5033     * Nearly everywhere, inner must be non-null, however in places where
5034     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5035     */
5036    LDKnativeNetGraphMsgHandler *inner;
5037    /**
5038     * Indicates that this is the only struct which contains the same pointer.
5039     * Rust functions which take ownership of an object provided via an argument require
5040     * this to be true and invalidate the object pointed to by inner.
5041     */
5042    bool is_owned;
5043 } LDKNetGraphMsgHandler;
5044
5045 extern const uintptr_t MAX_BUF_SIZE;
5046
5047 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
5048
5049 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
5050
5051 extern const uint16_t BREAKDOWN_TIMEOUT;
5052
5053 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
5054
5055 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
5056
5057 void Transaction_free(struct LDKTransaction _res);
5058
5059 void TxOut_free(struct LDKTxOut _res);
5060
5061 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
5062
5063 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
5064
5065 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
5066
5067 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
5068
5069 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
5070
5071 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
5072
5073 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
5074
5075 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
5076
5077 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
5078
5079 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
5080
5081 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
5082
5083 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
5084
5085 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
5086
5087 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
5088
5089 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
5090
5091 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
5092
5093 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
5094
5095 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
5096
5097 void COption_u32Z_free(struct LDKCOption_u32Z _res);
5098
5099 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
5100
5101 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
5102
5103 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
5104
5105 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
5106
5107 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
5108
5109 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
5110
5111 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
5112
5113 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
5114
5115 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
5116
5117 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
5118
5119 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
5120
5121 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
5122
5123 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
5124
5125 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
5126
5127 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
5128
5129 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
5130
5131 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
5132
5133 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
5134
5135 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
5136
5137 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
5138
5139 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
5140
5141 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
5142
5143 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
5144
5145 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
5146
5147 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
5148
5149 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
5150
5151 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
5152
5153 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
5154
5155 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
5156
5157 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
5158
5159 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
5160
5161 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
5162
5163 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
5164
5165 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
5166
5167 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
5168
5169 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
5170
5171 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
5172
5173 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
5174
5175 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
5176
5177 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
5178
5179 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
5180
5181 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
5182
5183 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
5184
5185 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
5186
5187 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
5188
5189 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
5190
5191 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
5192
5193 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
5194
5195 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
5196
5197 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
5198
5199 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
5200
5201 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
5202
5203 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
5204
5205 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
5206
5207 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
5208
5209 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
5210
5211 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
5212
5213 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
5214
5215 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
5216
5217 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
5218
5219 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
5220
5221 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
5222
5223 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
5224
5225 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
5226
5227 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
5228
5229 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
5230
5231 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
5232
5233 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
5234
5235 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
5236
5237 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
5238
5239 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
5240
5241 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
5242
5243 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
5244
5245 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
5246
5247 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
5248
5249 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
5250
5251 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
5252
5253 void COption_u64Z_free(struct LDKCOption_u64Z _res);
5254
5255 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
5256
5257 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
5258
5259 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
5260
5261 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
5262
5263 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
5264
5265 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
5266
5267 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
5268
5269 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
5270
5271 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
5272
5273 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
5274
5275 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
5276
5277 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
5278
5279 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
5280
5281 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
5282
5283 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
5284
5285 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
5286
5287 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
5288
5289 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
5290
5291 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
5292
5293 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
5294
5295 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
5296
5297 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
5298
5299 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
5300
5301 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
5302
5303 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
5304
5305 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
5306
5307 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
5308
5309 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
5310
5311 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
5312
5313 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
5314
5315 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
5316
5317 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
5318
5319 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
5320
5321 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
5322
5323 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
5324
5325 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
5326
5327 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
5328
5329 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
5330
5331 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
5332
5333 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
5334
5335 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
5336
5337 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
5338
5339 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
5340
5341 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
5342
5343 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
5344
5345 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
5346
5347 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
5348
5349 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
5350
5351 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
5352
5353 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
5354
5355 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
5356
5357 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
5358
5359 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
5360
5361 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
5362
5363 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
5364
5365 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
5366
5367 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
5368
5369 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
5370
5371 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
5372
5373 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
5374
5375 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
5376
5377 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
5378
5379 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
5380
5381 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
5382
5383 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
5384
5385 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
5386
5387 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
5388
5389 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
5390
5391 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
5392
5393 void CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res);
5394
5395 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
5396
5397 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
5398
5399 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
5400
5401 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
5402
5403 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
5404
5405 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
5406
5407 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
5408
5409 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
5410
5411 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
5412
5413 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
5414
5415 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
5416
5417 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
5418
5419 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
5420
5421 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
5422
5423 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
5424
5425 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
5426
5427 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
5428
5429 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
5430
5431 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
5432
5433 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
5434
5435 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
5436
5437 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
5438
5439 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
5440
5441 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
5442
5443 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
5444
5445 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
5446
5447 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
5448
5449 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
5450
5451 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
5452
5453 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
5454
5455 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
5456
5457 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
5458
5459 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
5460
5461 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
5462
5463 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
5464
5465 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
5466
5467 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
5468
5469 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
5470
5471 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
5472
5473 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
5474
5475 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
5476
5477 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
5478
5479 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
5480
5481 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
5482
5483 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
5484
5485 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
5486
5487 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
5488
5489 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
5490
5491 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
5492
5493 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
5494
5495 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
5496
5497 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
5498
5499 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
5500
5501 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
5502
5503 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
5504
5505 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
5506
5507 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
5508
5509 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
5510
5511 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
5512
5513 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
5514
5515 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
5516
5517 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
5518
5519 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
5520
5521 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
5522
5523 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
5524
5525 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
5526
5527 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
5528
5529 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
5530
5531 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
5532
5533 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
5534
5535 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
5536
5537 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
5538
5539 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
5540
5541 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
5542
5543 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
5544
5545 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
5546
5547 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
5548
5549 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
5550
5551 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
5552
5553 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
5554
5555 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
5556
5557 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
5558
5559 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
5560
5561 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
5562
5563 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
5564
5565 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
5566
5567 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
5568
5569 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
5570
5571 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
5572
5573 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
5574
5575 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
5576
5577 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
5578
5579 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
5580
5581 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
5582
5583 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
5584
5585 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
5586
5587 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
5588
5589 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
5590
5591 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
5592
5593 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
5594
5595 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
5596
5597 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
5598
5599 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
5600
5601 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
5602
5603 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
5604
5605 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
5606
5607 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
5608
5609 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
5610
5611 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
5612
5613 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
5614
5615 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
5616
5617 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
5618
5619 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
5620
5621 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
5622
5623 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
5624
5625 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
5626
5627 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
5628
5629 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
5630
5631 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
5632
5633 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
5634
5635 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
5636
5637 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
5638
5639 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
5640
5641 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
5642
5643 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
5644
5645 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
5646
5647 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
5648
5649 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
5650
5651 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
5652
5653 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
5654
5655 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
5656
5657 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
5658
5659 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
5660
5661 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
5662
5663 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
5664
5665 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
5666
5667 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
5668
5669 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
5670
5671 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
5672
5673 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
5674
5675 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
5676
5677 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
5678
5679 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
5680
5681 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
5682
5683 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
5684
5685 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
5686
5687 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
5688
5689 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
5690
5691 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
5692
5693 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
5694
5695 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
5696
5697 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
5698
5699 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
5700
5701 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
5702
5703 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
5704
5705 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
5706
5707 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
5708
5709 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
5710
5711 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
5712
5713 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
5714
5715 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
5716
5717 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
5718
5719 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
5720
5721 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
5722
5723 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
5724
5725 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
5726
5727 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
5728
5729 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
5730
5731 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
5732
5733 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
5734
5735 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
5736
5737 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
5738
5739 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
5740
5741 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
5742
5743 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
5744
5745 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
5746
5747 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
5748
5749 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
5750
5751 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
5752
5753 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
5754
5755 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
5756
5757 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
5758
5759 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
5760
5761 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
5762
5763 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
5764
5765 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
5766
5767 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
5768
5769 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
5770
5771 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
5772
5773 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
5774
5775 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
5776
5777 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
5778
5779 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
5780
5781 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
5782
5783 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
5784
5785 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
5786
5787 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
5788
5789 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
5790
5791 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
5792
5793 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
5794
5795 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
5796
5797 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
5798
5799 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
5800
5801 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
5802
5803 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
5804
5805 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
5806
5807 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
5808
5809 /**
5810  * Frees any resources used by the Event
5811  */
5812 void Event_free(struct LDKEvent this_ptr);
5813
5814 /**
5815  * Creates a copy of the Event
5816  */
5817 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
5818
5819 /**
5820  * Serialize the Event object into a byte array which can be read by Event_read
5821  */
5822 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
5823
5824 /**
5825  * Frees any resources used by the MessageSendEvent
5826  */
5827 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
5828
5829 /**
5830  * Creates a copy of the MessageSendEvent
5831  */
5832 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
5833
5834 /**
5835  * Calls the free function if one is set
5836  */
5837 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
5838
5839 /**
5840  * Calls the free function if one is set
5841  */
5842 void EventsProvider_free(struct LDKEventsProvider this_ptr);
5843
5844 /**
5845  * Frees any resources used by the APIError
5846  */
5847 void APIError_free(struct LDKAPIError this_ptr);
5848
5849 /**
5850  * Creates a copy of the APIError
5851  */
5852 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
5853
5854 /**
5855  * Creates a copy of the Level
5856  */
5857 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
5858
5859 /**
5860  * Returns the most verbose logging level.
5861  */
5862 MUST_USE_RES enum LDKLevel Level_max(void);
5863
5864 /**
5865  * Calls the free function if one is set
5866  */
5867 void Logger_free(struct LDKLogger this_ptr);
5868
5869 /**
5870  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
5871  */
5872 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
5873
5874 /**
5875  * Confirmations we will wait for before considering the channel locked in.
5876  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
5877  * equivalent limit applied to outbound channels).
5878  *
5879  * Default value: 6.
5880  */
5881 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
5882
5883 /**
5884  * Confirmations we will wait for before considering the channel locked in.
5885  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
5886  * equivalent limit applied to outbound channels).
5887  *
5888  * Default value: 6.
5889  */
5890 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
5891
5892 /**
5893  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
5894  * the number of blocks we have to punish our counterparty if they broadcast a revoked
5895  * transaction).
5896  *
5897  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
5898  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
5899  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
5900  * possibly with time in between to RBF the spending transaction).
5901  *
5902  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
5903  * case of an honest unilateral channel close, which implicitly decrease the economic value of
5904  * our channel.
5905  *
5906  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
5907  * can tweak config to ask for more security, not less.
5908  */
5909 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
5910
5911 /**
5912  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
5913  * the number of blocks we have to punish our counterparty if they broadcast a revoked
5914  * transaction).
5915  *
5916  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
5917  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
5918  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
5919  * possibly with time in between to RBF the spending transaction).
5920  *
5921  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
5922  * case of an honest unilateral channel close, which implicitly decrease the economic value of
5923  * our channel.
5924  *
5925  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
5926  * can tweak config to ask for more security, not less.
5927  */
5928 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
5929
5930 /**
5931  * Set to the smallest value HTLC we will accept to process.
5932  *
5933  * This value is sent to our counterparty on channel-open and we close the channel any time
5934  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
5935  *
5936  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
5937  * by the protocol.
5938  */
5939 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
5940
5941 /**
5942  * Set to the smallest value HTLC we will accept to process.
5943  *
5944  * This value is sent to our counterparty on channel-open and we close the channel any time
5945  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
5946  *
5947  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
5948  * by the protocol.
5949  */
5950 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
5951
5952 /**
5953  * Constructs a new ChannelHandshakeConfig given each field
5954  */
5955 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);
5956
5957 /**
5958  * Creates a copy of the ChannelHandshakeConfig
5959  */
5960 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
5961
5962 /**
5963  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
5964  */
5965 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
5966
5967 /**
5968  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
5969  */
5970 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
5971
5972 /**
5973  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
5974  * only applies to inbound channels.
5975  *
5976  * Default value: 0.
5977  */
5978 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
5979
5980 /**
5981  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
5982  * only applies to inbound channels.
5983  *
5984  * Default value: 0.
5985  */
5986 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
5987
5988 /**
5989  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
5990  * you to limit the maximum minimum-size they can require.
5991  *
5992  * Default value: u64::max_value.
5993  */
5994 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
5995
5996 /**
5997  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
5998  * you to limit the maximum minimum-size they can require.
5999  *
6000  * Default value: u64::max_value.
6001  */
6002 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
6003
6004 /**
6005  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
6006  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
6007  *
6008  * Default value: 0.
6009  */
6010 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6011
6012 /**
6013  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
6014  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
6015  *
6016  * Default value: 0.
6017  */
6018 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
6019
6020 /**
6021  * The remote node will require we keep a certain amount in direct payment to ourselves at all
6022  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
6023  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
6024  *
6025  * Default value: u64::max_value.
6026  */
6027 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6028
6029 /**
6030  * The remote node will require we keep a certain amount in direct payment to ourselves at all
6031  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
6032  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
6033  *
6034  * Default value: u64::max_value.
6035  */
6036 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
6037
6038 /**
6039  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
6040  * time. This allows you to set a minimum such value.
6041  *
6042  * Default value: 0.
6043  */
6044 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6045
6046 /**
6047  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
6048  * time. This allows you to set a minimum such value.
6049  *
6050  * Default value: 0.
6051  */
6052 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
6053
6054 /**
6055  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
6056  * required to always be higher than this value so this only applies to HTLC outputs (and
6057  * potentially to-self outputs before any payments have been made).
6058  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
6059  * This setting allows you to set a minimum dust limit for their commitment transactions,
6060  * reflecting the reality that tiny outputs are not considered standard transactions and will
6061  * not propagate through the Bitcoin network.
6062  *
6063  * Default value: 546, the current dust limit on the Bitcoin network.
6064  */
6065 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6066
6067 /**
6068  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
6069  * required to always be higher than this value so this only applies to HTLC outputs (and
6070  * potentially to-self outputs before any payments have been made).
6071  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
6072  * This setting allows you to set a minimum dust limit for their commitment transactions,
6073  * reflecting the reality that tiny outputs are not considered standard transactions and will
6074  * not propagate through the Bitcoin network.
6075  *
6076  * Default value: 546, the current dust limit on the Bitcoin network.
6077  */
6078 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
6079
6080 /**
6081  * Maximum allowed threshold above which outputs will not be generated in their commitment
6082  * transactions.
6083  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
6084  *
6085  * Default value: u64::max_value.
6086  */
6087 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6088
6089 /**
6090  * Maximum allowed threshold above which outputs will not be generated in their commitment
6091  * transactions.
6092  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
6093  *
6094  * Default value: u64::max_value.
6095  */
6096 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
6097
6098 /**
6099  * Before a channel is usable the funding transaction will need to be confirmed by at least a
6100  * certain number of blocks, specified by the node which is not the funder (as the funder can
6101  * assume they aren't going to double-spend themselves).
6102  * This config allows you to set a limit on the maximum amount of time to wait.
6103  *
6104  * Default value: 144, or roughly one day and only applies to outbound channels.
6105  */
6106 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6107
6108 /**
6109  * Before a channel is usable the funding transaction will need to be confirmed by at least a
6110  * certain number of blocks, specified by the node which is not the funder (as the funder can
6111  * assume they aren't going to double-spend themselves).
6112  * This config allows you to set a limit on the maximum amount of time to wait.
6113  *
6114  * Default value: 144, or roughly one day and only applies to outbound channels.
6115  */
6116 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
6117
6118 /**
6119  * Set to force the incoming channel to match our announced channel preference in
6120  * ChannelConfig.
6121  *
6122  * Default value: true, to make the default that no announced channels are possible (which is
6123  * appropriate for any nodes which are not online very reliably).
6124  */
6125 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6126
6127 /**
6128  * Set to force the incoming channel to match our announced channel preference in
6129  * ChannelConfig.
6130  *
6131  * Default value: true, to make the default that no announced channels are possible (which is
6132  * appropriate for any nodes which are not online very reliably).
6133  */
6134 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
6135
6136 /**
6137  * Set to the amount of time we're willing to wait to claim money back to us.
6138  *
6139  * Not checking this value would be a security issue, as our peer would be able to set it to
6140  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
6141  *
6142  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
6143  * reduce the loss of having useless locked funds (if your peer accepts)
6144  */
6145 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6146
6147 /**
6148  * Set to the amount of time we're willing to wait to claim money back to us.
6149  *
6150  * Not checking this value would be a security issue, as our peer would be able to set it to
6151  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
6152  *
6153  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
6154  * reduce the loss of having useless locked funds (if your peer accepts)
6155  */
6156 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
6157
6158 /**
6159  * Constructs a new ChannelHandshakeLimits given each field
6160  */
6161 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);
6162
6163 /**
6164  * Creates a copy of the ChannelHandshakeLimits
6165  */
6166 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
6167
6168 /**
6169  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
6170  */
6171 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
6172
6173 /**
6174  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
6175  */
6176 void ChannelConfig_free(struct LDKChannelConfig this_obj);
6177
6178 /**
6179  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
6180  * This may be allowed to change at runtime in a later update, however doing so must result in
6181  * update messages sent to notify all nodes of our updated relay fee.
6182  *
6183  * Default value: 0.
6184  */
6185 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
6186
6187 /**
6188  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
6189  * This may be allowed to change at runtime in a later update, however doing so must result in
6190  * update messages sent to notify all nodes of our updated relay fee.
6191  *
6192  * Default value: 0.
6193  */
6194 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
6195
6196 /**
6197  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
6198  * the channel this config applies to.
6199  *
6200  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
6201  * HTLC balance when a channel appears on-chain whereas
6202  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
6203  * (non-HTLC-encumbered) balance.
6204  *
6205  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
6206  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
6207  * commitment transaction at least once per this many blocks (minus some margin to allow us
6208  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
6209  * the spending transaction).
6210  *
6211  * Default value: 72 (12 hours at an average of 6 blocks/hour).
6212  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
6213  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
6214  *
6215  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
6216  */
6217 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
6218
6219 /**
6220  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
6221  * the channel this config applies to.
6222  *
6223  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
6224  * HTLC balance when a channel appears on-chain whereas
6225  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
6226  * (non-HTLC-encumbered) balance.
6227  *
6228  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
6229  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
6230  * commitment transaction at least once per this many blocks (minus some margin to allow us
6231  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
6232  * the spending transaction).
6233  *
6234  * Default value: 72 (12 hours at an average of 6 blocks/hour).
6235  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
6236  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
6237  *
6238  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
6239  */
6240 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
6241
6242 /**
6243  * Set to announce the channel publicly and notify all nodes that they can route via this
6244  * channel.
6245  *
6246  * This should only be set to true for nodes which expect to be online reliably.
6247  *
6248  * As the node which funds a channel picks this value this will only apply for new outbound
6249  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
6250  *
6251  * This cannot be changed after the initial channel handshake.
6252  *
6253  * Default value: false.
6254  */
6255 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
6256
6257 /**
6258  * Set to announce the channel publicly and notify all nodes that they can route via this
6259  * channel.
6260  *
6261  * This should only be set to true for nodes which expect to be online reliably.
6262  *
6263  * As the node which funds a channel picks this value this will only apply for new outbound
6264  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
6265  *
6266  * This cannot be changed after the initial channel handshake.
6267  *
6268  * Default value: false.
6269  */
6270 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
6271
6272 /**
6273  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
6274  * supports it, they will then enforce the mutual-close output to us matches what we provided
6275  * at intialization, preventing us from closing to an alternate pubkey.
6276  *
6277  * This is set to true by default to provide a slight increase in security, though ultimately
6278  * any attacker who is able to take control of a channel can just as easily send the funds via
6279  * lightning payments, so we never require that our counterparties support this option.
6280  *
6281  * This cannot be changed after a channel has been initialized.
6282  *
6283  * Default value: true.
6284  */
6285 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
6286
6287 /**
6288  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
6289  * supports it, they will then enforce the mutual-close output to us matches what we provided
6290  * at intialization, preventing us from closing to an alternate pubkey.
6291  *
6292  * This is set to true by default to provide a slight increase in security, though ultimately
6293  * any attacker who is able to take control of a channel can just as easily send the funds via
6294  * lightning payments, so we never require that our counterparties support this option.
6295  *
6296  * This cannot be changed after a channel has been initialized.
6297  *
6298  * Default value: true.
6299  */
6300 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
6301
6302 /**
6303  * Constructs a new ChannelConfig given each field
6304  */
6305 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);
6306
6307 /**
6308  * Creates a copy of the ChannelConfig
6309  */
6310 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
6311
6312 /**
6313  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
6314  */
6315 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
6316
6317 /**
6318  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
6319  */
6320 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
6321
6322 /**
6323  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
6324  */
6325 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
6326
6327 /**
6328  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
6329  */
6330 void UserConfig_free(struct LDKUserConfig this_obj);
6331
6332 /**
6333  * Channel config that we propose to our counterparty.
6334  */
6335 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
6336
6337 /**
6338  * Channel config that we propose to our counterparty.
6339  */
6340 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
6341
6342 /**
6343  * Limits applied to our counterparty's proposed channel config settings.
6344  */
6345 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
6346
6347 /**
6348  * Limits applied to our counterparty's proposed channel config settings.
6349  */
6350 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
6351
6352 /**
6353  * Channel config which affects behavior during channel lifetime.
6354  */
6355 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
6356
6357 /**
6358  * Channel config which affects behavior during channel lifetime.
6359  */
6360 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
6361
6362 /**
6363  * Constructs a new UserConfig given each field
6364  */
6365 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);
6366
6367 /**
6368  * Creates a copy of the UserConfig
6369  */
6370 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
6371
6372 /**
6373  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
6374  */
6375 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
6376
6377 /**
6378  * Creates a copy of the AccessError
6379  */
6380 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
6381
6382 /**
6383  * Calls the free function if one is set
6384  */
6385 void Access_free(struct LDKAccess this_ptr);
6386
6387 /**
6388  * Calls the free function if one is set
6389  */
6390 void Listen_free(struct LDKListen this_ptr);
6391
6392 /**
6393  * Calls the free function if one is set
6394  */
6395 void Watch_free(struct LDKWatch this_ptr);
6396
6397 /**
6398  * Calls the free function if one is set
6399  */
6400 void Filter_free(struct LDKFilter this_ptr);
6401
6402 /**
6403  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
6404  */
6405 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
6406
6407 /**
6408  * First block where the transaction output may have been spent.
6409  */
6410 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
6411
6412 /**
6413  * First block where the transaction output may have been spent.
6414  */
6415 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6416
6417 /**
6418  * Outpoint identifying the transaction output.
6419  */
6420 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
6421
6422 /**
6423  * Outpoint identifying the transaction output.
6424  */
6425 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
6426
6427 /**
6428  * Spending condition of the transaction output.
6429  */
6430 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
6431
6432 /**
6433  * Spending condition of the transaction output.
6434  */
6435 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
6436
6437 /**
6438  * Constructs a new WatchedOutput given each field
6439  */
6440 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
6441
6442 /**
6443  * Calls the free function if one is set
6444  */
6445 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
6446
6447 /**
6448  * Creates a copy of the ConfirmationTarget
6449  */
6450 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
6451
6452 /**
6453  * Calls the free function if one is set
6454  */
6455 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
6456
6457 /**
6458  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
6459  */
6460 void ChainMonitor_free(struct LDKChainMonitor this_obj);
6461
6462 /**
6463  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
6464  * of a channel and reacting accordingly based on transactions in the connected block. See
6465  * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
6466  * be returned by [`chain::Watch::release_pending_monitor_events`].
6467  *
6468  * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
6469  * calls must not exclude any transactions matching the new outputs nor any in-block
6470  * descendants of such transactions. It is not necessary to re-fetch the block to obtain
6471  * updated `txdata`.
6472  */
6473 void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
6474
6475 /**
6476  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
6477  * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
6478  * details.
6479  */
6480 void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
6481
6482 /**
6483  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
6484  *
6485  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
6486  * will call back to it indicating transactions and outputs of interest. This allows clients to
6487  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
6488  * always need to fetch full blocks absent another means for determining which blocks contain
6489  * transactions relevant to the watched channels.
6490  */
6491 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
6492
6493 /**
6494  * Constructs a new Watch which calls the relevant methods on this_arg.
6495  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
6496  */
6497 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
6498
6499 /**
6500  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
6501  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
6502  */
6503 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
6504
6505 /**
6506  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
6507  */
6508 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
6509
6510 /**
6511  * The sequence number of this update. Updates *must* be replayed in-order according to this
6512  * sequence number (and updates may panic if they are not). The update_id values are strictly
6513  * increasing and increase by one for each new update, with one exception specified below.
6514  *
6515  * This sequence number is also used to track up to which points updates which returned
6516  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
6517  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
6518  *
6519  * The only instance where update_id values are not strictly increasing is the case where we
6520  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
6521  * its docs for more details.
6522  */
6523 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
6524
6525 /**
6526  * The sequence number of this update. Updates *must* be replayed in-order according to this
6527  * sequence number (and updates may panic if they are not). The update_id values are strictly
6528  * increasing and increase by one for each new update, with one exception specified below.
6529  *
6530  * This sequence number is also used to track up to which points updates which returned
6531  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
6532  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
6533  *
6534  * The only instance where update_id values are not strictly increasing is the case where we
6535  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
6536  * its docs for more details.
6537  */
6538 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
6539
6540 /**
6541  * Creates a copy of the ChannelMonitorUpdate
6542  */
6543 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
6544
6545 /**
6546  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
6547  */
6548 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
6549
6550 /**
6551  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
6552  */
6553 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
6554
6555 /**
6556  * Creates a copy of the ChannelMonitorUpdateErr
6557  */
6558 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
6559
6560 /**
6561  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
6562  */
6563 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
6564
6565 /**
6566  * Creates a copy of the MonitorUpdateError
6567  */
6568 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
6569
6570 /**
6571  * Frees any resources used by the MonitorEvent
6572  */
6573 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
6574
6575 /**
6576  * Creates a copy of the MonitorEvent
6577  */
6578 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
6579
6580 /**
6581  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
6582  */
6583 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
6584
6585 /**
6586  * Creates a copy of the HTLCUpdate
6587  */
6588 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
6589
6590 /**
6591  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
6592  */
6593 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
6594
6595 /**
6596  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
6597  */
6598 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
6599
6600 /**
6601  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
6602  */
6603 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
6604
6605 /**
6606  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
6607  */
6608 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
6609
6610 /**
6611  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
6612  * itself.
6613  *
6614  * panics if the given update is not the next update by update_id.
6615  */
6616 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);
6617
6618 /**
6619  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
6620  * ChannelMonitor.
6621  */
6622 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
6623
6624 /**
6625  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
6626  */
6627 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
6628
6629 /**
6630  * Gets a list of txids, with their output scripts (in the order they appear in the
6631  * transaction), which we must learn about spends of via block_connected().
6632  */
6633 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
6634
6635 /**
6636  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
6637  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
6638  * have been registered.
6639  */
6640 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
6641
6642 /**
6643  * Get the list of HTLCs who's status has been updated on chain. This should be called by
6644  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
6645  */
6646 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
6647
6648 /**
6649  * Gets the list of pending events which were generated by previous actions, clearing the list
6650  * in the process.
6651  *
6652  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
6653  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
6654  * no internal locking in ChannelMonitors.
6655  */
6656 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
6657
6658 /**
6659  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
6660  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
6661  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
6662  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
6663  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
6664  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
6665  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
6666  * out-of-band the other node operator to coordinate with him if option is available to you.
6667  * In any-case, choice is up to the user.
6668  */
6669 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);
6670
6671 /**
6672  * Processes transactions in a newly connected block, which may result in any of the following:
6673  * - update the monitor's state against resolved HTLCs
6674  * - punish the counterparty in the case of seeing a revoked commitment transaction
6675  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
6676  * - detect settled outputs for later spending
6677  * - schedule and bump any in-flight claims
6678  *
6679  * Returns any new outputs to watch from `txdata`; after called, these are also included in
6680  * [`get_outputs_to_watch`].
6681  *
6682  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
6683  */
6684 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ 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);
6685
6686 /**
6687  * Determines if the disconnected block contained any transactions of interest and updates
6688  * appropriately.
6689  */
6690 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);
6691
6692 /**
6693  * Calls the free function if one is set
6694  */
6695 void Persist_free(struct LDKPersist this_ptr);
6696
6697 /**
6698  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
6699  */
6700 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
6701
6702 /**
6703  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
6704  */
6705 void OutPoint_free(struct LDKOutPoint this_obj);
6706
6707 /**
6708  * The referenced transaction's txid.
6709  */
6710 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
6711
6712 /**
6713  * The referenced transaction's txid.
6714  */
6715 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6716
6717 /**
6718  * The index of the referenced output in its transaction's vout.
6719  */
6720 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
6721
6722 /**
6723  * The index of the referenced output in its transaction's vout.
6724  */
6725 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
6726
6727 /**
6728  * Constructs a new OutPoint given each field
6729  */
6730 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
6731
6732 /**
6733  * Creates a copy of the OutPoint
6734  */
6735 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
6736
6737 /**
6738  * Convert an `OutPoint` to a lightning channel id.
6739  */
6740 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
6741
6742 /**
6743  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
6744  */
6745 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
6746
6747 /**
6748  * Read a OutPoint from a byte array, created by OutPoint_write
6749  */
6750 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
6751
6752 /**
6753  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
6754  */
6755 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
6756
6757 /**
6758  * The outpoint which is spendable
6759  */
6760 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
6761
6762 /**
6763  * The outpoint which is spendable
6764  */
6765 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
6766
6767 /**
6768  * Per commitment point to derive delayed_payment_key by key holder
6769  */
6770 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
6771
6772 /**
6773  * Per commitment point to derive delayed_payment_key by key holder
6774  */
6775 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6776
6777 /**
6778  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
6779  * the witness_script.
6780  */
6781 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
6782
6783 /**
6784  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
6785  * the witness_script.
6786  */
6787 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
6788
6789 /**
6790  * The output which is referenced by the given outpoint
6791  */
6792 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
6793
6794 /**
6795  * The revocation point specific to the commitment transaction which was broadcast. Used to
6796  * derive the witnessScript for this output.
6797  */
6798 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
6799
6800 /**
6801  * The revocation point specific to the commitment transaction which was broadcast. Used to
6802  * derive the witnessScript for this output.
6803  */
6804 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6805
6806 /**
6807  * Arbitrary identification information returned by a call to
6808  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
6809  * the channel to spend the output.
6810  */
6811 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
6812
6813 /**
6814  * Arbitrary identification information returned by a call to
6815  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
6816  * the channel to spend the output.
6817  */
6818 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6819
6820 /**
6821  * The value of the channel which this output originated from, possibly indirectly.
6822  */
6823 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
6824
6825 /**
6826  * The value of the channel which this output originated from, possibly indirectly.
6827  */
6828 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
6829
6830 /**
6831  * Constructs a new DelayedPaymentOutputDescriptor given each field
6832  */
6833 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);
6834
6835 /**
6836  * Creates a copy of the DelayedPaymentOutputDescriptor
6837  */
6838 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
6839
6840 /**
6841  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
6842  */
6843 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
6844
6845 /**
6846  * The outpoint which is spendable
6847  */
6848 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
6849
6850 /**
6851  * The outpoint which is spendable
6852  */
6853 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
6854
6855 /**
6856  * The output which is referenced by the given outpoint
6857  */
6858 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
6859
6860 /**
6861  * Arbitrary identification information returned by a call to
6862  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
6863  * the channel to spend the output.
6864  */
6865 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
6866
6867 /**
6868  * Arbitrary identification information returned by a call to
6869  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
6870  * the channel to spend the output.
6871  */
6872 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6873
6874 /**
6875  * The value of the channel which this transactions spends.
6876  */
6877 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
6878
6879 /**
6880  * The value of the channel which this transactions spends.
6881  */
6882 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
6883
6884 /**
6885  * Constructs a new StaticPaymentOutputDescriptor given each field
6886  */
6887 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);
6888
6889 /**
6890  * Creates a copy of the StaticPaymentOutputDescriptor
6891  */
6892 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
6893
6894 /**
6895  * Frees any resources used by the SpendableOutputDescriptor
6896  */
6897 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
6898
6899 /**
6900  * Creates a copy of the SpendableOutputDescriptor
6901  */
6902 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
6903
6904 /**
6905  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
6906  */
6907 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
6908
6909 /**
6910  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
6911  */
6912 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
6913
6914 /**
6915  * Creates a copy of a Sign
6916  */
6917 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
6918
6919 /**
6920  * Calls the free function if one is set
6921  */
6922 void Sign_free(struct LDKSign this_ptr);
6923
6924 /**
6925  * Calls the free function if one is set
6926  */
6927 void KeysInterface_free(struct LDKKeysInterface this_ptr);
6928
6929 /**
6930  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
6931  */
6932 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
6933
6934 /**
6935  * Private key of anchor tx
6936  */
6937 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
6938
6939 /**
6940  * Private key of anchor tx
6941  */
6942 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
6943
6944 /**
6945  * Holder secret key for blinded revocation pubkey
6946  */
6947 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
6948
6949 /**
6950  * Holder secret key for blinded revocation pubkey
6951  */
6952 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
6953
6954 /**
6955  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
6956  */
6957 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
6958
6959 /**
6960  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
6961  */
6962 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
6963
6964 /**
6965  * Holder secret key used in HTLC tx
6966  */
6967 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
6968
6969 /**
6970  * Holder secret key used in HTLC tx
6971  */
6972 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
6973
6974 /**
6975  * Holder htlc secret key used in commitment tx htlc outputs
6976  */
6977 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
6978
6979 /**
6980  * Holder htlc secret key used in commitment tx htlc outputs
6981  */
6982 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
6983
6984 /**
6985  * Commitment seed
6986  */
6987 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
6988
6989 /**
6990  * Commitment seed
6991  */
6992 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6993
6994 /**
6995  * Creates a copy of the InMemorySigner
6996  */
6997 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
6998
6999 /**
7000  * Create a new InMemorySigner
7001  */
7002 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);
7003
7004 /**
7005  * Counterparty pubkeys.
7006  * Will panic if ready_channel wasn't called.
7007  */
7008 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
7009
7010 /**
7011  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
7012  * transactions, ie the amount of time that we have to wait to recover our funds if we
7013  * broadcast a transaction.
7014  * Will panic if ready_channel wasn't called.
7015  */
7016 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
7017
7018 /**
7019  * The contest_delay value specified by us and applied on transactions broadcastable
7020  * by our counterparty, ie the amount of time that they have to wait to recover their funds
7021  * if they broadcast a transaction.
7022  * Will panic if ready_channel wasn't called.
7023  */
7024 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
7025
7026 /**
7027  * Whether the holder is the initiator
7028  * Will panic if ready_channel wasn't called.
7029  */
7030 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
7031
7032 /**
7033  * Funding outpoint
7034  * Will panic if ready_channel wasn't called.
7035  */
7036 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
7037
7038 /**
7039  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
7040  * building transactions.
7041  *
7042  * Will panic if ready_channel wasn't called.
7043  */
7044 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
7045
7046 /**
7047  * Sign the single input of spend_tx at index `input_idx` which spends the output
7048  * described by descriptor, returning the witness stack for the input.
7049  *
7050  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
7051  * or is not spending the outpoint described by `descriptor.outpoint`.
7052  */
7053 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);
7054
7055 /**
7056  * Sign the single input of spend_tx at index `input_idx` which spends the output
7057  * described by descriptor, returning the witness stack for the input.
7058  *
7059  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
7060  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
7061  * sequence set to `descriptor.to_self_delay`.
7062  */
7063 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);
7064
7065 /**
7066  * Constructs a new Sign which calls the relevant methods on this_arg.
7067  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
7068  */
7069 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
7070
7071 /**
7072  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
7073  */
7074 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
7075
7076 /**
7077  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
7078  */
7079 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
7080
7081 /**
7082  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
7083  */
7084 void KeysManager_free(struct LDKKeysManager this_obj);
7085
7086 /**
7087  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
7088  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
7089  * starting_time isn't strictly required to actually be a time, but it must absolutely,
7090  * without a doubt, be unique to this instance. ie if you start multiple times with the same
7091  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
7092  * simply use the current time (with very high precision).
7093  *
7094  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
7095  * obviously, starting_time should be unique every time you reload the library - it is only
7096  * used to generate new ephemeral key data (which will be stored by the individual channel if
7097  * necessary).
7098  *
7099  * Note that the seed is required to recover certain on-chain funds independent of
7100  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
7101  * channel, and some on-chain during-closing funds.
7102  *
7103  * Note that until the 0.1 release there is no guarantee of backward compatibility between
7104  * versions. Once the library is more fully supported, the docs will be updated to include a
7105  * detailed description of the guarantee.
7106  */
7107 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
7108
7109 /**
7110  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
7111  *
7112  * Key derivation parameters are accessible through a per-channel secrets
7113  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
7114  * onchain output detection for which a corresponding delayed_payment_key must be derived.
7115  */
7116 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]);
7117
7118 /**
7119  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
7120  * output to the given change destination (if sufficient change value remains). The
7121  * transaction will have a feerate, at least, of the given value.
7122  *
7123  * Returns `Err(())` if the output value is greater than the input value minus required fee or
7124  * if a descriptor was duplicated.
7125  *
7126  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
7127  *
7128  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
7129  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
7130  */
7131 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);
7132
7133 /**
7134  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
7135  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
7136  */
7137 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
7138
7139 /**
7140  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
7141  */
7142 void ChannelManager_free(struct LDKChannelManager this_obj);
7143
7144 /**
7145  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
7146  */
7147 void ChainParameters_free(struct LDKChainParameters this_obj);
7148
7149 /**
7150  * The network for determining the `chain_hash` in Lightning messages.
7151  */
7152 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
7153
7154 /**
7155  * The network for determining the `chain_hash` in Lightning messages.
7156  */
7157 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
7158
7159 /**
7160  * The hash of the latest block successfully connected.
7161  */
7162 const uint8_t (*ChainParameters_get_latest_hash(const struct LDKChainParameters *NONNULL_PTR this_ptr))[32];
7163
7164 /**
7165  * The hash of the latest block successfully connected.
7166  */
7167 void ChainParameters_set_latest_hash(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7168
7169 /**
7170  * The height of the latest block successfully connected.
7171  *
7172  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
7173  */
7174 uintptr_t ChainParameters_get_latest_height(const struct LDKChainParameters *NONNULL_PTR this_ptr);
7175
7176 /**
7177  * The height of the latest block successfully connected.
7178  *
7179  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
7180  */
7181 void ChainParameters_set_latest_height(struct LDKChainParameters *NONNULL_PTR this_ptr, uintptr_t val);
7182
7183 /**
7184  * Constructs a new ChainParameters given each field
7185  */
7186 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKThirtyTwoBytes latest_hash_arg, uintptr_t latest_height_arg);
7187
7188 /**
7189  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
7190  */
7191 void ChannelDetails_free(struct LDKChannelDetails this_obj);
7192
7193 /**
7194  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
7195  * thereafter this is the txid of the funding transaction xor the funding transaction output).
7196  * Note that this means this value is *not* persistent - it can change once during the
7197  * lifetime of the channel.
7198  */
7199 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
7200
7201 /**
7202  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
7203  * thereafter this is the txid of the funding transaction xor the funding transaction output).
7204  * Note that this means this value is *not* persistent - it can change once during the
7205  * lifetime of the channel.
7206  */
7207 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7208
7209 /**
7210  * The position of the funding transaction in the chain. None if the funding transaction has
7211  * not yet been confirmed and the channel fully opened.
7212  */
7213 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7214
7215 /**
7216  * The position of the funding transaction in the chain. None if the funding transaction has
7217  * not yet been confirmed and the channel fully opened.
7218  */
7219 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
7220
7221 /**
7222  * The node_id of our counterparty
7223  */
7224 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7225
7226 /**
7227  * The node_id of our counterparty
7228  */
7229 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7230
7231 /**
7232  * The Features the channel counterparty provided upon last connection.
7233  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
7234  * many routing-relevant features are present in the init context.
7235  */
7236 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7237
7238 /**
7239  * The Features the channel counterparty provided upon last connection.
7240  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
7241  * many routing-relevant features are present in the init context.
7242  */
7243 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
7244
7245 /**
7246  * The value, in satoshis, of this channel as appears in the funding output
7247  */
7248 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7249
7250 /**
7251  * The value, in satoshis, of this channel as appears in the funding output
7252  */
7253 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
7254
7255 /**
7256  * The user_id passed in to create_channel, or 0 if the channel was inbound.
7257  */
7258 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7259
7260 /**
7261  * The user_id passed in to create_channel, or 0 if the channel was inbound.
7262  */
7263 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
7264
7265 /**
7266  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
7267  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
7268  * available for inclusion in new outbound HTLCs). This further does not include any pending
7269  * outgoing HTLCs which are awaiting some other resolution to be sent.
7270  */
7271 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7272
7273 /**
7274  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
7275  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
7276  * available for inclusion in new outbound HTLCs). This further does not include any pending
7277  * outgoing HTLCs which are awaiting some other resolution to be sent.
7278  */
7279 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
7280
7281 /**
7282  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
7283  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
7284  * available for inclusion in new inbound HTLCs).
7285  * Note that there are some corner cases not fully handled here, so the actual available
7286  * inbound capacity may be slightly higher than this.
7287  */
7288 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7289
7290 /**
7291  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
7292  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
7293  * available for inclusion in new inbound HTLCs).
7294  * Note that there are some corner cases not fully handled here, so the actual available
7295  * inbound capacity may be slightly higher than this.
7296  */
7297 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
7298
7299 /**
7300  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
7301  * the peer is connected, and (c) no monitor update failure is pending resolution.
7302  */
7303 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7304
7305 /**
7306  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
7307  * the peer is connected, and (c) no monitor update failure is pending resolution.
7308  */
7309 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
7310
7311 /**
7312  * Creates a copy of the ChannelDetails
7313  */
7314 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
7315
7316 /**
7317  * Frees any resources used by the PaymentSendFailure
7318  */
7319 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
7320
7321 /**
7322  * Creates a copy of the PaymentSendFailure
7323  */
7324 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
7325
7326 /**
7327  * Constructs a new ChannelManager to hold several channels and route between them.
7328  *
7329  * This is the main \"logic hub\" for all channel-related actions, and implements
7330  * ChannelMessageHandler.
7331  *
7332  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
7333  *
7334  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
7335  *
7336  * Users need to notify the new ChannelManager when a new block is connected or
7337  * disconnected using its `block_connected` and `block_disconnected` methods, starting
7338  * from after `params.latest_hash`.
7339  */
7340 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);
7341
7342 /**
7343  * Creates a new outbound channel to the given remote node and with the given value.
7344  *
7345  * user_id will be provided back as user_channel_id in FundingGenerationReady and
7346  * FundingBroadcastSafe events to allow tracking of which events correspond with which
7347  * create_channel call. Note that user_channel_id defaults to 0 for inbound channels, so you
7348  * may wish to avoid using 0 for user_id here.
7349  *
7350  * If successful, will generate a SendOpenChannel message event, so you should probably poll
7351  * PeerManager::process_events afterwards.
7352  *
7353  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
7354  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
7355  */
7356 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);
7357
7358 /**
7359  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
7360  * more information.
7361  */
7362 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
7363
7364 /**
7365  * Gets the list of usable channels, in random order. Useful as an argument to
7366  * get_route to ensure non-announced channels are used.
7367  *
7368  * These are guaranteed to have their is_live value set to true, see the documentation for
7369  * ChannelDetails::is_live for more info on exactly what the criteria are.
7370  */
7371 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
7372
7373 /**
7374  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
7375  * will be accepted on the given channel, and after additional timeout/the closing of all
7376  * pending HTLCs, the channel will be closed on chain.
7377  *
7378  * May generate a SendShutdown message event on success, which should be relayed.
7379  */
7380 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
7381
7382 /**
7383  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
7384  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
7385  */
7386 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
7387
7388 /**
7389  * Force close all channels, immediately broadcasting the latest local commitment transaction
7390  * for each to the chain and rejecting new HTLCs on each.
7391  */
7392 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
7393
7394 /**
7395  * Sends a payment along a given route.
7396  *
7397  * Value parameters are provided via the last hop in route, see documentation for RouteHop
7398  * fields for more info.
7399  *
7400  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
7401  * payment), we don't do anything to stop you! We always try to ensure that if the provided
7402  * next hop knows the preimage to payment_hash they can claim an additional amount as
7403  * specified in the last hop in the route! Thus, you should probably do your own
7404  * payment_preimage tracking (which you should already be doing as they represent \"proof of
7405  * payment\") and prevent double-sends yourself.
7406  *
7407  * May generate SendHTLCs message(s) event on success, which should be relayed.
7408  *
7409  * Each path may have a different return value, and PaymentSendValue may return a Vec with
7410  * each entry matching the corresponding-index entry in the route paths, see
7411  * PaymentSendFailure for more info.
7412  *
7413  * In general, a path may raise:
7414  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
7415  *    node public key) is specified.
7416  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
7417  *    (including due to previous monitor update failure or new permanent monitor update
7418  *    failure).
7419  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
7420  *    relevant updates.
7421  *
7422  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
7423  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
7424  * different route unless you intend to pay twice!
7425  *
7426  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
7427  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
7428  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
7429  * must not contain multiple paths as multi-path payments require a recipient-provided
7430  * payment_secret.
7431  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
7432  * bit set (either as required or as available). If multiple paths are present in the Route,
7433  * we assume the invoice had the basic_mpp feature set.
7434  */
7435 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);
7436
7437 /**
7438  * Call this upon creation of a funding transaction for the given channel.
7439  *
7440  * Note that ALL inputs in the transaction pointed to by funding_txo MUST spend SegWit outputs
7441  * or your counterparty can steal your funds!
7442  *
7443  * Panics if a funding transaction has already been provided for this channel.
7444  *
7445  * May panic if the funding_txo is duplicative with some other channel (note that this should
7446  * be trivially prevented by using unique funding transaction keys per-channel).
7447  */
7448 void ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKOutPoint funding_txo);
7449
7450 /**
7451  * Generates a signed node_announcement from the given arguments and creates a
7452  * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
7453  * seen a channel_announcement from us (ie unless we have public channels open).
7454  *
7455  * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
7456  * to humans. They carry no in-protocol meaning.
7457  *
7458  * addresses represent the set (possibly empty) of socket addresses on which this node accepts
7459  * incoming connections. These will be broadcast to the network, publicly tying these
7460  * addresses together. If you wish to preserve user privacy, addresses should likely contain
7461  * only Tor Onion addresses.
7462  *
7463  * Panics if addresses is absurdly large (more than 500).
7464  */
7465 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
7466
7467 /**
7468  * Processes HTLCs which are pending waiting on random forward delay.
7469  *
7470  * Should only really ever be called in response to a PendingHTLCsForwardable event.
7471  * Will likely generate further events.
7472  */
7473 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
7474
7475 /**
7476  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
7477  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
7478  * to inform the network about the uselessness of these channels.
7479  *
7480  * This method handles all the details, and must be called roughly once per minute.
7481  *
7482  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
7483  */
7484 void ChannelManager_timer_chan_freshness_every_min(const struct LDKChannelManager *NONNULL_PTR this_arg);
7485
7486 /**
7487  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
7488  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
7489  * along the path (including in our own channel on which we received it).
7490  * Returns false if no payment was found to fail backwards, true if the process of failing the
7491  * HTLC backwards has been started.
7492  */
7493 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);
7494
7495 /**
7496  * Provides a payment preimage in response to a PaymentReceived event, returning true and
7497  * generating message events for the net layer to claim the payment, if possible. Thus, you
7498  * should probably kick the net layer to go send messages if this returns true!
7499  *
7500  * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
7501  * available within a few percent of the expected amount. This is critical for several
7502  * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
7503  * payment_preimage without having provided the full value and b) it avoids certain
7504  * privacy-breaking recipient-probing attacks which may reveal payment activity to
7505  * motivated attackers.
7506  *
7507  * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
7508  * set. Thus, for such payments we will claim any payments which do not under-pay.
7509  *
7510  * May panic if called except in response to a PaymentReceived event.
7511  */
7512 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);
7513
7514 /**
7515  * Gets the node_id held by this ChannelManager
7516  */
7517 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
7518
7519 /**
7520  * Restores a single, given channel to normal operation after a
7521  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
7522  * operation.
7523  *
7524  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
7525  * fully committed in every copy of the given channels' ChannelMonitors.
7526  *
7527  * Note that there is no effect to calling with a highest_applied_update_id other than the
7528  * current latest ChannelMonitorUpdate and one call to this function after multiple
7529  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
7530  * exists largely only to prevent races between this and concurrent update_monitor calls.
7531  *
7532  * Thus, the anticipated use is, at a high level:
7533  *  1) You register a chain::Watch with this ChannelManager,
7534  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
7535  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
7536  *     any time it cannot do so instantly,
7537  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
7538  *  4) once all remote copies are updated, you call this function with the update_id that
7539  *     completed, and once it is the latest the Channel will be re-enabled.
7540  */
7541 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);
7542
7543 /**
7544  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
7545  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
7546  */
7547 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
7548
7549 /**
7550  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
7551  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
7552  */
7553 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
7554
7555 /**
7556  * Constructs a new Listen which calls the relevant methods on this_arg.
7557  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
7558  */
7559 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
7560
7561 /**
7562  * Updates channel state based on transactions seen in a connected block.
7563  */
7564 void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
7565
7566 /**
7567  * Updates channel state based on a disconnected block.
7568  *
7569  * If necessary, the channel may be force-closed without letting the counterparty participate
7570  * in the shutdown.
7571  */
7572 void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]);
7573
7574 /**
7575  * Blocks until ChannelManager needs to be persisted. Only one listener on
7576  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
7577  * up.
7578  */
7579 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
7580
7581 /**
7582  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
7583  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
7584  */
7585 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
7586
7587 /**
7588  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
7589  */
7590 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
7591
7592 /**
7593  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
7594  */
7595 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
7596
7597 /**
7598  * The keys provider which will give us relevant keys. Some keys will be loaded during
7599  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
7600  * signing data.
7601  */
7602 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
7603
7604 /**
7605  * The keys provider which will give us relevant keys. Some keys will be loaded during
7606  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
7607  * signing data.
7608  */
7609 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
7610
7611 /**
7612  * The fee_estimator for use in the ChannelManager in the future.
7613  *
7614  * No calls to the FeeEstimator will be made during deserialization.
7615  */
7616 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
7617
7618 /**
7619  * The fee_estimator for use in the ChannelManager in the future.
7620  *
7621  * No calls to the FeeEstimator will be made during deserialization.
7622  */
7623 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
7624
7625 /**
7626  * The chain::Watch for use in the ChannelManager in the future.
7627  *
7628  * No calls to the chain::Watch will be made during deserialization. It is assumed that
7629  * you have deserialized ChannelMonitors separately and will add them to your
7630  * chain::Watch after deserializing this ChannelManager.
7631  */
7632 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
7633
7634 /**
7635  * The chain::Watch for use in the ChannelManager in the future.
7636  *
7637  * No calls to the chain::Watch will be made during deserialization. It is assumed that
7638  * you have deserialized ChannelMonitors separately and will add them to your
7639  * chain::Watch after deserializing this ChannelManager.
7640  */
7641 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
7642
7643 /**
7644  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
7645  * used to broadcast the latest local commitment transactions of channels which must be
7646  * force-closed during deserialization.
7647  */
7648 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
7649
7650 /**
7651  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
7652  * used to broadcast the latest local commitment transactions of channels which must be
7653  * force-closed during deserialization.
7654  */
7655 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
7656
7657 /**
7658  * The Logger for use in the ChannelManager and which may be used to log information during
7659  * deserialization.
7660  */
7661 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
7662
7663 /**
7664  * The Logger for use in the ChannelManager and which may be used to log information during
7665  * deserialization.
7666  */
7667 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
7668
7669 /**
7670  * Default settings used for new channels. Any existing channels will continue to use the
7671  * runtime settings which were stored when the ChannelManager was serialized.
7672  */
7673 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
7674
7675 /**
7676  * Default settings used for new channels. Any existing channels will continue to use the
7677  * runtime settings which were stored when the ChannelManager was serialized.
7678  */
7679 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
7680
7681 /**
7682  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
7683  * HashMap for you. This is primarily useful for C bindings where it is not practical to
7684  * populate a HashMap directly from C.
7685  */
7686 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);
7687
7688 /**
7689  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
7690  */
7691 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
7692
7693 /**
7694  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
7695  */
7696 void DecodeError_free(struct LDKDecodeError this_obj);
7697
7698 /**
7699  * Creates a copy of the DecodeError
7700  */
7701 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
7702
7703 /**
7704  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
7705  */
7706 void Init_free(struct LDKInit this_obj);
7707
7708 /**
7709  * The relevant features which the sender supports
7710  */
7711 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
7712
7713 /**
7714  * The relevant features which the sender supports
7715  */
7716 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
7717
7718 /**
7719  * Constructs a new Init given each field
7720  */
7721 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
7722
7723 /**
7724  * Creates a copy of the Init
7725  */
7726 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
7727
7728 /**
7729  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
7730  */
7731 void ErrorMessage_free(struct LDKErrorMessage this_obj);
7732
7733 /**
7734  * The channel ID involved in the error
7735  */
7736 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
7737
7738 /**
7739  * The channel ID involved in the error
7740  */
7741 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7742
7743 /**
7744  * A possibly human-readable error description.
7745  * The string should be sanitized before it is used (e.g. emitted to logs
7746  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
7747  * vulnerability in the terminal emulator or the logging subsystem.
7748  */
7749 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
7750
7751 /**
7752  * A possibly human-readable error description.
7753  * The string should be sanitized before it is used (e.g. emitted to logs
7754  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
7755  * vulnerability in the terminal emulator or the logging subsystem.
7756  */
7757 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
7758
7759 /**
7760  * Constructs a new ErrorMessage given each field
7761  */
7762 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg);
7763
7764 /**
7765  * Creates a copy of the ErrorMessage
7766  */
7767 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
7768
7769 /**
7770  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
7771  */
7772 void Ping_free(struct LDKPing this_obj);
7773
7774 /**
7775  * The desired response length
7776  */
7777 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
7778
7779 /**
7780  * The desired response length
7781  */
7782 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
7783
7784 /**
7785  * The ping packet size.
7786  * This field is not sent on the wire. byteslen zeros are sent.
7787  */
7788 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
7789
7790 /**
7791  * The ping packet size.
7792  * This field is not sent on the wire. byteslen zeros are sent.
7793  */
7794 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
7795
7796 /**
7797  * Constructs a new Ping given each field
7798  */
7799 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
7800
7801 /**
7802  * Creates a copy of the Ping
7803  */
7804 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
7805
7806 /**
7807  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
7808  */
7809 void Pong_free(struct LDKPong this_obj);
7810
7811 /**
7812  * The pong packet size.
7813  * This field is not sent on the wire. byteslen zeros are sent.
7814  */
7815 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
7816
7817 /**
7818  * The pong packet size.
7819  * This field is not sent on the wire. byteslen zeros are sent.
7820  */
7821 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
7822
7823 /**
7824  * Constructs a new Pong given each field
7825  */
7826 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
7827
7828 /**
7829  * Creates a copy of the Pong
7830  */
7831 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
7832
7833 /**
7834  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
7835  */
7836 void OpenChannel_free(struct LDKOpenChannel this_obj);
7837
7838 /**
7839  * The genesis hash of the blockchain where the channel is to be opened
7840  */
7841 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
7842
7843 /**
7844  * The genesis hash of the blockchain where the channel is to be opened
7845  */
7846 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7847
7848 /**
7849  * A temporary channel ID, until the funding outpoint is announced
7850  */
7851 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
7852
7853 /**
7854  * A temporary channel ID, until the funding outpoint is announced
7855  */
7856 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7857
7858 /**
7859  * The channel value
7860  */
7861 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7862
7863 /**
7864  * The channel value
7865  */
7866 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
7867
7868 /**
7869  * The amount to push to the counterparty as part of the open, in milli-satoshi
7870  */
7871 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7872
7873 /**
7874  * The amount to push to the counterparty as part of the open, in milli-satoshi
7875  */
7876 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
7877
7878 /**
7879  * The threshold below which outputs on transactions broadcast by sender will be omitted
7880  */
7881 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7882
7883 /**
7884  * The threshold below which outputs on transactions broadcast by sender will be omitted
7885  */
7886 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
7887
7888 /**
7889  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
7890  */
7891 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7892
7893 /**
7894  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
7895  */
7896 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
7897
7898 /**
7899  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
7900  */
7901 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7902
7903 /**
7904  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
7905  */
7906 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
7907
7908 /**
7909  * The minimum HTLC size incoming to sender, in milli-satoshi
7910  */
7911 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7912
7913 /**
7914  * The minimum HTLC size incoming to sender, in milli-satoshi
7915  */
7916 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
7917
7918 /**
7919  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
7920  */
7921 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7922
7923 /**
7924  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
7925  */
7926 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
7927
7928 /**
7929  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
7930  */
7931 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7932
7933 /**
7934  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
7935  */
7936 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
7937
7938 /**
7939  * The maximum number of inbound HTLCs towards sender
7940  */
7941 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7942
7943 /**
7944  * The maximum number of inbound HTLCs towards sender
7945  */
7946 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
7947
7948 /**
7949  * The sender's key controlling the funding transaction
7950  */
7951 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7952
7953 /**
7954  * The sender's key controlling the funding transaction
7955  */
7956 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7957
7958 /**
7959  * Used to derive a revocation key for transactions broadcast by counterparty
7960  */
7961 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7962
7963 /**
7964  * Used to derive a revocation key for transactions broadcast by counterparty
7965  */
7966 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7967
7968 /**
7969  * A payment key to sender for transactions broadcast by counterparty
7970  */
7971 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7972
7973 /**
7974  * A payment key to sender for transactions broadcast by counterparty
7975  */
7976 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7977
7978 /**
7979  * Used to derive a payment key to sender for transactions broadcast by sender
7980  */
7981 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7982
7983 /**
7984  * Used to derive a payment key to sender for transactions broadcast by sender
7985  */
7986 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7987
7988 /**
7989  * Used to derive an HTLC payment key to sender
7990  */
7991 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7992
7993 /**
7994  * Used to derive an HTLC payment key to sender
7995  */
7996 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7997
7998 /**
7999  * The first to-be-broadcast-by-sender transaction's per commitment point
8000  */
8001 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
8002
8003 /**
8004  * The first to-be-broadcast-by-sender transaction's per commitment point
8005  */
8006 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8007
8008 /**
8009  * Channel flags
8010  */
8011 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
8012
8013 /**
8014  * Channel flags
8015  */
8016 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
8017
8018 /**
8019  * Creates a copy of the OpenChannel
8020  */
8021 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
8022
8023 /**
8024  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
8025  */
8026 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
8027
8028 /**
8029  * A temporary channel ID, until the funding outpoint is announced
8030  */
8031 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
8032
8033 /**
8034  * A temporary channel ID, until the funding outpoint is announced
8035  */
8036 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8037
8038 /**
8039  * The threshold below which outputs on transactions broadcast by sender will be omitted
8040  */
8041 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8042
8043 /**
8044  * The threshold below which outputs on transactions broadcast by sender will be omitted
8045  */
8046 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
8047
8048 /**
8049  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
8050  */
8051 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8052
8053 /**
8054  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
8055  */
8056 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
8057
8058 /**
8059  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
8060  */
8061 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8062
8063 /**
8064  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
8065  */
8066 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
8067
8068 /**
8069  * The minimum HTLC size incoming to sender, in milli-satoshi
8070  */
8071 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8072
8073 /**
8074  * The minimum HTLC size incoming to sender, in milli-satoshi
8075  */
8076 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
8077
8078 /**
8079  * Minimum depth of the funding transaction before the channel is considered open
8080  */
8081 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8082
8083 /**
8084  * Minimum depth of the funding transaction before the channel is considered open
8085  */
8086 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
8087
8088 /**
8089  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
8090  */
8091 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8092
8093 /**
8094  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
8095  */
8096 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
8097
8098 /**
8099  * The maximum number of inbound HTLCs towards sender
8100  */
8101 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8102
8103 /**
8104  * The maximum number of inbound HTLCs towards sender
8105  */
8106 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
8107
8108 /**
8109  * The sender's key controlling the funding transaction
8110  */
8111 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8112
8113 /**
8114  * The sender's key controlling the funding transaction
8115  */
8116 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8117
8118 /**
8119  * Used to derive a revocation key for transactions broadcast by counterparty
8120  */
8121 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8122
8123 /**
8124  * Used to derive a revocation key for transactions broadcast by counterparty
8125  */
8126 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8127
8128 /**
8129  * A payment key to sender for transactions broadcast by counterparty
8130  */
8131 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8132
8133 /**
8134  * A payment key to sender for transactions broadcast by counterparty
8135  */
8136 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8137
8138 /**
8139  * Used to derive a payment key to sender for transactions broadcast by sender
8140  */
8141 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8142
8143 /**
8144  * Used to derive a payment key to sender for transactions broadcast by sender
8145  */
8146 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8147
8148 /**
8149  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
8150  */
8151 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8152
8153 /**
8154  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
8155  */
8156 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8157
8158 /**
8159  * The first to-be-broadcast-by-sender transaction's per commitment point
8160  */
8161 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8162
8163 /**
8164  * The first to-be-broadcast-by-sender transaction's per commitment point
8165  */
8166 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8167
8168 /**
8169  * Creates a copy of the AcceptChannel
8170  */
8171 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
8172
8173 /**
8174  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
8175  */
8176 void FundingCreated_free(struct LDKFundingCreated this_obj);
8177
8178 /**
8179  * A temporary channel ID, until the funding is established
8180  */
8181 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
8182
8183 /**
8184  * A temporary channel ID, until the funding is established
8185  */
8186 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8187
8188 /**
8189  * The funding transaction ID
8190  */
8191 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
8192
8193 /**
8194  * The funding transaction ID
8195  */
8196 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8197
8198 /**
8199  * The specific output index funding this channel
8200  */
8201 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
8202
8203 /**
8204  * The specific output index funding this channel
8205  */
8206 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
8207
8208 /**
8209  * The signature of the channel initiator (funder) on the funding transaction
8210  */
8211 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
8212
8213 /**
8214  * The signature of the channel initiator (funder) on the funding transaction
8215  */
8216 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
8217
8218 /**
8219  * Constructs a new FundingCreated given each field
8220  */
8221 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);
8222
8223 /**
8224  * Creates a copy of the FundingCreated
8225  */
8226 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
8227
8228 /**
8229  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
8230  */
8231 void FundingSigned_free(struct LDKFundingSigned this_obj);
8232
8233 /**
8234  * The channel ID
8235  */
8236 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
8237
8238 /**
8239  * The channel ID
8240  */
8241 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8242
8243 /**
8244  * The signature of the channel acceptor (fundee) on the funding transaction
8245  */
8246 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
8247
8248 /**
8249  * The signature of the channel acceptor (fundee) on the funding transaction
8250  */
8251 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
8252
8253 /**
8254  * Constructs a new FundingSigned given each field
8255  */
8256 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
8257
8258 /**
8259  * Creates a copy of the FundingSigned
8260  */
8261 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
8262
8263 /**
8264  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
8265  */
8266 void FundingLocked_free(struct LDKFundingLocked this_obj);
8267
8268 /**
8269  * The channel ID
8270  */
8271 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
8272
8273 /**
8274  * The channel ID
8275  */
8276 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8277
8278 /**
8279  * The per-commitment point of the second commitment transaction
8280  */
8281 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
8282
8283 /**
8284  * The per-commitment point of the second commitment transaction
8285  */
8286 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8287
8288 /**
8289  * Constructs a new FundingLocked given each field
8290  */
8291 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
8292
8293 /**
8294  * Creates a copy of the FundingLocked
8295  */
8296 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
8297
8298 /**
8299  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
8300  */
8301 void Shutdown_free(struct LDKShutdown this_obj);
8302
8303 /**
8304  * The channel ID
8305  */
8306 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
8307
8308 /**
8309  * The channel ID
8310  */
8311 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8312
8313 /**
8314  * The destination of this peer's funds on closing.
8315  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
8316  */
8317 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
8318
8319 /**
8320  * The destination of this peer's funds on closing.
8321  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
8322  */
8323 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
8324
8325 /**
8326  * Constructs a new Shutdown given each field
8327  */
8328 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
8329
8330 /**
8331  * Creates a copy of the Shutdown
8332  */
8333 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
8334
8335 /**
8336  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
8337  */
8338 void ClosingSigned_free(struct LDKClosingSigned this_obj);
8339
8340 /**
8341  * The channel ID
8342  */
8343 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
8344
8345 /**
8346  * The channel ID
8347  */
8348 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8349
8350 /**
8351  * The proposed total fee for the closing transaction
8352  */
8353 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
8354
8355 /**
8356  * The proposed total fee for the closing transaction
8357  */
8358 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
8359
8360 /**
8361  * A signature on the closing transaction
8362  */
8363 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
8364
8365 /**
8366  * A signature on the closing transaction
8367  */
8368 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
8369
8370 /**
8371  * Constructs a new ClosingSigned given each field
8372  */
8373 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
8374
8375 /**
8376  * Creates a copy of the ClosingSigned
8377  */
8378 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
8379
8380 /**
8381  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
8382  */
8383 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
8384
8385 /**
8386  * The channel ID
8387  */
8388 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
8389
8390 /**
8391  * The channel ID
8392  */
8393 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8394
8395 /**
8396  * The HTLC ID
8397  */
8398 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
8399
8400 /**
8401  * The HTLC ID
8402  */
8403 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
8404
8405 /**
8406  * The HTLC value in milli-satoshi
8407  */
8408 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
8409
8410 /**
8411  * The HTLC value in milli-satoshi
8412  */
8413 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
8414
8415 /**
8416  * The payment hash, the pre-image of which controls HTLC redemption
8417  */
8418 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
8419
8420 /**
8421  * The payment hash, the pre-image of which controls HTLC redemption
8422  */
8423 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8424
8425 /**
8426  * The expiry height of the HTLC
8427  */
8428 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
8429
8430 /**
8431  * The expiry height of the HTLC
8432  */
8433 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
8434
8435 /**
8436  * Creates a copy of the UpdateAddHTLC
8437  */
8438 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
8439
8440 /**
8441  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
8442  */
8443 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
8444
8445 /**
8446  * The channel ID
8447  */
8448 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
8449
8450 /**
8451  * The channel ID
8452  */
8453 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8454
8455 /**
8456  * The HTLC ID
8457  */
8458 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
8459
8460 /**
8461  * The HTLC ID
8462  */
8463 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
8464
8465 /**
8466  * The pre-image of the payment hash, allowing HTLC redemption
8467  */
8468 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
8469
8470 /**
8471  * The pre-image of the payment hash, allowing HTLC redemption
8472  */
8473 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8474
8475 /**
8476  * Constructs a new UpdateFulfillHTLC given each field
8477  */
8478 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
8479
8480 /**
8481  * Creates a copy of the UpdateFulfillHTLC
8482  */
8483 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
8484
8485 /**
8486  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
8487  */
8488 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
8489
8490 /**
8491  * The channel ID
8492  */
8493 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
8494
8495 /**
8496  * The channel ID
8497  */
8498 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8499
8500 /**
8501  * The HTLC ID
8502  */
8503 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
8504
8505 /**
8506  * The HTLC ID
8507  */
8508 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
8509
8510 /**
8511  * Creates a copy of the UpdateFailHTLC
8512  */
8513 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
8514
8515 /**
8516  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
8517  */
8518 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
8519
8520 /**
8521  * The channel ID
8522  */
8523 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
8524
8525 /**
8526  * The channel ID
8527  */
8528 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8529
8530 /**
8531  * The HTLC ID
8532  */
8533 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
8534
8535 /**
8536  * The HTLC ID
8537  */
8538 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
8539
8540 /**
8541  * The failure code
8542  */
8543 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
8544
8545 /**
8546  * The failure code
8547  */
8548 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
8549
8550 /**
8551  * Creates a copy of the UpdateFailMalformedHTLC
8552  */
8553 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
8554
8555 /**
8556  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
8557  */
8558 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
8559
8560 /**
8561  * The channel ID
8562  */
8563 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
8564
8565 /**
8566  * The channel ID
8567  */
8568 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8569
8570 /**
8571  * A signature on the commitment transaction
8572  */
8573 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
8574
8575 /**
8576  * A signature on the commitment transaction
8577  */
8578 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
8579
8580 /**
8581  * Signatures on the HTLC transactions
8582  */
8583 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
8584
8585 /**
8586  * Constructs a new CommitmentSigned given each field
8587  */
8588 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
8589
8590 /**
8591  * Creates a copy of the CommitmentSigned
8592  */
8593 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
8594
8595 /**
8596  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
8597  */
8598 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
8599
8600 /**
8601  * The channel ID
8602  */
8603 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
8604
8605 /**
8606  * The channel ID
8607  */
8608 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8609
8610 /**
8611  * The secret corresponding to the per-commitment point
8612  */
8613 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
8614
8615 /**
8616  * The secret corresponding to the per-commitment point
8617  */
8618 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8619
8620 /**
8621  * The next sender-broadcast commitment transaction's per-commitment point
8622  */
8623 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
8624
8625 /**
8626  * The next sender-broadcast commitment transaction's per-commitment point
8627  */
8628 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8629
8630 /**
8631  * Constructs a new RevokeAndACK given each field
8632  */
8633 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);
8634
8635 /**
8636  * Creates a copy of the RevokeAndACK
8637  */
8638 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
8639
8640 /**
8641  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
8642  */
8643 void UpdateFee_free(struct LDKUpdateFee this_obj);
8644
8645 /**
8646  * The channel ID
8647  */
8648 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
8649
8650 /**
8651  * The channel ID
8652  */
8653 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8654
8655 /**
8656  * Fee rate per 1000-weight of the transaction
8657  */
8658 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
8659
8660 /**
8661  * Fee rate per 1000-weight of the transaction
8662  */
8663 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
8664
8665 /**
8666  * Constructs a new UpdateFee given each field
8667  */
8668 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
8669
8670 /**
8671  * Creates a copy of the UpdateFee
8672  */
8673 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
8674
8675 /**
8676  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
8677  */
8678 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
8679
8680 /**
8681  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
8682  * belonging to the recipient
8683  */
8684 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
8685
8686 /**
8687  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
8688  * belonging to the recipient
8689  */
8690 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8691
8692 /**
8693  * The sender's per-commitment point for their current commitment transaction
8694  */
8695 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
8696
8697 /**
8698  * The sender's per-commitment point for their current commitment transaction
8699  */
8700 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8701
8702 /**
8703  * Constructs a new DataLossProtect given each field
8704  */
8705 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
8706
8707 /**
8708  * Creates a copy of the DataLossProtect
8709  */
8710 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
8711
8712 /**
8713  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
8714  */
8715 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
8716
8717 /**
8718  * The channel ID
8719  */
8720 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
8721
8722 /**
8723  * The channel ID
8724  */
8725 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8726
8727 /**
8728  * The next commitment number for the sender
8729  */
8730 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
8731
8732 /**
8733  * The next commitment number for the sender
8734  */
8735 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
8736
8737 /**
8738  * The next commitment number for the recipient
8739  */
8740 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
8741
8742 /**
8743  * The next commitment number for the recipient
8744  */
8745 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
8746
8747 /**
8748  * Creates a copy of the ChannelReestablish
8749  */
8750 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
8751
8752 /**
8753  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
8754  */
8755 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
8756
8757 /**
8758  * The channel ID
8759  */
8760 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
8761
8762 /**
8763  * The channel ID
8764  */
8765 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8766
8767 /**
8768  * The short channel ID
8769  */
8770 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
8771
8772 /**
8773  * The short channel ID
8774  */
8775 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
8776
8777 /**
8778  * A signature by the node key
8779  */
8780 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
8781
8782 /**
8783  * A signature by the node key
8784  */
8785 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
8786
8787 /**
8788  * A signature by the funding key
8789  */
8790 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
8791
8792 /**
8793  * A signature by the funding key
8794  */
8795 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
8796
8797 /**
8798  * Constructs a new AnnouncementSignatures given each field
8799  */
8800 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);
8801
8802 /**
8803  * Creates a copy of the AnnouncementSignatures
8804  */
8805 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
8806
8807 /**
8808  * Frees any resources used by the NetAddress
8809  */
8810 void NetAddress_free(struct LDKNetAddress this_ptr);
8811
8812 /**
8813  * Creates a copy of the NetAddress
8814  */
8815 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
8816
8817 /**
8818  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
8819  */
8820 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
8821
8822 /**
8823  * Read a Result from a byte array, created by Result_write
8824  */
8825 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
8826
8827 /**
8828  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
8829  */
8830 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
8831
8832 /**
8833  * The advertised features
8834  */
8835 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
8836
8837 /**
8838  * The advertised features
8839  */
8840 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
8841
8842 /**
8843  * A strictly monotonic announcement counter, with gaps allowed
8844  */
8845 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
8846
8847 /**
8848  * A strictly monotonic announcement counter, with gaps allowed
8849  */
8850 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
8851
8852 /**
8853  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
8854  * to this node).
8855  */
8856 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
8857
8858 /**
8859  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
8860  * to this node).
8861  */
8862 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8863
8864 /**
8865  * An RGB color for UI purposes
8866  */
8867 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
8868
8869 /**
8870  * An RGB color for UI purposes
8871  */
8872 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
8873
8874 /**
8875  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
8876  * of uniqueness.
8877  */
8878 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
8879
8880 /**
8881  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
8882  * of uniqueness.
8883  */
8884 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8885
8886 /**
8887  * List of addresses on which this node is reachable
8888  */
8889 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
8890
8891 /**
8892  * Creates a copy of the UnsignedNodeAnnouncement
8893  */
8894 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
8895
8896 /**
8897  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
8898  */
8899 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
8900
8901 /**
8902  * The signature by the node key
8903  */
8904 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
8905
8906 /**
8907  * The signature by the node key
8908  */
8909 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
8910
8911 /**
8912  * The actual content of the announcement
8913  */
8914 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
8915
8916 /**
8917  * The actual content of the announcement
8918  */
8919 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
8920
8921 /**
8922  * Constructs a new NodeAnnouncement given each field
8923  */
8924 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
8925
8926 /**
8927  * Creates a copy of the NodeAnnouncement
8928  */
8929 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
8930
8931 /**
8932  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
8933  */
8934 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
8935
8936 /**
8937  * The advertised channel features
8938  */
8939 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
8940
8941 /**
8942  * The advertised channel features
8943  */
8944 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
8945
8946 /**
8947  * The genesis hash of the blockchain where the channel is to be opened
8948  */
8949 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
8950
8951 /**
8952  * The genesis hash of the blockchain where the channel is to be opened
8953  */
8954 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8955
8956 /**
8957  * The short channel ID
8958  */
8959 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
8960
8961 /**
8962  * The short channel ID
8963  */
8964 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
8965
8966 /**
8967  * One of the two node_ids which are endpoints of this channel
8968  */
8969 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
8970
8971 /**
8972  * One of the two node_ids which are endpoints of this channel
8973  */
8974 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8975
8976 /**
8977  * The other of the two node_ids which are endpoints of this channel
8978  */
8979 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
8980
8981 /**
8982  * The other of the two node_ids which are endpoints of this channel
8983  */
8984 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8985
8986 /**
8987  * The funding key for the first node
8988  */
8989 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
8990
8991 /**
8992  * The funding key for the first node
8993  */
8994 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8995
8996 /**
8997  * The funding key for the second node
8998  */
8999 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
9000
9001 /**
9002  * The funding key for the second node
9003  */
9004 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
9005
9006 /**
9007  * Creates a copy of the UnsignedChannelAnnouncement
9008  */
9009 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
9010
9011 /**
9012  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
9013  */
9014 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
9015
9016 /**
9017  * Authentication of the announcement by the first public node
9018  */
9019 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
9020
9021 /**
9022  * Authentication of the announcement by the first public node
9023  */
9024 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
9025
9026 /**
9027  * Authentication of the announcement by the second public node
9028  */
9029 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
9030
9031 /**
9032  * Authentication of the announcement by the second public node
9033  */
9034 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
9035
9036 /**
9037  * Proof of funding UTXO ownership by the first public node
9038  */
9039 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
9040
9041 /**
9042  * Proof of funding UTXO ownership by the first public node
9043  */
9044 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
9045
9046 /**
9047  * Proof of funding UTXO ownership by the second public node
9048  */
9049 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
9050
9051 /**
9052  * Proof of funding UTXO ownership by the second public node
9053  */
9054 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
9055
9056 /**
9057  * The actual announcement
9058  */
9059 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
9060
9061 /**
9062  * The actual announcement
9063  */
9064 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
9065
9066 /**
9067  * Constructs a new ChannelAnnouncement given each field
9068  */
9069 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);
9070
9071 /**
9072  * Creates a copy of the ChannelAnnouncement
9073  */
9074 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
9075
9076 /**
9077  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
9078  */
9079 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
9080
9081 /**
9082  * The genesis hash of the blockchain where the channel is to be opened
9083  */
9084 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
9085
9086 /**
9087  * The genesis hash of the blockchain where the channel is to be opened
9088  */
9089 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
9090
9091 /**
9092  * The short channel ID
9093  */
9094 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
9095
9096 /**
9097  * The short channel ID
9098  */
9099 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
9100
9101 /**
9102  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
9103  */
9104 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
9105
9106 /**
9107  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
9108  */
9109 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
9110
9111 /**
9112  * Channel flags
9113  */
9114 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
9115
9116 /**
9117  * Channel flags
9118  */
9119 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
9120
9121 /**
9122  * The number of blocks such that if:
9123  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
9124  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
9125  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
9126  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
9127  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
9128  * forwarding. Note that the HTLC sender is the one who originally sets this value when
9129  * constructing the route.
9130  */
9131 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
9132
9133 /**
9134  * The number of blocks such that if:
9135  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
9136  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
9137  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
9138  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
9139  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
9140  * forwarding. Note that the HTLC sender is the one who originally sets this value when
9141  * constructing the route.
9142  */
9143 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
9144
9145 /**
9146  * The minimum HTLC size incoming to sender, in milli-satoshi
9147  */
9148 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
9149
9150 /**
9151  * The minimum HTLC size incoming to sender, in milli-satoshi
9152  */
9153 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
9154
9155 /**
9156  * The base HTLC fee charged by sender, in milli-satoshi
9157  */
9158 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
9159
9160 /**
9161  * The base HTLC fee charged by sender, in milli-satoshi
9162  */
9163 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
9164
9165 /**
9166  * The amount to fee multiplier, in micro-satoshi
9167  */
9168 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
9169
9170 /**
9171  * The amount to fee multiplier, in micro-satoshi
9172  */
9173 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
9174
9175 /**
9176  * Creates a copy of the UnsignedChannelUpdate
9177  */
9178 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
9179
9180 /**
9181  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
9182  */
9183 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
9184
9185 /**
9186  * A signature of the channel update
9187  */
9188 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
9189
9190 /**
9191  * A signature of the channel update
9192  */
9193 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
9194
9195 /**
9196  * The actual channel update
9197  */
9198 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
9199
9200 /**
9201  * The actual channel update
9202  */
9203 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
9204
9205 /**
9206  * Constructs a new ChannelUpdate given each field
9207  */
9208 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
9209
9210 /**
9211  * Creates a copy of the ChannelUpdate
9212  */
9213 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
9214
9215 /**
9216  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
9217  */
9218 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
9219
9220 /**
9221  * The genesis hash of the blockchain being queried
9222  */
9223 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
9224
9225 /**
9226  * The genesis hash of the blockchain being queried
9227  */
9228 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
9229
9230 /**
9231  * The height of the first block for the channel UTXOs being queried
9232  */
9233 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
9234
9235 /**
9236  * The height of the first block for the channel UTXOs being queried
9237  */
9238 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
9239
9240 /**
9241  * The number of blocks to include in the query results
9242  */
9243 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
9244
9245 /**
9246  * The number of blocks to include in the query results
9247  */
9248 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
9249
9250 /**
9251  * Constructs a new QueryChannelRange given each field
9252  */
9253 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
9254
9255 /**
9256  * Creates a copy of the QueryChannelRange
9257  */
9258 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
9259
9260 /**
9261  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
9262  */
9263 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
9264
9265 /**
9266  * The genesis hash of the blockchain being queried
9267  */
9268 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
9269
9270 /**
9271  * The genesis hash of the blockchain being queried
9272  */
9273 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
9274
9275 /**
9276  * The height of the first block in the range of the reply
9277  */
9278 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
9279
9280 /**
9281  * The height of the first block in the range of the reply
9282  */
9283 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
9284
9285 /**
9286  * The number of blocks included in the range of the reply
9287  */
9288 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
9289
9290 /**
9291  * The number of blocks included in the range of the reply
9292  */
9293 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
9294
9295 /**
9296  * True when this is the final reply for a query
9297  */
9298 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
9299
9300 /**
9301  * True when this is the final reply for a query
9302  */
9303 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
9304
9305 /**
9306  * The short_channel_ids in the channel range
9307  */
9308 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
9309
9310 /**
9311  * Constructs a new ReplyChannelRange given each field
9312  */
9313 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);
9314
9315 /**
9316  * Creates a copy of the ReplyChannelRange
9317  */
9318 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
9319
9320 /**
9321  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
9322  */
9323 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
9324
9325 /**
9326  * The genesis hash of the blockchain being queried
9327  */
9328 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
9329
9330 /**
9331  * The genesis hash of the blockchain being queried
9332  */
9333 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
9334
9335 /**
9336  * The short_channel_ids that are being queried
9337  */
9338 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
9339
9340 /**
9341  * Constructs a new QueryShortChannelIds given each field
9342  */
9343 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
9344
9345 /**
9346  * Creates a copy of the QueryShortChannelIds
9347  */
9348 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
9349
9350 /**
9351  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
9352  */
9353 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
9354
9355 /**
9356  * The genesis hash of the blockchain that was queried
9357  */
9358 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
9359
9360 /**
9361  * The genesis hash of the blockchain that was queried
9362  */
9363 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
9364
9365 /**
9366  * Indicates if the query recipient maintains up-to-date channel
9367  * information for the chain_hash
9368  */
9369 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
9370
9371 /**
9372  * Indicates if the query recipient maintains up-to-date channel
9373  * information for the chain_hash
9374  */
9375 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
9376
9377 /**
9378  * Constructs a new ReplyShortChannelIdsEnd given each field
9379  */
9380 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
9381
9382 /**
9383  * Creates a copy of the ReplyShortChannelIdsEnd
9384  */
9385 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
9386
9387 /**
9388  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
9389  */
9390 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
9391
9392 /**
9393  * The genesis hash of the blockchain for channel and node information
9394  */
9395 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
9396
9397 /**
9398  * The genesis hash of the blockchain for channel and node information
9399  */
9400 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
9401
9402 /**
9403  * The starting unix timestamp
9404  */
9405 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
9406
9407 /**
9408  * The starting unix timestamp
9409  */
9410 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
9411
9412 /**
9413  * The range of information in seconds
9414  */
9415 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
9416
9417 /**
9418  * The range of information in seconds
9419  */
9420 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
9421
9422 /**
9423  * Constructs a new GossipTimestampFilter given each field
9424  */
9425 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
9426
9427 /**
9428  * Creates a copy of the GossipTimestampFilter
9429  */
9430 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
9431
9432 /**
9433  * Frees any resources used by the ErrorAction
9434  */
9435 void ErrorAction_free(struct LDKErrorAction this_ptr);
9436
9437 /**
9438  * Creates a copy of the ErrorAction
9439  */
9440 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
9441
9442 /**
9443  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
9444  */
9445 void LightningError_free(struct LDKLightningError this_obj);
9446
9447 /**
9448  * A human-readable message describing the error
9449  */
9450 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
9451
9452 /**
9453  * A human-readable message describing the error
9454  */
9455 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
9456
9457 /**
9458  * The action which should be taken against the offending peer.
9459  */
9460 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
9461
9462 /**
9463  * The action which should be taken against the offending peer.
9464  */
9465 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
9466
9467 /**
9468  * Constructs a new LightningError given each field
9469  */
9470 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
9471
9472 /**
9473  * Creates a copy of the LightningError
9474  */
9475 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
9476
9477 /**
9478  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
9479  */
9480 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
9481
9482 /**
9483  * update_add_htlc messages which should be sent
9484  */
9485 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
9486
9487 /**
9488  * update_fulfill_htlc messages which should be sent
9489  */
9490 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
9491
9492 /**
9493  * update_fail_htlc messages which should be sent
9494  */
9495 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
9496
9497 /**
9498  * update_fail_malformed_htlc messages which should be sent
9499  */
9500 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
9501
9502 /**
9503  * An update_fee message which should be sent
9504  */
9505 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
9506
9507 /**
9508  * An update_fee message which should be sent
9509  */
9510 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
9511
9512 /**
9513  * Finally, the commitment_signed message which should be sent
9514  */
9515 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
9516
9517 /**
9518  * Finally, the commitment_signed message which should be sent
9519  */
9520 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
9521
9522 /**
9523  * Constructs a new CommitmentUpdate given each field
9524  */
9525 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);
9526
9527 /**
9528  * Creates a copy of the CommitmentUpdate
9529  */
9530 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
9531
9532 /**
9533  * Frees any resources used by the HTLCFailChannelUpdate
9534  */
9535 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
9536
9537 /**
9538  * Creates a copy of the HTLCFailChannelUpdate
9539  */
9540 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
9541
9542 /**
9543  * Calls the free function if one is set
9544  */
9545 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
9546
9547 /**
9548  * Calls the free function if one is set
9549  */
9550 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
9551
9552 /**
9553  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
9554  */
9555 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
9556
9557 /**
9558  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
9559  */
9560 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
9561
9562 /**
9563  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
9564  */
9565 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
9566
9567 /**
9568  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
9569  */
9570 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
9571
9572 /**
9573  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
9574  */
9575 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
9576
9577 /**
9578  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
9579  */
9580 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
9581
9582 /**
9583  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
9584  */
9585 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
9586
9587 /**
9588  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
9589  */
9590 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
9591
9592 /**
9593  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
9594  */
9595 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
9596
9597 /**
9598  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
9599  */
9600 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
9601
9602 /**
9603  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
9604  */
9605 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
9606
9607 /**
9608  * Read a FundingCreated from a byte array, created by FundingCreated_write
9609  */
9610 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
9611
9612 /**
9613  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
9614  */
9615 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
9616
9617 /**
9618  * Read a FundingSigned from a byte array, created by FundingSigned_write
9619  */
9620 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
9621
9622 /**
9623  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
9624  */
9625 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
9626
9627 /**
9628  * Read a FundingLocked from a byte array, created by FundingLocked_write
9629  */
9630 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
9631
9632 /**
9633  * Serialize the Init object into a byte array which can be read by Init_read
9634  */
9635 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
9636
9637 /**
9638  * Read a Init from a byte array, created by Init_write
9639  */
9640 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
9641
9642 /**
9643  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
9644  */
9645 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
9646
9647 /**
9648  * Read a OpenChannel from a byte array, created by OpenChannel_write
9649  */
9650 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
9651
9652 /**
9653  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
9654  */
9655 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
9656
9657 /**
9658  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
9659  */
9660 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
9661
9662 /**
9663  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
9664  */
9665 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
9666
9667 /**
9668  * Read a Shutdown from a byte array, created by Shutdown_write
9669  */
9670 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
9671
9672 /**
9673  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
9674  */
9675 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
9676
9677 /**
9678  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
9679  */
9680 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
9681
9682 /**
9683  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
9684  */
9685 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
9686
9687 /**
9688  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
9689  */
9690 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
9691
9692 /**
9693  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
9694  */
9695 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
9696
9697 /**
9698  * Read a UpdateFee from a byte array, created by UpdateFee_write
9699  */
9700 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
9701
9702 /**
9703  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
9704  */
9705 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
9706
9707 /**
9708  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
9709  */
9710 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
9711
9712 /**
9713  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
9714  */
9715 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
9716
9717 /**
9718  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
9719  */
9720 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
9721
9722 /**
9723  * Serialize the Ping object into a byte array which can be read by Ping_read
9724  */
9725 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
9726
9727 /**
9728  * Read a Ping from a byte array, created by Ping_write
9729  */
9730 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
9731
9732 /**
9733  * Serialize the Pong object into a byte array which can be read by Pong_read
9734  */
9735 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
9736
9737 /**
9738  * Read a Pong from a byte array, created by Pong_write
9739  */
9740 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
9741
9742 /**
9743  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
9744  */
9745 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
9746
9747 /**
9748  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
9749  */
9750 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
9751
9752 /**
9753  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
9754  */
9755 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
9756
9757 /**
9758  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
9759  */
9760 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
9761
9762 /**
9763  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
9764  */
9765 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
9766
9767 /**
9768  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
9769  */
9770 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
9771
9772 /**
9773  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
9774  */
9775 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
9776
9777 /**
9778  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
9779  */
9780 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
9781
9782 /**
9783  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
9784  */
9785 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
9786
9787 /**
9788  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
9789  */
9790 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
9791
9792 /**
9793  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
9794  */
9795 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
9796
9797 /**
9798  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
9799  */
9800 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
9801
9802 /**
9803  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
9804  */
9805 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
9806
9807 /**
9808  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
9809  */
9810 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
9811
9812 /**
9813  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
9814  */
9815 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
9816
9817 /**
9818  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
9819  */
9820 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
9821
9822 /**
9823  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
9824  */
9825 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
9826
9827 /**
9828  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
9829  */
9830 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
9831
9832 /**
9833  *\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
9834  */
9835 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
9836
9837 /**
9838  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
9839  */
9840 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
9841
9842 /**
9843  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
9844  */
9845 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
9846
9847 /**
9848  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
9849  */
9850 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
9851
9852 /**
9853  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
9854  */
9855 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
9856
9857 /**
9858  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
9859  */
9860 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
9861
9862 /**
9863  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
9864  */
9865 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
9866
9867 /**
9868  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
9869  */
9870 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
9871
9872 /**
9873  * Constructs a new IgnoringMessageHandler given each field
9874  */
9875 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
9876
9877 /**
9878  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
9879  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
9880  */
9881 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
9882
9883 /**
9884  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
9885  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
9886  */
9887 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
9888
9889 /**
9890  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
9891  */
9892 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
9893
9894 /**
9895  * Constructs a new ErroringMessageHandler
9896  */
9897 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
9898
9899 /**
9900  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
9901  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
9902  */
9903 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
9904
9905 /**
9906  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
9907  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
9908  */
9909 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
9910
9911 /**
9912  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
9913  */
9914 void MessageHandler_free(struct LDKMessageHandler this_obj);
9915
9916 /**
9917  * A message handler which handles messages specific to channels. Usually this is just a
9918  * ChannelManager object or a ErroringMessageHandler.
9919  */
9920 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
9921
9922 /**
9923  * A message handler which handles messages specific to channels. Usually this is just a
9924  * ChannelManager object or a ErroringMessageHandler.
9925  */
9926 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
9927
9928 /**
9929  * A message handler which handles messages updating our knowledge of the network channel
9930  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
9931  */
9932 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
9933
9934 /**
9935  * A message handler which handles messages updating our knowledge of the network channel
9936  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
9937  */
9938 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
9939
9940 /**
9941  * Constructs a new MessageHandler given each field
9942  */
9943 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
9944
9945 /**
9946  * Creates a copy of a SocketDescriptor
9947  */
9948 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
9949
9950 /**
9951  * Calls the free function if one is set
9952  */
9953 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
9954
9955 /**
9956  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
9957  */
9958 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
9959
9960 /**
9961  * Used to indicate that we probably can't make any future connections to this peer, implying
9962  * we should go ahead and force-close any channels we have with it.
9963  */
9964 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
9965
9966 /**
9967  * Used to indicate that we probably can't make any future connections to this peer, implying
9968  * we should go ahead and force-close any channels we have with it.
9969  */
9970 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
9971
9972 /**
9973  * Constructs a new PeerHandleError given each field
9974  */
9975 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
9976
9977 /**
9978  * Creates a copy of the PeerHandleError
9979  */
9980 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
9981
9982 /**
9983  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
9984  */
9985 void PeerManager_free(struct LDKPeerManager this_obj);
9986
9987 /**
9988  * Constructs a new PeerManager with the given message handlers and node_id secret key
9989  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
9990  * cryptographically secure random bytes.
9991  */
9992 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);
9993
9994 /**
9995  * Get the list of node ids for peers which have completed the initial handshake.
9996  *
9997  * For outbound connections, this will be the same as the their_node_id parameter passed in to
9998  * new_outbound_connection, however entries will only appear once the initial handshake has
9999  * completed and we are sure the remote peer has the private key for the given node_id.
10000  */
10001 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
10002
10003 /**
10004  * Indicates a new outbound connection has been established to a node with the given node_id.
10005  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
10006  * descriptor but must disconnect the connection immediately.
10007  *
10008  * Returns a small number of bytes to send to the remote node (currently always 50).
10009  *
10010  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
10011  * socket_disconnected().
10012  */
10013 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);
10014
10015 /**
10016  * Indicates a new inbound connection has been established.
10017  *
10018  * May refuse the connection by returning an Err, but will never write bytes to the remote end
10019  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
10020  * call socket_disconnected for the new descriptor but must disconnect the connection
10021  * immediately.
10022  *
10023  * Panics if descriptor is duplicative with some other descriptor which has not yet had
10024  * socket_disconnected called.
10025  */
10026 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
10027
10028 /**
10029  * Indicates that there is room to write data to the given socket descriptor.
10030  *
10031  * May return an Err to indicate that the connection should be closed.
10032  *
10033  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
10034  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
10035  * invariants around calling write_buffer_space_avail in case a write did not fully complete
10036  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
10037  * here isn't sufficient! Panics if the descriptor was not previously registered in a
10038  * new_\\*_connection event.
10039  */
10040 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
10041
10042 /**
10043  * Indicates that data was read from the given socket descriptor.
10044  *
10045  * May return an Err to indicate that the connection should be closed.
10046  *
10047  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
10048  * Thus, however, you almost certainly want to call process_events() after any read_event to
10049  * generate send_data calls to handle responses.
10050  *
10051  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
10052  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
10053  *
10054  * Panics if the descriptor was not previously registered in a new_*_connection event.
10055  */
10056 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);
10057
10058 /**
10059  * Checks for any events generated by our handlers and processes them. Includes sending most
10060  * response messages as well as messages generated by calls to handler functions directly (eg
10061  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
10062  */
10063 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
10064
10065 /**
10066  * Indicates that the given socket descriptor's connection is now closed.
10067  *
10068  * This must only be called if the socket has been disconnected by the peer or your own
10069  * decision to disconnect it and must NOT be called in any case where other parts of this
10070  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
10071  * the peer.
10072  *
10073  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
10074  */
10075 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
10076
10077 /**
10078  * Disconnect a peer given its node id.
10079  *
10080  * Set no_connection_possible to true to prevent any further connection with this peer,
10081  * force-closing any channels we have with it.
10082  *
10083  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
10084  * so be careful about reentrancy issues.
10085  */
10086 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
10087
10088 /**
10089  * This function should be called roughly once every 30 seconds.
10090  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
10091  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
10092  */
10093 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
10094
10095 /**
10096  * Build the commitment secret from the seed and the commitment number
10097  */
10098 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
10099
10100 /**
10101  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
10102  * from the base secret and the per_commitment_point.
10103  *
10104  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
10105  * generated (ie our own).
10106  */
10107 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
10108
10109 /**
10110  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
10111  * from the base point and the per_commitment_key. This is the public equivalent of
10112  * derive_private_key - using only public keys to derive a public key instead of private keys.
10113  *
10114  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
10115  * generated (ie our own).
10116  */
10117 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
10118
10119 /**
10120  * Derives a per-commitment-transaction revocation key from its constituent parts.
10121  *
10122  * Only the cheating participant owns a valid witness to propagate a revoked
10123  * commitment transaction, thus per_commitment_secret always come from cheater
10124  * and revocation_base_secret always come from punisher, which is the broadcaster
10125  * of the transaction spending with this key knowledge.
10126  *
10127  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
10128  * generated (ie our own).
10129  */
10130 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
10131
10132 /**
10133  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
10134  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
10135  * public key instead of private keys.
10136  *
10137  * Only the cheating participant owns a valid witness to propagate a revoked
10138  * commitment transaction, thus per_commitment_point always come from cheater
10139  * and revocation_base_point always come from punisher, which is the broadcaster
10140  * of the transaction spending with this key knowledge.
10141  *
10142  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
10143  * generated (ie our own).
10144  */
10145 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
10146
10147 /**
10148  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
10149  */
10150 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
10151
10152 /**
10153  * The broadcaster's per-commitment public key which was used to derive the other keys.
10154  */
10155 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
10156
10157 /**
10158  * The broadcaster's per-commitment public key which was used to derive the other keys.
10159  */
10160 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10161
10162 /**
10163  * The revocation key which is used to allow the broadcaster of the commitment
10164  * transaction to provide their counterparty the ability to punish them if they broadcast
10165  * an old state.
10166  */
10167 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
10168
10169 /**
10170  * The revocation key which is used to allow the broadcaster of the commitment
10171  * transaction to provide their counterparty the ability to punish them if they broadcast
10172  * an old state.
10173  */
10174 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10175
10176 /**
10177  * Broadcaster's HTLC Key
10178  */
10179 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
10180
10181 /**
10182  * Broadcaster's HTLC Key
10183  */
10184 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10185
10186 /**
10187  * Countersignatory's HTLC Key
10188  */
10189 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
10190
10191 /**
10192  * Countersignatory's HTLC Key
10193  */
10194 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10195
10196 /**
10197  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
10198  */
10199 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
10200
10201 /**
10202  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
10203  */
10204 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10205
10206 /**
10207  * Constructs a new TxCreationKeys given each field
10208  */
10209 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);
10210
10211 /**
10212  * Creates a copy of the TxCreationKeys
10213  */
10214 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
10215
10216 /**
10217  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
10218  */
10219 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
10220
10221 /**
10222  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
10223  */
10224 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
10225
10226 /**
10227  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
10228  */
10229 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
10230
10231 /**
10232  * The public key which is used to sign all commitment transactions, as it appears in the
10233  * on-chain channel lock-in 2-of-2 multisig output.
10234  */
10235 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
10236
10237 /**
10238  * The public key which is used to sign all commitment transactions, as it appears in the
10239  * on-chain channel lock-in 2-of-2 multisig output.
10240  */
10241 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10242
10243 /**
10244  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
10245  * revocation keys. This is combined with the per-commitment-secret generated by the
10246  * counterparty to create a secret which the counterparty can reveal to revoke previous
10247  * states.
10248  */
10249 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
10250
10251 /**
10252  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
10253  * revocation keys. This is combined with the per-commitment-secret generated by the
10254  * counterparty to create a secret which the counterparty can reveal to revoke previous
10255  * states.
10256  */
10257 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10258
10259 /**
10260  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
10261  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
10262  * static across every commitment transaction.
10263  */
10264 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
10265
10266 /**
10267  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
10268  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
10269  * static across every commitment transaction.
10270  */
10271 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10272
10273 /**
10274  * The base point which is used (with derive_public_key) to derive a per-commitment payment
10275  * public key which receives non-HTLC-encumbered funds which are only available for spending
10276  * after some delay (or can be claimed via the revocation path).
10277  */
10278 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
10279
10280 /**
10281  * The base point which is used (with derive_public_key) to derive a per-commitment payment
10282  * public key which receives non-HTLC-encumbered funds which are only available for spending
10283  * after some delay (or can be claimed via the revocation path).
10284  */
10285 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10286
10287 /**
10288  * The base point which is used (with derive_public_key) to derive a per-commitment public key
10289  * which is used to encumber HTLC-in-flight outputs.
10290  */
10291 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
10292
10293 /**
10294  * The base point which is used (with derive_public_key) to derive a per-commitment public key
10295  * which is used to encumber HTLC-in-flight outputs.
10296  */
10297 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10298
10299 /**
10300  * Constructs a new ChannelPublicKeys given each field
10301  */
10302 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);
10303
10304 /**
10305  * Creates a copy of the ChannelPublicKeys
10306  */
10307 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
10308
10309 /**
10310  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
10311  */
10312 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
10313
10314 /**
10315  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
10316  */
10317 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
10318
10319 /**
10320  * Create per-state keys from channel base points and the per-commitment point.
10321  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
10322  */
10323 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);
10324
10325 /**
10326  * Generate per-state keys from channel static keys.
10327  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
10328  */
10329 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);
10330
10331 /**
10332  * A script either spendable by the revocation
10333  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
10334  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
10335  */
10336 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
10337
10338 /**
10339  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
10340  */
10341 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
10342
10343 /**
10344  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
10345  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
10346  * need to compare this value to whether the commitment transaction in question is that of
10347  * the counterparty or our own.
10348  */
10349 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
10350
10351 /**
10352  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
10353  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
10354  * need to compare this value to whether the commitment transaction in question is that of
10355  * the counterparty or our own.
10356  */
10357 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
10358
10359 /**
10360  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
10361  * this divided by 1000.
10362  */
10363 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
10364
10365 /**
10366  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
10367  * this divided by 1000.
10368  */
10369 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
10370
10371 /**
10372  * The CLTV lock-time at which this HTLC expires.
10373  */
10374 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
10375
10376 /**
10377  * The CLTV lock-time at which this HTLC expires.
10378  */
10379 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
10380
10381 /**
10382  * The hash of the preimage which unlocks this HTLC.
10383  */
10384 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
10385
10386 /**
10387  * The hash of the preimage which unlocks this HTLC.
10388  */
10389 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10390
10391 /**
10392  * The position within the commitment transactions' outputs. This may be None if the value is
10393  * below the dust limit (in which case no output appears in the commitment transaction and the
10394  * value is spent to additional transaction fees).
10395  */
10396 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
10397
10398 /**
10399  * The position within the commitment transactions' outputs. This may be None if the value is
10400  * below the dust limit (in which case no output appears in the commitment transaction and the
10401  * value is spent to additional transaction fees).
10402  */
10403 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
10404
10405 /**
10406  * Constructs a new HTLCOutputInCommitment given each field
10407  */
10408 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);
10409
10410 /**
10411  * Creates a copy of the HTLCOutputInCommitment
10412  */
10413 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
10414
10415 /**
10416  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
10417  */
10418 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
10419
10420 /**
10421  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
10422  */
10423 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
10424
10425 /**
10426  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
10427  * does not need to have its previous_output_index filled.
10428  */
10429 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
10430
10431 /**
10432  * Gets the redeemscript for a funding output from the two funding public keys.
10433  * Note that the order of funding public keys does not matter.
10434  */
10435 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
10436
10437 /**
10438  * panics if htlc.transaction_output_index.is_none()!
10439  */
10440 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);
10441
10442 /**
10443  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
10444  */
10445 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
10446
10447 /**
10448  * Holder public keys
10449  */
10450 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
10451
10452 /**
10453  * Holder public keys
10454  */
10455 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
10456
10457 /**
10458  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
10459  */
10460 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
10461
10462 /**
10463  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
10464  */
10465 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
10466
10467 /**
10468  * Whether the holder is the initiator of this channel.
10469  * This is an input to the commitment number obscure factor computation.
10470  */
10471 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
10472
10473 /**
10474  * Whether the holder is the initiator of this channel.
10475  * This is an input to the commitment number obscure factor computation.
10476  */
10477 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
10478
10479 /**
10480  * The late-bound counterparty channel transaction parameters.
10481  * These parameters are populated at the point in the protocol where the counterparty provides them.
10482  */
10483 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
10484
10485 /**
10486  * The late-bound counterparty channel transaction parameters.
10487  * These parameters are populated at the point in the protocol where the counterparty provides them.
10488  */
10489 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
10490
10491 /**
10492  * The late-bound funding outpoint
10493  */
10494 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
10495
10496 /**
10497  * The late-bound funding outpoint
10498  */
10499 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10500
10501 /**
10502  * Constructs a new ChannelTransactionParameters given each field
10503  */
10504 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);
10505
10506 /**
10507  * Creates a copy of the ChannelTransactionParameters
10508  */
10509 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
10510
10511 /**
10512  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
10513  */
10514 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
10515
10516 /**
10517  * Counter-party public keys
10518  */
10519 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
10520
10521 /**
10522  * Counter-party public keys
10523  */
10524 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
10525
10526 /**
10527  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
10528  */
10529 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
10530
10531 /**
10532  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
10533  */
10534 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
10535
10536 /**
10537  * Constructs a new CounterpartyChannelTransactionParameters given each field
10538  */
10539 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
10540
10541 /**
10542  * Creates a copy of the CounterpartyChannelTransactionParameters
10543  */
10544 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
10545
10546 /**
10547  * Whether the late bound parameters are populated.
10548  */
10549 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
10550
10551 /**
10552  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
10553  * given that the holder is the broadcaster.
10554  *
10555  * self.is_populated() must be true before calling this function.
10556  */
10557 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
10558
10559 /**
10560  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
10561  * given that the counterparty is the broadcaster.
10562  *
10563  * self.is_populated() must be true before calling this function.
10564  */
10565 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
10566
10567 /**
10568  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
10569  */
10570 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
10571
10572 /**
10573  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
10574  */
10575 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
10576
10577 /**
10578  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
10579  */
10580 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
10581
10582 /**
10583  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
10584  */
10585 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
10586
10587 /**
10588  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
10589  */
10590 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
10591
10592 /**
10593  * Get the channel pubkeys for the broadcaster
10594  */
10595 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
10596
10597 /**
10598  * Get the channel pubkeys for the countersignatory
10599  */
10600 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
10601
10602 /**
10603  * Get the contest delay applicable to the transactions.
10604  * Note that the contest delay was selected by the countersignatory.
10605  */
10606 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
10607
10608 /**
10609  * Whether the channel is outbound from the broadcaster.
10610  *
10611  * The boolean representing the side that initiated the channel is
10612  * an input to the commitment number obscure factor computation.
10613  */
10614 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
10615
10616 /**
10617  * The funding outpoint
10618  */
10619 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
10620
10621 /**
10622  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
10623  */
10624 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
10625
10626 /**
10627  * Our counterparty's signature for the transaction
10628  */
10629 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
10630
10631 /**
10632  * Our counterparty's signature for the transaction
10633  */
10634 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
10635
10636 /**
10637  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
10638  */
10639 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
10640
10641 /**
10642  * Creates a copy of the HolderCommitmentTransaction
10643  */
10644 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
10645
10646 /**
10647  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
10648  */
10649 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
10650
10651 /**
10652  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
10653  */
10654 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
10655
10656 /**
10657  * Create a new holder transaction with the given counterparty signatures.
10658  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
10659  */
10660 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);
10661
10662 /**
10663  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
10664  */
10665 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
10666
10667 /**
10668  * The commitment transaction
10669  */
10670 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
10671
10672 /**
10673  * The commitment transaction
10674  */
10675 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
10676
10677 /**
10678  * The txid for the commitment transaction.
10679  *
10680  * This is provided as a performance optimization, instead of calling transaction.txid()
10681  * multiple times.
10682  */
10683 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
10684
10685 /**
10686  * The txid for the commitment transaction.
10687  *
10688  * This is provided as a performance optimization, instead of calling transaction.txid()
10689  * multiple times.
10690  */
10691 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10692
10693 /**
10694  * Constructs a new BuiltCommitmentTransaction given each field
10695  */
10696 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
10697
10698 /**
10699  * Creates a copy of the BuiltCommitmentTransaction
10700  */
10701 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
10702
10703 /**
10704  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
10705  */
10706 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
10707
10708 /**
10709  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
10710  */
10711 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
10712
10713 /**
10714  * Get the SIGHASH_ALL sighash value of the transaction.
10715  *
10716  * This can be used to verify a signature.
10717  */
10718 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);
10719
10720 /**
10721  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
10722  * because we are about to broadcast a holder transaction.
10723  */
10724 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);
10725
10726 /**
10727  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
10728  */
10729 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
10730
10731 /**
10732  * Creates a copy of the CommitmentTransaction
10733  */
10734 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
10735
10736 /**
10737  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
10738  */
10739 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
10740
10741 /**
10742  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
10743  */
10744 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
10745
10746 /**
10747  * The backwards-counting commitment number
10748  */
10749 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
10750
10751 /**
10752  * The value to be sent to the broadcaster
10753  */
10754 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
10755
10756 /**
10757  * The value to be sent to the counterparty
10758  */
10759 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
10760
10761 /**
10762  * The feerate paid per 1000-weight-unit in this commitment transaction.
10763  */
10764 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
10765
10766 /**
10767  * Trust our pre-built transaction and derived transaction creation public keys.
10768  *
10769  * Applies a wrapper which allows access to these fields.
10770  *
10771  * This should only be used if you fully trust the builder of this object.  It should not
10772  *\tbe used by an external signer - instead use the verify function.
10773  */
10774 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
10775
10776 /**
10777  * Verify our pre-built transaction and derived transaction creation public keys.
10778  *
10779  * Applies a wrapper which allows access to these fields.
10780  *
10781  * An external validating signer must call this method before signing
10782  * or using the built transaction.
10783  */
10784 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);
10785
10786 /**
10787  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
10788  */
10789 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
10790
10791 /**
10792  * The transaction ID of the built Bitcoin transaction
10793  */
10794 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
10795
10796 /**
10797  * The pre-built Bitcoin commitment transaction
10798  */
10799 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
10800
10801 /**
10802  * The pre-calculated transaction creation public keys.
10803  */
10804 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
10805
10806 /**
10807  * Get a signature for each HTLC which was included in the commitment transaction (ie for
10808  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
10809  *
10810  * The returned Vec has one entry for each HTLC, and in the same order.
10811  */
10812 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);
10813
10814 /**
10815  * Get the transaction number obscure factor
10816  */
10817 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
10818
10819 /**
10820  * Creates a copy of the InitFeatures
10821  */
10822 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
10823
10824 /**
10825  * Creates a copy of the NodeFeatures
10826  */
10827 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
10828
10829 /**
10830  * Creates a copy of the ChannelFeatures
10831  */
10832 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
10833
10834 /**
10835  * Creates a copy of the InvoiceFeatures
10836  */
10837 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
10838
10839 /**
10840  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
10841  */
10842 void InitFeatures_free(struct LDKInitFeatures this_obj);
10843
10844 /**
10845  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
10846  */
10847 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
10848
10849 /**
10850  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
10851  */
10852 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
10853
10854 /**
10855  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
10856  */
10857 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
10858
10859 /**
10860  * Create a blank Features with no features set
10861  */
10862 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
10863
10864 /**
10865  * Creates a Features with the bits set which are known by the implementation
10866  */
10867 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
10868
10869 /**
10870  * Create a blank Features with no features set
10871  */
10872 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
10873
10874 /**
10875  * Creates a Features with the bits set which are known by the implementation
10876  */
10877 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
10878
10879 /**
10880  * Create a blank Features with no features set
10881  */
10882 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
10883
10884 /**
10885  * Creates a Features with the bits set which are known by the implementation
10886  */
10887 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
10888
10889 /**
10890  * Create a blank Features with no features set
10891  */
10892 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
10893
10894 /**
10895  * Creates a Features with the bits set which are known by the implementation
10896  */
10897 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
10898
10899 /**
10900  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
10901  */
10902 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
10903
10904 /**
10905  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
10906  */
10907 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
10908
10909 /**
10910  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
10911  */
10912 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
10913
10914 /**
10915  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
10916  */
10917 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
10918
10919 /**
10920  * Read a InitFeatures from a byte array, created by InitFeatures_write
10921  */
10922 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
10923
10924 /**
10925  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
10926  */
10927 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
10928
10929 /**
10930  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
10931  */
10932 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
10933
10934 /**
10935  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
10936  */
10937 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
10938
10939 /**
10940  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
10941  */
10942 void RouteHop_free(struct LDKRouteHop this_obj);
10943
10944 /**
10945  * The node_id of the node at this hop.
10946  */
10947 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
10948
10949 /**
10950  * The node_id of the node at this hop.
10951  */
10952 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10953
10954 /**
10955  * The node_announcement features of the node at this hop. For the last hop, these may be
10956  * amended to match the features present in the invoice this node generated.
10957  */
10958 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
10959
10960 /**
10961  * The node_announcement features of the node at this hop. For the last hop, these may be
10962  * amended to match the features present in the invoice this node generated.
10963  */
10964 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
10965
10966 /**
10967  * The channel that should be used from the previous hop to reach this node.
10968  */
10969 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
10970
10971 /**
10972  * The channel that should be used from the previous hop to reach this node.
10973  */
10974 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
10975
10976 /**
10977  * The channel_announcement features of the channel that should be used from the previous hop
10978  * to reach this node.
10979  */
10980 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
10981
10982 /**
10983  * The channel_announcement features of the channel that should be used from the previous hop
10984  * to reach this node.
10985  */
10986 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
10987
10988 /**
10989  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
10990  * For the last hop, this should be the full value of the payment (might be more than
10991  * requested if we had to match htlc_minimum_msat).
10992  */
10993 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
10994
10995 /**
10996  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
10997  * For the last hop, this should be the full value of the payment (might be more than
10998  * requested if we had to match htlc_minimum_msat).
10999  */
11000 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
11001
11002 /**
11003  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
11004  * expected at the destination, in excess of the current block height.
11005  */
11006 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
11007
11008 /**
11009  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
11010  * expected at the destination, in excess of the current block height.
11011  */
11012 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
11013
11014 /**
11015  * Constructs a new RouteHop given each field
11016  */
11017 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);
11018
11019 /**
11020  * Creates a copy of the RouteHop
11021  */
11022 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
11023
11024 /**
11025  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
11026  */
11027 void Route_free(struct LDKRoute this_obj);
11028
11029 /**
11030  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
11031  * last RouteHop in each path must be the same.
11032  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
11033  * destination. Thus, this must always be at least length one. While the maximum length of any
11034  * given path is variable, keeping the length of any path to less than 20 should currently
11035  * ensure it is viable.
11036  */
11037 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
11038
11039 /**
11040  * Constructs a new Route given each field
11041  */
11042 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
11043
11044 /**
11045  * Creates a copy of the Route
11046  */
11047 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
11048
11049 /**
11050  * Serialize the Route object into a byte array which can be read by Route_read
11051  */
11052 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
11053
11054 /**
11055  * Read a Route from a byte array, created by Route_write
11056  */
11057 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
11058
11059 /**
11060  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
11061  */
11062 void RouteHint_free(struct LDKRouteHint this_obj);
11063
11064 /**
11065  * The node_id of the non-target end of the route
11066  */
11067 struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
11068
11069 /**
11070  * The node_id of the non-target end of the route
11071  */
11072 void RouteHint_set_src_node_id(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11073
11074 /**
11075  * The short_channel_id of this channel
11076  */
11077 uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
11078
11079 /**
11080  * The short_channel_id of this channel
11081  */
11082 void RouteHint_set_short_channel_id(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
11083
11084 /**
11085  * The fees which must be paid to use this channel
11086  */
11087 struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *NONNULL_PTR this_ptr);
11088
11089 /**
11090  * The fees which must be paid to use this channel
11091  */
11092 void RouteHint_set_fees(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
11093
11094 /**
11095  * The difference in CLTV values between this node and the next node.
11096  */
11097 uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR this_ptr);
11098
11099 /**
11100  * The difference in CLTV values between this node and the next node.
11101  */
11102 void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val);
11103
11104 /**
11105  * The minimum value, in msat, which must be relayed to the next hop.
11106  */
11107 struct LDKCOption_u64Z RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
11108
11109 /**
11110  * The minimum value, in msat, which must be relayed to the next hop.
11111  */
11112 void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
11113
11114 /**
11115  * The maximum value in msat available for routing with a single HTLC.
11116  */
11117 struct LDKCOption_u64Z RouteHint_get_htlc_maximum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
11118
11119 /**
11120  * The maximum value in msat available for routing with a single HTLC.
11121  */
11122 void RouteHint_set_htlc_maximum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
11123
11124 /**
11125  * Constructs a new RouteHint given each field
11126  */
11127 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);
11128
11129 /**
11130  * Creates a copy of the RouteHint
11131  */
11132 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
11133
11134 /**
11135  * Gets a route from us (payer) to the given target node (payee).
11136  *
11137  * If the payee provided features in their invoice, they should be provided via payee_features.
11138  * Without this, MPP will only be used if the payee's features are available in the network graph.
11139  *
11140  * Extra routing hops between known nodes and the target will be used if they are included in
11141  * last_hops.
11142  *
11143  * If some channels aren't announced, it may be useful to fill in a first_hops with the
11144  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
11145  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
11146  * in first_hops will be used.
11147  *
11148  * Panics if first_hops contains channels without short_channel_ids
11149  * (ChannelManager::list_usable_channels will never include such channels).
11150  *
11151  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
11152  * equal), however the enabled/disabled bit on such channels as well as the
11153  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
11154  */
11155 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);
11156
11157 /**
11158  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
11159  */
11160 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
11161
11162 /**
11163  * Creates a copy of the NetworkGraph
11164  */
11165 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
11166
11167 /**
11168  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
11169  */
11170 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
11171
11172 /**
11173  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
11174  */
11175 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
11176
11177 /**
11178  * Creates a new tracker of the actual state of the network of channels and nodes,
11179  * assuming a fresh network graph.
11180  * Chain monitor is used to make sure announced channels exist on-chain,
11181  * channel data is correct, and that the announcement is signed with
11182  * channel owners' keys.
11183  */
11184 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
11185
11186 /**
11187  * Creates a new tracker of the actual state of the network of channels and nodes,
11188  * assuming an existing Network Graph.
11189  */
11190 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
11191
11192 /**
11193  * Adds a provider used to check new announcements. Does not affect
11194  * existing announcements unless they are updated.
11195  * Add, update or remove the provider would replace the current one.
11196  */
11197 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
11198
11199 /**
11200  * Take a read lock on the network_graph and return it in the C-bindings
11201  * newtype helper. This is likely only useful when called via the C
11202  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
11203  * yourself.
11204  */
11205 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
11206
11207 /**
11208  * Get a reference to the NetworkGraph which this read-lock contains.
11209  */
11210 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
11211
11212 /**
11213  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
11214  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
11215  */
11216 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
11217
11218 /**
11219  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
11220  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
11221  */
11222 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
11223
11224 /**
11225  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
11226  */
11227 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
11228
11229 /**
11230  * When the last update to the channel direction was issued.
11231  * Value is opaque, as set in the announcement.
11232  */
11233 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
11234
11235 /**
11236  * When the last update to the channel direction was issued.
11237  * Value is opaque, as set in the announcement.
11238  */
11239 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
11240
11241 /**
11242  * Whether the channel can be currently used for payments (in this one direction).
11243  */
11244 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
11245
11246 /**
11247  * Whether the channel can be currently used for payments (in this one direction).
11248  */
11249 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
11250
11251 /**
11252  * The difference in CLTV values that you must have when routing through this channel.
11253  */
11254 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
11255
11256 /**
11257  * The difference in CLTV values that you must have when routing through this channel.
11258  */
11259 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
11260
11261 /**
11262  * The minimum value, which must be relayed to the next hop via the channel
11263  */
11264 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
11265
11266 /**
11267  * The minimum value, which must be relayed to the next hop via the channel
11268  */
11269 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
11270
11271 /**
11272  * The maximum value which may be relayed to the next hop via the channel.
11273  */
11274 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
11275
11276 /**
11277  * The maximum value which may be relayed to the next hop via the channel.
11278  */
11279 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
11280
11281 /**
11282  * Fees charged when the channel is used for routing
11283  */
11284 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
11285
11286 /**
11287  * Fees charged when the channel is used for routing
11288  */
11289 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
11290
11291 /**
11292  * Most recent update for the channel received from the network
11293  * Mostly redundant with the data we store in fields explicitly.
11294  * Everything else is useful only for sending out for initial routing sync.
11295  * Not stored if contains excess data to prevent DoS.
11296  */
11297 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
11298
11299 /**
11300  * Most recent update for the channel received from the network
11301  * Mostly redundant with the data we store in fields explicitly.
11302  * Everything else is useful only for sending out for initial routing sync.
11303  * Not stored if contains excess data to prevent DoS.
11304  */
11305 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
11306
11307 /**
11308  * Constructs a new DirectionalChannelInfo given each field
11309  */
11310 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);
11311
11312 /**
11313  * Creates a copy of the DirectionalChannelInfo
11314  */
11315 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
11316
11317 /**
11318  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
11319  */
11320 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
11321
11322 /**
11323  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
11324  */
11325 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
11326
11327 /**
11328  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
11329  */
11330 void ChannelInfo_free(struct LDKChannelInfo this_obj);
11331
11332 /**
11333  * Protocol features of a channel communicated during its announcement
11334  */
11335 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
11336
11337 /**
11338  * Protocol features of a channel communicated during its announcement
11339  */
11340 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
11341
11342 /**
11343  * Source node of the first direction of a channel
11344  */
11345 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
11346
11347 /**
11348  * Source node of the first direction of a channel
11349  */
11350 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11351
11352 /**
11353  * Details about the first direction of a channel
11354  */
11355 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
11356
11357 /**
11358  * Details about the first direction of a channel
11359  */
11360 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
11361
11362 /**
11363  * Source node of the second direction of a channel
11364  */
11365 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
11366
11367 /**
11368  * Source node of the second direction of a channel
11369  */
11370 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11371
11372 /**
11373  * Details about the second direction of a channel
11374  */
11375 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
11376
11377 /**
11378  * Details about the second direction of a channel
11379  */
11380 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
11381
11382 /**
11383  * The channel capacity as seen on-chain, if chain lookup is available.
11384  */
11385 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
11386
11387 /**
11388  * The channel capacity as seen on-chain, if chain lookup is available.
11389  */
11390 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
11391
11392 /**
11393  * An initial announcement of the channel
11394  * Mostly redundant with the data we store in fields explicitly.
11395  * Everything else is useful only for sending out for initial routing sync.
11396  * Not stored if contains excess data to prevent DoS.
11397  */
11398 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
11399
11400 /**
11401  * An initial announcement of the channel
11402  * Mostly redundant with the data we store in fields explicitly.
11403  * Everything else is useful only for sending out for initial routing sync.
11404  * Not stored if contains excess data to prevent DoS.
11405  */
11406 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
11407
11408 /**
11409  * Constructs a new ChannelInfo given each field
11410  */
11411 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);
11412
11413 /**
11414  * Creates a copy of the ChannelInfo
11415  */
11416 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
11417
11418 /**
11419  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
11420  */
11421 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
11422
11423 /**
11424  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
11425  */
11426 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
11427
11428 /**
11429  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
11430  */
11431 void RoutingFees_free(struct LDKRoutingFees this_obj);
11432
11433 /**
11434  * Flat routing fee in satoshis
11435  */
11436 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
11437
11438 /**
11439  * Flat routing fee in satoshis
11440  */
11441 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
11442
11443 /**
11444  * Liquidity-based routing fee in millionths of a routed amount.
11445  * In other words, 10000 is 1%.
11446  */
11447 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
11448
11449 /**
11450  * Liquidity-based routing fee in millionths of a routed amount.
11451  * In other words, 10000 is 1%.
11452  */
11453 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
11454
11455 /**
11456  * Constructs a new RoutingFees given each field
11457  */
11458 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
11459
11460 /**
11461  * Creates a copy of the RoutingFees
11462  */
11463 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
11464
11465 /**
11466  * Read a RoutingFees from a byte array, created by RoutingFees_write
11467  */
11468 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
11469
11470 /**
11471  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
11472  */
11473 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
11474
11475 /**
11476  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
11477  */
11478 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
11479
11480 /**
11481  * Protocol features the node announced support for
11482  */
11483 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
11484
11485 /**
11486  * Protocol features the node announced support for
11487  */
11488 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
11489
11490 /**
11491  * When the last known update to the node state was issued.
11492  * Value is opaque, as set in the announcement.
11493  */
11494 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
11495
11496 /**
11497  * When the last known update to the node state was issued.
11498  * Value is opaque, as set in the announcement.
11499  */
11500 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
11501
11502 /**
11503  * Color assigned to the node
11504  */
11505 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
11506
11507 /**
11508  * Color assigned to the node
11509  */
11510 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
11511
11512 /**
11513  * Moniker assigned to the node.
11514  * May be invalid or malicious (eg control chars),
11515  * should not be exposed to the user.
11516  */
11517 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
11518
11519 /**
11520  * Moniker assigned to the node.
11521  * May be invalid or malicious (eg control chars),
11522  * should not be exposed to the user.
11523  */
11524 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11525
11526 /**
11527  * Internet-level addresses via which one can connect to the node
11528  */
11529 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
11530
11531 /**
11532  * An initial announcement of the node
11533  * Mostly redundant with the data we store in fields explicitly.
11534  * Everything else is useful only for sending out for initial routing sync.
11535  * Not stored if contains excess data to prevent DoS.
11536  */
11537 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
11538
11539 /**
11540  * An initial announcement of the node
11541  * Mostly redundant with the data we store in fields explicitly.
11542  * Everything else is useful only for sending out for initial routing sync.
11543  * Not stored if contains excess data to prevent DoS.
11544  */
11545 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
11546
11547 /**
11548  * Constructs a new NodeAnnouncementInfo given each field
11549  */
11550 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);
11551
11552 /**
11553  * Creates a copy of the NodeAnnouncementInfo
11554  */
11555 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
11556
11557 /**
11558  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
11559  */
11560 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
11561
11562 /**
11563  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
11564  */
11565 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
11566
11567 /**
11568  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
11569  */
11570 void NodeInfo_free(struct LDKNodeInfo this_obj);
11571
11572 /**
11573  * All valid channels a node has announced
11574  */
11575 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
11576
11577 /**
11578  * Lowest fees enabling routing via any of the enabled, known channels to a node.
11579  * The two fields (flat and proportional fee) are independent,
11580  * meaning they don't have to refer to the same channel.
11581  */
11582 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
11583
11584 /**
11585  * Lowest fees enabling routing via any of the enabled, known channels to a node.
11586  * The two fields (flat and proportional fee) are independent,
11587  * meaning they don't have to refer to the same channel.
11588  */
11589 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
11590
11591 /**
11592  * More information about a node from node_announcement.
11593  * Optional because we store a Node entry after learning about it from
11594  * a channel announcement, but before receiving a node announcement.
11595  */
11596 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
11597
11598 /**
11599  * More information about a node from node_announcement.
11600  * Optional because we store a Node entry after learning about it from
11601  * a channel announcement, but before receiving a node announcement.
11602  */
11603 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
11604
11605 /**
11606  * Constructs a new NodeInfo given each field
11607  */
11608 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
11609
11610 /**
11611  * Creates a copy of the NodeInfo
11612  */
11613 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
11614
11615 /**
11616  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
11617  */
11618 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
11619
11620 /**
11621  * Read a NodeInfo from a byte array, created by NodeInfo_write
11622  */
11623 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
11624
11625 /**
11626  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
11627  */
11628 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
11629
11630 /**
11631  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
11632  */
11633 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
11634
11635 /**
11636  * Creates a new, empty, network graph.
11637  */
11638 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
11639
11640 /**
11641  * For an already known node (from channel announcements), update its stored properties from a
11642  * given node announcement.
11643  *
11644  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
11645  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
11646  * routing messages from a source using a protocol other than the lightning P2P protocol.
11647  */
11648 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
11649
11650 /**
11651  * For an already known node (from channel announcements), update its stored properties from a
11652  * given node announcement without verifying the associated signatures. Because we aren't
11653  * given the associated signatures here we cannot relay the node announcement to any of our
11654  * peers.
11655  */
11656 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
11657
11658 /**
11659  * Store or update channel info from a channel announcement.
11660  *
11661  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
11662  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
11663  * routing messages from a source using a protocol other than the lightning P2P protocol.
11664  *
11665  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
11666  * the corresponding UTXO exists on chain and is correctly-formatted.
11667  */
11668 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);
11669
11670 /**
11671  * Store or update channel info from a channel announcement without verifying the associated
11672  * signatures. Because we aren't given the associated signatures here we cannot relay the
11673  * channel announcement to any of our peers.
11674  *
11675  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
11676  * the corresponding UTXO exists on chain and is correctly-formatted.
11677  */
11678 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);
11679
11680 /**
11681  * Close a channel if a corresponding HTLC fail was sent.
11682  * If permanent, removes a channel from the local storage.
11683  * May cause the removal of nodes too, if this was their last channel.
11684  * If not permanent, makes channels unavailable for routing.
11685  */
11686 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
11687
11688 /**
11689  * For an already known (from announcement) channel, update info about one of the directions
11690  * of the channel.
11691  *
11692  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
11693  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
11694  * routing messages from a source using a protocol other than the lightning P2P protocol.
11695  */
11696 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
11697
11698 /**
11699  * For an already known (from announcement) channel, update info about one of the directions
11700  * of the channel without verifying the associated signatures. Because we aren't given the
11701  * associated signatures here we cannot relay the channel update to any of our peers.
11702  */
11703 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
11704
11705 /* Text to put at the end of the generated file */