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