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