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