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