Update auto-generated bindings with Option constructor utilities
[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 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
5098
5099 struct LDKCOption_u32Z COption_u32Z_none(void);
5100
5101 void COption_u32Z_free(struct LDKCOption_u32Z _res);
5102
5103 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
5104
5105 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
5106
5107 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
5108
5109 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
5110
5111 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
5112
5113 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
5114
5115 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
5116
5117 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
5118
5119 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
5120
5121 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
5122
5123 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
5124
5125 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
5126
5127 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
5128
5129 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
5130
5131 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
5132
5133 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
5134
5135 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
5136
5137 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
5138
5139 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
5140
5141 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
5142
5143 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
5144
5145 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
5146
5147 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
5148
5149 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
5150
5151 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
5152
5153 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
5154
5155 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
5156
5157 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
5158
5159 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
5160
5161 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
5162
5163 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
5164
5165 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
5166
5167 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
5168
5169 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
5170
5171 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
5172
5173 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
5174
5175 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
5176
5177 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
5178
5179 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
5180
5181 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
5182
5183 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
5184
5185 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
5186
5187 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
5188
5189 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
5190
5191 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
5192
5193 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
5194
5195 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
5196
5197 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
5198
5199 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
5200
5201 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
5202
5203 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
5204
5205 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
5206
5207 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
5208
5209 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
5210
5211 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
5212
5213 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
5214
5215 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
5216
5217 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
5218
5219 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
5220
5221 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
5222
5223 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
5224
5225 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
5226
5227 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
5228
5229 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
5230
5231 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
5232
5233 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
5234
5235 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
5236
5237 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
5238
5239 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
5240
5241 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
5242
5243 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
5244
5245 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
5246
5247 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
5248
5249 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
5250
5251 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
5252
5253 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
5254
5255 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
5256
5257 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
5258
5259 struct LDKCOption_u64Z COption_u64Z_none(void);
5260
5261 void COption_u64Z_free(struct LDKCOption_u64Z _res);
5262
5263 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
5264
5265 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
5266
5267 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
5268
5269 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
5270
5271 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
5272
5273 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
5274
5275 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
5276
5277 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
5278
5279 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
5280
5281 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
5282
5283 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
5284
5285 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
5286
5287 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
5288
5289 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
5290
5291 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
5292
5293 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
5294
5295 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
5296
5297 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
5298
5299 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
5300
5301 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
5302
5303 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
5304
5305 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
5306
5307 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
5308
5309 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
5310
5311 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
5312
5313 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
5314
5315 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
5316
5317 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
5318
5319 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
5320
5321 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
5322
5323 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
5324
5325 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
5326
5327 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
5328
5329 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
5330
5331 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
5332
5333 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
5334
5335 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
5336
5337 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
5338
5339 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
5340
5341 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
5342
5343 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
5344
5345 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
5346
5347 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
5348
5349 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
5350
5351 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
5352
5353 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
5354
5355 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
5356
5357 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
5358
5359 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
5360
5361 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
5362
5363 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
5364
5365 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
5366
5367 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
5368
5369 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
5370
5371 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
5372
5373 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
5374
5375 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
5376
5377 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
5378
5379 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
5380
5381 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
5382
5383 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
5384
5385 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
5386
5387 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
5388
5389 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
5390
5391 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
5392
5393 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
5394
5395 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
5396
5397 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
5398
5399 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
5400
5401 void CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res);
5402
5403 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
5404
5405 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
5406
5407 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
5408
5409 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
5410
5411 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
5412
5413 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
5414
5415 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
5416
5417 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
5418
5419 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
5420
5421 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
5422
5423 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
5424
5425 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
5426
5427 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
5428
5429 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
5430
5431 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
5432
5433 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
5434
5435 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
5436
5437 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
5438
5439 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
5440
5441 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
5442
5443 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
5444
5445 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
5446
5447 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
5448
5449 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
5450
5451 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
5452
5453 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
5454
5455 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
5456
5457 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
5458
5459 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
5460
5461 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
5462
5463 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
5464
5465 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
5466
5467 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
5468
5469 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
5470
5471 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
5472
5473 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
5474
5475 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
5476
5477 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
5478
5479 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
5480
5481 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
5482
5483 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
5484
5485 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
5486
5487 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
5488
5489 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
5490
5491 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
5492
5493 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
5494
5495 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
5496
5497 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
5498
5499 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
5500
5501 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
5502
5503 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
5504
5505 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
5506
5507 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
5508
5509 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
5510
5511 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
5512
5513 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
5514
5515 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
5516
5517 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
5518
5519 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
5520
5521 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
5522
5523 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
5524
5525 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
5526
5527 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
5528
5529 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
5530
5531 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
5532
5533 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
5534
5535 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
5536
5537 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
5538
5539 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
5540
5541 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
5542
5543 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
5544
5545 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
5546
5547 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
5548
5549 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
5550
5551 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
5552
5553 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
5554
5555 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
5556
5557 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
5558
5559 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
5560
5561 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
5562
5563 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
5564
5565 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
5566
5567 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
5568
5569 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
5570
5571 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
5572
5573 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
5574
5575 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
5576
5577 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
5578
5579 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
5580
5581 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
5582
5583 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
5584
5585 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
5586
5587 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
5588
5589 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
5590
5591 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
5592
5593 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
5594
5595 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
5596
5597 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
5598
5599 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
5600
5601 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
5602
5603 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
5604
5605 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
5606
5607 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
5608
5609 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
5610
5611 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
5612
5613 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
5614
5615 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
5616
5617 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
5618
5619 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
5620
5621 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
5622
5623 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
5624
5625 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
5626
5627 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
5628
5629 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
5630
5631 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
5632
5633 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
5634
5635 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
5636
5637 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
5638
5639 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
5640
5641 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
5642
5643 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
5644
5645 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
5646
5647 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
5648
5649 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
5650
5651 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
5652
5653 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
5654
5655 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
5656
5657 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
5658
5659 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
5660
5661 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
5662
5663 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
5664
5665 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
5666
5667 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
5668
5669 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
5670
5671 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
5672
5673 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
5674
5675 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
5676
5677 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
5678
5679 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
5680
5681 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
5682
5683 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
5684
5685 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
5686
5687 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
5688
5689 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
5690
5691 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
5692
5693 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
5694
5695 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
5696
5697 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
5698
5699 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
5700
5701 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
5702
5703 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
5704
5705 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
5706
5707 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
5708
5709 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
5710
5711 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
5712
5713 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
5714
5715 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
5716
5717 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
5718
5719 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
5720
5721 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
5722
5723 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
5724
5725 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
5726
5727 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
5728
5729 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
5730
5731 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
5732
5733 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
5734
5735 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
5736
5737 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
5738
5739 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
5740
5741 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
5742
5743 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
5744
5745 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
5746
5747 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
5748
5749 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
5750
5751 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
5752
5753 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
5754
5755 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
5756
5757 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
5758
5759 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
5760
5761 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
5762
5763 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
5764
5765 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
5766
5767 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
5768
5769 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
5770
5771 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
5772
5773 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
5774
5775 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
5776
5777 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
5778
5779 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
5780
5781 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
5782
5783 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
5784
5785 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
5786
5787 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
5788
5789 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
5790
5791 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
5792
5793 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
5794
5795 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
5796
5797 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
5798
5799 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
5800
5801 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
5802
5803 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
5804
5805 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
5806
5807 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
5808
5809 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
5810
5811 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
5812
5813 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
5814
5815 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
5816
5817 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
5818
5819 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
5820
5821 /**
5822  * Frees any resources used by the Event
5823  */
5824 void Event_free(struct LDKEvent this_ptr);
5825
5826 /**
5827  * Creates a copy of the Event
5828  */
5829 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
5830
5831 /**
5832  * Serialize the Event object into a byte array which can be read by Event_read
5833  */
5834 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
5835
5836 /**
5837  * Frees any resources used by the MessageSendEvent
5838  */
5839 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
5840
5841 /**
5842  * Creates a copy of the MessageSendEvent
5843  */
5844 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
5845
5846 /**
5847  * Calls the free function if one is set
5848  */
5849 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
5850
5851 /**
5852  * Calls the free function if one is set
5853  */
5854 void EventsProvider_free(struct LDKEventsProvider this_ptr);
5855
5856 /**
5857  * Frees any resources used by the APIError
5858  */
5859 void APIError_free(struct LDKAPIError this_ptr);
5860
5861 /**
5862  * Creates a copy of the APIError
5863  */
5864 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
5865
5866 /**
5867  * Creates a copy of the Level
5868  */
5869 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
5870
5871 /**
5872  * Returns the most verbose logging level.
5873  */
5874 MUST_USE_RES enum LDKLevel Level_max(void);
5875
5876 /**
5877  * Calls the free function if one is set
5878  */
5879 void Logger_free(struct LDKLogger this_ptr);
5880
5881 /**
5882  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
5883  */
5884 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
5885
5886 /**
5887  * Confirmations we will wait for before considering the channel locked in.
5888  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
5889  * equivalent limit applied to outbound channels).
5890  *
5891  * Default value: 6.
5892  */
5893 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
5894
5895 /**
5896  * Confirmations we will wait for before considering the channel locked in.
5897  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
5898  * equivalent limit applied to outbound channels).
5899  *
5900  * Default value: 6.
5901  */
5902 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
5903
5904 /**
5905  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
5906  * the number of blocks we have to punish our counterparty if they broadcast a revoked
5907  * transaction).
5908  *
5909  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
5910  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
5911  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
5912  * possibly with time in between to RBF the spending transaction).
5913  *
5914  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
5915  * case of an honest unilateral channel close, which implicitly decrease the economic value of
5916  * our channel.
5917  *
5918  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
5919  * can tweak config to ask for more security, not less.
5920  */
5921 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
5922
5923 /**
5924  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
5925  * the number of blocks we have to punish our counterparty if they broadcast a revoked
5926  * transaction).
5927  *
5928  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
5929  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
5930  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
5931  * possibly with time in between to RBF the spending transaction).
5932  *
5933  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
5934  * case of an honest unilateral channel close, which implicitly decrease the economic value of
5935  * our channel.
5936  *
5937  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
5938  * can tweak config to ask for more security, not less.
5939  */
5940 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
5941
5942 /**
5943  * Set to the smallest value HTLC we will accept to process.
5944  *
5945  * This value is sent to our counterparty on channel-open and we close the channel any time
5946  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
5947  *
5948  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
5949  * by the protocol.
5950  */
5951 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
5952
5953 /**
5954  * Set to the smallest value HTLC we will accept to process.
5955  *
5956  * This value is sent to our counterparty on channel-open and we close the channel any time
5957  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
5958  *
5959  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
5960  * by the protocol.
5961  */
5962 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
5963
5964 /**
5965  * Constructs a new ChannelHandshakeConfig given each field
5966  */
5967 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);
5968
5969 /**
5970  * Creates a copy of the ChannelHandshakeConfig
5971  */
5972 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
5973
5974 /**
5975  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
5976  */
5977 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
5978
5979 /**
5980  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
5981  */
5982 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
5983
5984 /**
5985  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
5986  * only applies to inbound channels.
5987  *
5988  * Default value: 0.
5989  */
5990 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
5991
5992 /**
5993  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
5994  * only applies to inbound channels.
5995  *
5996  * Default value: 0.
5997  */
5998 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
5999
6000 /**
6001  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
6002  * you to limit the maximum minimum-size they can require.
6003  *
6004  * Default value: u64::max_value.
6005  */
6006 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6007
6008 /**
6009  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
6010  * you to limit the maximum minimum-size they can require.
6011  *
6012  * Default value: u64::max_value.
6013  */
6014 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
6015
6016 /**
6017  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
6018  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
6019  *
6020  * Default value: 0.
6021  */
6022 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6023
6024 /**
6025  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
6026  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
6027  *
6028  * Default value: 0.
6029  */
6030 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
6031
6032 /**
6033  * The remote node will require we keep a certain amount in direct payment to ourselves at all
6034  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
6035  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
6036  *
6037  * Default value: u64::max_value.
6038  */
6039 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6040
6041 /**
6042  * The remote node will require we keep a certain amount in direct payment to ourselves at all
6043  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
6044  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
6045  *
6046  * Default value: u64::max_value.
6047  */
6048 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
6049
6050 /**
6051  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
6052  * time. This allows you to set a minimum such value.
6053  *
6054  * Default value: 0.
6055  */
6056 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6057
6058 /**
6059  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
6060  * time. This allows you to set a minimum such value.
6061  *
6062  * Default value: 0.
6063  */
6064 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
6065
6066 /**
6067  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
6068  * required to always be higher than this value so this only applies to HTLC outputs (and
6069  * potentially to-self outputs before any payments have been made).
6070  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
6071  * This setting allows you to set a minimum dust limit for their commitment transactions,
6072  * reflecting the reality that tiny outputs are not considered standard transactions and will
6073  * not propagate through the Bitcoin network.
6074  *
6075  * Default value: 546, the current dust limit on the Bitcoin network.
6076  */
6077 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6078
6079 /**
6080  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
6081  * required to always be higher than this value so this only applies to HTLC outputs (and
6082  * potentially to-self outputs before any payments have been made).
6083  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
6084  * This setting allows you to set a minimum dust limit for their commitment transactions,
6085  * reflecting the reality that tiny outputs are not considered standard transactions and will
6086  * not propagate through the Bitcoin network.
6087  *
6088  * Default value: 546, the current dust limit on the Bitcoin network.
6089  */
6090 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
6091
6092 /**
6093  * Maximum allowed threshold above which outputs will not be generated in their commitment
6094  * transactions.
6095  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
6096  *
6097  * Default value: u64::max_value.
6098  */
6099 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6100
6101 /**
6102  * Maximum allowed threshold above which outputs will not be generated in their commitment
6103  * transactions.
6104  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
6105  *
6106  * Default value: u64::max_value.
6107  */
6108 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
6109
6110 /**
6111  * Before a channel is usable the funding transaction will need to be confirmed by at least a
6112  * certain number of blocks, specified by the node which is not the funder (as the funder can
6113  * assume they aren't going to double-spend themselves).
6114  * This config allows you to set a limit on the maximum amount of time to wait.
6115  *
6116  * Default value: 144, or roughly one day and only applies to outbound channels.
6117  */
6118 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6119
6120 /**
6121  * Before a channel is usable the funding transaction will need to be confirmed by at least a
6122  * certain number of blocks, specified by the node which is not the funder (as the funder can
6123  * assume they aren't going to double-spend themselves).
6124  * This config allows you to set a limit on the maximum amount of time to wait.
6125  *
6126  * Default value: 144, or roughly one day and only applies to outbound channels.
6127  */
6128 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
6129
6130 /**
6131  * Set to force the incoming channel to match our announced channel preference in
6132  * ChannelConfig.
6133  *
6134  * Default value: true, to make the default that no announced channels are possible (which is
6135  * appropriate for any nodes which are not online very reliably).
6136  */
6137 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6138
6139 /**
6140  * Set to force the incoming channel to match our announced channel preference in
6141  * ChannelConfig.
6142  *
6143  * Default value: true, to make the default that no announced channels are possible (which is
6144  * appropriate for any nodes which are not online very reliably).
6145  */
6146 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
6147
6148 /**
6149  * Set to the amount of time we're willing to wait to claim money back to us.
6150  *
6151  * Not checking this value would be a security issue, as our peer would be able to set it to
6152  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
6153  *
6154  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
6155  * reduce the loss of having useless locked funds (if your peer accepts)
6156  */
6157 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
6158
6159 /**
6160  * Set to the amount of time we're willing to wait to claim money back to us.
6161  *
6162  * Not checking this value would be a security issue, as our peer would be able to set it to
6163  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
6164  *
6165  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
6166  * reduce the loss of having useless locked funds (if your peer accepts)
6167  */
6168 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
6169
6170 /**
6171  * Constructs a new ChannelHandshakeLimits given each field
6172  */
6173 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);
6174
6175 /**
6176  * Creates a copy of the ChannelHandshakeLimits
6177  */
6178 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
6179
6180 /**
6181  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
6182  */
6183 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
6184
6185 /**
6186  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
6187  */
6188 void ChannelConfig_free(struct LDKChannelConfig this_obj);
6189
6190 /**
6191  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
6192  * This may be allowed to change at runtime in a later update, however doing so must result in
6193  * update messages sent to notify all nodes of our updated relay fee.
6194  *
6195  * Default value: 0.
6196  */
6197 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
6198
6199 /**
6200  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
6201  * This may be allowed to change at runtime in a later update, however doing so must result in
6202  * update messages sent to notify all nodes of our updated relay fee.
6203  *
6204  * Default value: 0.
6205  */
6206 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
6207
6208 /**
6209  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
6210  * the channel this config applies to.
6211  *
6212  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
6213  * HTLC balance when a channel appears on-chain whereas
6214  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
6215  * (non-HTLC-encumbered) balance.
6216  *
6217  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
6218  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
6219  * commitment transaction at least once per this many blocks (minus some margin to allow us
6220  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
6221  * the spending transaction).
6222  *
6223  * Default value: 72 (12 hours at an average of 6 blocks/hour).
6224  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
6225  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
6226  *
6227  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
6228  */
6229 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
6230
6231 /**
6232  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
6233  * the channel this config applies to.
6234  *
6235  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
6236  * HTLC balance when a channel appears on-chain whereas
6237  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
6238  * (non-HTLC-encumbered) balance.
6239  *
6240  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
6241  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
6242  * commitment transaction at least once per this many blocks (minus some margin to allow us
6243  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
6244  * the spending transaction).
6245  *
6246  * Default value: 72 (12 hours at an average of 6 blocks/hour).
6247  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
6248  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
6249  *
6250  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
6251  */
6252 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
6253
6254 /**
6255  * Set to announce the channel publicly and notify all nodes that they can route via this
6256  * channel.
6257  *
6258  * This should only be set to true for nodes which expect to be online reliably.
6259  *
6260  * As the node which funds a channel picks this value this will only apply for new outbound
6261  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
6262  *
6263  * This cannot be changed after the initial channel handshake.
6264  *
6265  * Default value: false.
6266  */
6267 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
6268
6269 /**
6270  * Set to announce the channel publicly and notify all nodes that they can route via this
6271  * channel.
6272  *
6273  * This should only be set to true for nodes which expect to be online reliably.
6274  *
6275  * As the node which funds a channel picks this value this will only apply for new outbound
6276  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
6277  *
6278  * This cannot be changed after the initial channel handshake.
6279  *
6280  * Default value: false.
6281  */
6282 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
6283
6284 /**
6285  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
6286  * supports it, they will then enforce the mutual-close output to us matches what we provided
6287  * at intialization, preventing us from closing to an alternate pubkey.
6288  *
6289  * This is set to true by default to provide a slight increase in security, though ultimately
6290  * any attacker who is able to take control of a channel can just as easily send the funds via
6291  * lightning payments, so we never require that our counterparties support this option.
6292  *
6293  * This cannot be changed after a channel has been initialized.
6294  *
6295  * Default value: true.
6296  */
6297 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
6298
6299 /**
6300  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
6301  * supports it, they will then enforce the mutual-close output to us matches what we provided
6302  * at intialization, preventing us from closing to an alternate pubkey.
6303  *
6304  * This is set to true by default to provide a slight increase in security, though ultimately
6305  * any attacker who is able to take control of a channel can just as easily send the funds via
6306  * lightning payments, so we never require that our counterparties support this option.
6307  *
6308  * This cannot be changed after a channel has been initialized.
6309  *
6310  * Default value: true.
6311  */
6312 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
6313
6314 /**
6315  * Constructs a new ChannelConfig given each field
6316  */
6317 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);
6318
6319 /**
6320  * Creates a copy of the ChannelConfig
6321  */
6322 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
6323
6324 /**
6325  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
6326  */
6327 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
6328
6329 /**
6330  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
6331  */
6332 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
6333
6334 /**
6335  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
6336  */
6337 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
6338
6339 /**
6340  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
6341  */
6342 void UserConfig_free(struct LDKUserConfig this_obj);
6343
6344 /**
6345  * Channel config that we propose to our counterparty.
6346  */
6347 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
6348
6349 /**
6350  * Channel config that we propose to our counterparty.
6351  */
6352 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
6353
6354 /**
6355  * Limits applied to our counterparty's proposed channel config settings.
6356  */
6357 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
6358
6359 /**
6360  * Limits applied to our counterparty's proposed channel config settings.
6361  */
6362 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
6363
6364 /**
6365  * Channel config which affects behavior during channel lifetime.
6366  */
6367 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
6368
6369 /**
6370  * Channel config which affects behavior during channel lifetime.
6371  */
6372 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
6373
6374 /**
6375  * Constructs a new UserConfig given each field
6376  */
6377 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);
6378
6379 /**
6380  * Creates a copy of the UserConfig
6381  */
6382 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
6383
6384 /**
6385  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
6386  */
6387 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
6388
6389 /**
6390  * Creates a copy of the AccessError
6391  */
6392 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
6393
6394 /**
6395  * Calls the free function if one is set
6396  */
6397 void Access_free(struct LDKAccess this_ptr);
6398
6399 /**
6400  * Calls the free function if one is set
6401  */
6402 void Listen_free(struct LDKListen this_ptr);
6403
6404 /**
6405  * Calls the free function if one is set
6406  */
6407 void Watch_free(struct LDKWatch this_ptr);
6408
6409 /**
6410  * Calls the free function if one is set
6411  */
6412 void Filter_free(struct LDKFilter this_ptr);
6413
6414 /**
6415  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
6416  */
6417 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
6418
6419 /**
6420  * First block where the transaction output may have been spent.
6421  */
6422 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
6423
6424 /**
6425  * First block where the transaction output may have been spent.
6426  */
6427 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6428
6429 /**
6430  * Outpoint identifying the transaction output.
6431  */
6432 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
6433
6434 /**
6435  * Outpoint identifying the transaction output.
6436  */
6437 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
6438
6439 /**
6440  * Spending condition of the transaction output.
6441  */
6442 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
6443
6444 /**
6445  * Spending condition of the transaction output.
6446  */
6447 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
6448
6449 /**
6450  * Constructs a new WatchedOutput given each field
6451  */
6452 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
6453
6454 /**
6455  * Calls the free function if one is set
6456  */
6457 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
6458
6459 /**
6460  * Creates a copy of the ConfirmationTarget
6461  */
6462 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
6463
6464 /**
6465  * Calls the free function if one is set
6466  */
6467 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
6468
6469 /**
6470  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
6471  */
6472 void ChainMonitor_free(struct LDKChainMonitor this_obj);
6473
6474 /**
6475  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
6476  * of a channel and reacting accordingly based on transactions in the connected block. See
6477  * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
6478  * be returned by [`chain::Watch::release_pending_monitor_events`].
6479  *
6480  * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
6481  * calls must not exclude any transactions matching the new outputs nor any in-block
6482  * descendants of such transactions. It is not necessary to re-fetch the block to obtain
6483  * updated `txdata`.
6484  */
6485 void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
6486
6487 /**
6488  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
6489  * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
6490  * details.
6491  */
6492 void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
6493
6494 /**
6495  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
6496  *
6497  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
6498  * will call back to it indicating transactions and outputs of interest. This allows clients to
6499  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
6500  * always need to fetch full blocks absent another means for determining which blocks contain
6501  * transactions relevant to the watched channels.
6502  */
6503 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
6504
6505 /**
6506  * Constructs a new Watch which calls the relevant methods on this_arg.
6507  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
6508  */
6509 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
6510
6511 /**
6512  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
6513  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
6514  */
6515 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
6516
6517 /**
6518  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
6519  */
6520 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
6521
6522 /**
6523  * The sequence number of this update. Updates *must* be replayed in-order according to this
6524  * sequence number (and updates may panic if they are not). The update_id values are strictly
6525  * increasing and increase by one for each new update, with one exception specified below.
6526  *
6527  * This sequence number is also used to track up to which points updates which returned
6528  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
6529  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
6530  *
6531  * The only instance where update_id values are not strictly increasing is the case where we
6532  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
6533  * its docs for more details.
6534  */
6535 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
6536
6537 /**
6538  * The sequence number of this update. Updates *must* be replayed in-order according to this
6539  * sequence number (and updates may panic if they are not). The update_id values are strictly
6540  * increasing and increase by one for each new update, with one exception specified below.
6541  *
6542  * This sequence number is also used to track up to which points updates which returned
6543  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
6544  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
6545  *
6546  * The only instance where update_id values are not strictly increasing is the case where we
6547  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
6548  * its docs for more details.
6549  */
6550 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
6551
6552 /**
6553  * Creates a copy of the ChannelMonitorUpdate
6554  */
6555 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
6556
6557 /**
6558  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
6559  */
6560 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
6561
6562 /**
6563  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
6564  */
6565 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
6566
6567 /**
6568  * Creates a copy of the ChannelMonitorUpdateErr
6569  */
6570 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
6571
6572 /**
6573  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
6574  */
6575 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
6576
6577 /**
6578  * Creates a copy of the MonitorUpdateError
6579  */
6580 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
6581
6582 /**
6583  * Frees any resources used by the MonitorEvent
6584  */
6585 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
6586
6587 /**
6588  * Creates a copy of the MonitorEvent
6589  */
6590 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
6591
6592 /**
6593  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
6594  */
6595 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
6596
6597 /**
6598  * Creates a copy of the HTLCUpdate
6599  */
6600 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
6601
6602 /**
6603  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
6604  */
6605 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
6606
6607 /**
6608  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
6609  */
6610 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
6611
6612 /**
6613  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
6614  */
6615 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
6616
6617 /**
6618  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
6619  */
6620 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
6621
6622 /**
6623  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
6624  * itself.
6625  *
6626  * panics if the given update is not the next update by update_id.
6627  */
6628 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);
6629
6630 /**
6631  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
6632  * ChannelMonitor.
6633  */
6634 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
6635
6636 /**
6637  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
6638  */
6639 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
6640
6641 /**
6642  * Gets a list of txids, with their output scripts (in the order they appear in the
6643  * transaction), which we must learn about spends of via block_connected().
6644  */
6645 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
6646
6647 /**
6648  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
6649  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
6650  * have been registered.
6651  */
6652 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
6653
6654 /**
6655  * Get the list of HTLCs who's status has been updated on chain. This should be called by
6656  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
6657  */
6658 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
6659
6660 /**
6661  * Gets the list of pending events which were generated by previous actions, clearing the list
6662  * in the process.
6663  *
6664  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
6665  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
6666  * no internal locking in ChannelMonitors.
6667  */
6668 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
6669
6670 /**
6671  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
6672  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
6673  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
6674  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
6675  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
6676  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
6677  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
6678  * out-of-band the other node operator to coordinate with him if option is available to you.
6679  * In any-case, choice is up to the user.
6680  */
6681 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);
6682
6683 /**
6684  * Processes transactions in a newly connected block, which may result in any of the following:
6685  * - update the monitor's state against resolved HTLCs
6686  * - punish the counterparty in the case of seeing a revoked commitment transaction
6687  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
6688  * - detect settled outputs for later spending
6689  * - schedule and bump any in-flight claims
6690  *
6691  * Returns any new outputs to watch from `txdata`; after called, these are also included in
6692  * [`get_outputs_to_watch`].
6693  *
6694  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
6695  */
6696 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);
6697
6698 /**
6699  * Determines if the disconnected block contained any transactions of interest and updates
6700  * appropriately.
6701  */
6702 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);
6703
6704 /**
6705  * Calls the free function if one is set
6706  */
6707 void Persist_free(struct LDKPersist this_ptr);
6708
6709 /**
6710  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
6711  */
6712 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
6713
6714 /**
6715  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
6716  */
6717 void OutPoint_free(struct LDKOutPoint this_obj);
6718
6719 /**
6720  * The referenced transaction's txid.
6721  */
6722 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
6723
6724 /**
6725  * The referenced transaction's txid.
6726  */
6727 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6728
6729 /**
6730  * The index of the referenced output in its transaction's vout.
6731  */
6732 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
6733
6734 /**
6735  * The index of the referenced output in its transaction's vout.
6736  */
6737 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
6738
6739 /**
6740  * Constructs a new OutPoint given each field
6741  */
6742 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
6743
6744 /**
6745  * Creates a copy of the OutPoint
6746  */
6747 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
6748
6749 /**
6750  * Convert an `OutPoint` to a lightning channel id.
6751  */
6752 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
6753
6754 /**
6755  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
6756  */
6757 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
6758
6759 /**
6760  * Read a OutPoint from a byte array, created by OutPoint_write
6761  */
6762 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
6763
6764 /**
6765  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
6766  */
6767 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
6768
6769 /**
6770  * The outpoint which is spendable
6771  */
6772 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
6773
6774 /**
6775  * The outpoint which is spendable
6776  */
6777 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
6778
6779 /**
6780  * Per commitment point to derive delayed_payment_key by key holder
6781  */
6782 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
6783
6784 /**
6785  * Per commitment point to derive delayed_payment_key by key holder
6786  */
6787 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6788
6789 /**
6790  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
6791  * the witness_script.
6792  */
6793 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
6794
6795 /**
6796  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
6797  * the witness_script.
6798  */
6799 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
6800
6801 /**
6802  * The output which is referenced by the given outpoint
6803  */
6804 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
6805
6806 /**
6807  * The revocation point specific to the commitment transaction which was broadcast. Used to
6808  * derive the witnessScript for this output.
6809  */
6810 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
6811
6812 /**
6813  * The revocation point specific to the commitment transaction which was broadcast. Used to
6814  * derive the witnessScript for this output.
6815  */
6816 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6817
6818 /**
6819  * Arbitrary identification information returned by a call to
6820  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
6821  * the channel to spend the output.
6822  */
6823 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
6824
6825 /**
6826  * Arbitrary identification information returned by a call to
6827  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
6828  * the channel to spend the output.
6829  */
6830 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6831
6832 /**
6833  * The value of the channel which this output originated from, possibly indirectly.
6834  */
6835 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
6836
6837 /**
6838  * The value of the channel which this output originated from, possibly indirectly.
6839  */
6840 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
6841
6842 /**
6843  * Constructs a new DelayedPaymentOutputDescriptor given each field
6844  */
6845 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);
6846
6847 /**
6848  * Creates a copy of the DelayedPaymentOutputDescriptor
6849  */
6850 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
6851
6852 /**
6853  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
6854  */
6855 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
6856
6857 /**
6858  * The outpoint which is spendable
6859  */
6860 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
6861
6862 /**
6863  * The outpoint which is spendable
6864  */
6865 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
6866
6867 /**
6868  * The output which is referenced by the given outpoint
6869  */
6870 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
6871
6872 /**
6873  * Arbitrary identification information returned by a call to
6874  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
6875  * the channel to spend the output.
6876  */
6877 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
6878
6879 /**
6880  * Arbitrary identification information returned by a call to
6881  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
6882  * the channel to spend the output.
6883  */
6884 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6885
6886 /**
6887  * The value of the channel which this transactions spends.
6888  */
6889 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
6890
6891 /**
6892  * The value of the channel which this transactions spends.
6893  */
6894 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
6895
6896 /**
6897  * Constructs a new StaticPaymentOutputDescriptor given each field
6898  */
6899 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);
6900
6901 /**
6902  * Creates a copy of the StaticPaymentOutputDescriptor
6903  */
6904 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
6905
6906 /**
6907  * Frees any resources used by the SpendableOutputDescriptor
6908  */
6909 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
6910
6911 /**
6912  * Creates a copy of the SpendableOutputDescriptor
6913  */
6914 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
6915
6916 /**
6917  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
6918  */
6919 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
6920
6921 /**
6922  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
6923  */
6924 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
6925
6926 /**
6927  * Creates a copy of a Sign
6928  */
6929 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
6930
6931 /**
6932  * Calls the free function if one is set
6933  */
6934 void Sign_free(struct LDKSign this_ptr);
6935
6936 /**
6937  * Calls the free function if one is set
6938  */
6939 void KeysInterface_free(struct LDKKeysInterface this_ptr);
6940
6941 /**
6942  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
6943  */
6944 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
6945
6946 /**
6947  * Private key of anchor tx
6948  */
6949 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
6950
6951 /**
6952  * Private key of anchor tx
6953  */
6954 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
6955
6956 /**
6957  * Holder secret key for blinded revocation pubkey
6958  */
6959 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
6960
6961 /**
6962  * Holder secret key for blinded revocation pubkey
6963  */
6964 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
6965
6966 /**
6967  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
6968  */
6969 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
6970
6971 /**
6972  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
6973  */
6974 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
6975
6976 /**
6977  * Holder secret key used in HTLC tx
6978  */
6979 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
6980
6981 /**
6982  * Holder secret key used in HTLC tx
6983  */
6984 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
6985
6986 /**
6987  * Holder htlc secret key used in commitment tx htlc outputs
6988  */
6989 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
6990
6991 /**
6992  * Holder htlc secret key used in commitment tx htlc outputs
6993  */
6994 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
6995
6996 /**
6997  * Commitment seed
6998  */
6999 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
7000
7001 /**
7002  * Commitment seed
7003  */
7004 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7005
7006 /**
7007  * Creates a copy of the InMemorySigner
7008  */
7009 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
7010
7011 /**
7012  * Create a new InMemorySigner
7013  */
7014 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);
7015
7016 /**
7017  * Counterparty pubkeys.
7018  * Will panic if ready_channel wasn't called.
7019  */
7020 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
7021
7022 /**
7023  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
7024  * transactions, ie the amount of time that we have to wait to recover our funds if we
7025  * broadcast a transaction.
7026  * Will panic if ready_channel wasn't called.
7027  */
7028 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
7029
7030 /**
7031  * The contest_delay value specified by us and applied on transactions broadcastable
7032  * by our counterparty, ie the amount of time that they have to wait to recover their funds
7033  * if they broadcast a transaction.
7034  * Will panic if ready_channel wasn't called.
7035  */
7036 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
7037
7038 /**
7039  * Whether the holder is the initiator
7040  * Will panic if ready_channel wasn't called.
7041  */
7042 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
7043
7044 /**
7045  * Funding outpoint
7046  * Will panic if ready_channel wasn't called.
7047  */
7048 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
7049
7050 /**
7051  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
7052  * building transactions.
7053  *
7054  * Will panic if ready_channel wasn't called.
7055  */
7056 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
7057
7058 /**
7059  * Sign the single input of spend_tx at index `input_idx` which spends the output
7060  * described by descriptor, returning the witness stack for the input.
7061  *
7062  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
7063  * or is not spending the outpoint described by `descriptor.outpoint`.
7064  */
7065 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);
7066
7067 /**
7068  * Sign the single input of spend_tx at index `input_idx` which spends the output
7069  * described by descriptor, returning the witness stack for the input.
7070  *
7071  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
7072  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
7073  * sequence set to `descriptor.to_self_delay`.
7074  */
7075 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);
7076
7077 /**
7078  * Constructs a new Sign which calls the relevant methods on this_arg.
7079  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
7080  */
7081 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
7082
7083 /**
7084  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
7085  */
7086 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
7087
7088 /**
7089  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
7090  */
7091 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
7092
7093 /**
7094  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
7095  */
7096 void KeysManager_free(struct LDKKeysManager this_obj);
7097
7098 /**
7099  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
7100  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
7101  * starting_time isn't strictly required to actually be a time, but it must absolutely,
7102  * without a doubt, be unique to this instance. ie if you start multiple times with the same
7103  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
7104  * simply use the current time (with very high precision).
7105  *
7106  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
7107  * obviously, starting_time should be unique every time you reload the library - it is only
7108  * used to generate new ephemeral key data (which will be stored by the individual channel if
7109  * necessary).
7110  *
7111  * Note that the seed is required to recover certain on-chain funds independent of
7112  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
7113  * channel, and some on-chain during-closing funds.
7114  *
7115  * Note that until the 0.1 release there is no guarantee of backward compatibility between
7116  * versions. Once the library is more fully supported, the docs will be updated to include a
7117  * detailed description of the guarantee.
7118  */
7119 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
7120
7121 /**
7122  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
7123  *
7124  * Key derivation parameters are accessible through a per-channel secrets
7125  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
7126  * onchain output detection for which a corresponding delayed_payment_key must be derived.
7127  */
7128 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]);
7129
7130 /**
7131  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
7132  * output to the given change destination (if sufficient change value remains). The
7133  * transaction will have a feerate, at least, of the given value.
7134  *
7135  * Returns `Err(())` if the output value is greater than the input value minus required fee or
7136  * if a descriptor was duplicated.
7137  *
7138  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
7139  *
7140  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
7141  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
7142  */
7143 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);
7144
7145 /**
7146  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
7147  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
7148  */
7149 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
7150
7151 /**
7152  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
7153  */
7154 void ChannelManager_free(struct LDKChannelManager this_obj);
7155
7156 /**
7157  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
7158  */
7159 void ChainParameters_free(struct LDKChainParameters this_obj);
7160
7161 /**
7162  * The network for determining the `chain_hash` in Lightning messages.
7163  */
7164 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
7165
7166 /**
7167  * The network for determining the `chain_hash` in Lightning messages.
7168  */
7169 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
7170
7171 /**
7172  * The hash of the latest block successfully connected.
7173  */
7174 const uint8_t (*ChainParameters_get_latest_hash(const struct LDKChainParameters *NONNULL_PTR this_ptr))[32];
7175
7176 /**
7177  * The hash of the latest block successfully connected.
7178  */
7179 void ChainParameters_set_latest_hash(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7180
7181 /**
7182  * The height of the latest block successfully connected.
7183  *
7184  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
7185  */
7186 uintptr_t ChainParameters_get_latest_height(const struct LDKChainParameters *NONNULL_PTR this_ptr);
7187
7188 /**
7189  * The height of the latest block successfully connected.
7190  *
7191  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
7192  */
7193 void ChainParameters_set_latest_height(struct LDKChainParameters *NONNULL_PTR this_ptr, uintptr_t val);
7194
7195 /**
7196  * Constructs a new ChainParameters given each field
7197  */
7198 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKThirtyTwoBytes latest_hash_arg, uintptr_t latest_height_arg);
7199
7200 /**
7201  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
7202  */
7203 void ChannelDetails_free(struct LDKChannelDetails this_obj);
7204
7205 /**
7206  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
7207  * thereafter this is the txid of the funding transaction xor the funding transaction output).
7208  * Note that this means this value is *not* persistent - it can change once during the
7209  * lifetime of the channel.
7210  */
7211 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
7212
7213 /**
7214  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
7215  * thereafter this is the txid of the funding transaction xor the funding transaction output).
7216  * Note that this means this value is *not* persistent - it can change once during the
7217  * lifetime of the channel.
7218  */
7219 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7220
7221 /**
7222  * The position of the funding transaction in the chain. None if the funding transaction has
7223  * not yet been confirmed and the channel fully opened.
7224  */
7225 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7226
7227 /**
7228  * The position of the funding transaction in the chain. None if the funding transaction has
7229  * not yet been confirmed and the channel fully opened.
7230  */
7231 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
7232
7233 /**
7234  * The node_id of our counterparty
7235  */
7236 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7237
7238 /**
7239  * The node_id of our counterparty
7240  */
7241 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7242
7243 /**
7244  * The Features the channel counterparty provided upon last connection.
7245  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
7246  * many routing-relevant features are present in the init context.
7247  */
7248 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7249
7250 /**
7251  * The Features the channel counterparty provided upon last connection.
7252  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
7253  * many routing-relevant features are present in the init context.
7254  */
7255 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
7256
7257 /**
7258  * The value, in satoshis, of this channel as appears in the funding output
7259  */
7260 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7261
7262 /**
7263  * The value, in satoshis, of this channel as appears in the funding output
7264  */
7265 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
7266
7267 /**
7268  * The user_id passed in to create_channel, or 0 if the channel was inbound.
7269  */
7270 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7271
7272 /**
7273  * The user_id passed in to create_channel, or 0 if the channel was inbound.
7274  */
7275 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
7276
7277 /**
7278  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
7279  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
7280  * available for inclusion in new outbound HTLCs). This further does not include any pending
7281  * outgoing HTLCs which are awaiting some other resolution to be sent.
7282  */
7283 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7284
7285 /**
7286  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
7287  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
7288  * available for inclusion in new outbound HTLCs). This further does not include any pending
7289  * outgoing HTLCs which are awaiting some other resolution to be sent.
7290  */
7291 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
7292
7293 /**
7294  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
7295  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
7296  * available for inclusion in new inbound HTLCs).
7297  * Note that there are some corner cases not fully handled here, so the actual available
7298  * inbound capacity may be slightly higher than this.
7299  */
7300 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7301
7302 /**
7303  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
7304  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
7305  * available for inclusion in new inbound HTLCs).
7306  * Note that there are some corner cases not fully handled here, so the actual available
7307  * inbound capacity may be slightly higher than this.
7308  */
7309 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
7310
7311 /**
7312  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
7313  * the peer is connected, and (c) no monitor update failure is pending resolution.
7314  */
7315 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
7316
7317 /**
7318  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
7319  * the peer is connected, and (c) no monitor update failure is pending resolution.
7320  */
7321 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
7322
7323 /**
7324  * Creates a copy of the ChannelDetails
7325  */
7326 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
7327
7328 /**
7329  * Frees any resources used by the PaymentSendFailure
7330  */
7331 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
7332
7333 /**
7334  * Creates a copy of the PaymentSendFailure
7335  */
7336 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
7337
7338 /**
7339  * Constructs a new ChannelManager to hold several channels and route between them.
7340  *
7341  * This is the main \"logic hub\" for all channel-related actions, and implements
7342  * ChannelMessageHandler.
7343  *
7344  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
7345  *
7346  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
7347  *
7348  * Users need to notify the new ChannelManager when a new block is connected or
7349  * disconnected using its `block_connected` and `block_disconnected` methods, starting
7350  * from after `params.latest_hash`.
7351  */
7352 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);
7353
7354 /**
7355  * Creates a new outbound channel to the given remote node and with the given value.
7356  *
7357  * user_id will be provided back as user_channel_id in FundingGenerationReady and
7358  * FundingBroadcastSafe events to allow tracking of which events correspond with which
7359  * create_channel call. Note that user_channel_id defaults to 0 for inbound channels, so you
7360  * may wish to avoid using 0 for user_id here.
7361  *
7362  * If successful, will generate a SendOpenChannel message event, so you should probably poll
7363  * PeerManager::process_events afterwards.
7364  *
7365  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
7366  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
7367  */
7368 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);
7369
7370 /**
7371  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
7372  * more information.
7373  */
7374 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
7375
7376 /**
7377  * Gets the list of usable channels, in random order. Useful as an argument to
7378  * get_route to ensure non-announced channels are used.
7379  *
7380  * These are guaranteed to have their is_live value set to true, see the documentation for
7381  * ChannelDetails::is_live for more info on exactly what the criteria are.
7382  */
7383 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
7384
7385 /**
7386  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
7387  * will be accepted on the given channel, and after additional timeout/the closing of all
7388  * pending HTLCs, the channel will be closed on chain.
7389  *
7390  * May generate a SendShutdown message event on success, which should be relayed.
7391  */
7392 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
7393
7394 /**
7395  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
7396  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
7397  */
7398 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
7399
7400 /**
7401  * Force close all channels, immediately broadcasting the latest local commitment transaction
7402  * for each to the chain and rejecting new HTLCs on each.
7403  */
7404 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
7405
7406 /**
7407  * Sends a payment along a given route.
7408  *
7409  * Value parameters are provided via the last hop in route, see documentation for RouteHop
7410  * fields for more info.
7411  *
7412  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
7413  * payment), we don't do anything to stop you! We always try to ensure that if the provided
7414  * next hop knows the preimage to payment_hash they can claim an additional amount as
7415  * specified in the last hop in the route! Thus, you should probably do your own
7416  * payment_preimage tracking (which you should already be doing as they represent \"proof of
7417  * payment\") and prevent double-sends yourself.
7418  *
7419  * May generate SendHTLCs message(s) event on success, which should be relayed.
7420  *
7421  * Each path may have a different return value, and PaymentSendValue may return a Vec with
7422  * each entry matching the corresponding-index entry in the route paths, see
7423  * PaymentSendFailure for more info.
7424  *
7425  * In general, a path may raise:
7426  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
7427  *    node public key) is specified.
7428  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
7429  *    (including due to previous monitor update failure or new permanent monitor update
7430  *    failure).
7431  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
7432  *    relevant updates.
7433  *
7434  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
7435  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
7436  * different route unless you intend to pay twice!
7437  *
7438  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
7439  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
7440  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
7441  * must not contain multiple paths as multi-path payments require a recipient-provided
7442  * payment_secret.
7443  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
7444  * bit set (either as required or as available). If multiple paths are present in the Route,
7445  * we assume the invoice had the basic_mpp feature set.
7446  */
7447 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);
7448
7449 /**
7450  * Call this upon creation of a funding transaction for the given channel.
7451  *
7452  * Note that ALL inputs in the transaction pointed to by funding_txo MUST spend SegWit outputs
7453  * or your counterparty can steal your funds!
7454  *
7455  * Panics if a funding transaction has already been provided for this channel.
7456  *
7457  * May panic if the funding_txo is duplicative with some other channel (note that this should
7458  * be trivially prevented by using unique funding transaction keys per-channel).
7459  */
7460 void ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKOutPoint funding_txo);
7461
7462 /**
7463  * Generates a signed node_announcement from the given arguments and creates a
7464  * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
7465  * seen a channel_announcement from us (ie unless we have public channels open).
7466  *
7467  * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
7468  * to humans. They carry no in-protocol meaning.
7469  *
7470  * addresses represent the set (possibly empty) of socket addresses on which this node accepts
7471  * incoming connections. These will be broadcast to the network, publicly tying these
7472  * addresses together. If you wish to preserve user privacy, addresses should likely contain
7473  * only Tor Onion addresses.
7474  *
7475  * Panics if addresses is absurdly large (more than 500).
7476  */
7477 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
7478
7479 /**
7480  * Processes HTLCs which are pending waiting on random forward delay.
7481  *
7482  * Should only really ever be called in response to a PendingHTLCsForwardable event.
7483  * Will likely generate further events.
7484  */
7485 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
7486
7487 /**
7488  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
7489  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
7490  * to inform the network about the uselessness of these channels.
7491  *
7492  * This method handles all the details, and must be called roughly once per minute.
7493  *
7494  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
7495  */
7496 void ChannelManager_timer_chan_freshness_every_min(const struct LDKChannelManager *NONNULL_PTR this_arg);
7497
7498 /**
7499  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
7500  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
7501  * along the path (including in our own channel on which we received it).
7502  * Returns false if no payment was found to fail backwards, true if the process of failing the
7503  * HTLC backwards has been started.
7504  */
7505 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);
7506
7507 /**
7508  * Provides a payment preimage in response to a PaymentReceived event, returning true and
7509  * generating message events for the net layer to claim the payment, if possible. Thus, you
7510  * should probably kick the net layer to go send messages if this returns true!
7511  *
7512  * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
7513  * available within a few percent of the expected amount. This is critical for several
7514  * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
7515  * payment_preimage without having provided the full value and b) it avoids certain
7516  * privacy-breaking recipient-probing attacks which may reveal payment activity to
7517  * motivated attackers.
7518  *
7519  * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
7520  * set. Thus, for such payments we will claim any payments which do not under-pay.
7521  *
7522  * May panic if called except in response to a PaymentReceived event.
7523  */
7524 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);
7525
7526 /**
7527  * Gets the node_id held by this ChannelManager
7528  */
7529 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
7530
7531 /**
7532  * Restores a single, given channel to normal operation after a
7533  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
7534  * operation.
7535  *
7536  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
7537  * fully committed in every copy of the given channels' ChannelMonitors.
7538  *
7539  * Note that there is no effect to calling with a highest_applied_update_id other than the
7540  * current latest ChannelMonitorUpdate and one call to this function after multiple
7541  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
7542  * exists largely only to prevent races between this and concurrent update_monitor calls.
7543  *
7544  * Thus, the anticipated use is, at a high level:
7545  *  1) You register a chain::Watch with this ChannelManager,
7546  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
7547  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
7548  *     any time it cannot do so instantly,
7549  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
7550  *  4) once all remote copies are updated, you call this function with the update_id that
7551  *     completed, and once it is the latest the Channel will be re-enabled.
7552  */
7553 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);
7554
7555 /**
7556  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
7557  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
7558  */
7559 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
7560
7561 /**
7562  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
7563  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
7564  */
7565 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
7566
7567 /**
7568  * Constructs a new Listen which calls the relevant methods on this_arg.
7569  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
7570  */
7571 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
7572
7573 /**
7574  * Updates channel state based on transactions seen in a connected block.
7575  */
7576 void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
7577
7578 /**
7579  * Updates channel state based on a disconnected block.
7580  *
7581  * If necessary, the channel may be force-closed without letting the counterparty participate
7582  * in the shutdown.
7583  */
7584 void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]);
7585
7586 /**
7587  * Blocks until ChannelManager needs to be persisted. Only one listener on
7588  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
7589  * up.
7590  */
7591 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
7592
7593 /**
7594  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
7595  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
7596  */
7597 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
7598
7599 /**
7600  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
7601  */
7602 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
7603
7604 /**
7605  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
7606  */
7607 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
7608
7609 /**
7610  * The keys provider which will give us relevant keys. Some keys will be loaded during
7611  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
7612  * signing data.
7613  */
7614 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
7615
7616 /**
7617  * The keys provider which will give us relevant keys. Some keys will be loaded during
7618  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
7619  * signing data.
7620  */
7621 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
7622
7623 /**
7624  * The fee_estimator for use in the ChannelManager in the future.
7625  *
7626  * No calls to the FeeEstimator will be made during deserialization.
7627  */
7628 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
7629
7630 /**
7631  * The fee_estimator for use in the ChannelManager in the future.
7632  *
7633  * No calls to the FeeEstimator will be made during deserialization.
7634  */
7635 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
7636
7637 /**
7638  * The chain::Watch for use in the ChannelManager in the future.
7639  *
7640  * No calls to the chain::Watch will be made during deserialization. It is assumed that
7641  * you have deserialized ChannelMonitors separately and will add them to your
7642  * chain::Watch after deserializing this ChannelManager.
7643  */
7644 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
7645
7646 /**
7647  * The chain::Watch for use in the ChannelManager in the future.
7648  *
7649  * No calls to the chain::Watch will be made during deserialization. It is assumed that
7650  * you have deserialized ChannelMonitors separately and will add them to your
7651  * chain::Watch after deserializing this ChannelManager.
7652  */
7653 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
7654
7655 /**
7656  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
7657  * used to broadcast the latest local commitment transactions of channels which must be
7658  * force-closed during deserialization.
7659  */
7660 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
7661
7662 /**
7663  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
7664  * used to broadcast the latest local commitment transactions of channels which must be
7665  * force-closed during deserialization.
7666  */
7667 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
7668
7669 /**
7670  * The Logger for use in the ChannelManager and which may be used to log information during
7671  * deserialization.
7672  */
7673 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
7674
7675 /**
7676  * The Logger for use in the ChannelManager and which may be used to log information during
7677  * deserialization.
7678  */
7679 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
7680
7681 /**
7682  * Default settings used for new channels. Any existing channels will continue to use the
7683  * runtime settings which were stored when the ChannelManager was serialized.
7684  */
7685 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
7686
7687 /**
7688  * Default settings used for new channels. Any existing channels will continue to use the
7689  * runtime settings which were stored when the ChannelManager was serialized.
7690  */
7691 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
7692
7693 /**
7694  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
7695  * HashMap for you. This is primarily useful for C bindings where it is not practical to
7696  * populate a HashMap directly from C.
7697  */
7698 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);
7699
7700 /**
7701  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
7702  */
7703 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
7704
7705 /**
7706  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
7707  */
7708 void DecodeError_free(struct LDKDecodeError this_obj);
7709
7710 /**
7711  * Creates a copy of the DecodeError
7712  */
7713 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
7714
7715 /**
7716  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
7717  */
7718 void Init_free(struct LDKInit this_obj);
7719
7720 /**
7721  * The relevant features which the sender supports
7722  */
7723 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
7724
7725 /**
7726  * The relevant features which the sender supports
7727  */
7728 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
7729
7730 /**
7731  * Constructs a new Init given each field
7732  */
7733 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
7734
7735 /**
7736  * Creates a copy of the Init
7737  */
7738 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
7739
7740 /**
7741  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
7742  */
7743 void ErrorMessage_free(struct LDKErrorMessage this_obj);
7744
7745 /**
7746  * The channel ID involved in the error
7747  */
7748 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
7749
7750 /**
7751  * The channel ID involved in the error
7752  */
7753 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7754
7755 /**
7756  * A possibly human-readable error description.
7757  * The string should be sanitized before it is used (e.g. emitted to logs
7758  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
7759  * vulnerability in the terminal emulator or the logging subsystem.
7760  */
7761 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
7762
7763 /**
7764  * A possibly human-readable error description.
7765  * The string should be sanitized before it is used (e.g. emitted to logs
7766  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
7767  * vulnerability in the terminal emulator or the logging subsystem.
7768  */
7769 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
7770
7771 /**
7772  * Constructs a new ErrorMessage given each field
7773  */
7774 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg);
7775
7776 /**
7777  * Creates a copy of the ErrorMessage
7778  */
7779 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
7780
7781 /**
7782  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
7783  */
7784 void Ping_free(struct LDKPing this_obj);
7785
7786 /**
7787  * The desired response length
7788  */
7789 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
7790
7791 /**
7792  * The desired response length
7793  */
7794 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
7795
7796 /**
7797  * The ping packet size.
7798  * This field is not sent on the wire. byteslen zeros are sent.
7799  */
7800 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
7801
7802 /**
7803  * The ping packet size.
7804  * This field is not sent on the wire. byteslen zeros are sent.
7805  */
7806 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
7807
7808 /**
7809  * Constructs a new Ping given each field
7810  */
7811 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
7812
7813 /**
7814  * Creates a copy of the Ping
7815  */
7816 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
7817
7818 /**
7819  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
7820  */
7821 void Pong_free(struct LDKPong this_obj);
7822
7823 /**
7824  * The pong packet size.
7825  * This field is not sent on the wire. byteslen zeros are sent.
7826  */
7827 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
7828
7829 /**
7830  * The pong packet size.
7831  * This field is not sent on the wire. byteslen zeros are sent.
7832  */
7833 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
7834
7835 /**
7836  * Constructs a new Pong given each field
7837  */
7838 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
7839
7840 /**
7841  * Creates a copy of the Pong
7842  */
7843 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
7844
7845 /**
7846  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
7847  */
7848 void OpenChannel_free(struct LDKOpenChannel this_obj);
7849
7850 /**
7851  * The genesis hash of the blockchain where the channel is to be opened
7852  */
7853 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
7854
7855 /**
7856  * The genesis hash of the blockchain where the channel is to be opened
7857  */
7858 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7859
7860 /**
7861  * A temporary channel ID, until the funding outpoint is announced
7862  */
7863 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
7864
7865 /**
7866  * A temporary channel ID, until the funding outpoint is announced
7867  */
7868 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7869
7870 /**
7871  * The channel value
7872  */
7873 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7874
7875 /**
7876  * The channel value
7877  */
7878 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
7879
7880 /**
7881  * The amount to push to the counterparty as part of the open, in milli-satoshi
7882  */
7883 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7884
7885 /**
7886  * The amount to push to the counterparty as part of the open, in milli-satoshi
7887  */
7888 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
7889
7890 /**
7891  * The threshold below which outputs on transactions broadcast by sender will be omitted
7892  */
7893 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7894
7895 /**
7896  * The threshold below which outputs on transactions broadcast by sender will be omitted
7897  */
7898 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
7899
7900 /**
7901  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
7902  */
7903 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7904
7905 /**
7906  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
7907  */
7908 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
7909
7910 /**
7911  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
7912  */
7913 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7914
7915 /**
7916  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
7917  */
7918 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
7919
7920 /**
7921  * The minimum HTLC size incoming to sender, in milli-satoshi
7922  */
7923 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7924
7925 /**
7926  * The minimum HTLC size incoming to sender, in milli-satoshi
7927  */
7928 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
7929
7930 /**
7931  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
7932  */
7933 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7934
7935 /**
7936  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
7937  */
7938 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
7939
7940 /**
7941  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
7942  */
7943 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7944
7945 /**
7946  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
7947  */
7948 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
7949
7950 /**
7951  * The maximum number of inbound HTLCs towards sender
7952  */
7953 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7954
7955 /**
7956  * The maximum number of inbound HTLCs towards sender
7957  */
7958 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
7959
7960 /**
7961  * The sender's key controlling the funding transaction
7962  */
7963 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7964
7965 /**
7966  * The sender's key controlling the funding transaction
7967  */
7968 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7969
7970 /**
7971  * Used to derive a revocation key for transactions broadcast by counterparty
7972  */
7973 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7974
7975 /**
7976  * Used to derive a revocation key for transactions broadcast by counterparty
7977  */
7978 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7979
7980 /**
7981  * A payment key to sender for transactions broadcast by counterparty
7982  */
7983 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7984
7985 /**
7986  * A payment key to sender for transactions broadcast by counterparty
7987  */
7988 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7989
7990 /**
7991  * Used to derive a payment key to sender for transactions broadcast by sender
7992  */
7993 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
7994
7995 /**
7996  * Used to derive a payment key to sender for transactions broadcast by sender
7997  */
7998 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7999
8000 /**
8001  * Used to derive an HTLC payment key to sender
8002  */
8003 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
8004
8005 /**
8006  * Used to derive an HTLC payment key to sender
8007  */
8008 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8009
8010 /**
8011  * The first to-be-broadcast-by-sender transaction's per commitment point
8012  */
8013 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
8014
8015 /**
8016  * The first to-be-broadcast-by-sender transaction's per commitment point
8017  */
8018 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8019
8020 /**
8021  * Channel flags
8022  */
8023 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
8024
8025 /**
8026  * Channel flags
8027  */
8028 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
8029
8030 /**
8031  * Creates a copy of the OpenChannel
8032  */
8033 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
8034
8035 /**
8036  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
8037  */
8038 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
8039
8040 /**
8041  * A temporary channel ID, until the funding outpoint is announced
8042  */
8043 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
8044
8045 /**
8046  * A temporary channel ID, until the funding outpoint is announced
8047  */
8048 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8049
8050 /**
8051  * The threshold below which outputs on transactions broadcast by sender will be omitted
8052  */
8053 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8054
8055 /**
8056  * The threshold below which outputs on transactions broadcast by sender will be omitted
8057  */
8058 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
8059
8060 /**
8061  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
8062  */
8063 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8064
8065 /**
8066  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
8067  */
8068 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
8069
8070 /**
8071  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
8072  */
8073 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8074
8075 /**
8076  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
8077  */
8078 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
8079
8080 /**
8081  * The minimum HTLC size incoming to sender, in milli-satoshi
8082  */
8083 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8084
8085 /**
8086  * The minimum HTLC size incoming to sender, in milli-satoshi
8087  */
8088 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
8089
8090 /**
8091  * Minimum depth of the funding transaction before the channel is considered open
8092  */
8093 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8094
8095 /**
8096  * Minimum depth of the funding transaction before the channel is considered open
8097  */
8098 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
8099
8100 /**
8101  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
8102  */
8103 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8104
8105 /**
8106  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
8107  */
8108 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
8109
8110 /**
8111  * The maximum number of inbound HTLCs towards sender
8112  */
8113 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8114
8115 /**
8116  * The maximum number of inbound HTLCs towards sender
8117  */
8118 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
8119
8120 /**
8121  * The sender's key controlling the funding transaction
8122  */
8123 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8124
8125 /**
8126  * The sender's key controlling the funding transaction
8127  */
8128 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8129
8130 /**
8131  * Used to derive a revocation key for transactions broadcast by counterparty
8132  */
8133 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8134
8135 /**
8136  * Used to derive a revocation key for transactions broadcast by counterparty
8137  */
8138 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8139
8140 /**
8141  * A payment key to sender for transactions broadcast by counterparty
8142  */
8143 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8144
8145 /**
8146  * A payment key to sender for transactions broadcast by counterparty
8147  */
8148 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8149
8150 /**
8151  * Used to derive a payment key to sender for transactions broadcast by sender
8152  */
8153 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8154
8155 /**
8156  * Used to derive a payment key to sender for transactions broadcast by sender
8157  */
8158 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8159
8160 /**
8161  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
8162  */
8163 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8164
8165 /**
8166  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
8167  */
8168 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8169
8170 /**
8171  * The first to-be-broadcast-by-sender transaction's per commitment point
8172  */
8173 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
8174
8175 /**
8176  * The first to-be-broadcast-by-sender transaction's per commitment point
8177  */
8178 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8179
8180 /**
8181  * Creates a copy of the AcceptChannel
8182  */
8183 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
8184
8185 /**
8186  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
8187  */
8188 void FundingCreated_free(struct LDKFundingCreated this_obj);
8189
8190 /**
8191  * A temporary channel ID, until the funding is established
8192  */
8193 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
8194
8195 /**
8196  * A temporary channel ID, until the funding is established
8197  */
8198 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8199
8200 /**
8201  * The funding transaction ID
8202  */
8203 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
8204
8205 /**
8206  * The funding transaction ID
8207  */
8208 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8209
8210 /**
8211  * The specific output index funding this channel
8212  */
8213 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
8214
8215 /**
8216  * The specific output index funding this channel
8217  */
8218 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
8219
8220 /**
8221  * The signature of the channel initiator (funder) on the funding transaction
8222  */
8223 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
8224
8225 /**
8226  * The signature of the channel initiator (funder) on the funding transaction
8227  */
8228 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
8229
8230 /**
8231  * Constructs a new FundingCreated given each field
8232  */
8233 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);
8234
8235 /**
8236  * Creates a copy of the FundingCreated
8237  */
8238 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
8239
8240 /**
8241  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
8242  */
8243 void FundingSigned_free(struct LDKFundingSigned this_obj);
8244
8245 /**
8246  * The channel ID
8247  */
8248 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
8249
8250 /**
8251  * The channel ID
8252  */
8253 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8254
8255 /**
8256  * The signature of the channel acceptor (fundee) on the funding transaction
8257  */
8258 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
8259
8260 /**
8261  * The signature of the channel acceptor (fundee) on the funding transaction
8262  */
8263 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
8264
8265 /**
8266  * Constructs a new FundingSigned given each field
8267  */
8268 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
8269
8270 /**
8271  * Creates a copy of the FundingSigned
8272  */
8273 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
8274
8275 /**
8276  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
8277  */
8278 void FundingLocked_free(struct LDKFundingLocked this_obj);
8279
8280 /**
8281  * The channel ID
8282  */
8283 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
8284
8285 /**
8286  * The channel ID
8287  */
8288 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8289
8290 /**
8291  * The per-commitment point of the second commitment transaction
8292  */
8293 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
8294
8295 /**
8296  * The per-commitment point of the second commitment transaction
8297  */
8298 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8299
8300 /**
8301  * Constructs a new FundingLocked given each field
8302  */
8303 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
8304
8305 /**
8306  * Creates a copy of the FundingLocked
8307  */
8308 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
8309
8310 /**
8311  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
8312  */
8313 void Shutdown_free(struct LDKShutdown this_obj);
8314
8315 /**
8316  * The channel ID
8317  */
8318 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
8319
8320 /**
8321  * The channel ID
8322  */
8323 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8324
8325 /**
8326  * The destination of this peer's funds on closing.
8327  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
8328  */
8329 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
8330
8331 /**
8332  * The destination of this peer's funds on closing.
8333  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
8334  */
8335 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
8336
8337 /**
8338  * Constructs a new Shutdown given each field
8339  */
8340 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
8341
8342 /**
8343  * Creates a copy of the Shutdown
8344  */
8345 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
8346
8347 /**
8348  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
8349  */
8350 void ClosingSigned_free(struct LDKClosingSigned this_obj);
8351
8352 /**
8353  * The channel ID
8354  */
8355 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
8356
8357 /**
8358  * The channel ID
8359  */
8360 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8361
8362 /**
8363  * The proposed total fee for the closing transaction
8364  */
8365 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
8366
8367 /**
8368  * The proposed total fee for the closing transaction
8369  */
8370 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
8371
8372 /**
8373  * A signature on the closing transaction
8374  */
8375 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
8376
8377 /**
8378  * A signature on the closing transaction
8379  */
8380 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
8381
8382 /**
8383  * Constructs a new ClosingSigned given each field
8384  */
8385 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
8386
8387 /**
8388  * Creates a copy of the ClosingSigned
8389  */
8390 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
8391
8392 /**
8393  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
8394  */
8395 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
8396
8397 /**
8398  * The channel ID
8399  */
8400 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
8401
8402 /**
8403  * The channel ID
8404  */
8405 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8406
8407 /**
8408  * The HTLC ID
8409  */
8410 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
8411
8412 /**
8413  * The HTLC ID
8414  */
8415 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
8416
8417 /**
8418  * The HTLC value in milli-satoshi
8419  */
8420 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
8421
8422 /**
8423  * The HTLC value in milli-satoshi
8424  */
8425 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
8426
8427 /**
8428  * The payment hash, the pre-image of which controls HTLC redemption
8429  */
8430 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
8431
8432 /**
8433  * The payment hash, the pre-image of which controls HTLC redemption
8434  */
8435 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8436
8437 /**
8438  * The expiry height of the HTLC
8439  */
8440 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
8441
8442 /**
8443  * The expiry height of the HTLC
8444  */
8445 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
8446
8447 /**
8448  * Creates a copy of the UpdateAddHTLC
8449  */
8450 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
8451
8452 /**
8453  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
8454  */
8455 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
8456
8457 /**
8458  * The channel ID
8459  */
8460 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
8461
8462 /**
8463  * The channel ID
8464  */
8465 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8466
8467 /**
8468  * The HTLC ID
8469  */
8470 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
8471
8472 /**
8473  * The HTLC ID
8474  */
8475 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
8476
8477 /**
8478  * The pre-image of the payment hash, allowing HTLC redemption
8479  */
8480 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
8481
8482 /**
8483  * The pre-image of the payment hash, allowing HTLC redemption
8484  */
8485 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8486
8487 /**
8488  * Constructs a new UpdateFulfillHTLC given each field
8489  */
8490 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
8491
8492 /**
8493  * Creates a copy of the UpdateFulfillHTLC
8494  */
8495 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
8496
8497 /**
8498  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
8499  */
8500 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
8501
8502 /**
8503  * The channel ID
8504  */
8505 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
8506
8507 /**
8508  * The channel ID
8509  */
8510 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8511
8512 /**
8513  * The HTLC ID
8514  */
8515 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
8516
8517 /**
8518  * The HTLC ID
8519  */
8520 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
8521
8522 /**
8523  * Creates a copy of the UpdateFailHTLC
8524  */
8525 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
8526
8527 /**
8528  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
8529  */
8530 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
8531
8532 /**
8533  * The channel ID
8534  */
8535 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
8536
8537 /**
8538  * The channel ID
8539  */
8540 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8541
8542 /**
8543  * The HTLC ID
8544  */
8545 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
8546
8547 /**
8548  * The HTLC ID
8549  */
8550 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
8551
8552 /**
8553  * The failure code
8554  */
8555 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
8556
8557 /**
8558  * The failure code
8559  */
8560 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
8561
8562 /**
8563  * Creates a copy of the UpdateFailMalformedHTLC
8564  */
8565 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
8566
8567 /**
8568  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
8569  */
8570 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
8571
8572 /**
8573  * The channel ID
8574  */
8575 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
8576
8577 /**
8578  * The channel ID
8579  */
8580 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8581
8582 /**
8583  * A signature on the commitment transaction
8584  */
8585 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
8586
8587 /**
8588  * A signature on the commitment transaction
8589  */
8590 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
8591
8592 /**
8593  * Signatures on the HTLC transactions
8594  */
8595 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
8596
8597 /**
8598  * Constructs a new CommitmentSigned given each field
8599  */
8600 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
8601
8602 /**
8603  * Creates a copy of the CommitmentSigned
8604  */
8605 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
8606
8607 /**
8608  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
8609  */
8610 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
8611
8612 /**
8613  * The channel ID
8614  */
8615 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
8616
8617 /**
8618  * The channel ID
8619  */
8620 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8621
8622 /**
8623  * The secret corresponding to the per-commitment point
8624  */
8625 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
8626
8627 /**
8628  * The secret corresponding to the per-commitment point
8629  */
8630 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8631
8632 /**
8633  * The next sender-broadcast commitment transaction's per-commitment point
8634  */
8635 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
8636
8637 /**
8638  * The next sender-broadcast commitment transaction's per-commitment point
8639  */
8640 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8641
8642 /**
8643  * Constructs a new RevokeAndACK given each field
8644  */
8645 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);
8646
8647 /**
8648  * Creates a copy of the RevokeAndACK
8649  */
8650 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
8651
8652 /**
8653  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
8654  */
8655 void UpdateFee_free(struct LDKUpdateFee this_obj);
8656
8657 /**
8658  * The channel ID
8659  */
8660 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
8661
8662 /**
8663  * The channel ID
8664  */
8665 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8666
8667 /**
8668  * Fee rate per 1000-weight of the transaction
8669  */
8670 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
8671
8672 /**
8673  * Fee rate per 1000-weight of the transaction
8674  */
8675 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
8676
8677 /**
8678  * Constructs a new UpdateFee given each field
8679  */
8680 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
8681
8682 /**
8683  * Creates a copy of the UpdateFee
8684  */
8685 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
8686
8687 /**
8688  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
8689  */
8690 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
8691
8692 /**
8693  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
8694  * belonging to the recipient
8695  */
8696 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
8697
8698 /**
8699  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
8700  * belonging to the recipient
8701  */
8702 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8703
8704 /**
8705  * The sender's per-commitment point for their current commitment transaction
8706  */
8707 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
8708
8709 /**
8710  * The sender's per-commitment point for their current commitment transaction
8711  */
8712 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8713
8714 /**
8715  * Constructs a new DataLossProtect given each field
8716  */
8717 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
8718
8719 /**
8720  * Creates a copy of the DataLossProtect
8721  */
8722 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
8723
8724 /**
8725  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
8726  */
8727 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
8728
8729 /**
8730  * The channel ID
8731  */
8732 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
8733
8734 /**
8735  * The channel ID
8736  */
8737 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8738
8739 /**
8740  * The next commitment number for the sender
8741  */
8742 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
8743
8744 /**
8745  * The next commitment number for the sender
8746  */
8747 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
8748
8749 /**
8750  * The next commitment number for the recipient
8751  */
8752 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
8753
8754 /**
8755  * The next commitment number for the recipient
8756  */
8757 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
8758
8759 /**
8760  * Creates a copy of the ChannelReestablish
8761  */
8762 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
8763
8764 /**
8765  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
8766  */
8767 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
8768
8769 /**
8770  * The channel ID
8771  */
8772 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
8773
8774 /**
8775  * The channel ID
8776  */
8777 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8778
8779 /**
8780  * The short channel ID
8781  */
8782 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
8783
8784 /**
8785  * The short channel ID
8786  */
8787 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
8788
8789 /**
8790  * A signature by the node key
8791  */
8792 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
8793
8794 /**
8795  * A signature by the node key
8796  */
8797 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
8798
8799 /**
8800  * A signature by the funding key
8801  */
8802 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
8803
8804 /**
8805  * A signature by the funding key
8806  */
8807 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
8808
8809 /**
8810  * Constructs a new AnnouncementSignatures given each field
8811  */
8812 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);
8813
8814 /**
8815  * Creates a copy of the AnnouncementSignatures
8816  */
8817 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
8818
8819 /**
8820  * Frees any resources used by the NetAddress
8821  */
8822 void NetAddress_free(struct LDKNetAddress this_ptr);
8823
8824 /**
8825  * Creates a copy of the NetAddress
8826  */
8827 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
8828
8829 /**
8830  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
8831  */
8832 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
8833
8834 /**
8835  * Read a Result from a byte array, created by Result_write
8836  */
8837 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
8838
8839 /**
8840  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
8841  */
8842 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
8843
8844 /**
8845  * The advertised features
8846  */
8847 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
8848
8849 /**
8850  * The advertised features
8851  */
8852 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
8853
8854 /**
8855  * A strictly monotonic announcement counter, with gaps allowed
8856  */
8857 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
8858
8859 /**
8860  * A strictly monotonic announcement counter, with gaps allowed
8861  */
8862 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
8863
8864 /**
8865  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
8866  * to this node).
8867  */
8868 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
8869
8870 /**
8871  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
8872  * to this node).
8873  */
8874 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8875
8876 /**
8877  * An RGB color for UI purposes
8878  */
8879 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
8880
8881 /**
8882  * An RGB color for UI purposes
8883  */
8884 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
8885
8886 /**
8887  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
8888  * of uniqueness.
8889  */
8890 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
8891
8892 /**
8893  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
8894  * of uniqueness.
8895  */
8896 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8897
8898 /**
8899  * List of addresses on which this node is reachable
8900  */
8901 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
8902
8903 /**
8904  * Creates a copy of the UnsignedNodeAnnouncement
8905  */
8906 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
8907
8908 /**
8909  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
8910  */
8911 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
8912
8913 /**
8914  * The signature by the node key
8915  */
8916 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
8917
8918 /**
8919  * The signature by the node key
8920  */
8921 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
8922
8923 /**
8924  * The actual content of the announcement
8925  */
8926 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
8927
8928 /**
8929  * The actual content of the announcement
8930  */
8931 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
8932
8933 /**
8934  * Constructs a new NodeAnnouncement given each field
8935  */
8936 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
8937
8938 /**
8939  * Creates a copy of the NodeAnnouncement
8940  */
8941 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
8942
8943 /**
8944  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
8945  */
8946 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
8947
8948 /**
8949  * The advertised channel features
8950  */
8951 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
8952
8953 /**
8954  * The advertised channel features
8955  */
8956 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
8957
8958 /**
8959  * The genesis hash of the blockchain where the channel is to be opened
8960  */
8961 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
8962
8963 /**
8964  * The genesis hash of the blockchain where the channel is to be opened
8965  */
8966 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8967
8968 /**
8969  * The short channel ID
8970  */
8971 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
8972
8973 /**
8974  * The short channel ID
8975  */
8976 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
8977
8978 /**
8979  * One of the two node_ids which are endpoints of this channel
8980  */
8981 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
8982
8983 /**
8984  * One of the two node_ids which are endpoints of this channel
8985  */
8986 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8987
8988 /**
8989  * The other of the two node_ids which are endpoints of this channel
8990  */
8991 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
8992
8993 /**
8994  * The other of the two node_ids which are endpoints of this channel
8995  */
8996 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
8997
8998 /**
8999  * The funding key for the first node
9000  */
9001 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
9002
9003 /**
9004  * The funding key for the first node
9005  */
9006 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
9007
9008 /**
9009  * The funding key for the second node
9010  */
9011 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
9012
9013 /**
9014  * The funding key for the second node
9015  */
9016 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
9017
9018 /**
9019  * Creates a copy of the UnsignedChannelAnnouncement
9020  */
9021 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
9022
9023 /**
9024  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
9025  */
9026 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
9027
9028 /**
9029  * Authentication of the announcement by the first public node
9030  */
9031 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
9032
9033 /**
9034  * Authentication of the announcement by the first public node
9035  */
9036 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
9037
9038 /**
9039  * Authentication of the announcement by the second public node
9040  */
9041 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
9042
9043 /**
9044  * Authentication of the announcement by the second public node
9045  */
9046 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
9047
9048 /**
9049  * Proof of funding UTXO ownership by the first public node
9050  */
9051 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
9052
9053 /**
9054  * Proof of funding UTXO ownership by the first public node
9055  */
9056 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
9057
9058 /**
9059  * Proof of funding UTXO ownership by the second public node
9060  */
9061 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
9062
9063 /**
9064  * Proof of funding UTXO ownership by the second public node
9065  */
9066 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
9067
9068 /**
9069  * The actual announcement
9070  */
9071 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
9072
9073 /**
9074  * The actual announcement
9075  */
9076 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
9077
9078 /**
9079  * Constructs a new ChannelAnnouncement given each field
9080  */
9081 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);
9082
9083 /**
9084  * Creates a copy of the ChannelAnnouncement
9085  */
9086 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
9087
9088 /**
9089  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
9090  */
9091 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
9092
9093 /**
9094  * The genesis hash of the blockchain where the channel is to be opened
9095  */
9096 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
9097
9098 /**
9099  * The genesis hash of the blockchain where the channel is to be opened
9100  */
9101 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
9102
9103 /**
9104  * The short channel ID
9105  */
9106 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
9107
9108 /**
9109  * The short channel ID
9110  */
9111 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
9112
9113 /**
9114  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
9115  */
9116 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
9117
9118 /**
9119  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
9120  */
9121 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
9122
9123 /**
9124  * Channel flags
9125  */
9126 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
9127
9128 /**
9129  * Channel flags
9130  */
9131 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
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 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
9144
9145 /**
9146  * The number of blocks such that if:
9147  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
9148  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
9149  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
9150  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
9151  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
9152  * forwarding. Note that the HTLC sender is the one who originally sets this value when
9153  * constructing the route.
9154  */
9155 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
9156
9157 /**
9158  * The minimum HTLC size incoming to sender, in milli-satoshi
9159  */
9160 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
9161
9162 /**
9163  * The minimum HTLC size incoming to sender, in milli-satoshi
9164  */
9165 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
9166
9167 /**
9168  * The base HTLC fee charged by sender, in milli-satoshi
9169  */
9170 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
9171
9172 /**
9173  * The base HTLC fee charged by sender, in milli-satoshi
9174  */
9175 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
9176
9177 /**
9178  * The amount to fee multiplier, in micro-satoshi
9179  */
9180 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
9181
9182 /**
9183  * The amount to fee multiplier, in micro-satoshi
9184  */
9185 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
9186
9187 /**
9188  * Creates a copy of the UnsignedChannelUpdate
9189  */
9190 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
9191
9192 /**
9193  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
9194  */
9195 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
9196
9197 /**
9198  * A signature of the channel update
9199  */
9200 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
9201
9202 /**
9203  * A signature of the channel update
9204  */
9205 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
9206
9207 /**
9208  * The actual channel update
9209  */
9210 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
9211
9212 /**
9213  * The actual channel update
9214  */
9215 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
9216
9217 /**
9218  * Constructs a new ChannelUpdate given each field
9219  */
9220 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
9221
9222 /**
9223  * Creates a copy of the ChannelUpdate
9224  */
9225 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
9226
9227 /**
9228  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
9229  */
9230 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
9231
9232 /**
9233  * The genesis hash of the blockchain being queried
9234  */
9235 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
9236
9237 /**
9238  * The genesis hash of the blockchain being queried
9239  */
9240 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
9241
9242 /**
9243  * The height of the first block for the channel UTXOs being queried
9244  */
9245 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
9246
9247 /**
9248  * The height of the first block for the channel UTXOs being queried
9249  */
9250 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
9251
9252 /**
9253  * The number of blocks to include in the query results
9254  */
9255 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
9256
9257 /**
9258  * The number of blocks to include in the query results
9259  */
9260 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
9261
9262 /**
9263  * Constructs a new QueryChannelRange given each field
9264  */
9265 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
9266
9267 /**
9268  * Creates a copy of the QueryChannelRange
9269  */
9270 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
9271
9272 /**
9273  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
9274  */
9275 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
9276
9277 /**
9278  * The genesis hash of the blockchain being queried
9279  */
9280 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
9281
9282 /**
9283  * The genesis hash of the blockchain being queried
9284  */
9285 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
9286
9287 /**
9288  * The height of the first block in the range of the reply
9289  */
9290 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
9291
9292 /**
9293  * The height of the first block in the range of the reply
9294  */
9295 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
9296
9297 /**
9298  * The number of blocks included in the range of the reply
9299  */
9300 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
9301
9302 /**
9303  * The number of blocks included in the range of the reply
9304  */
9305 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
9306
9307 /**
9308  * True when this is the final reply for a query
9309  */
9310 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
9311
9312 /**
9313  * True when this is the final reply for a query
9314  */
9315 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
9316
9317 /**
9318  * The short_channel_ids in the channel range
9319  */
9320 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
9321
9322 /**
9323  * Constructs a new ReplyChannelRange given each field
9324  */
9325 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);
9326
9327 /**
9328  * Creates a copy of the ReplyChannelRange
9329  */
9330 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
9331
9332 /**
9333  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
9334  */
9335 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
9336
9337 /**
9338  * The genesis hash of the blockchain being queried
9339  */
9340 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
9341
9342 /**
9343  * The genesis hash of the blockchain being queried
9344  */
9345 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
9346
9347 /**
9348  * The short_channel_ids that are being queried
9349  */
9350 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
9351
9352 /**
9353  * Constructs a new QueryShortChannelIds given each field
9354  */
9355 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
9356
9357 /**
9358  * Creates a copy of the QueryShortChannelIds
9359  */
9360 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
9361
9362 /**
9363  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
9364  */
9365 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
9366
9367 /**
9368  * The genesis hash of the blockchain that was queried
9369  */
9370 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
9371
9372 /**
9373  * The genesis hash of the blockchain that was queried
9374  */
9375 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
9376
9377 /**
9378  * Indicates if the query recipient maintains up-to-date channel
9379  * information for the chain_hash
9380  */
9381 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
9382
9383 /**
9384  * Indicates if the query recipient maintains up-to-date channel
9385  * information for the chain_hash
9386  */
9387 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
9388
9389 /**
9390  * Constructs a new ReplyShortChannelIdsEnd given each field
9391  */
9392 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
9393
9394 /**
9395  * Creates a copy of the ReplyShortChannelIdsEnd
9396  */
9397 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
9398
9399 /**
9400  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
9401  */
9402 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
9403
9404 /**
9405  * The genesis hash of the blockchain for channel and node information
9406  */
9407 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
9408
9409 /**
9410  * The genesis hash of the blockchain for channel and node information
9411  */
9412 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
9413
9414 /**
9415  * The starting unix timestamp
9416  */
9417 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
9418
9419 /**
9420  * The starting unix timestamp
9421  */
9422 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
9423
9424 /**
9425  * The range of information in seconds
9426  */
9427 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
9428
9429 /**
9430  * The range of information in seconds
9431  */
9432 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
9433
9434 /**
9435  * Constructs a new GossipTimestampFilter given each field
9436  */
9437 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
9438
9439 /**
9440  * Creates a copy of the GossipTimestampFilter
9441  */
9442 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
9443
9444 /**
9445  * Frees any resources used by the ErrorAction
9446  */
9447 void ErrorAction_free(struct LDKErrorAction this_ptr);
9448
9449 /**
9450  * Creates a copy of the ErrorAction
9451  */
9452 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
9453
9454 /**
9455  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
9456  */
9457 void LightningError_free(struct LDKLightningError this_obj);
9458
9459 /**
9460  * A human-readable message describing the error
9461  */
9462 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
9463
9464 /**
9465  * A human-readable message describing the error
9466  */
9467 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
9468
9469 /**
9470  * The action which should be taken against the offending peer.
9471  */
9472 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
9473
9474 /**
9475  * The action which should be taken against the offending peer.
9476  */
9477 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
9478
9479 /**
9480  * Constructs a new LightningError given each field
9481  */
9482 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
9483
9484 /**
9485  * Creates a copy of the LightningError
9486  */
9487 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
9488
9489 /**
9490  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
9491  */
9492 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
9493
9494 /**
9495  * update_add_htlc messages which should be sent
9496  */
9497 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
9498
9499 /**
9500  * update_fulfill_htlc messages which should be sent
9501  */
9502 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
9503
9504 /**
9505  * update_fail_htlc messages which should be sent
9506  */
9507 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
9508
9509 /**
9510  * update_fail_malformed_htlc messages which should be sent
9511  */
9512 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
9513
9514 /**
9515  * An update_fee message which should be sent
9516  */
9517 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
9518
9519 /**
9520  * An update_fee message which should be sent
9521  */
9522 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
9523
9524 /**
9525  * Finally, the commitment_signed message which should be sent
9526  */
9527 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
9528
9529 /**
9530  * Finally, the commitment_signed message which should be sent
9531  */
9532 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
9533
9534 /**
9535  * Constructs a new CommitmentUpdate given each field
9536  */
9537 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);
9538
9539 /**
9540  * Creates a copy of the CommitmentUpdate
9541  */
9542 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
9543
9544 /**
9545  * Frees any resources used by the HTLCFailChannelUpdate
9546  */
9547 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
9548
9549 /**
9550  * Creates a copy of the HTLCFailChannelUpdate
9551  */
9552 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
9553
9554 /**
9555  * Calls the free function if one is set
9556  */
9557 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
9558
9559 /**
9560  * Calls the free function if one is set
9561  */
9562 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
9563
9564 /**
9565  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
9566  */
9567 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
9568
9569 /**
9570  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
9571  */
9572 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
9573
9574 /**
9575  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
9576  */
9577 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
9578
9579 /**
9580  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
9581  */
9582 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
9583
9584 /**
9585  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
9586  */
9587 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
9588
9589 /**
9590  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
9591  */
9592 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
9593
9594 /**
9595  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
9596  */
9597 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
9598
9599 /**
9600  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
9601  */
9602 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
9603
9604 /**
9605  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
9606  */
9607 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
9608
9609 /**
9610  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
9611  */
9612 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
9613
9614 /**
9615  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
9616  */
9617 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
9618
9619 /**
9620  * Read a FundingCreated from a byte array, created by FundingCreated_write
9621  */
9622 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
9623
9624 /**
9625  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
9626  */
9627 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
9628
9629 /**
9630  * Read a FundingSigned from a byte array, created by FundingSigned_write
9631  */
9632 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
9633
9634 /**
9635  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
9636  */
9637 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
9638
9639 /**
9640  * Read a FundingLocked from a byte array, created by FundingLocked_write
9641  */
9642 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
9643
9644 /**
9645  * Serialize the Init object into a byte array which can be read by Init_read
9646  */
9647 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
9648
9649 /**
9650  * Read a Init from a byte array, created by Init_write
9651  */
9652 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
9653
9654 /**
9655  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
9656  */
9657 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
9658
9659 /**
9660  * Read a OpenChannel from a byte array, created by OpenChannel_write
9661  */
9662 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
9663
9664 /**
9665  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
9666  */
9667 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
9668
9669 /**
9670  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
9671  */
9672 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
9673
9674 /**
9675  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
9676  */
9677 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
9678
9679 /**
9680  * Read a Shutdown from a byte array, created by Shutdown_write
9681  */
9682 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
9683
9684 /**
9685  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
9686  */
9687 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
9688
9689 /**
9690  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
9691  */
9692 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
9693
9694 /**
9695  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
9696  */
9697 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
9698
9699 /**
9700  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
9701  */
9702 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
9703
9704 /**
9705  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
9706  */
9707 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
9708
9709 /**
9710  * Read a UpdateFee from a byte array, created by UpdateFee_write
9711  */
9712 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
9713
9714 /**
9715  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
9716  */
9717 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
9718
9719 /**
9720  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
9721  */
9722 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
9723
9724 /**
9725  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
9726  */
9727 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
9728
9729 /**
9730  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
9731  */
9732 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
9733
9734 /**
9735  * Serialize the Ping object into a byte array which can be read by Ping_read
9736  */
9737 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
9738
9739 /**
9740  * Read a Ping from a byte array, created by Ping_write
9741  */
9742 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
9743
9744 /**
9745  * Serialize the Pong object into a byte array which can be read by Pong_read
9746  */
9747 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
9748
9749 /**
9750  * Read a Pong from a byte array, created by Pong_write
9751  */
9752 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
9753
9754 /**
9755  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
9756  */
9757 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
9758
9759 /**
9760  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
9761  */
9762 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
9763
9764 /**
9765  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
9766  */
9767 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
9768
9769 /**
9770  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
9771  */
9772 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
9773
9774 /**
9775  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
9776  */
9777 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
9778
9779 /**
9780  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
9781  */
9782 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
9783
9784 /**
9785  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
9786  */
9787 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
9788
9789 /**
9790  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
9791  */
9792 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
9793
9794 /**
9795  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
9796  */
9797 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
9798
9799 /**
9800  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
9801  */
9802 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
9803
9804 /**
9805  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
9806  */
9807 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
9808
9809 /**
9810  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
9811  */
9812 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
9813
9814 /**
9815  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
9816  */
9817 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
9818
9819 /**
9820  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
9821  */
9822 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
9823
9824 /**
9825  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
9826  */
9827 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
9828
9829 /**
9830  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
9831  */
9832 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
9833
9834 /**
9835  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
9836  */
9837 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
9838
9839 /**
9840  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
9841  */
9842 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
9843
9844 /**
9845  *\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
9846  */
9847 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
9848
9849 /**
9850  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
9851  */
9852 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
9853
9854 /**
9855  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
9856  */
9857 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
9858
9859 /**
9860  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
9861  */
9862 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
9863
9864 /**
9865  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
9866  */
9867 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
9868
9869 /**
9870  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
9871  */
9872 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
9873
9874 /**
9875  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
9876  */
9877 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
9878
9879 /**
9880  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
9881  */
9882 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
9883
9884 /**
9885  * Constructs a new IgnoringMessageHandler given each field
9886  */
9887 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
9888
9889 /**
9890  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
9891  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
9892  */
9893 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
9894
9895 /**
9896  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
9897  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
9898  */
9899 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
9900
9901 /**
9902  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
9903  */
9904 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
9905
9906 /**
9907  * Constructs a new ErroringMessageHandler
9908  */
9909 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
9910
9911 /**
9912  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
9913  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
9914  */
9915 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
9916
9917 /**
9918  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
9919  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
9920  */
9921 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
9922
9923 /**
9924  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
9925  */
9926 void MessageHandler_free(struct LDKMessageHandler this_obj);
9927
9928 /**
9929  * A message handler which handles messages specific to channels. Usually this is just a
9930  * ChannelManager object or a ErroringMessageHandler.
9931  */
9932 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
9933
9934 /**
9935  * A message handler which handles messages specific to channels. Usually this is just a
9936  * ChannelManager object or a ErroringMessageHandler.
9937  */
9938 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
9939
9940 /**
9941  * A message handler which handles messages updating our knowledge of the network channel
9942  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
9943  */
9944 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
9945
9946 /**
9947  * A message handler which handles messages updating our knowledge of the network channel
9948  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
9949  */
9950 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
9951
9952 /**
9953  * Constructs a new MessageHandler given each field
9954  */
9955 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
9956
9957 /**
9958  * Creates a copy of a SocketDescriptor
9959  */
9960 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
9961
9962 /**
9963  * Calls the free function if one is set
9964  */
9965 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
9966
9967 /**
9968  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
9969  */
9970 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
9971
9972 /**
9973  * Used to indicate that we probably can't make any future connections to this peer, implying
9974  * we should go ahead and force-close any channels we have with it.
9975  */
9976 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
9977
9978 /**
9979  * Used to indicate that we probably can't make any future connections to this peer, implying
9980  * we should go ahead and force-close any channels we have with it.
9981  */
9982 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
9983
9984 /**
9985  * Constructs a new PeerHandleError given each field
9986  */
9987 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
9988
9989 /**
9990  * Creates a copy of the PeerHandleError
9991  */
9992 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
9993
9994 /**
9995  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
9996  */
9997 void PeerManager_free(struct LDKPeerManager this_obj);
9998
9999 /**
10000  * Constructs a new PeerManager with the given message handlers and node_id secret key
10001  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
10002  * cryptographically secure random bytes.
10003  */
10004 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);
10005
10006 /**
10007  * Get the list of node ids for peers which have completed the initial handshake.
10008  *
10009  * For outbound connections, this will be the same as the their_node_id parameter passed in to
10010  * new_outbound_connection, however entries will only appear once the initial handshake has
10011  * completed and we are sure the remote peer has the private key for the given node_id.
10012  */
10013 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
10014
10015 /**
10016  * Indicates a new outbound connection has been established to a node with the given node_id.
10017  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
10018  * descriptor but must disconnect the connection immediately.
10019  *
10020  * Returns a small number of bytes to send to the remote node (currently always 50).
10021  *
10022  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
10023  * socket_disconnected().
10024  */
10025 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);
10026
10027 /**
10028  * Indicates a new inbound connection has been established.
10029  *
10030  * May refuse the connection by returning an Err, but will never write bytes to the remote end
10031  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
10032  * call socket_disconnected for the new descriptor but must disconnect the connection
10033  * immediately.
10034  *
10035  * Panics if descriptor is duplicative with some other descriptor which has not yet had
10036  * socket_disconnected called.
10037  */
10038 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
10039
10040 /**
10041  * Indicates that there is room to write data to the given socket descriptor.
10042  *
10043  * May return an Err to indicate that the connection should be closed.
10044  *
10045  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
10046  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
10047  * invariants around calling write_buffer_space_avail in case a write did not fully complete
10048  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
10049  * here isn't sufficient! Panics if the descriptor was not previously registered in a
10050  * new_\\*_connection event.
10051  */
10052 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
10053
10054 /**
10055  * Indicates that data was read from the given socket descriptor.
10056  *
10057  * May return an Err to indicate that the connection should be closed.
10058  *
10059  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
10060  * Thus, however, you almost certainly want to call process_events() after any read_event to
10061  * generate send_data calls to handle responses.
10062  *
10063  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
10064  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
10065  *
10066  * Panics if the descriptor was not previously registered in a new_*_connection event.
10067  */
10068 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);
10069
10070 /**
10071  * Checks for any events generated by our handlers and processes them. Includes sending most
10072  * response messages as well as messages generated by calls to handler functions directly (eg
10073  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
10074  */
10075 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
10076
10077 /**
10078  * Indicates that the given socket descriptor's connection is now closed.
10079  *
10080  * This must only be called if the socket has been disconnected by the peer or your own
10081  * decision to disconnect it and must NOT be called in any case where other parts of this
10082  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
10083  * the peer.
10084  *
10085  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
10086  */
10087 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
10088
10089 /**
10090  * Disconnect a peer given its node id.
10091  *
10092  * Set no_connection_possible to true to prevent any further connection with this peer,
10093  * force-closing any channels we have with it.
10094  *
10095  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
10096  * so be careful about reentrancy issues.
10097  */
10098 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
10099
10100 /**
10101  * This function should be called roughly once every 30 seconds.
10102  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
10103  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
10104  */
10105 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
10106
10107 /**
10108  * Build the commitment secret from the seed and the commitment number
10109  */
10110 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
10111
10112 /**
10113  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
10114  * from the base secret and the per_commitment_point.
10115  *
10116  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
10117  * generated (ie our own).
10118  */
10119 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
10120
10121 /**
10122  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
10123  * from the base point and the per_commitment_key. This is the public equivalent of
10124  * derive_private_key - using only public keys to derive a public key instead of private keys.
10125  *
10126  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
10127  * generated (ie our own).
10128  */
10129 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
10130
10131 /**
10132  * Derives a per-commitment-transaction revocation key from its constituent parts.
10133  *
10134  * Only the cheating participant owns a valid witness to propagate a revoked
10135  * commitment transaction, thus per_commitment_secret always come from cheater
10136  * and revocation_base_secret always come from punisher, which is the broadcaster
10137  * of the transaction spending with this key knowledge.
10138  *
10139  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
10140  * generated (ie our own).
10141  */
10142 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
10143
10144 /**
10145  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
10146  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
10147  * public key instead of private keys.
10148  *
10149  * Only the cheating participant owns a valid witness to propagate a revoked
10150  * commitment transaction, thus per_commitment_point always come from cheater
10151  * and revocation_base_point always come from punisher, which is the broadcaster
10152  * of the transaction spending with this key knowledge.
10153  *
10154  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
10155  * generated (ie our own).
10156  */
10157 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
10158
10159 /**
10160  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
10161  */
10162 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
10163
10164 /**
10165  * The broadcaster's per-commitment public key which was used to derive the other keys.
10166  */
10167 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
10168
10169 /**
10170  * The broadcaster's per-commitment public key which was used to derive the other keys.
10171  */
10172 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10173
10174 /**
10175  * The revocation key which is used to allow the broadcaster of the commitment
10176  * transaction to provide their counterparty the ability to punish them if they broadcast
10177  * an old state.
10178  */
10179 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
10180
10181 /**
10182  * The revocation key which is used to allow the broadcaster of the commitment
10183  * transaction to provide their counterparty the ability to punish them if they broadcast
10184  * an old state.
10185  */
10186 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10187
10188 /**
10189  * Broadcaster's HTLC Key
10190  */
10191 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
10192
10193 /**
10194  * Broadcaster's HTLC Key
10195  */
10196 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10197
10198 /**
10199  * Countersignatory's HTLC Key
10200  */
10201 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
10202
10203 /**
10204  * Countersignatory's HTLC Key
10205  */
10206 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10207
10208 /**
10209  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
10210  */
10211 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
10212
10213 /**
10214  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
10215  */
10216 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10217
10218 /**
10219  * Constructs a new TxCreationKeys given each field
10220  */
10221 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);
10222
10223 /**
10224  * Creates a copy of the TxCreationKeys
10225  */
10226 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
10227
10228 /**
10229  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
10230  */
10231 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
10232
10233 /**
10234  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
10235  */
10236 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
10237
10238 /**
10239  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
10240  */
10241 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
10242
10243 /**
10244  * The public key which is used to sign all commitment transactions, as it appears in the
10245  * on-chain channel lock-in 2-of-2 multisig output.
10246  */
10247 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
10248
10249 /**
10250  * The public key which is used to sign all commitment transactions, as it appears in the
10251  * on-chain channel lock-in 2-of-2 multisig output.
10252  */
10253 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10254
10255 /**
10256  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
10257  * revocation keys. This is combined with the per-commitment-secret generated by the
10258  * counterparty to create a secret which the counterparty can reveal to revoke previous
10259  * states.
10260  */
10261 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
10262
10263 /**
10264  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
10265  * revocation keys. This is combined with the per-commitment-secret generated by the
10266  * counterparty to create a secret which the counterparty can reveal to revoke previous
10267  * states.
10268  */
10269 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10270
10271 /**
10272  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
10273  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
10274  * static across every commitment transaction.
10275  */
10276 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
10277
10278 /**
10279  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
10280  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
10281  * static across every commitment transaction.
10282  */
10283 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10284
10285 /**
10286  * The base point which is used (with derive_public_key) to derive a per-commitment payment
10287  * public key which receives non-HTLC-encumbered funds which are only available for spending
10288  * after some delay (or can be claimed via the revocation path).
10289  */
10290 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
10291
10292 /**
10293  * The base point which is used (with derive_public_key) to derive a per-commitment payment
10294  * public key which receives non-HTLC-encumbered funds which are only available for spending
10295  * after some delay (or can be claimed via the revocation path).
10296  */
10297 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10298
10299 /**
10300  * The base point which is used (with derive_public_key) to derive a per-commitment public key
10301  * which is used to encumber HTLC-in-flight outputs.
10302  */
10303 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
10304
10305 /**
10306  * The base point which is used (with derive_public_key) to derive a per-commitment public key
10307  * which is used to encumber HTLC-in-flight outputs.
10308  */
10309 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10310
10311 /**
10312  * Constructs a new ChannelPublicKeys given each field
10313  */
10314 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);
10315
10316 /**
10317  * Creates a copy of the ChannelPublicKeys
10318  */
10319 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
10320
10321 /**
10322  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
10323  */
10324 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
10325
10326 /**
10327  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
10328  */
10329 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
10330
10331 /**
10332  * Create per-state keys from channel base points and the per-commitment point.
10333  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
10334  */
10335 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);
10336
10337 /**
10338  * Generate per-state keys from channel static keys.
10339  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
10340  */
10341 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);
10342
10343 /**
10344  * A script either spendable by the revocation
10345  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
10346  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
10347  */
10348 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
10349
10350 /**
10351  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
10352  */
10353 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
10354
10355 /**
10356  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
10357  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
10358  * need to compare this value to whether the commitment transaction in question is that of
10359  * the counterparty or our own.
10360  */
10361 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
10362
10363 /**
10364  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
10365  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
10366  * need to compare this value to whether the commitment transaction in question is that of
10367  * the counterparty or our own.
10368  */
10369 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
10370
10371 /**
10372  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
10373  * this divided by 1000.
10374  */
10375 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
10376
10377 /**
10378  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
10379  * this divided by 1000.
10380  */
10381 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
10382
10383 /**
10384  * The CLTV lock-time at which this HTLC expires.
10385  */
10386 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
10387
10388 /**
10389  * The CLTV lock-time at which this HTLC expires.
10390  */
10391 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
10392
10393 /**
10394  * The hash of the preimage which unlocks this HTLC.
10395  */
10396 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
10397
10398 /**
10399  * The hash of the preimage which unlocks this HTLC.
10400  */
10401 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10402
10403 /**
10404  * The position within the commitment transactions' outputs. This may be None if the value is
10405  * below the dust limit (in which case no output appears in the commitment transaction and the
10406  * value is spent to additional transaction fees).
10407  */
10408 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
10409
10410 /**
10411  * The position within the commitment transactions' outputs. This may be None if the value is
10412  * below the dust limit (in which case no output appears in the commitment transaction and the
10413  * value is spent to additional transaction fees).
10414  */
10415 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
10416
10417 /**
10418  * Constructs a new HTLCOutputInCommitment given each field
10419  */
10420 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);
10421
10422 /**
10423  * Creates a copy of the HTLCOutputInCommitment
10424  */
10425 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
10426
10427 /**
10428  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
10429  */
10430 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
10431
10432 /**
10433  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
10434  */
10435 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
10436
10437 /**
10438  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
10439  * does not need to have its previous_output_index filled.
10440  */
10441 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
10442
10443 /**
10444  * Gets the redeemscript for a funding output from the two funding public keys.
10445  * Note that the order of funding public keys does not matter.
10446  */
10447 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
10448
10449 /**
10450  * panics if htlc.transaction_output_index.is_none()!
10451  */
10452 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);
10453
10454 /**
10455  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
10456  */
10457 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
10458
10459 /**
10460  * Holder public keys
10461  */
10462 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
10463
10464 /**
10465  * Holder public keys
10466  */
10467 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
10468
10469 /**
10470  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
10471  */
10472 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
10473
10474 /**
10475  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
10476  */
10477 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
10478
10479 /**
10480  * Whether the holder is the initiator of this channel.
10481  * This is an input to the commitment number obscure factor computation.
10482  */
10483 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
10484
10485 /**
10486  * Whether the holder is the initiator of this channel.
10487  * This is an input to the commitment number obscure factor computation.
10488  */
10489 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
10490
10491 /**
10492  * The late-bound counterparty channel transaction parameters.
10493  * These parameters are populated at the point in the protocol where the counterparty provides them.
10494  */
10495 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
10496
10497 /**
10498  * The late-bound counterparty channel transaction parameters.
10499  * These parameters are populated at the point in the protocol where the counterparty provides them.
10500  */
10501 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
10502
10503 /**
10504  * The late-bound funding outpoint
10505  */
10506 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
10507
10508 /**
10509  * The late-bound funding outpoint
10510  */
10511 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10512
10513 /**
10514  * Constructs a new ChannelTransactionParameters given each field
10515  */
10516 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);
10517
10518 /**
10519  * Creates a copy of the ChannelTransactionParameters
10520  */
10521 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
10522
10523 /**
10524  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
10525  */
10526 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
10527
10528 /**
10529  * Counter-party public keys
10530  */
10531 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
10532
10533 /**
10534  * Counter-party public keys
10535  */
10536 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
10537
10538 /**
10539  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
10540  */
10541 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
10542
10543 /**
10544  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
10545  */
10546 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
10547
10548 /**
10549  * Constructs a new CounterpartyChannelTransactionParameters given each field
10550  */
10551 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
10552
10553 /**
10554  * Creates a copy of the CounterpartyChannelTransactionParameters
10555  */
10556 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
10557
10558 /**
10559  * Whether the late bound parameters are populated.
10560  */
10561 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
10562
10563 /**
10564  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
10565  * given that the holder is the broadcaster.
10566  *
10567  * self.is_populated() must be true before calling this function.
10568  */
10569 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
10570
10571 /**
10572  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
10573  * given that the counterparty is the broadcaster.
10574  *
10575  * self.is_populated() must be true before calling this function.
10576  */
10577 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
10578
10579 /**
10580  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
10581  */
10582 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
10583
10584 /**
10585  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
10586  */
10587 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
10588
10589 /**
10590  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
10591  */
10592 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
10593
10594 /**
10595  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
10596  */
10597 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
10598
10599 /**
10600  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
10601  */
10602 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
10603
10604 /**
10605  * Get the channel pubkeys for the broadcaster
10606  */
10607 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
10608
10609 /**
10610  * Get the channel pubkeys for the countersignatory
10611  */
10612 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
10613
10614 /**
10615  * Get the contest delay applicable to the transactions.
10616  * Note that the contest delay was selected by the countersignatory.
10617  */
10618 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
10619
10620 /**
10621  * Whether the channel is outbound from the broadcaster.
10622  *
10623  * The boolean representing the side that initiated the channel is
10624  * an input to the commitment number obscure factor computation.
10625  */
10626 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
10627
10628 /**
10629  * The funding outpoint
10630  */
10631 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
10632
10633 /**
10634  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
10635  */
10636 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
10637
10638 /**
10639  * Our counterparty's signature for the transaction
10640  */
10641 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
10642
10643 /**
10644  * Our counterparty's signature for the transaction
10645  */
10646 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
10647
10648 /**
10649  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
10650  */
10651 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
10652
10653 /**
10654  * Creates a copy of the HolderCommitmentTransaction
10655  */
10656 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
10657
10658 /**
10659  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
10660  */
10661 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
10662
10663 /**
10664  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
10665  */
10666 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
10667
10668 /**
10669  * Create a new holder transaction with the given counterparty signatures.
10670  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
10671  */
10672 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);
10673
10674 /**
10675  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
10676  */
10677 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
10678
10679 /**
10680  * The commitment transaction
10681  */
10682 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
10683
10684 /**
10685  * The commitment transaction
10686  */
10687 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
10688
10689 /**
10690  * The txid for the commitment transaction.
10691  *
10692  * This is provided as a performance optimization, instead of calling transaction.txid()
10693  * multiple times.
10694  */
10695 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
10696
10697 /**
10698  * The txid for the commitment transaction.
10699  *
10700  * This is provided as a performance optimization, instead of calling transaction.txid()
10701  * multiple times.
10702  */
10703 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10704
10705 /**
10706  * Constructs a new BuiltCommitmentTransaction given each field
10707  */
10708 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
10709
10710 /**
10711  * Creates a copy of the BuiltCommitmentTransaction
10712  */
10713 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
10714
10715 /**
10716  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
10717  */
10718 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
10719
10720 /**
10721  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
10722  */
10723 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
10724
10725 /**
10726  * Get the SIGHASH_ALL sighash value of the transaction.
10727  *
10728  * This can be used to verify a signature.
10729  */
10730 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);
10731
10732 /**
10733  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
10734  * because we are about to broadcast a holder transaction.
10735  */
10736 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);
10737
10738 /**
10739  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
10740  */
10741 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
10742
10743 /**
10744  * Creates a copy of the CommitmentTransaction
10745  */
10746 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
10747
10748 /**
10749  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
10750  */
10751 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
10752
10753 /**
10754  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
10755  */
10756 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
10757
10758 /**
10759  * The backwards-counting commitment number
10760  */
10761 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
10762
10763 /**
10764  * The value to be sent to the broadcaster
10765  */
10766 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
10767
10768 /**
10769  * The value to be sent to the counterparty
10770  */
10771 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
10772
10773 /**
10774  * The feerate paid per 1000-weight-unit in this commitment transaction.
10775  */
10776 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
10777
10778 /**
10779  * Trust our pre-built transaction and derived transaction creation public keys.
10780  *
10781  * Applies a wrapper which allows access to these fields.
10782  *
10783  * This should only be used if you fully trust the builder of this object.  It should not
10784  *\tbe used by an external signer - instead use the verify function.
10785  */
10786 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
10787
10788 /**
10789  * Verify our pre-built transaction and derived transaction creation public keys.
10790  *
10791  * Applies a wrapper which allows access to these fields.
10792  *
10793  * An external validating signer must call this method before signing
10794  * or using the built transaction.
10795  */
10796 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);
10797
10798 /**
10799  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
10800  */
10801 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
10802
10803 /**
10804  * The transaction ID of the built Bitcoin transaction
10805  */
10806 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
10807
10808 /**
10809  * The pre-built Bitcoin commitment transaction
10810  */
10811 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
10812
10813 /**
10814  * The pre-calculated transaction creation public keys.
10815  */
10816 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
10817
10818 /**
10819  * Get a signature for each HTLC which was included in the commitment transaction (ie for
10820  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
10821  *
10822  * The returned Vec has one entry for each HTLC, and in the same order.
10823  */
10824 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);
10825
10826 /**
10827  * Get the transaction number obscure factor
10828  */
10829 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
10830
10831 /**
10832  * Creates a copy of the InitFeatures
10833  */
10834 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
10835
10836 /**
10837  * Creates a copy of the NodeFeatures
10838  */
10839 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
10840
10841 /**
10842  * Creates a copy of the ChannelFeatures
10843  */
10844 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
10845
10846 /**
10847  * Creates a copy of the InvoiceFeatures
10848  */
10849 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
10850
10851 /**
10852  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
10853  */
10854 void InitFeatures_free(struct LDKInitFeatures this_obj);
10855
10856 /**
10857  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
10858  */
10859 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
10860
10861 /**
10862  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
10863  */
10864 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
10865
10866 /**
10867  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
10868  */
10869 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
10870
10871 /**
10872  * Create a blank Features with no features set
10873  */
10874 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
10875
10876 /**
10877  * Creates a Features with the bits set which are known by the implementation
10878  */
10879 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
10880
10881 /**
10882  * Create a blank Features with no features set
10883  */
10884 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
10885
10886 /**
10887  * Creates a Features with the bits set which are known by the implementation
10888  */
10889 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
10890
10891 /**
10892  * Create a blank Features with no features set
10893  */
10894 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
10895
10896 /**
10897  * Creates a Features with the bits set which are known by the implementation
10898  */
10899 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
10900
10901 /**
10902  * Create a blank Features with no features set
10903  */
10904 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
10905
10906 /**
10907  * Creates a Features with the bits set which are known by the implementation
10908  */
10909 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
10910
10911 /**
10912  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
10913  */
10914 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
10915
10916 /**
10917  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
10918  */
10919 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
10920
10921 /**
10922  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
10923  */
10924 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
10925
10926 /**
10927  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
10928  */
10929 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
10930
10931 /**
10932  * Read a InitFeatures from a byte array, created by InitFeatures_write
10933  */
10934 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
10935
10936 /**
10937  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
10938  */
10939 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
10940
10941 /**
10942  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
10943  */
10944 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
10945
10946 /**
10947  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
10948  */
10949 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
10950
10951 /**
10952  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
10953  */
10954 void RouteHop_free(struct LDKRouteHop this_obj);
10955
10956 /**
10957  * The node_id of the node at this hop.
10958  */
10959 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
10960
10961 /**
10962  * The node_id of the node at this hop.
10963  */
10964 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10965
10966 /**
10967  * The node_announcement features of the node at this hop. For the last hop, these may be
10968  * amended to match the features present in the invoice this node generated.
10969  */
10970 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
10971
10972 /**
10973  * The node_announcement features of the node at this hop. For the last hop, these may be
10974  * amended to match the features present in the invoice this node generated.
10975  */
10976 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
10977
10978 /**
10979  * The channel that should be used from the previous hop to reach this node.
10980  */
10981 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
10982
10983 /**
10984  * The channel that should be used from the previous hop to reach this node.
10985  */
10986 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
10987
10988 /**
10989  * The channel_announcement features of the channel that should be used from the previous hop
10990  * to reach this node.
10991  */
10992 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
10993
10994 /**
10995  * The channel_announcement features of the channel that should be used from the previous hop
10996  * to reach this node.
10997  */
10998 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
10999
11000 /**
11001  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
11002  * For the last hop, this should be the full value of the payment (might be more than
11003  * requested if we had to match htlc_minimum_msat).
11004  */
11005 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
11006
11007 /**
11008  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
11009  * For the last hop, this should be the full value of the payment (might be more than
11010  * requested if we had to match htlc_minimum_msat).
11011  */
11012 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
11013
11014 /**
11015  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
11016  * expected at the destination, in excess of the current block height.
11017  */
11018 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
11019
11020 /**
11021  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
11022  * expected at the destination, in excess of the current block height.
11023  */
11024 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
11025
11026 /**
11027  * Constructs a new RouteHop given each field
11028  */
11029 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);
11030
11031 /**
11032  * Creates a copy of the RouteHop
11033  */
11034 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
11035
11036 /**
11037  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
11038  */
11039 void Route_free(struct LDKRoute this_obj);
11040
11041 /**
11042  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
11043  * last RouteHop in each path must be the same.
11044  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
11045  * destination. Thus, this must always be at least length one. While the maximum length of any
11046  * given path is variable, keeping the length of any path to less than 20 should currently
11047  * ensure it is viable.
11048  */
11049 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
11050
11051 /**
11052  * Constructs a new Route given each field
11053  */
11054 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
11055
11056 /**
11057  * Creates a copy of the Route
11058  */
11059 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
11060
11061 /**
11062  * Serialize the Route object into a byte array which can be read by Route_read
11063  */
11064 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
11065
11066 /**
11067  * Read a Route from a byte array, created by Route_write
11068  */
11069 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
11070
11071 /**
11072  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
11073  */
11074 void RouteHint_free(struct LDKRouteHint this_obj);
11075
11076 /**
11077  * The node_id of the non-target end of the route
11078  */
11079 struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
11080
11081 /**
11082  * The node_id of the non-target end of the route
11083  */
11084 void RouteHint_set_src_node_id(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11085
11086 /**
11087  * The short_channel_id of this channel
11088  */
11089 uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
11090
11091 /**
11092  * The short_channel_id of this channel
11093  */
11094 void RouteHint_set_short_channel_id(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
11095
11096 /**
11097  * The fees which must be paid to use this channel
11098  */
11099 struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *NONNULL_PTR this_ptr);
11100
11101 /**
11102  * The fees which must be paid to use this channel
11103  */
11104 void RouteHint_set_fees(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
11105
11106 /**
11107  * The difference in CLTV values between this node and the next node.
11108  */
11109 uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR this_ptr);
11110
11111 /**
11112  * The difference in CLTV values between this node and the next node.
11113  */
11114 void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val);
11115
11116 /**
11117  * The minimum value, in msat, which must be relayed to the next hop.
11118  */
11119 struct LDKCOption_u64Z RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
11120
11121 /**
11122  * The minimum value, in msat, which must be relayed to the next hop.
11123  */
11124 void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
11125
11126 /**
11127  * The maximum value in msat available for routing with a single HTLC.
11128  */
11129 struct LDKCOption_u64Z RouteHint_get_htlc_maximum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
11130
11131 /**
11132  * The maximum value in msat available for routing with a single HTLC.
11133  */
11134 void RouteHint_set_htlc_maximum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
11135
11136 /**
11137  * Constructs a new RouteHint given each field
11138  */
11139 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);
11140
11141 /**
11142  * Creates a copy of the RouteHint
11143  */
11144 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
11145
11146 /**
11147  * Gets a route from us (payer) to the given target node (payee).
11148  *
11149  * If the payee provided features in their invoice, they should be provided via payee_features.
11150  * Without this, MPP will only be used if the payee's features are available in the network graph.
11151  *
11152  * Extra routing hops between known nodes and the target will be used if they are included in
11153  * last_hops.
11154  *
11155  * If some channels aren't announced, it may be useful to fill in a first_hops with the
11156  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
11157  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
11158  * in first_hops will be used.
11159  *
11160  * Panics if first_hops contains channels without short_channel_ids
11161  * (ChannelManager::list_usable_channels will never include such channels).
11162  *
11163  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
11164  * equal), however the enabled/disabled bit on such channels as well as the
11165  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
11166  */
11167 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);
11168
11169 /**
11170  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
11171  */
11172 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
11173
11174 /**
11175  * Creates a copy of the NetworkGraph
11176  */
11177 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
11178
11179 /**
11180  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
11181  */
11182 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
11183
11184 /**
11185  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
11186  */
11187 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
11188
11189 /**
11190  * Creates a new tracker of the actual state of the network of channels and nodes,
11191  * assuming a fresh network graph.
11192  * Chain monitor is used to make sure announced channels exist on-chain,
11193  * channel data is correct, and that the announcement is signed with
11194  * channel owners' keys.
11195  */
11196 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
11197
11198 /**
11199  * Creates a new tracker of the actual state of the network of channels and nodes,
11200  * assuming an existing Network Graph.
11201  */
11202 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
11203
11204 /**
11205  * Adds a provider used to check new announcements. Does not affect
11206  * existing announcements unless they are updated.
11207  * Add, update or remove the provider would replace the current one.
11208  */
11209 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
11210
11211 /**
11212  * Take a read lock on the network_graph and return it in the C-bindings
11213  * newtype helper. This is likely only useful when called via the C
11214  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
11215  * yourself.
11216  */
11217 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
11218
11219 /**
11220  * Get a reference to the NetworkGraph which this read-lock contains.
11221  */
11222 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
11223
11224 /**
11225  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
11226  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
11227  */
11228 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
11229
11230 /**
11231  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
11232  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
11233  */
11234 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
11235
11236 /**
11237  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
11238  */
11239 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
11240
11241 /**
11242  * When the last update to the channel direction was issued.
11243  * Value is opaque, as set in the announcement.
11244  */
11245 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
11246
11247 /**
11248  * When the last update to the channel direction was issued.
11249  * Value is opaque, as set in the announcement.
11250  */
11251 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
11252
11253 /**
11254  * Whether the channel can be currently used for payments (in this one direction).
11255  */
11256 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
11257
11258 /**
11259  * Whether the channel can be currently used for payments (in this one direction).
11260  */
11261 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
11262
11263 /**
11264  * The difference in CLTV values that you must have when routing through this channel.
11265  */
11266 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
11267
11268 /**
11269  * The difference in CLTV values that you must have when routing through this channel.
11270  */
11271 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
11272
11273 /**
11274  * The minimum value, which must be relayed to the next hop via the channel
11275  */
11276 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
11277
11278 /**
11279  * The minimum value, which must be relayed to the next hop via the channel
11280  */
11281 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
11282
11283 /**
11284  * The maximum value which may be relayed to the next hop via the channel.
11285  */
11286 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
11287
11288 /**
11289  * The maximum value which may be relayed to the next hop via the channel.
11290  */
11291 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
11292
11293 /**
11294  * Fees charged when the channel is used for routing
11295  */
11296 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
11297
11298 /**
11299  * Fees charged when the channel is used for routing
11300  */
11301 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
11302
11303 /**
11304  * Most recent update for the channel received from the network
11305  * Mostly redundant with the data we store in fields explicitly.
11306  * Everything else is useful only for sending out for initial routing sync.
11307  * Not stored if contains excess data to prevent DoS.
11308  */
11309 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
11310
11311 /**
11312  * Most recent update for the channel received from the network
11313  * Mostly redundant with the data we store in fields explicitly.
11314  * Everything else is useful only for sending out for initial routing sync.
11315  * Not stored if contains excess data to prevent DoS.
11316  */
11317 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
11318
11319 /**
11320  * Constructs a new DirectionalChannelInfo given each field
11321  */
11322 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);
11323
11324 /**
11325  * Creates a copy of the DirectionalChannelInfo
11326  */
11327 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
11328
11329 /**
11330  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
11331  */
11332 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
11333
11334 /**
11335  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
11336  */
11337 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
11338
11339 /**
11340  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
11341  */
11342 void ChannelInfo_free(struct LDKChannelInfo this_obj);
11343
11344 /**
11345  * Protocol features of a channel communicated during its announcement
11346  */
11347 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
11348
11349 /**
11350  * Protocol features of a channel communicated during its announcement
11351  */
11352 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
11353
11354 /**
11355  * Source node of the first direction of a channel
11356  */
11357 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
11358
11359 /**
11360  * Source node of the first direction of a channel
11361  */
11362 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11363
11364 /**
11365  * Details about the first direction of a channel
11366  */
11367 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
11368
11369 /**
11370  * Details about the first direction of a channel
11371  */
11372 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
11373
11374 /**
11375  * Source node of the second direction of a channel
11376  */
11377 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
11378
11379 /**
11380  * Source node of the second direction of a channel
11381  */
11382 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11383
11384 /**
11385  * Details about the second direction of a channel
11386  */
11387 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
11388
11389 /**
11390  * Details about the second direction of a channel
11391  */
11392 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
11393
11394 /**
11395  * The channel capacity as seen on-chain, if chain lookup is available.
11396  */
11397 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
11398
11399 /**
11400  * The channel capacity as seen on-chain, if chain lookup is available.
11401  */
11402 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
11403
11404 /**
11405  * An initial announcement of the channel
11406  * Mostly redundant with the data we store in fields explicitly.
11407  * Everything else is useful only for sending out for initial routing sync.
11408  * Not stored if contains excess data to prevent DoS.
11409  */
11410 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
11411
11412 /**
11413  * An initial announcement of the channel
11414  * Mostly redundant with the data we store in fields explicitly.
11415  * Everything else is useful only for sending out for initial routing sync.
11416  * Not stored if contains excess data to prevent DoS.
11417  */
11418 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
11419
11420 /**
11421  * Constructs a new ChannelInfo given each field
11422  */
11423 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);
11424
11425 /**
11426  * Creates a copy of the ChannelInfo
11427  */
11428 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
11429
11430 /**
11431  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
11432  */
11433 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
11434
11435 /**
11436  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
11437  */
11438 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
11439
11440 /**
11441  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
11442  */
11443 void RoutingFees_free(struct LDKRoutingFees this_obj);
11444
11445 /**
11446  * Flat routing fee in satoshis
11447  */
11448 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
11449
11450 /**
11451  * Flat routing fee in satoshis
11452  */
11453 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
11454
11455 /**
11456  * Liquidity-based routing fee in millionths of a routed amount.
11457  * In other words, 10000 is 1%.
11458  */
11459 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
11460
11461 /**
11462  * Liquidity-based routing fee in millionths of a routed amount.
11463  * In other words, 10000 is 1%.
11464  */
11465 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
11466
11467 /**
11468  * Constructs a new RoutingFees given each field
11469  */
11470 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
11471
11472 /**
11473  * Creates a copy of the RoutingFees
11474  */
11475 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
11476
11477 /**
11478  * Read a RoutingFees from a byte array, created by RoutingFees_write
11479  */
11480 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
11481
11482 /**
11483  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
11484  */
11485 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
11486
11487 /**
11488  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
11489  */
11490 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
11491
11492 /**
11493  * Protocol features the node announced support for
11494  */
11495 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
11496
11497 /**
11498  * Protocol features the node announced support for
11499  */
11500 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
11501
11502 /**
11503  * When the last known update to the node state was issued.
11504  * Value is opaque, as set in the announcement.
11505  */
11506 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
11507
11508 /**
11509  * When the last known update to the node state was issued.
11510  * Value is opaque, as set in the announcement.
11511  */
11512 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
11513
11514 /**
11515  * Color assigned to the node
11516  */
11517 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
11518
11519 /**
11520  * Color assigned to the node
11521  */
11522 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
11523
11524 /**
11525  * Moniker assigned to the node.
11526  * May be invalid or malicious (eg control chars),
11527  * should not be exposed to the user.
11528  */
11529 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
11530
11531 /**
11532  * Moniker assigned to the node.
11533  * May be invalid or malicious (eg control chars),
11534  * should not be exposed to the user.
11535  */
11536 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11537
11538 /**
11539  * Internet-level addresses via which one can connect to the node
11540  */
11541 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
11542
11543 /**
11544  * An initial announcement of the node
11545  * Mostly redundant with the data we store in fields explicitly.
11546  * Everything else is useful only for sending out for initial routing sync.
11547  * Not stored if contains excess data to prevent DoS.
11548  */
11549 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
11550
11551 /**
11552  * An initial announcement of the node
11553  * Mostly redundant with the data we store in fields explicitly.
11554  * Everything else is useful only for sending out for initial routing sync.
11555  * Not stored if contains excess data to prevent DoS.
11556  */
11557 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
11558
11559 /**
11560  * Constructs a new NodeAnnouncementInfo given each field
11561  */
11562 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);
11563
11564 /**
11565  * Creates a copy of the NodeAnnouncementInfo
11566  */
11567 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
11568
11569 /**
11570  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
11571  */
11572 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
11573
11574 /**
11575  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
11576  */
11577 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
11578
11579 /**
11580  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
11581  */
11582 void NodeInfo_free(struct LDKNodeInfo this_obj);
11583
11584 /**
11585  * All valid channels a node has announced
11586  */
11587 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
11588
11589 /**
11590  * Lowest fees enabling routing via any of the enabled, known channels to a node.
11591  * The two fields (flat and proportional fee) are independent,
11592  * meaning they don't have to refer to the same channel.
11593  */
11594 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
11595
11596 /**
11597  * Lowest fees enabling routing via any of the enabled, known channels to a node.
11598  * The two fields (flat and proportional fee) are independent,
11599  * meaning they don't have to refer to the same channel.
11600  */
11601 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
11602
11603 /**
11604  * More information about a node from node_announcement.
11605  * Optional because we store a Node entry after learning about it from
11606  * a channel announcement, but before receiving a node announcement.
11607  */
11608 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
11609
11610 /**
11611  * More information about a node from node_announcement.
11612  * Optional because we store a Node entry after learning about it from
11613  * a channel announcement, but before receiving a node announcement.
11614  */
11615 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
11616
11617 /**
11618  * Constructs a new NodeInfo given each field
11619  */
11620 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
11621
11622 /**
11623  * Creates a copy of the NodeInfo
11624  */
11625 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
11626
11627 /**
11628  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
11629  */
11630 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
11631
11632 /**
11633  * Read a NodeInfo from a byte array, created by NodeInfo_write
11634  */
11635 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
11636
11637 /**
11638  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
11639  */
11640 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
11641
11642 /**
11643  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
11644  */
11645 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
11646
11647 /**
11648  * Creates a new, empty, network graph.
11649  */
11650 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
11651
11652 /**
11653  * For an already known node (from channel announcements), update its stored properties from a
11654  * given node announcement.
11655  *
11656  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
11657  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
11658  * routing messages from a source using a protocol other than the lightning P2P protocol.
11659  */
11660 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
11661
11662 /**
11663  * For an already known node (from channel announcements), update its stored properties from a
11664  * given node announcement without verifying the associated signatures. Because we aren't
11665  * given the associated signatures here we cannot relay the node announcement to any of our
11666  * peers.
11667  */
11668 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
11669
11670 /**
11671  * Store or update channel info from a channel announcement.
11672  *
11673  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
11674  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
11675  * routing messages from a source using a protocol other than the lightning P2P protocol.
11676  *
11677  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
11678  * the corresponding UTXO exists on chain and is correctly-formatted.
11679  */
11680 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);
11681
11682 /**
11683  * Store or update channel info from a channel announcement without verifying the associated
11684  * signatures. Because we aren't given the associated signatures here we cannot relay the
11685  * channel announcement to any of our peers.
11686  *
11687  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
11688  * the corresponding UTXO exists on chain and is correctly-formatted.
11689  */
11690 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);
11691
11692 /**
11693  * Close a channel if a corresponding HTLC fail was sent.
11694  * If permanent, removes a channel from the local storage.
11695  * May cause the removal of nodes too, if this was their last channel.
11696  * If not permanent, makes channels unavailable for routing.
11697  */
11698 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
11699
11700 /**
11701  * For an already known (from announcement) channel, update info about one of the directions
11702  * of the channel.
11703  *
11704  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
11705  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
11706  * routing messages from a source using a protocol other than the lightning P2P protocol.
11707  */
11708 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
11709
11710 /**
11711  * For an already known (from announcement) channel, update info about one of the directions
11712  * of the channel without verifying the associated signatures. Because we aren't given the
11713  * associated signatures here we cannot relay the channel update to any of our peers.
11714  */
11715 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
11716
11717 /* Text to put at the end of the generated file */