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