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