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