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