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