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