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