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