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