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