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