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