1 /* Text to put at the beginning of the generated file. Probably a license. */
3 /* Generated with cbindgen:0.16.0 */
5 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
13 * An error when accessing the chain via [`Access`].
15 * [`Access`]: trait.Access.html
17 typedef enum LDKAccessError {
19 * The requested chain is unknown.
21 LDKAccessError_UnknownChain,
23 * The requested transaction doesn't exist or hasn't confirmed.
25 LDKAccessError_UnknownTx,
27 * Must be last for serialization purposes
29 LDKAccessError_Sentinel,
33 * An error enum representing a failure to persist a channel monitor update.
35 typedef enum LDKChannelMonitorUpdateErr {
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).
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.
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.
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
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
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
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.
72 LDKChannelMonitorUpdateErr_TemporaryFailure,
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
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.
83 * This failure may also signal a failure to update the local persisted copy of one of
84 * the channel monitor instance.
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)
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.
95 LDKChannelMonitorUpdateErr_PermanentFailure,
97 * Must be last for serialization purposes
99 LDKChannelMonitorUpdateErr_Sentinel,
100 } LDKChannelMonitorUpdateErr;
103 * An enum that represents the speed at which we want a transaction to confirm used for feerate
106 typedef enum LDKConfirmationTarget {
108 * We are happy with this transaction confirming slowly when feerate drops some.
110 LDKConfirmationTarget_Background,
112 * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
114 LDKConfirmationTarget_Normal,
116 * We'd like this transaction to confirm in the next few blocks.
118 LDKConfirmationTarget_HighPriority,
120 * Must be last for serialization purposes
122 LDKConfirmationTarget_Sentinel,
123 } LDKConfirmationTarget;
126 * An enum representing the available verbosity levels of the logger.
128 typedef enum LDKLevel {
130 *Designates logger being silent
134 * Designates very serious errors
138 * Designates hazardous situations
142 * Designates useful information
146 * Designates lower priority information
150 * Designates very low priority, often extremely verbose, information
154 * Must be last for serialization purposes
159 typedef enum LDKNetwork {
164 * Must be last for serialization purposes
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,
180 * Must be last for serialization purposes
182 LDKSecp256k1Error_Sentinel,
186 * A serialized transaction, in (pointer, length) form.
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.
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.
200 typedef struct LDKTransaction {
202 * This is non-const for your convenience, an object passed to Rust is never written to.
209 typedef struct LDKCVec_u8Z {
215 * A transaction output including a scriptPubKey and value.
216 * This type *does* own its own memory, so must be free'd appropriately.
218 typedef struct LDKTxOut {
219 struct LDKCVec_u8Z script_pubkey;
226 * A reference to a transaction output.
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.
231 typedef struct MUST_USE_STRUCT LDKOutPoint {
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.
236 LDKnativeOutPoint *inner;
240 typedef struct LDKPublicKey {
241 uint8_t compressed_form[33];
244 typedef struct LDKC2TupleTempl_u64__u64 {
247 } LDKC2TupleTempl_u64__u64;
249 typedef struct LDKC2TupleTempl_u64__u64 LDKC2Tuple_u64u64Z;
252 * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
253 * claim at any point in the future) an event is generated which you must track and be able to
254 * spend on-chain. The information needed to do this is provided in this enum, including the
255 * outpoint describing which txid and output index is available, the full output which exists at
256 * that txid/index, and any keys or other information required to sign.
258 typedef enum LDKSpendableOutputDescriptor_Tag {
260 * An output to a script which was provided via KeysInterface, thus you should already know
261 * how to spend it. No keys are provided as rust-lightning was never given any keys - only the
262 * script_pubkey as it appears in the output.
263 * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
264 * on-chain using the payment preimage or after it has timed out.
266 LDKSpendableOutputDescriptor_StaticOutput,
268 * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
270 * The witness in the spending input should be:
271 * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
273 * Note that the nSequence field in the spending input must be set to to_self_delay
274 * (which means the transaction is not broadcastable until at least to_self_delay
275 * blocks after the outpoint confirms).
277 * These are generally the result of a \"revocable\" output to us, spendable only by us unless
278 * it is an output from an old state which we broadcast (which should never happen).
280 * To derive the delayed_payment key which is used to sign for this input, you must pass the
281 * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
282 * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
283 * chan_utils::derive_private_key. The public key can be generated without the secret key
284 * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
285 * ChannelKeys::pubkeys().
287 * To derive the revocation_pubkey provided here (which is used in the witness
288 * script generation), you must pass the counterparty revocation_basepoint (which appears in the
289 * call to ChannelKeys::ready_channel) and the provided per_commitment point
290 * to chan_utils::derive_public_revocation_key.
292 * The witness script which is hashed and included in the output script_pubkey may be
293 * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
294 * (derived as above), and the to_self_delay contained here to
295 * chan_utils::get_revokeable_redeemscript.
297 LDKSpendableOutputDescriptor_DynamicOutputP2WSH,
299 * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
300 * corresponds to the public key in ChannelKeys::pubkeys().payment_point).
301 * The witness in the spending input, is, thus, simply:
302 * <BIP 143 signature> <payment key>
304 * These are generally the result of our counterparty having broadcast the current state,
305 * allowing us to claim the non-HTLC-encumbered outputs immediately.
307 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment,
309 * Must be last for serialization purposes
311 LDKSpendableOutputDescriptor_Sentinel,
312 } LDKSpendableOutputDescriptor_Tag;
314 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
315 struct LDKOutPoint outpoint;
316 struct LDKTxOut output;
317 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
319 typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body {
320 struct LDKOutPoint outpoint;
321 struct LDKPublicKey per_commitment_point;
322 uint16_t to_self_delay;
323 struct LDKTxOut output;
324 LDKC2Tuple_u64u64Z key_derivation_params;
325 struct LDKPublicKey revocation_pubkey;
326 } LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
328 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
329 struct LDKOutPoint outpoint;
330 struct LDKTxOut output;
331 LDKC2Tuple_u64u64Z key_derivation_params;
332 } LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body;
334 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
335 LDKSpendableOutputDescriptor_Tag tag;
337 LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
338 LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh;
339 LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment;
341 } LDKSpendableOutputDescriptor;
343 typedef struct LDKCVec_SpendableOutputDescriptorZ {
344 struct LDKSpendableOutputDescriptor *data;
346 } LDKCVec_SpendableOutputDescriptorZ;
351 * An accept_channel message to be sent or received from a peer
353 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
355 * Nearly everywhere, inner must be non-null, however in places where
356 * the Rust equivalent takes an Option, it may be set to null to indicate None.
358 LDKnativeAcceptChannel *inner;
365 * An open_channel message to be sent or received from a peer
367 typedef struct MUST_USE_STRUCT LDKOpenChannel {
369 * Nearly everywhere, inner must be non-null, however in places where
370 * the Rust equivalent takes an Option, it may be set to null to indicate None.
372 LDKnativeOpenChannel *inner;
379 * A funding_created message to be sent or received from a peer
381 typedef struct MUST_USE_STRUCT LDKFundingCreated {
383 * Nearly everywhere, inner must be non-null, however in places where
384 * the Rust equivalent takes an Option, it may be set to null to indicate None.
386 LDKnativeFundingCreated *inner;
393 * A funding_signed message to be sent or received from a peer
395 typedef struct MUST_USE_STRUCT LDKFundingSigned {
397 * Nearly everywhere, inner must be non-null, however in places where
398 * the Rust equivalent takes an Option, it may be set to null to indicate None.
400 LDKnativeFundingSigned *inner;
407 * A funding_locked message to be sent or received from a peer
409 typedef struct MUST_USE_STRUCT LDKFundingLocked {
411 * Nearly everywhere, inner must be non-null, however in places where
412 * the Rust equivalent takes an Option, it may be set to null to indicate None.
414 LDKnativeFundingLocked *inner;
421 * An announcement_signatures message to be sent or received from a peer
423 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
425 * Nearly everywhere, inner must be non-null, however in places where
426 * the Rust equivalent takes an Option, it may be set to null to indicate None.
428 LDKnativeAnnouncementSignatures *inner;
430 } LDKAnnouncementSignatures;
435 * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
436 * transaction updates if they were pending.
438 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
440 * Nearly everywhere, inner must be non-null, however in places where
441 * the Rust equivalent takes an Option, it may be set to null to indicate None.
443 LDKnativeCommitmentUpdate *inner;
445 } LDKCommitmentUpdate;
450 * A revoke_and_ack message to be sent or received from a peer
452 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
454 * Nearly everywhere, inner must be non-null, however in places where
455 * the Rust equivalent takes an Option, it may be set to null to indicate None.
457 LDKnativeRevokeAndACK *inner;
464 * A closing_signed message to be sent or received from a peer
466 typedef struct MUST_USE_STRUCT LDKClosingSigned {
468 * Nearly everywhere, inner must be non-null, however in places where
469 * the Rust equivalent takes an Option, it may be set to null to indicate None.
471 LDKnativeClosingSigned *inner;
478 * A shutdown message to be sent or received from a peer
480 typedef struct MUST_USE_STRUCT LDKShutdown {
482 * Nearly everywhere, inner must be non-null, however in places where
483 * the Rust equivalent takes an Option, it may be set to null to indicate None.
485 LDKnativeShutdown *inner;
492 * A channel_reestablish message to be sent or received from a peer
494 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
496 * Nearly everywhere, inner must be non-null, however in places where
497 * the Rust equivalent takes an Option, it may be set to null to indicate None.
499 LDKnativeChannelReestablish *inner;
501 } LDKChannelReestablish;
506 * A channel_announcement message to be sent or received from a peer
508 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
510 * Nearly everywhere, inner must be non-null, however in places where
511 * the Rust equivalent takes an Option, it may be set to null to indicate None.
513 LDKnativeChannelAnnouncement *inner;
515 } LDKChannelAnnouncement;
520 * A channel_update message to be sent or received from a peer
522 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
524 * Nearly everywhere, inner must be non-null, however in places where
525 * the Rust equivalent takes an Option, it may be set to null to indicate None.
527 LDKnativeChannelUpdate *inner;
534 * A node_announcement message to be sent or received from a peer
536 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
538 * Nearly everywhere, inner must be non-null, however in places where
539 * the Rust equivalent takes an Option, it may be set to null to indicate None.
541 LDKnativeNodeAnnouncement *inner;
543 } LDKNodeAnnouncement;
548 * An error message to be sent or received from a peer
550 typedef struct MUST_USE_STRUCT LDKErrorMessage {
552 * Nearly everywhere, inner must be non-null, however in places where
553 * the Rust equivalent takes an Option, it may be set to null to indicate None.
555 LDKnativeErrorMessage *inner;
560 * Used to put an error message in a LightningError
562 typedef enum LDKErrorAction_Tag {
564 * The peer took some action which made us think they were useless. Disconnect them.
566 LDKErrorAction_DisconnectPeer,
568 * The peer did something harmless that we weren't able to process, just log and ignore
570 LDKErrorAction_IgnoreError,
572 * The peer did something incorrect. Tell them.
574 LDKErrorAction_SendErrorMessage,
576 * Must be last for serialization purposes
578 LDKErrorAction_Sentinel,
579 } LDKErrorAction_Tag;
581 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
582 struct LDKErrorMessage msg;
583 } LDKErrorAction_LDKDisconnectPeer_Body;
585 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
586 struct LDKErrorMessage msg;
587 } LDKErrorAction_LDKSendErrorMessage_Body;
589 typedef struct MUST_USE_STRUCT LDKErrorAction {
590 LDKErrorAction_Tag tag;
592 LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
593 LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
598 * The information we received from a peer along the route of a payment we originated. This is
599 * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
600 * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
602 typedef enum LDKHTLCFailChannelUpdate_Tag {
604 * We received an error which included a full ChannelUpdate message.
606 LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
608 * We received an error which indicated only that a channel has been closed
610 LDKHTLCFailChannelUpdate_ChannelClosed,
612 * We received an error which indicated only that a node has failed
614 LDKHTLCFailChannelUpdate_NodeFailure,
616 * Must be last for serialization purposes
618 LDKHTLCFailChannelUpdate_Sentinel,
619 } LDKHTLCFailChannelUpdate_Tag;
621 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
622 struct LDKChannelUpdate msg;
623 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
625 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
626 uint64_t short_channel_id;
628 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
630 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
631 struct LDKPublicKey node_id;
633 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
635 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
636 LDKHTLCFailChannelUpdate_Tag tag;
638 LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
639 LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
640 LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
642 } LDKHTLCFailChannelUpdate;
647 * A query_channel_range message is used to query a peer for channel
648 * UTXOs in a range of blocks. The recipient of a query makes a best
649 * effort to reply to the query using one or more reply_channel_range
652 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
654 * Nearly everywhere, inner must be non-null, however in places where
655 * the Rust equivalent takes an Option, it may be set to null to indicate None.
657 LDKnativeQueryChannelRange *inner;
659 } LDKQueryChannelRange;
664 * A query_short_channel_ids message is used to query a peer for
665 * routing gossip messages related to one or more short_channel_ids.
666 * The query recipient will reply with the latest, if available,
667 * channel_announcement, channel_update and node_announcement messages
668 * it maintains for the requested short_channel_ids followed by a
669 * reply_short_channel_ids_end message. The short_channel_ids sent in
670 * this query are encoded. We only support encoding_type=0 uncompressed
671 * serialization and do not support encoding_type=1 zlib serialization.
673 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
675 * Nearly everywhere, inner must be non-null, however in places where
676 * the Rust equivalent takes an Option, it may be set to null to indicate None.
678 LDKnativeQueryShortChannelIds *inner;
680 } LDKQueryShortChannelIds;
683 * An event generated by ChannelManager which indicates a message should be sent to a peer (or
684 * broadcast to most peers).
685 * These events are handled by PeerManager::process_events if you are using a PeerManager.
687 typedef enum LDKMessageSendEvent_Tag {
689 * Used to indicate that we've accepted a channel open and should send the accept_channel
690 * message provided to the given peer.
692 LDKMessageSendEvent_SendAcceptChannel,
694 * Used to indicate that we've initiated a channel open and should send the open_channel
695 * message provided to the given peer.
697 LDKMessageSendEvent_SendOpenChannel,
699 * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
701 LDKMessageSendEvent_SendFundingCreated,
703 * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
705 LDKMessageSendEvent_SendFundingSigned,
707 * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
709 LDKMessageSendEvent_SendFundingLocked,
711 * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
713 LDKMessageSendEvent_SendAnnouncementSignatures,
715 * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
716 * message should be sent to the peer with the given node_id.
718 LDKMessageSendEvent_UpdateHTLCs,
720 * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
722 LDKMessageSendEvent_SendRevokeAndACK,
724 * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
726 LDKMessageSendEvent_SendClosingSigned,
728 * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
730 LDKMessageSendEvent_SendShutdown,
732 * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
734 LDKMessageSendEvent_SendChannelReestablish,
736 * Used to indicate that a channel_announcement and channel_update should be broadcast to all
737 * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
739 * Note that after doing so, you very likely (unless you did so very recently) want to call
740 * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
741 * This ensures that any nodes which see our channel_announcement also have a relevant
742 * node_announcement, including relevant feature flags which may be important for routing
745 LDKMessageSendEvent_BroadcastChannelAnnouncement,
747 * Used to indicate that a node_announcement should be broadcast to all peers.
749 LDKMessageSendEvent_BroadcastNodeAnnouncement,
751 * Used to indicate that a channel_update should be broadcast to all peers.
753 LDKMessageSendEvent_BroadcastChannelUpdate,
755 * Broadcast an error downstream to be handled
757 LDKMessageSendEvent_HandleError,
759 * When a payment fails we may receive updates back from the hop where it failed. In such
760 * cases this event is generated so that we can inform the network graph of this information.
762 LDKMessageSendEvent_PaymentFailureNetworkUpdate,
764 * Query a peer for channels with funding transaction UTXOs in a block range.
766 LDKMessageSendEvent_SendChannelRangeQuery,
768 * Request routing gossip messages from a peer for a list of channels identified by
769 * their short_channel_ids.
771 LDKMessageSendEvent_SendShortIdsQuery,
773 * Must be last for serialization purposes
775 LDKMessageSendEvent_Sentinel,
776 } LDKMessageSendEvent_Tag;
778 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
779 struct LDKPublicKey node_id;
780 struct LDKAcceptChannel msg;
781 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
783 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
784 struct LDKPublicKey node_id;
785 struct LDKOpenChannel msg;
786 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
788 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
789 struct LDKPublicKey node_id;
790 struct LDKFundingCreated msg;
791 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
793 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
794 struct LDKPublicKey node_id;
795 struct LDKFundingSigned msg;
796 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
798 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
799 struct LDKPublicKey node_id;
800 struct LDKFundingLocked msg;
801 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
803 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
804 struct LDKPublicKey node_id;
805 struct LDKAnnouncementSignatures msg;
806 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
808 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
809 struct LDKPublicKey node_id;
810 struct LDKCommitmentUpdate updates;
811 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
813 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
814 struct LDKPublicKey node_id;
815 struct LDKRevokeAndACK msg;
816 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
818 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
819 struct LDKPublicKey node_id;
820 struct LDKClosingSigned msg;
821 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
823 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
824 struct LDKPublicKey node_id;
825 struct LDKShutdown msg;
826 } LDKMessageSendEvent_LDKSendShutdown_Body;
828 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
829 struct LDKPublicKey node_id;
830 struct LDKChannelReestablish msg;
831 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
833 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
834 struct LDKChannelAnnouncement msg;
835 struct LDKChannelUpdate update_msg;
836 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
838 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
839 struct LDKNodeAnnouncement msg;
840 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
842 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
843 struct LDKChannelUpdate msg;
844 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
846 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
847 struct LDKPublicKey node_id;
848 struct LDKErrorAction action;
849 } LDKMessageSendEvent_LDKHandleError_Body;
851 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
852 struct LDKHTLCFailChannelUpdate update;
853 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
855 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
856 struct LDKPublicKey node_id;
857 struct LDKQueryChannelRange msg;
858 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
860 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
861 struct LDKPublicKey node_id;
862 struct LDKQueryShortChannelIds msg;
863 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
865 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
866 LDKMessageSendEvent_Tag tag;
868 LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
869 LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
870 LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
871 LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
872 LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
873 LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
874 LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
875 LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
876 LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
877 LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
878 LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
879 LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
880 LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
881 LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
882 LDKMessageSendEvent_LDKHandleError_Body handle_error;
883 LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
884 LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
885 LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
887 } LDKMessageSendEvent;
889 typedef struct LDKCVec_MessageSendEventZ {
890 struct LDKMessageSendEvent *data;
892 } LDKCVec_MessageSendEventZ;
895 * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
896 * look up the corresponding function in rust-lightning's docs.
898 typedef struct LDKThirtyTwoBytes {
903 * An Event which you should probably take some action in response to.
905 * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
906 * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
907 * written as it makes no sense to respond to it after reconnecting to peers).
909 typedef enum LDKEvent_Tag {
911 * Used to indicate that the client should generate a funding transaction with the given
912 * parameters and then call ChannelManager::funding_transaction_generated.
913 * Generated in ChannelManager message handling.
914 * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
915 * counterparty can steal your funds!
917 LDKEvent_FundingGenerationReady,
919 * Used to indicate that the client may now broadcast the funding transaction it created for a
920 * channel. Broadcasting such a transaction prior to this event may lead to our counterparty
921 * trivially stealing all funds in the funding transaction!
923 LDKEvent_FundingBroadcastSafe,
925 * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
926 * ChannelManager::claim_funds to get it....
927 * Note that if the preimage is not known or the amount paid is incorrect, you should call
928 * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
929 * network congestion.
930 * The amount paid should be considered 'incorrect' when it is less than or more than twice
931 * the amount expected.
932 * If you fail to call either ChannelManager::claim_funds or
933 * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
934 * automatically failed.
936 LDKEvent_PaymentReceived,
938 * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
939 * and we got back the payment preimage for it).
940 * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
941 * deduplicate them by payment_preimage (which MUST be unique)!
943 LDKEvent_PaymentSent,
945 * Indicates an outbound payment we made failed. Probably some intermediary node dropped
946 * something. You may wish to retry with a different route.
947 * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
948 * deduplicate them by payment_hash (which MUST be unique)!
950 LDKEvent_PaymentFailed,
952 * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
953 * time in the future.
955 LDKEvent_PendingHTLCsForwardable,
957 * Used to indicate that an output was generated on-chain which you should know how to spend.
958 * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
959 * counterparty spending them due to some kind of timeout. Thus, you need to store them
960 * somewhere and spend them when you create on-chain transactions.
962 LDKEvent_SpendableOutputs,
964 * Must be last for serialization purposes
969 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
970 struct LDKThirtyTwoBytes temporary_channel_id;
971 uint64_t channel_value_satoshis;
972 struct LDKCVec_u8Z output_script;
973 uint64_t user_channel_id;
974 } LDKEvent_LDKFundingGenerationReady_Body;
976 typedef struct LDKEvent_LDKFundingBroadcastSafe_Body {
977 struct LDKOutPoint funding_txo;
978 uint64_t user_channel_id;
979 } LDKEvent_LDKFundingBroadcastSafe_Body;
981 typedef struct LDKEvent_LDKPaymentReceived_Body {
982 struct LDKThirtyTwoBytes payment_hash;
983 struct LDKThirtyTwoBytes payment_secret;
985 } LDKEvent_LDKPaymentReceived_Body;
987 typedef struct LDKEvent_LDKPaymentSent_Body {
988 struct LDKThirtyTwoBytes payment_preimage;
989 } LDKEvent_LDKPaymentSent_Body;
991 typedef struct LDKEvent_LDKPaymentFailed_Body {
992 struct LDKThirtyTwoBytes payment_hash;
993 bool rejected_by_dest;
994 } LDKEvent_LDKPaymentFailed_Body;
996 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
997 uint64_t time_forwardable;
998 } LDKEvent_LDKPendingHTLCsForwardable_Body;
1000 typedef struct LDKEvent_LDKSpendableOutputs_Body {
1001 struct LDKCVec_SpendableOutputDescriptorZ outputs;
1002 } LDKEvent_LDKSpendableOutputs_Body;
1004 typedef struct MUST_USE_STRUCT LDKEvent {
1007 LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
1008 LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe;
1009 LDKEvent_LDKPaymentReceived_Body payment_received;
1010 LDKEvent_LDKPaymentSent_Body payment_sent;
1011 LDKEvent_LDKPaymentFailed_Body payment_failed;
1012 LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
1013 LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
1017 typedef struct LDKCVec_EventZ {
1018 struct LDKEvent *data;
1022 typedef struct LDKC2TupleTempl_usize__Transaction {
1024 struct LDKTransaction b;
1025 } LDKC2TupleTempl_usize__Transaction;
1027 typedef struct LDKC2TupleTempl_usize__Transaction LDKC2Tuple_usizeTransactionZ;
1029 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
1030 struct LDKC2TupleTempl_usize__Transaction *data;
1032 } LDKCVec_C2Tuple_usizeTransactionZZ;
1034 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
1036 * Note that this value is always NULL, as there are no contents in the OK variant
1039 enum LDKChannelMonitorUpdateErr *err;
1040 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
1042 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
1043 union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
1045 } LDKCResult_NoneChannelMonitorUpdateErrZ;
1050 * An event to be processed by the ChannelManager.
1052 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1054 * Nearly everywhere, inner must be non-null, however in places where
1055 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1057 LDKnativeMonitorEvent *inner;
1061 typedef struct LDKCVec_MonitorEventZ {
1062 struct LDKMonitorEvent *data;
1064 } LDKCVec_MonitorEventZ;
1069 * An update generated by the underlying Channel itself which contains some new information the
1070 * ChannelMonitor should be made aware of.
1072 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1074 * Nearly everywhere, inner must be non-null, however in places where
1075 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1077 LDKnativeChannelMonitorUpdate *inner;
1079 } LDKChannelMonitorUpdate;
1084 * An error in decoding a message or struct.
1086 typedef struct MUST_USE_STRUCT LDKDecodeError {
1088 * Nearly everywhere, inner must be non-null, however in places where
1089 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1091 LDKnativeDecodeError *inner;
1095 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
1096 struct LDKChannelMonitorUpdate *result;
1097 struct LDKDecodeError *err;
1098 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
1100 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
1101 union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
1103 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
1108 * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
1109 * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
1110 * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
1112 * Contains a developer-readable error message.
1114 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
1116 * Nearly everywhere, inner must be non-null, however in places where
1117 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1119 LDKnativeMonitorUpdateError *inner;
1121 } LDKMonitorUpdateError;
1123 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
1125 * Note that this value is always NULL, as there are no contents in the OK variant
1128 struct LDKMonitorUpdateError *err;
1129 } LDKCResult_NoneMonitorUpdateErrorZPtr;
1131 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
1132 union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
1134 } LDKCResult_NoneMonitorUpdateErrorZ;
1136 typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z {
1137 struct LDKOutPoint a;
1138 struct LDKCVec_u8Z b;
1139 } LDKC2TupleTempl_OutPoint__CVec_u8Z;
1141 typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z LDKC2Tuple_OutPointScriptZ;
1143 typedef struct LDKCVec_TransactionZ {
1144 struct LDKTransaction *data;
1146 } LDKCVec_TransactionZ;
1148 typedef struct LDKC2TupleTempl_u32__TxOut {
1151 } LDKC2TupleTempl_u32__TxOut;
1153 typedef struct LDKC2TupleTempl_u32__TxOut LDKC2Tuple_u32TxOutZ;
1155 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
1156 struct LDKC2TupleTempl_u32__TxOut *data;
1158 } LDKCVec_C2Tuple_u32TxOutZZ;
1160 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVec_C2Tuple_u32TxOutZZ {
1161 struct LDKThirtyTwoBytes a;
1162 struct LDKCVec_C2Tuple_u32TxOutZZ b;
1163 } LDKC2TupleTempl_ThirtyTwoBytes__CVec_C2Tuple_u32TxOutZZ;
1165 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVec_C2Tuple_u32TxOutZZ LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
1167 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
1168 struct LDKC2TupleTempl_ThirtyTwoBytes__CVec_C2Tuple_u32TxOutZZ *data;
1170 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ;
1175 * One counterparty's public keys which do not change over the life of a channel.
1177 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
1179 * Nearly everywhere, inner must be non-null, however in places where
1180 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1182 LDKnativeChannelPublicKeys *inner;
1184 } LDKChannelPublicKeys;
1186 typedef struct LDKSignature {
1187 uint8_t compact_form[64];
1190 typedef struct LDKCVec_SignatureZ {
1191 struct LDKSignature *data;
1193 } LDKCVec_SignatureZ;
1195 typedef struct LDKC2TupleTempl_Signature__CVec_SignatureZ {
1196 struct LDKSignature a;
1197 struct LDKCVec_SignatureZ b;
1198 } LDKC2TupleTempl_Signature__CVec_SignatureZ;
1200 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1201 struct LDKC2TupleTempl_Signature__CVec_SignatureZ *result;
1203 * Note that this value is always NULL, as there are no contents in the Err variant
1206 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
1208 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1209 union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
1211 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
1216 * This class tracks the per-transaction information needed to build a commitment transaction and to
1217 * actually build it and sign. It is used for holder transactions that we sign only when needed
1218 * and for transactions we sign for the counterparty.
1220 * This class can be used inside a signer implementation to generate a signature given the relevant
1223 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1225 * Nearly everywhere, inner must be non-null, however in places where
1226 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1228 LDKnativeCommitmentTransaction *inner;
1230 } LDKCommitmentTransaction;
1232 typedef union LDKCResult_SignatureNoneZPtr {
1233 struct LDKSignature *result;
1235 * Note that this value is always NULL, as there are no contents in the Err variant
1238 } LDKCResult_SignatureNoneZPtr;
1240 typedef struct LDKCResult_SignatureNoneZ {
1241 union LDKCResult_SignatureNoneZPtr contents;
1243 } LDKCResult_SignatureNoneZ;
1248 * Information needed to build and sign a holder's commitment transaction.
1250 * The transaction is only signed once we are ready to broadcast.
1252 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1254 * Nearly everywhere, inner must be non-null, however in places where
1255 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1257 LDKnativeHolderCommitmentTransaction *inner;
1259 } LDKHolderCommitmentTransaction;
1261 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1262 struct LDKCVec_SignatureZ *result;
1264 * Note that this value is always NULL, as there are no contents in the Err variant
1267 } LDKCResult_CVec_SignatureZNoneZPtr;
1269 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1270 union LDKCResult_CVec_SignatureZNoneZPtr contents;
1272 } LDKCResult_CVec_SignatureZNoneZ;
1277 * Information about an HTLC as it appears in a commitment transaction
1279 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
1281 * Nearly everywhere, inner must be non-null, however in places where
1282 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1284 LDKnativeHTLCOutputInCommitment *inner;
1286 } LDKHTLCOutputInCommitment;
1291 * The unsigned part of a channel_announcement
1293 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
1295 * Nearly everywhere, inner must be non-null, however in places where
1296 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1298 LDKnativeUnsignedChannelAnnouncement *inner;
1300 } LDKUnsignedChannelAnnouncement;
1305 * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
1306 * The fields are organized by holder/counterparty.
1308 * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
1309 * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
1311 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
1313 * Nearly everywhere, inner must be non-null, however in places where
1314 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1316 LDKnativeChannelTransactionParameters *inner;
1318 } LDKChannelTransactionParameters;
1321 * Set of lightning keys needed to operate a channel as described in BOLT 3.
1323 * Signing services could be implemented on a hardware wallet. In this case,
1324 * the current ChannelKeys would be a front-end on top of a communication
1325 * channel connected to your secure device and lightning key material wouldn't
1326 * reside on a hot server. Nevertheless, a this deployment would still need
1327 * to trust the ChannelManager to avoid loss of funds as this latest component
1328 * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
1330 * A more secure iteration would be to use hashlock (or payment points) to pair
1331 * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
1332 * at the price of more state and computation on the hardware wallet side. In the future,
1333 * we are looking forward to design such interface.
1335 * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
1336 * to act, as liveness and breach reply correctness are always going to be hard requirements
1337 * of LN security model, orthogonal of key management issues.
1339 * If you're implementing a custom signer, you almost certainly want to implement
1340 * Readable/Writable to serialize out a unique reference to this set of keys so
1341 * that you can serialize the full ChannelManager object.
1344 typedef struct LDKChannelKeys {
1347 * Gets the per-commitment point for a specific commitment number
1349 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1351 struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
1353 * Gets the commitment secret for a specific commitment number as part of the revocation process
1355 * An external signer implementation should error here if the commitment was already signed
1356 * and should refuse to sign it in the future.
1358 * May be called more than once for the same index.
1360 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1361 * TODO: return a Result so we can signal a validation error
1363 struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
1365 * Gets the holder's channel public keys and basepoints
1367 struct LDKChannelPublicKeys pubkeys;
1369 * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
1370 * Note that this takes a pointer to this object, not the this_ptr like other methods do
1371 * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
1373 void (*set_pubkeys)(const struct LDKChannelKeys*NONNULL_PTR );
1375 * Gets arbitrary identifiers describing the set of keys which are provided back to you in
1376 * some SpendableOutputDescriptor types. These should be sufficient to identify this
1377 * ChannelKeys object uniquely and lookup or re-derive its keys.
1379 LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg);
1381 * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
1383 * Note that if signing fails or is rejected, the channel will be force-closed.
1385 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
1387 * Create a signature for a holder's commitment transaction. This will only ever be called with
1388 * the same commitment_tx (or a copy thereof), though there are currently no guarantees
1389 * that it will not be called multiple times.
1390 * An external signer implementation should check that the commitment has not been revoked.
1392 struct LDKCResult_SignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
1394 * Create a signature for each HTLC transaction spending a holder's commitment transaction.
1396 * Unlike sign_holder_commitment, this may be called multiple times with *different*
1397 * commitment_tx values. While this will never be called with a revoked
1398 * commitment_tx, it is possible that it is called with the second-latest
1399 * commitment_tx (only if we haven't yet revoked it) if some watchtower/secondary
1400 * ChannelMonitor decided to broadcast before it had been updated to the latest.
1402 * Either an Err should be returned, or a Vec with one entry for each HTLC which exists in
1405 struct LDKCResult_CVec_SignatureZNoneZ (*sign_holder_commitment_htlc_transactions)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
1407 * Create a signature for the given input in a transaction spending an HTLC or commitment
1408 * transaction output when our counterparty broadcasts an old state.
1410 * A justice transaction may claim multiples outputs at the same time if timelocks are
1411 * similar, but only a signature for the input at index `input` should be signed for here.
1412 * It may be called multiples time for same output(s) if a fee-bump is needed with regards
1413 * to an upcoming timelock expiration.
1415 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1417 * per_commitment_key is revocation secret which was provided by our counterparty when they
1418 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
1419 * not allow the spending of any funds by itself (you need our holder revocation_secret to do
1422 * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
1423 * changing the format of the witness script (which is committed to in the BIP 143
1426 struct LDKCResult_SignatureNoneZ (*sign_justice_transaction)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
1428 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
1429 * transaction, either offered or received.
1431 * Such a transaction may claim multiples offered outputs at same time if we know the
1432 * preimage for each when we create it, but only the input at index `input` should be
1433 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
1434 * needed with regards to an upcoming timelock expiration.
1436 * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
1439 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1441 * Per_commitment_point is the dynamic point corresponding to the channel state
1442 * detected onchain. It has been generated by our counterparty and is used to derive
1443 * channel state keys, which are then included in the witness script and committed to in the
1444 * BIP 143 signature.
1446 struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
1448 * Create a signature for a (proposed) closing transaction.
1450 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
1451 * chosen to forgo their output as dust.
1453 struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
1455 * Signs a channel announcement message with our funding key, proving it comes from one
1456 * of the channel participants.
1458 * Note that if this fails or is rejected, the channel will not be publicly announced and
1459 * our counterparty may (though likely will not) close the channel on us for violating the
1462 struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
1464 * Set the counterparty static channel data, including basepoints,
1465 * counterparty_selected/holder_selected_contest_delay and funding outpoint.
1466 * This is done as soon as the funding outpoint is known. Since these are static channel data,
1467 * they MUST NOT be allowed to change to different values once set.
1469 * channel_parameters.is_populated() MUST be true.
1471 * We bind holder_selected_contest_delay late here for API convenience.
1473 * Will be called before any signatures are applied.
1475 void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
1476 void *(*clone)(const void *this_arg);
1477 struct LDKCVec_u8Z (*write)(const void *this_arg);
1478 void (*free)(void *this_arg);
1484 * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
1485 * on-chain transactions to ensure no loss of funds occurs.
1487 * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
1488 * information and are actively monitoring the chain.
1490 * Pending Events or updated HTLCs which have not yet been read out by
1491 * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
1492 * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
1493 * gotten are fully handled before re-serializing the new state.
1495 * Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which
1496 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
1497 * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
1498 * returned block hash and the the current chain and then reconnecting blocks to get to the
1499 * best chain) upon deserializing the object!
1501 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
1503 * Nearly everywhere, inner must be non-null, however in places where
1504 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1506 LDKnativeChannelMonitor *inner;
1508 } LDKChannelMonitor;
1510 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor {
1511 struct LDKThirtyTwoBytes a;
1512 struct LDKChannelMonitor b;
1513 } LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor;
1515 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor LDKC2Tuple_BlockHashChannelMonitorZ;
1517 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
1518 struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor *result;
1519 struct LDKDecodeError *err;
1520 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
1522 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
1523 union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
1525 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
1527 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
1528 struct LDKSpendableOutputDescriptor *result;
1529 struct LDKDecodeError *err;
1530 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
1532 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
1533 union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
1535 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
1537 typedef struct LDKC2TupleTempl_Signature__CVec_SignatureZ LDKC2Tuple_SignatureCVec_SignatureZZ;
1539 typedef union LDKCResult_ChanKeySignerDecodeErrorZPtr {
1540 struct LDKChannelKeys *result;
1541 struct LDKDecodeError *err;
1542 } LDKCResult_ChanKeySignerDecodeErrorZPtr;
1544 typedef struct LDKCResult_ChanKeySignerDecodeErrorZ {
1545 union LDKCResult_ChanKeySignerDecodeErrorZPtr contents;
1547 } LDKCResult_ChanKeySignerDecodeErrorZ;
1552 * A simple implementation of ChannelKeys that just keeps the private keys in memory.
1554 * This implementation performs no policy checks and is insufficient by itself as
1555 * a secure external signer.
1557 typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys {
1559 * Nearly everywhere, inner must be non-null, however in places where
1560 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1562 LDKnativeInMemoryChannelKeys *inner;
1564 } LDKInMemoryChannelKeys;
1566 typedef union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr {
1567 struct LDKInMemoryChannelKeys *result;
1568 struct LDKDecodeError *err;
1569 } LDKCResult_InMemoryChannelKeysDecodeErrorZPtr;
1571 typedef struct LDKCResult_InMemoryChannelKeysDecodeErrorZ {
1572 union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr contents;
1574 } LDKCResult_InMemoryChannelKeysDecodeErrorZ;
1576 typedef union LDKCResult_TxOutAccessErrorZPtr {
1577 struct LDKTxOut *result;
1578 enum LDKAccessError *err;
1579 } LDKCResult_TxOutAccessErrorZPtr;
1581 typedef struct LDKCResult_TxOutAccessErrorZ {
1582 union LDKCResult_TxOutAccessErrorZPtr contents;
1584 } LDKCResult_TxOutAccessErrorZ;
1587 * A Rust str object, ie a reference to a UTF8-valid string.
1588 * This is *not* null-terminated so cannot be used directly as a C string!
1590 typedef struct LDKStr {
1591 const uint8_t *chars;
1596 * Indicates an error on the client's part (usually some variant of attempting to use too-low or
1599 typedef enum LDKAPIError_Tag {
1601 * Indicates the API was wholly misused (see err for more). Cases where these can be returned
1602 * are documented, but generally indicates some precondition of a function was violated.
1604 LDKAPIError_APIMisuseError,
1606 * Due to a high feerate, we were unable to complete the request.
1607 * For example, this may be returned if the feerate implies we cannot open a channel at the
1608 * requested value, but opening a larger channel would succeed.
1610 LDKAPIError_FeeRateTooHigh,
1612 * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
1613 * too-many-hops, etc).
1615 LDKAPIError_RouteError,
1617 * We were unable to complete the request as the Channel required to do so is unable to
1618 * complete the request (or was not found). This can take many forms, including disconnected
1619 * peer, channel at capacity, channel shutting down, etc.
1621 LDKAPIError_ChannelUnavailable,
1623 * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
1624 * attempted action to fail.
1626 LDKAPIError_MonitorUpdateFailed,
1628 * Must be last for serialization purposes
1630 LDKAPIError_Sentinel,
1633 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
1634 struct LDKCVec_u8Z err;
1635 } LDKAPIError_LDKAPIMisuseError_Body;
1637 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
1638 struct LDKCVec_u8Z err;
1640 } LDKAPIError_LDKFeeRateTooHigh_Body;
1642 typedef struct LDKAPIError_LDKRouteError_Body {
1644 } LDKAPIError_LDKRouteError_Body;
1646 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
1647 struct LDKCVec_u8Z err;
1648 } LDKAPIError_LDKChannelUnavailable_Body;
1650 typedef struct MUST_USE_STRUCT LDKAPIError {
1651 LDKAPIError_Tag tag;
1653 LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
1654 LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
1655 LDKAPIError_LDKRouteError_Body route_error;
1656 LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
1660 typedef union LDKCResult_NoneAPIErrorZPtr {
1662 * Note that this value is always NULL, as there are no contents in the OK variant
1665 struct LDKAPIError *err;
1666 } LDKCResult_NoneAPIErrorZPtr;
1668 typedef struct LDKCResult_NoneAPIErrorZ {
1669 union LDKCResult_NoneAPIErrorZPtr contents;
1671 } LDKCResult_NoneAPIErrorZ;
1676 * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
1678 typedef struct MUST_USE_STRUCT LDKChannelDetails {
1680 * Nearly everywhere, inner must be non-null, however in places where
1681 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1683 LDKnativeChannelDetails *inner;
1685 } LDKChannelDetails;
1687 typedef struct LDKCVec_ChannelDetailsZ {
1688 struct LDKChannelDetails *data;
1690 } LDKCVec_ChannelDetailsZ;
1695 * If a payment fails to send, it can be in one of several states. This enum is returned as the
1696 * Err() type describing which state the payment is in, see the description of individual enum
1699 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
1701 * Nearly everywhere, inner must be non-null, however in places where
1702 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1704 LDKnativePaymentSendFailure *inner;
1706 } LDKPaymentSendFailure;
1708 typedef union LDKCResult_NonePaymentSendFailureZPtr {
1710 * Note that this value is always NULL, as there are no contents in the OK variant
1713 struct LDKPaymentSendFailure *err;
1714 } LDKCResult_NonePaymentSendFailureZPtr;
1716 typedef struct LDKCResult_NonePaymentSendFailureZ {
1717 union LDKCResult_NonePaymentSendFailureZPtr contents;
1719 } LDKCResult_NonePaymentSendFailureZ;
1721 typedef struct LDKFourBytes {
1725 typedef struct LDKSixteenBytes {
1729 typedef struct LDKTenBytes {
1734 * An address which can be used to connect to a remote peer
1736 typedef enum LDKNetAddress_Tag {
1738 * An IPv4 address/port on which the peer is listening.
1742 * An IPv6 address/port on which the peer is listening.
1746 * An old-style Tor onion address/port on which the peer is listening.
1748 LDKNetAddress_OnionV2,
1750 * A new-style Tor onion address/port on which the peer is listening.
1751 * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
1752 * wrap as base32 and append \".onion\".
1754 LDKNetAddress_OnionV3,
1756 * Must be last for serialization purposes
1758 LDKNetAddress_Sentinel,
1759 } LDKNetAddress_Tag;
1761 typedef struct LDKNetAddress_LDKIPv4_Body {
1762 struct LDKFourBytes addr;
1764 } LDKNetAddress_LDKIPv4_Body;
1766 typedef struct LDKNetAddress_LDKIPv6_Body {
1767 struct LDKSixteenBytes addr;
1769 } LDKNetAddress_LDKIPv6_Body;
1771 typedef struct LDKNetAddress_LDKOnionV2_Body {
1772 struct LDKTenBytes addr;
1774 } LDKNetAddress_LDKOnionV2_Body;
1776 typedef struct LDKNetAddress_LDKOnionV3_Body {
1777 struct LDKThirtyTwoBytes ed25519_pubkey;
1781 } LDKNetAddress_LDKOnionV3_Body;
1783 typedef struct MUST_USE_STRUCT LDKNetAddress {
1784 LDKNetAddress_Tag tag;
1786 LDKNetAddress_LDKIPv4_Body i_pv4;
1787 LDKNetAddress_LDKIPv6_Body i_pv6;
1788 LDKNetAddress_LDKOnionV2_Body onion_v2;
1789 LDKNetAddress_LDKOnionV3_Body onion_v3;
1793 typedef struct LDKCVec_NetAddressZ {
1794 struct LDKNetAddress *data;
1796 } LDKCVec_NetAddressZ;
1798 typedef struct LDKCVec_ChannelMonitorZ {
1799 struct LDKChannelMonitor *data;
1801 } LDKCVec_ChannelMonitorZ;
1804 * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
1805 * blocks are connected and disconnected.
1807 * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
1808 * responsible for maintaining a set of monitors such that they can be updated accordingly as
1809 * channel state changes and HTLCs are resolved. See method documentation for specific
1812 * Implementations **must** ensure that updates are successfully applied and persisted upon method
1813 * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
1814 * without taking any further action such as persisting the current state.
1816 * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
1817 * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
1818 * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
1819 * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
1820 * multiple instances.
1822 * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
1823 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1824 * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
1826 typedef struct LDKWatch {
1829 * Watches a channel identified by `funding_txo` using `monitor`.
1831 * Implementations are responsible for watching the chain for the funding transaction along
1832 * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
1833 * calling [`block_connected`] and [`block_disconnected`] on the monitor.
1835 * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
1836 * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
1837 * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
1839 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
1841 * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
1843 * Implementations must call [`update_monitor`] with the given update. See
1844 * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
1846 * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
1847 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1849 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
1851 * Returns any monitor events since the last call. Subsequent calls must only return new
1854 struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
1855 void (*free)(void *this_arg);
1859 * An interface to send a transaction to the Bitcoin network.
1861 typedef struct LDKBroadcasterInterface {
1864 * Sends a transaction out to (hopefully) be mined.
1866 void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
1867 void (*free)(void *this_arg);
1868 } LDKBroadcasterInterface;
1870 typedef struct LDKSecretKey {
1874 typedef struct LDKu8slice {
1875 const uint8_t *data;
1880 * A trait to describe an object which can get user secrets and key material.
1882 typedef struct LDKKeysInterface {
1885 * Get node secret key (aka node_id or network_key)
1887 struct LDKSecretKey (*get_node_secret)(const void *this_arg);
1889 * Get destination redeemScript to encumber static protocol exit points.
1891 struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
1893 * Get shutdown_pubkey to use as PublicKey at channel closure
1895 struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
1897 * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
1898 * restarted with some stale data!
1900 struct LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
1902 * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
1903 * onion packets and for temporary channel IDs. There is no requirement that these be
1904 * persisted anywhere, though they must be unique across restarts.
1906 struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
1908 * Reads a `ChanKeySigner` for this `KeysInterface` from the given input stream.
1909 * This is only called during deserialization of other objects which contain
1910 * `ChannelKeys`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
1911 * The bytes are exactly those which `<Self::ChanKeySigner as Writeable>::write()` writes, and
1912 * contain no versioning scheme. You may wish to include your own version prefix and ensure
1913 * you've read all of the provided bytes to ensure no corruption occurred.
1915 struct LDKCResult_ChanKeySignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
1916 void (*free)(void *this_arg);
1920 * A trait which should be implemented to provide feerate information on a number of time
1923 * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
1924 * called from inside the library in response to chain events, P2P events, or timer events).
1926 typedef struct LDKFeeEstimator {
1929 * Gets estimated satoshis of fee required per 1000 Weight-Units.
1931 * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
1932 * don't put us below 1 satoshi-per-byte).
1934 * This translates to:
1935 * * satoshis-per-byte * 250
1936 * * ceil(satoshis-per-kbyte / 4)
1938 uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
1939 void (*free)(void *this_arg);
1943 * A trait encapsulating the operations required of a logger
1945 typedef struct LDKLogger {
1950 void (*log)(const void *this_arg, const char *record);
1951 void (*free)(void *this_arg);
1957 * Manager which keeps track of a number of channels and sends messages to the appropriate
1958 * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
1960 * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
1961 * to individual Channels.
1963 * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
1964 * all peers during write/read (though does not modify this instance, only the instance being
1965 * serialized). This will result in any channels which have not yet exchanged funding_created (ie
1966 * called funding_transaction_generated for outbound channels).
1968 * Note that you can be a bit lazier about writing out ChannelManager than you can be with
1969 * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
1970 * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
1971 * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
1972 * the serialization process). If the deserialized version is out-of-date compared to the
1973 * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
1974 * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
1976 * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which
1977 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
1978 * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
1979 * block_connected() to step towards your best block) upon deserialization before using the
1982 * Note that ChannelManager is responsible for tracking liveness of its channels and generating
1983 * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
1984 * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
1985 * offline for a full minute. In order to track this, you must call
1986 * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect.
1988 * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
1989 * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
1990 * essentially you should default to using a SimpleRefChannelManager, and use a
1991 * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
1992 * you're using lightning-net-tokio.
1994 typedef struct MUST_USE_STRUCT LDKChannelManager {
1996 * Nearly everywhere, inner must be non-null, however in places where
1997 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1999 LDKnativeChannelManager *inner;
2001 } LDKChannelManager;
2003 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager {
2004 struct LDKThirtyTwoBytes a;
2005 struct LDKChannelManager b;
2006 } LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager;
2008 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager LDKC2Tuple_BlockHashChannelManagerZ;
2010 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
2011 struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager *result;
2012 struct LDKDecodeError *err;
2013 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
2015 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
2016 union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
2018 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
2020 typedef union LDKCResult_NetAddressu8ZPtr {
2021 struct LDKNetAddress *result;
2023 } LDKCResult_NetAddressu8ZPtr;
2025 typedef struct LDKCResult_NetAddressu8Z {
2026 union LDKCResult_NetAddressu8ZPtr contents;
2028 } LDKCResult_NetAddressu8Z;
2030 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
2031 struct LDKCResult_NetAddressu8Z *result;
2032 struct LDKDecodeError *err;
2033 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
2035 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
2036 union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
2038 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
2040 typedef struct LDKCVec_u64Z {
2048 * An update_add_htlc message to be sent or received from a peer
2050 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
2052 * Nearly everywhere, inner must be non-null, however in places where
2053 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2055 LDKnativeUpdateAddHTLC *inner;
2059 typedef struct LDKCVec_UpdateAddHTLCZ {
2060 struct LDKUpdateAddHTLC *data;
2062 } LDKCVec_UpdateAddHTLCZ;
2067 * An update_fulfill_htlc message to be sent or received from a peer
2069 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
2071 * Nearly everywhere, inner must be non-null, however in places where
2072 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2074 LDKnativeUpdateFulfillHTLC *inner;
2076 } LDKUpdateFulfillHTLC;
2078 typedef struct LDKCVec_UpdateFulfillHTLCZ {
2079 struct LDKUpdateFulfillHTLC *data;
2081 } LDKCVec_UpdateFulfillHTLCZ;
2086 * An update_fail_htlc message to be sent or received from a peer
2088 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
2090 * Nearly everywhere, inner must be non-null, however in places where
2091 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2093 LDKnativeUpdateFailHTLC *inner;
2095 } LDKUpdateFailHTLC;
2097 typedef struct LDKCVec_UpdateFailHTLCZ {
2098 struct LDKUpdateFailHTLC *data;
2100 } LDKCVec_UpdateFailHTLCZ;
2105 * An update_fail_malformed_htlc message to be sent or received from a peer
2107 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
2109 * Nearly everywhere, inner must be non-null, however in places where
2110 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2112 LDKnativeUpdateFailMalformedHTLC *inner;
2114 } LDKUpdateFailMalformedHTLC;
2116 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
2117 struct LDKUpdateFailMalformedHTLC *data;
2119 } LDKCVec_UpdateFailMalformedHTLCZ;
2124 * An Err type for failure to process messages.
2126 typedef struct MUST_USE_STRUCT LDKLightningError {
2128 * Nearly everywhere, inner must be non-null, however in places where
2129 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2131 LDKnativeLightningError *inner;
2133 } LDKLightningError;
2135 typedef union LDKCResult_boolLightningErrorZPtr {
2137 struct LDKLightningError *err;
2138 } LDKCResult_boolLightningErrorZPtr;
2140 typedef struct LDKCResult_boolLightningErrorZ {
2141 union LDKCResult_boolLightningErrorZPtr contents;
2143 } LDKCResult_boolLightningErrorZ;
2145 typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
2146 struct LDKChannelAnnouncement a;
2147 struct LDKChannelUpdate b;
2148 struct LDKChannelUpdate c;
2149 } LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
2151 typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
2153 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2154 struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *data;
2156 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
2158 typedef struct LDKCVec_NodeAnnouncementZ {
2159 struct LDKNodeAnnouncement *data;
2161 } LDKCVec_NodeAnnouncementZ;
2163 typedef union LDKCResult_NoneLightningErrorZPtr {
2165 * Note that this value is always NULL, as there are no contents in the OK variant
2168 struct LDKLightningError *err;
2169 } LDKCResult_NoneLightningErrorZPtr;
2171 typedef struct LDKCResult_NoneLightningErrorZ {
2172 union LDKCResult_NoneLightningErrorZPtr contents;
2174 } LDKCResult_NoneLightningErrorZ;
2176 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
2177 struct LDKChannelReestablish *result;
2178 struct LDKDecodeError *err;
2179 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
2181 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
2182 union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
2184 } LDKCResult_ChannelReestablishDecodeErrorZ;
2189 * An init message to be sent or received from a peer
2191 typedef struct MUST_USE_STRUCT LDKInit {
2193 * Nearly everywhere, inner must be non-null, however in places where
2194 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2196 LDKnativeInit *inner;
2200 typedef union LDKCResult_InitDecodeErrorZPtr {
2201 struct LDKInit *result;
2202 struct LDKDecodeError *err;
2203 } LDKCResult_InitDecodeErrorZPtr;
2205 typedef struct LDKCResult_InitDecodeErrorZ {
2206 union LDKCResult_InitDecodeErrorZPtr contents;
2208 } LDKCResult_InitDecodeErrorZ;
2213 * A ping message to be sent or received from a peer
2215 typedef struct MUST_USE_STRUCT LDKPing {
2217 * Nearly everywhere, inner must be non-null, however in places where
2218 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2220 LDKnativePing *inner;
2224 typedef union LDKCResult_PingDecodeErrorZPtr {
2225 struct LDKPing *result;
2226 struct LDKDecodeError *err;
2227 } LDKCResult_PingDecodeErrorZPtr;
2229 typedef struct LDKCResult_PingDecodeErrorZ {
2230 union LDKCResult_PingDecodeErrorZPtr contents;
2232 } LDKCResult_PingDecodeErrorZ;
2237 * A pong message to be sent or received from a peer
2239 typedef struct MUST_USE_STRUCT LDKPong {
2241 * Nearly everywhere, inner must be non-null, however in places where
2242 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2244 LDKnativePong *inner;
2248 typedef union LDKCResult_PongDecodeErrorZPtr {
2249 struct LDKPong *result;
2250 struct LDKDecodeError *err;
2251 } LDKCResult_PongDecodeErrorZPtr;
2253 typedef struct LDKCResult_PongDecodeErrorZ {
2254 union LDKCResult_PongDecodeErrorZPtr contents;
2256 } LDKCResult_PongDecodeErrorZ;
2258 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2259 struct LDKUnsignedChannelAnnouncement *result;
2260 struct LDKDecodeError *err;
2261 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
2263 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
2264 union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
2266 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
2271 * The unsigned part of a channel_update
2273 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
2275 * Nearly everywhere, inner must be non-null, however in places where
2276 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2278 LDKnativeUnsignedChannelUpdate *inner;
2280 } LDKUnsignedChannelUpdate;
2282 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
2283 struct LDKUnsignedChannelUpdate *result;
2284 struct LDKDecodeError *err;
2285 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
2287 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
2288 union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
2290 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
2292 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
2293 struct LDKErrorMessage *result;
2294 struct LDKDecodeError *err;
2295 } LDKCResult_ErrorMessageDecodeErrorZPtr;
2297 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
2298 union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
2300 } LDKCResult_ErrorMessageDecodeErrorZ;
2305 * The unsigned part of a node_announcement
2307 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
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.
2312 LDKnativeUnsignedNodeAnnouncement *inner;
2314 } LDKUnsignedNodeAnnouncement;
2316 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2317 struct LDKUnsignedNodeAnnouncement *result;
2318 struct LDKDecodeError *err;
2319 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
2321 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
2322 union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
2324 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
2326 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
2327 struct LDKQueryShortChannelIds *result;
2328 struct LDKDecodeError *err;
2329 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
2331 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
2332 union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
2334 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
2339 * A reply_short_channel_ids_end message is sent as a reply to a
2340 * query_short_channel_ids message. The query recipient makes a best
2341 * effort to respond based on their local network view which may not be
2342 * a perfect view of the network.
2344 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
2346 * Nearly everywhere, inner must be non-null, however in places where
2347 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2349 LDKnativeReplyShortChannelIdsEnd *inner;
2351 } LDKReplyShortChannelIdsEnd;
2353 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2354 struct LDKReplyShortChannelIdsEnd *result;
2355 struct LDKDecodeError *err;
2356 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
2358 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
2359 union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
2361 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
2363 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
2364 struct LDKQueryChannelRange *result;
2365 struct LDKDecodeError *err;
2366 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
2368 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
2369 union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
2371 } LDKCResult_QueryChannelRangeDecodeErrorZ;
2376 * A reply_channel_range message is a reply to a query_channel_range
2377 * message. Multiple reply_channel_range messages can be sent in reply
2378 * to a single query_channel_range message. The query recipient makes a
2379 * best effort to respond based on their local network view which may
2380 * not be a perfect view of the network. The short_channel_ids in the
2381 * reply are encoded. We only support encoding_type=0 uncompressed
2382 * serialization and do not support encoding_type=1 zlib serialization.
2384 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2386 * Nearly everywhere, inner must be non-null, however in places where
2387 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2389 LDKnativeReplyChannelRange *inner;
2391 } LDKReplyChannelRange;
2393 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
2394 struct LDKReplyChannelRange *result;
2395 struct LDKDecodeError *err;
2396 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
2398 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
2399 union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
2401 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
2406 * A gossip_timestamp_filter message is used by a node to request
2407 * gossip relay for messages in the requested time range when the
2408 * gossip_queries feature has been negotiated.
2410 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
2412 * Nearly everywhere, inner must be non-null, however in places where
2413 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2415 LDKnativeGossipTimestampFilter *inner;
2417 } LDKGossipTimestampFilter;
2419 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
2420 struct LDKGossipTimestampFilter *result;
2421 struct LDKDecodeError *err;
2422 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
2424 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
2425 union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
2427 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
2429 typedef struct LDKCVec_PublicKeyZ {
2430 struct LDKPublicKey *data;
2432 } LDKCVec_PublicKeyZ;
2437 * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
2438 * generate no further read_event/write_buffer_space_avail calls for the descriptor, only
2439 * triggering a single socket_disconnected call (unless it was provided in response to a
2440 * new_*_connection event, in which case no such socket_disconnected() must be called and the
2441 * socket silently disconencted).
2443 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
2445 * Nearly everywhere, inner must be non-null, however in places where
2446 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2448 LDKnativePeerHandleError *inner;
2450 } LDKPeerHandleError;
2452 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
2453 struct LDKCVec_u8Z *result;
2454 struct LDKPeerHandleError *err;
2455 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
2457 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
2458 union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
2460 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
2462 typedef union LDKCResult_NonePeerHandleErrorZPtr {
2464 * Note that this value is always NULL, as there are no contents in the OK variant
2467 struct LDKPeerHandleError *err;
2468 } LDKCResult_NonePeerHandleErrorZPtr;
2470 typedef struct LDKCResult_NonePeerHandleErrorZ {
2471 union LDKCResult_NonePeerHandleErrorZPtr contents;
2473 } LDKCResult_NonePeerHandleErrorZ;
2475 typedef union LDKCResult_boolPeerHandleErrorZPtr {
2477 struct LDKPeerHandleError *err;
2478 } LDKCResult_boolPeerHandleErrorZPtr;
2480 typedef struct LDKCResult_boolPeerHandleErrorZ {
2481 union LDKCResult_boolPeerHandleErrorZPtr contents;
2483 } LDKCResult_boolPeerHandleErrorZ;
2485 typedef union LDKCResult_SecretKeySecpErrorZPtr {
2486 struct LDKSecretKey *result;
2487 enum LDKSecp256k1Error *err;
2488 } LDKCResult_SecretKeySecpErrorZPtr;
2490 typedef struct LDKCResult_SecretKeySecpErrorZ {
2491 union LDKCResult_SecretKeySecpErrorZPtr contents;
2493 } LDKCResult_SecretKeySecpErrorZ;
2495 typedef union LDKCResult_PublicKeySecpErrorZPtr {
2496 struct LDKPublicKey *result;
2497 enum LDKSecp256k1Error *err;
2498 } LDKCResult_PublicKeySecpErrorZPtr;
2500 typedef struct LDKCResult_PublicKeySecpErrorZ {
2501 union LDKCResult_PublicKeySecpErrorZPtr contents;
2503 } LDKCResult_PublicKeySecpErrorZ;
2508 * The set of public keys which are used in the creation of one commitment transaction.
2509 * These are derived from the channel base keys and per-commitment data.
2511 * A broadcaster key is provided from potential broadcaster of the computed transaction.
2512 * A countersignatory key is coming from a protocol participant unable to broadcast the
2515 * These keys are assumed to be good, either because the code derived them from
2516 * channel basepoints via the new function, or they were obtained via
2517 * CommitmentTransaction.trust().keys() because we trusted the source of the
2518 * pre-calculated keys.
2520 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
2522 * Nearly everywhere, inner must be non-null, however in places where
2523 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2525 LDKnativeTxCreationKeys *inner;
2527 } LDKTxCreationKeys;
2529 typedef union LDKCResult_TxCreationKeysSecpErrorZPtr {
2530 struct LDKTxCreationKeys *result;
2531 enum LDKSecp256k1Error *err;
2532 } LDKCResult_TxCreationKeysSecpErrorZPtr;
2534 typedef struct LDKCResult_TxCreationKeysSecpErrorZ {
2535 union LDKCResult_TxCreationKeysSecpErrorZPtr contents;
2537 } LDKCResult_TxCreationKeysSecpErrorZ;
2542 * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
2543 * transaction and the transaction creation keys) are trusted.
2545 * See trust() and verify() functions on CommitmentTransaction.
2547 * This structure implements Deref.
2549 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
2551 * Nearly everywhere, inner must be non-null, however in places where
2552 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2554 LDKnativeTrustedCommitmentTransaction *inner;
2556 } LDKTrustedCommitmentTransaction;
2558 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
2559 struct LDKTrustedCommitmentTransaction *result;
2561 * Note that this value is always NULL, as there are no contents in the Err variant
2564 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
2566 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
2567 union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
2569 } LDKCResult_TrustedCommitmentTransactionNoneZ;
2576 typedef struct MUST_USE_STRUCT LDKRouteHop {
2578 * Nearly everywhere, inner must be non-null, however in places where
2579 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2581 LDKnativeRouteHop *inner;
2585 typedef struct LDKCVec_RouteHopZ {
2586 struct LDKRouteHop *data;
2588 } LDKCVec_RouteHopZ;
2590 typedef struct LDKCVec_CVec_RouteHopZZ {
2591 struct LDKCVec_RouteHopZ *data;
2593 } LDKCVec_CVec_RouteHopZZ;
2598 * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2599 * it can take multiple paths. Each path is composed of one or more hops through the network.
2601 typedef struct MUST_USE_STRUCT LDKRoute {
2603 * Nearly everywhere, inner must be non-null, however in places where
2604 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2606 LDKnativeRoute *inner;
2610 typedef union LDKCResult_RouteDecodeErrorZPtr {
2611 struct LDKRoute *result;
2612 struct LDKDecodeError *err;
2613 } LDKCResult_RouteDecodeErrorZPtr;
2615 typedef struct LDKCResult_RouteDecodeErrorZ {
2616 union LDKCResult_RouteDecodeErrorZPtr contents;
2618 } LDKCResult_RouteDecodeErrorZ;
2623 * A channel descriptor which provides a last-hop route to get_route
2625 typedef struct MUST_USE_STRUCT LDKRouteHint {
2627 * Nearly everywhere, inner must be non-null, however in places where
2628 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2630 LDKnativeRouteHint *inner;
2634 typedef struct LDKCVec_RouteHintZ {
2635 struct LDKRouteHint *data;
2637 } LDKCVec_RouteHintZ;
2639 typedef union LDKCResult_RouteLightningErrorZPtr {
2640 struct LDKRoute *result;
2641 struct LDKLightningError *err;
2642 } LDKCResult_RouteLightningErrorZPtr;
2644 typedef struct LDKCResult_RouteLightningErrorZ {
2645 union LDKCResult_RouteLightningErrorZPtr contents;
2647 } LDKCResult_RouteLightningErrorZ;
2652 * Fees for routing via a given channel or a node
2654 typedef struct MUST_USE_STRUCT LDKRoutingFees {
2656 * Nearly everywhere, inner must be non-null, however in places where
2657 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2659 LDKnativeRoutingFees *inner;
2663 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
2664 struct LDKRoutingFees *result;
2665 struct LDKDecodeError *err;
2666 } LDKCResult_RoutingFeesDecodeErrorZPtr;
2668 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
2669 union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
2671 } LDKCResult_RoutingFeesDecodeErrorZ;
2676 * Information received in the latest node_announcement from this node.
2678 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
2680 * Nearly everywhere, inner must be non-null, however in places where
2681 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2683 LDKnativeNodeAnnouncementInfo *inner;
2685 } LDKNodeAnnouncementInfo;
2687 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
2688 struct LDKNodeAnnouncementInfo *result;
2689 struct LDKDecodeError *err;
2690 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
2692 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
2693 union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
2695 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
2700 * Details about a node in the network, known from the network announcement.
2702 typedef struct MUST_USE_STRUCT LDKNodeInfo {
2704 * Nearly everywhere, inner must be non-null, however in places where
2705 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2707 LDKnativeNodeInfo *inner;
2711 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
2712 struct LDKNodeInfo *result;
2713 struct LDKDecodeError *err;
2714 } LDKCResult_NodeInfoDecodeErrorZPtr;
2716 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
2717 union LDKCResult_NodeInfoDecodeErrorZPtr contents;
2719 } LDKCResult_NodeInfoDecodeErrorZ;
2724 * Represents the network as nodes and channels between them
2726 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
2728 * Nearly everywhere, inner must be non-null, however in places where
2729 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2731 LDKnativeNetworkGraph *inner;
2735 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
2736 struct LDKNetworkGraph *result;
2737 struct LDKDecodeError *err;
2738 } LDKCResult_NetworkGraphDecodeErrorZPtr;
2740 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
2741 union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
2743 } LDKCResult_NetworkGraphDecodeErrorZ;
2746 * A trait indicating an object may generate message send events
2748 typedef struct LDKMessageSendEventsProvider {
2751 * Gets the list of pending events which were generated by previous actions, clearing the list
2754 struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
2755 void (*free)(void *this_arg);
2756 } LDKMessageSendEventsProvider;
2759 * A trait indicating an object may generate events
2761 typedef struct LDKEventsProvider {
2764 * Gets the list of pending events which were generated by previous actions, clearing the list
2767 struct LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
2768 void (*free)(void *this_arg);
2769 } LDKEventsProvider;
2774 * Configuration we set when applicable.
2776 * Default::default() provides sane defaults.
2778 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
2780 * Nearly everywhere, inner must be non-null, however in places where
2781 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2783 LDKnativeChannelHandshakeConfig *inner;
2785 } LDKChannelHandshakeConfig;
2790 * Optional channel limits which are applied during channel creation.
2792 * These limits are only applied to our counterparty's limits, not our own.
2794 * Use 0/<type>::max_value() as appropriate to skip checking.
2796 * Provides sane defaults for most configurations.
2798 * Most additional limits are disabled except those with which specify a default in individual
2799 * field documentation. Note that this may result in barely-usable channels, but since they
2800 * are applied mostly only to incoming channels that's not much of a problem.
2802 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
2804 * Nearly everywhere, inner must be non-null, however in places where
2805 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2807 LDKnativeChannelHandshakeLimits *inner;
2809 } LDKChannelHandshakeLimits;
2814 * Options which apply on a per-channel basis and may change at runtime or based on negotiation
2815 * with our counterparty.
2817 typedef struct MUST_USE_STRUCT LDKChannelConfig {
2819 * Nearly everywhere, inner must be non-null, however in places where
2820 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2822 LDKnativeChannelConfig *inner;
2829 * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
2831 * Default::default() provides sane defaults for most configurations
2832 * (but currently with 0 relay fees!)
2834 typedef struct MUST_USE_STRUCT LDKUserConfig {
2836 * Nearly everywhere, inner must be non-null, however in places where
2837 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2839 LDKnativeUserConfig *inner;
2844 * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
2847 typedef struct LDKAccess {
2850 * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
2851 * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
2854 * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
2856 struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
2857 void (*free)(void *this_arg);
2861 * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
2864 * This is useful in order to have a [`Watch`] implementation convey to a chain source which
2865 * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
2866 * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
2867 * receiving full blocks from a chain source, any further filtering is unnecessary.
2869 * After an output has been registered, subsequent block retrievals from the chain source must not
2870 * exclude any transactions matching the new criteria nor any in-block descendants of such
2873 * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
2874 * should not block on I/O. Implementations should instead queue the newly monitored data to be
2875 * processed later. Then, in order to block until the data has been processed, any `Watch`
2876 * invocation that has called the `Filter` must return [`TemporaryFailure`].
2878 * [`Watch`]: trait.Watch.html
2879 * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure
2880 * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
2881 * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
2883 typedef struct LDKFilter {
2886 * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
2887 * a spending condition.
2889 void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
2891 * Registers interest in spends of a transaction output identified by `outpoint` having
2892 * `script_pubkey` as the spending condition.
2894 void (*register_output)(const void *this_arg, const struct LDKOutPoint *NONNULL_PTR outpoint, struct LDKu8slice script_pubkey);
2895 void (*free)(void *this_arg);
2899 * `Persist` defines behavior for persisting channel monitors: this could mean
2900 * writing once to disk, and/or uploading to one or more backup services.
2902 * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
2903 * to disk/backups. And, on every update, you **must** persist either the
2904 * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
2905 * of situations such as revoking a transaction, then crashing before this
2906 * revocation can be persisted, then unintentionally broadcasting a revoked
2907 * transaction and losing money. This is a risk because previous channel states
2908 * are toxic, so it's important that whatever channel state is persisted is
2911 typedef struct LDKPersist {
2914 * Persist a new channel's data. The data can be stored any way you want, but
2915 * the identifier provided by Rust-Lightning is the channel's outpoint (and
2916 * it is up to you to maintain a correct mapping between the outpoint and the
2917 * stored channel data). Note that you **must** persist every new monitor to
2918 * disk. See the `Persist` trait documentation for more details.
2920 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
2921 * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
2923 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
2924 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
2926 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
2928 * Update one channel's data. The provided `ChannelMonitor` has already
2929 * applied the given update.
2931 * Note that on every update, you **must** persist either the
2932 * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
2933 * the `Persist` trait documentation for more details.
2935 * If an implementer chooses to persist the updates only, they need to make
2936 * sure that all the updates are applied to the `ChannelMonitors` *before*
2937 * the set of channel monitors is given to the `ChannelManager`
2938 * deserialization routine. See [`ChannelMonitor::update_monitor`] for
2939 * applying a monitor update to a monitor. If full `ChannelMonitors` are
2940 * persisted, then there is no need to persist individual updates.
2942 * Note that there could be a performance tradeoff between persisting complete
2943 * channel monitors on every update vs. persisting only updates and applying
2944 * them in batches. The size of each monitor grows `O(number of state updates)`
2945 * whereas updates are small and `O(1)`.
2947 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
2948 * [`ChannelMonitorUpdate::write`] for writing out an update, and
2949 * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
2951 * [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1
2952 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
2953 * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write
2954 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
2956 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data);
2957 void (*free)(void *this_arg);
2963 * An implementation of [`chain::Watch`] for monitoring channels.
2965 * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
2966 * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
2967 * or used independently to monitor channels remotely. See the [module-level documentation] for
2970 * [`chain::Watch`]: ../trait.Watch.html
2971 * [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html
2972 * [module-level documentation]: index.html
2974 typedef struct MUST_USE_STRUCT LDKChainMonitor {
2976 * Nearly everywhere, inner must be non-null, however in places where
2977 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2979 LDKnativeChainMonitor *inner;
2986 * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2987 * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2988 * preimage claim backward will lead to loss of funds.
2990 * [`chain::Watch`]: ../trait.Watch.html
2992 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2994 * Nearly everywhere, inner must be non-null, however in places where
2995 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2997 LDKnativeHTLCUpdate *inner;
3004 * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
3005 * and derives keys from that.
3007 * Your node_id is seed/0'
3008 * ChannelMonitor closes may use seed/1'
3009 * Cooperative closes may use seed/2'
3010 * The two close keys may be needed to claim on-chain funds!
3012 typedef struct MUST_USE_STRUCT LDKKeysManager {
3014 * Nearly everywhere, inner must be non-null, however in places where
3015 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3017 LDKnativeKeysManager *inner;
3024 * Features used within an `init` message.
3026 typedef struct MUST_USE_STRUCT LDKInitFeatures {
3028 * Nearly everywhere, inner must be non-null, however in places where
3029 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3031 LDKnativeInitFeatures *inner;
3035 typedef struct LDKThreeBytes {
3042 * A commitment_signed message to be sent or received from a peer
3044 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
3046 * Nearly everywhere, inner must be non-null, however in places where
3047 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3049 LDKnativeCommitmentSigned *inner;
3051 } LDKCommitmentSigned;
3056 * An update_fee message to be sent or received from a peer
3058 typedef struct MUST_USE_STRUCT LDKUpdateFee {
3060 * Nearly everywhere, inner must be non-null, however in places where
3061 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3063 LDKnativeUpdateFee *inner;
3068 * A trait to describe an object which can receive channel messages.
3070 * Messages MAY be called in parallel when they originate from different their_node_ids, however
3071 * they MUST NOT be called in parallel when the two calls have the same their_node_id.
3073 typedef struct LDKChannelMessageHandler {
3076 * Handle an incoming open_channel message from the given peer.
3078 void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
3080 * Handle an incoming accept_channel message from the given peer.
3082 void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
3084 * Handle an incoming funding_created message from the given peer.
3086 void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
3088 * Handle an incoming funding_signed message from the given peer.
3090 void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
3092 * Handle an incoming funding_locked message from the given peer.
3094 void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
3096 * Handle an incoming shutdown message from the given peer.
3098 void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg);
3100 * Handle an incoming closing_signed message from the given peer.
3102 void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
3104 * Handle an incoming update_add_htlc message from the given peer.
3106 void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
3108 * Handle an incoming update_fulfill_htlc message from the given peer.
3110 void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
3112 * Handle an incoming update_fail_htlc message from the given peer.
3114 void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
3116 * Handle an incoming update_fail_malformed_htlc message from the given peer.
3118 void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
3120 * Handle an incoming commitment_signed message from the given peer.
3122 void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
3124 * Handle an incoming revoke_and_ack message from the given peer.
3126 void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
3128 * Handle an incoming update_fee message from the given peer.
3130 void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
3132 * Handle an incoming announcement_signatures message from the given peer.
3134 void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
3136 * Indicates a connection to the peer failed/an existing connection was lost. If no connection
3137 * is believed to be possible in the future (eg they're sending us messages we don't
3138 * understand or indicate they require unknown feature bits), no_connection_possible is set
3139 * and any outstanding channels should be failed.
3141 void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
3143 * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
3145 void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
3147 * Handle an incoming channel_reestablish message from the given peer.
3149 void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
3151 * Handle an incoming error message from the given peer.
3153 void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
3154 struct LDKMessageSendEventsProvider MessageSendEventsProvider;
3155 void (*free)(void *this_arg);
3156 } LDKChannelMessageHandler;
3161 * Arguments for the creation of a ChannelManager that are not deserialized.
3163 * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
3165 * 1) Deserialize all stored ChannelMonitors.
3166 * 2) Deserialize the ChannelManager by filling in this struct and calling <(Sha256dHash,
3167 * ChannelManager)>::read(reader, args).
3168 * This may result in closing some Channels if the ChannelMonitor is newer than the stored
3169 * ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
3170 * 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
3171 * ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo().
3172 * 4) Reconnect blocks on your ChannelMonitors.
3173 * 5) Move the ChannelMonitors into your local chain::Watch.
3174 * 6) Disconnect/connect blocks on the ChannelManager.
3176 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
3178 * Nearly everywhere, inner must be non-null, however in places where
3179 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3181 LDKnativeChannelManagerReadArgs *inner;
3183 } LDKChannelManagerReadArgs;
3188 * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
3189 * This is used to convince the recipient that the channel is at a certain commitment
3190 * number even if they lost that data due to a local failure. Of course, the peer may lie
3191 * and even later commitments may have been revoked.
3193 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
3195 * Nearly everywhere, inner must be non-null, however in places where
3196 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3198 LDKnativeDataLossProtect *inner;
3200 } LDKDataLossProtect;
3205 * Features used within a `node_announcement` message.
3207 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
3209 * Nearly everywhere, inner must be non-null, however in places where
3210 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3212 LDKnativeNodeFeatures *inner;
3219 * Features used within a `channel_announcement` message.
3221 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
3223 * Nearly everywhere, inner must be non-null, however in places where
3224 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3226 LDKnativeChannelFeatures *inner;
3228 } LDKChannelFeatures;
3231 * A trait to describe an object which can receive routing messages.
3233 * # Implementor DoS Warnings
3235 * For `gossip_queries` messages there are potential DoS vectors when handling
3236 * inbound queries. Implementors using an on-disk network graph should be aware of
3237 * repeated disk I/O for queries accessing different parts of the network graph.
3239 typedef struct LDKRoutingMessageHandler {
3242 * Handle an incoming node_announcement message, returning true if it should be forwarded on,
3243 * false or returning an Err otherwise.
3245 struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
3247 * Handle a channel_announcement message, returning true if it should be forwarded on, false
3248 * or returning an Err otherwise.
3250 struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
3252 * Handle an incoming channel_update message, returning true if it should be forwarded on,
3253 * false or returning an Err otherwise.
3255 struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
3257 * Handle some updates to the route graph that we learned due to an outbound failed payment.
3259 void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
3261 * Gets a subset of the channel announcements and updates required to dump our routing table
3262 * to a remote node, starting at the short_channel_id indicated by starting_point and
3263 * including the batch_amount entries immediately higher in numerical value than starting_point.
3265 struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
3267 * Gets a subset of the node announcements required to dump our routing table to a remote node,
3268 * starting at the node *after* the provided publickey and including batch_amount entries
3269 * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
3270 * If None is provided for starting_point, we start at the first node.
3272 struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
3274 * Called when a connection is established with a peer. This can be used to
3275 * perform routing table synchronization using a strategy defined by the
3278 void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
3280 * Handles the reply of a query we initiated to learn about channels
3281 * for a given range of blocks. We can expect to receive one or more
3282 * replies to a single query.
3284 struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
3286 * Handles the reply of a query we initiated asking for routing gossip
3287 * messages for a list of channels. We should receive this message when
3288 * a node has completed its best effort to send us the pertaining routing
3291 struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
3293 * Handles when a peer asks us to send a list of short_channel_ids
3294 * for the requested range of blocks.
3296 struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
3298 * Handles when a peer asks us to send routing gossip messages for a
3299 * list of short_channel_ids.
3301 struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
3302 struct LDKMessageSendEventsProvider MessageSendEventsProvider;
3303 void (*free)(void *this_arg);
3304 } LDKRoutingMessageHandler;
3309 * Provides references to trait impls which handle different types of messages.
3311 typedef struct MUST_USE_STRUCT LDKMessageHandler {
3313 * Nearly everywhere, inner must be non-null, however in places where
3314 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3316 LDKnativeMessageHandler *inner;
3318 } LDKMessageHandler;
3321 * Provides an object which can be used to send data to and which uniquely identifies a connection
3322 * to a remote host. You will need to be able to generate multiple of these which meet Eq and
3323 * implement Hash to meet the PeerManager API.
3325 * For efficiency, Clone should be relatively cheap for this type.
3327 * You probably want to just extend an int and put a file descriptor in a struct and implement
3328 * send_data. Note that if you are using a higher-level net library that may call close() itself,
3329 * be careful to ensure you don't have races whereby you might register a new connection with an
3330 * fd which is the same as a previous one which has yet to be removed via
3331 * PeerManager::socket_disconnected().
3333 typedef struct LDKSocketDescriptor {
3336 * Attempts to send some data from the given slice to the peer.
3338 * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
3339 * Note that in the disconnected case, socket_disconnected must still fire and further write
3340 * attempts may occur until that time.
3342 * If the returned size is smaller than data.len(), a write_available event must
3343 * trigger the next time more data can be written. Additionally, until the a send_data event
3344 * completes fully, no further read_events should trigger on the same peer!
3346 * If a read_event on this descriptor had previously returned true (indicating that read
3347 * events should be paused to prevent DoS in the send buffer), resume_read may be set
3348 * indicating that read events on this descriptor should resume. A resume_read of false does
3349 * *not* imply that further read events should be paused.
3351 uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
3353 * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
3354 * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
3355 * this descriptor. No socket_disconnected call should be generated as a result of this call,
3356 * though races may occur whereby disconnect_socket is called after a call to
3357 * socket_disconnected but prior to socket_disconnected returning.
3359 void (*disconnect_socket)(void *this_arg);
3360 bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
3361 uint64_t (*hash)(const void *this_arg);
3362 void *(*clone)(const void *this_arg);
3363 void (*free)(void *this_arg);
3364 } LDKSocketDescriptor;
3369 * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
3370 * events into messages which it passes on to its MessageHandlers.
3372 * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
3373 * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
3374 * essentially you should default to using a SimpleRefPeerManager, and use a
3375 * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
3376 * you're using lightning-net-tokio.
3378 typedef struct MUST_USE_STRUCT LDKPeerManager {
3380 * Nearly everywhere, inner must be non-null, however in places where
3381 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3383 LDKnativePeerManager *inner;
3390 * Late-bound per-channel counterparty data used to build transactions.
3392 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
3394 * Nearly everywhere, inner must be non-null, however in places where
3395 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3397 LDKnativeCounterpartyChannelTransactionParameters *inner;
3399 } LDKCounterpartyChannelTransactionParameters;
3404 * Static channel fields used to build transactions given per-commitment fields, organized by
3405 * broadcaster/countersignatory.
3407 * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
3408 * as_holder_broadcastable and as_counterparty_broadcastable functions.
3410 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
3412 * Nearly everywhere, inner must be non-null, however in places where
3413 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3415 LDKnativeDirectedChannelTransactionParameters *inner;
3417 } LDKDirectedChannelTransactionParameters;
3422 * A pre-built Bitcoin commitment transaction and its txid.
3424 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
3426 * Nearly everywhere, inner must be non-null, however in places where
3427 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3429 LDKnativeBuiltCommitmentTransaction *inner;
3431 } LDKBuiltCommitmentTransaction;
3436 * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
3437 * This exists only to make accessing a RwLock<NetworkGraph> possible from
3438 * the C bindings, as it can be done directly in Rust code.
3440 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
3442 * Nearly everywhere, inner must be non-null, however in places where
3443 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3445 LDKnativeLockedNetworkGraph *inner;
3447 } LDKLockedNetworkGraph;
3452 * Receives and validates network updates from peers,
3453 * stores authentic and relevant data as a network graph.
3454 * This network graph is then used for routing payments.
3455 * Provides interface to help with initial routing sync by
3456 * serving historical announcements.
3458 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
3460 * Nearly everywhere, inner must be non-null, however in places where
3461 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3463 LDKnativeNetGraphMsgHandler *inner;
3465 } LDKNetGraphMsgHandler;
3470 * Details about one direction of a channel. Received
3471 * within a channel update.
3473 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
3475 * Nearly everywhere, inner must be non-null, however in places where
3476 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3478 LDKnativeDirectionalChannelInfo *inner;
3480 } LDKDirectionalChannelInfo;
3485 * Details about a channel (both directions).
3486 * Received within a channel announcement.
3488 typedef struct MUST_USE_STRUCT LDKChannelInfo {
3490 * Nearly everywhere, inner must be non-null, however in places where
3491 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3493 LDKnativeChannelInfo *inner;
3497 extern const void (*C2Tuple_usizeTransactionZ_free)(LDKC2Tuple_usizeTransactionZ);
3499 extern const void (*C2Tuple_OutPointScriptZ_free)(LDKC2Tuple_OutPointScriptZ);
3501 extern const void (*C2Tuple_u32TxOutZ_free)(LDKC2Tuple_u32TxOutZ);
3503 extern const void (*C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free)(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ);
3505 extern const void (*C2Tuple_BlockHashChannelMonitorZ_free)(LDKC2Tuple_BlockHashChannelMonitorZ);
3507 extern const void (*C2Tuple_u64u64Z_free)(LDKC2Tuple_u64u64Z);
3509 extern const void (*C2Tuple_SignatureCVec_SignatureZZ_free)(LDKC2Tuple_SignatureCVec_SignatureZZ);
3511 extern const void (*C2Tuple_BlockHashChannelManagerZ_free)(LDKC2Tuple_BlockHashChannelManagerZ);
3513 extern const void (*C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free)(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ);
3515 extern const uintptr_t MAX_BUF_SIZE;
3517 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
3519 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
3521 void Transaction_free(struct LDKTransaction _res);
3523 void TxOut_free(struct LDKTxOut _res);
3525 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
3527 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
3529 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
3531 LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
3533 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
3535 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
3537 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
3539 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
3541 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
3543 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
3545 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
3547 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
3549 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
3551 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
3553 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
3555 LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
3557 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
3559 LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
3561 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
3563 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
3565 void CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res);
3567 LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
3569 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor o);
3571 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
3573 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
3575 LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
3577 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
3579 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
3581 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
3583 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
3585 LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
3587 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2TupleTempl_Signature__CVec_SignatureZ o);
3589 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
3591 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
3593 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
3595 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
3597 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
3599 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
3601 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
3603 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
3605 struct LDKCResult_ChanKeySignerDecodeErrorZ CResult_ChanKeySignerDecodeErrorZ_ok(struct LDKChannelKeys o);
3607 struct LDKCResult_ChanKeySignerDecodeErrorZ CResult_ChanKeySignerDecodeErrorZ_err(struct LDKDecodeError e);
3609 void CResult_ChanKeySignerDecodeErrorZ_free(struct LDKCResult_ChanKeySignerDecodeErrorZ _res);
3611 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_ok(struct LDKInMemoryChannelKeys o);
3613 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_err(struct LDKDecodeError e);
3615 void CResult_InMemoryChannelKeysDecodeErrorZ_free(struct LDKCResult_InMemoryChannelKeysDecodeErrorZ _res);
3617 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
3619 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
3621 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
3623 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
3625 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
3627 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
3629 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
3631 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
3633 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
3635 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
3637 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
3639 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
3641 LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
3643 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager o);
3645 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
3647 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
3649 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
3651 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
3653 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
3655 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
3657 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
3659 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
3661 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
3663 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
3665 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
3667 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
3669 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
3671 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
3673 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
3675 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
3677 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
3679 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
3681 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
3683 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
3685 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
3687 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
3689 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
3691 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
3693 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
3695 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
3697 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
3699 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
3701 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
3703 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
3705 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
3707 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
3709 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
3711 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
3713 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
3715 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
3717 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
3719 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
3721 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
3723 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
3725 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
3727 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
3729 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
3731 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
3733 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
3735 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
3737 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
3739 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
3741 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
3743 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
3745 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
3747 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
3749 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
3751 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
3753 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
3755 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
3757 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
3759 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
3761 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
3763 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
3765 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
3767 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
3769 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
3771 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
3773 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
3775 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
3777 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
3779 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
3781 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
3783 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
3785 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
3787 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
3789 struct LDKCResult_SecretKeySecpErrorZ CResult_SecretKeySecpErrorZ_ok(struct LDKSecretKey o);
3791 struct LDKCResult_SecretKeySecpErrorZ CResult_SecretKeySecpErrorZ_err(enum LDKSecp256k1Error e);
3793 void CResult_SecretKeySecpErrorZ_free(struct LDKCResult_SecretKeySecpErrorZ _res);
3795 struct LDKCResult_PublicKeySecpErrorZ CResult_PublicKeySecpErrorZ_ok(struct LDKPublicKey o);
3797 struct LDKCResult_PublicKeySecpErrorZ CResult_PublicKeySecpErrorZ_err(enum LDKSecp256k1Error e);
3799 void CResult_PublicKeySecpErrorZ_free(struct LDKCResult_PublicKeySecpErrorZ _res);
3801 struct LDKCResult_TxCreationKeysSecpErrorZ CResult_TxCreationKeysSecpErrorZ_ok(struct LDKTxCreationKeys o);
3803 struct LDKCResult_TxCreationKeysSecpErrorZ CResult_TxCreationKeysSecpErrorZ_err(enum LDKSecp256k1Error e);
3805 void CResult_TxCreationKeysSecpErrorZ_free(struct LDKCResult_TxCreationKeysSecpErrorZ _res);
3807 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
3809 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
3811 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
3813 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
3815 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
3817 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
3819 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
3821 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
3823 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
3825 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
3827 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
3829 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
3831 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
3833 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
3835 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
3837 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
3839 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
3841 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
3843 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
3845 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
3847 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
3849 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
3851 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
3853 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
3855 void Event_free(struct LDKEvent this_ptr);
3857 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
3859 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
3861 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
3863 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
3866 * Calls the free function if one is set
3868 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
3871 * Calls the free function if one is set
3873 void EventsProvider_free(struct LDKEventsProvider this_ptr);
3875 void APIError_free(struct LDKAPIError this_ptr);
3877 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
3879 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
3882 * Returns the most verbose logging level.
3884 MUST_USE_RES enum LDKLevel Level_max(void);
3887 * Calls the free function if one is set
3889 void Logger_free(struct LDKLogger this_ptr);
3891 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_ptr);
3893 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
3896 * Confirmations we will wait for before considering the channel locked in.
3897 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3898 * equivalent limit applied to outbound channels).
3902 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
3905 * Confirmations we will wait for before considering the channel locked in.
3906 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3907 * equivalent limit applied to outbound channels).
3911 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
3914 * Set to the amount of time we require our counterparty to wait to claim their money.
3916 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3917 * be online to check for peer having broadcast a revoked transaction to steal our funds
3918 * at least once every our_to_self_delay blocks.
3920 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3921 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3924 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3925 * opening so you can tweak config to ask for more security, not less.
3927 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
3930 * Set to the amount of time we require our counterparty to wait to claim their money.
3932 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3933 * be online to check for peer having broadcast a revoked transaction to steal our funds
3934 * at least once every our_to_self_delay blocks.
3936 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3937 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3940 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3941 * opening so you can tweak config to ask for more security, not less.
3943 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
3946 * Set to the smallest value HTLC we will accept to process.
3948 * This value is sent to our counterparty on channel-open and we close the channel any time
3949 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3951 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
3954 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
3957 * Set to the smallest value HTLC we will accept to process.
3959 * This value is sent to our counterparty on channel-open and we close the channel any time
3960 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3962 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
3965 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
3967 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg);
3969 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
3971 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_ptr);
3973 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
3976 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
3977 * only applies to inbound channels.
3981 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
3984 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
3985 * only applies to inbound channels.
3989 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
3992 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
3993 * you to limit the maximum minimum-size they can require.
3995 * Default value: u64::max_value.
3997 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4000 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
4001 * you to limit the maximum minimum-size they can require.
4003 * Default value: u64::max_value.
4005 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4008 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
4009 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
4013 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4016 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
4017 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
4021 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4024 * The remote node will require we keep a certain amount in direct payment to ourselves at all
4025 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
4026 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
4028 * Default value: u64::max_value.
4030 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4033 * The remote node will require we keep a certain amount in direct payment to ourselves at all
4034 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
4035 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
4037 * Default value: u64::max_value.
4039 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4042 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
4043 * time. This allows you to set a minimum such value.
4047 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4050 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
4051 * time. This allows you to set a minimum such value.
4055 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
4058 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
4059 * required to always be higher than this value so this only applies to HTLC outputs (and
4060 * potentially to-self outputs before any payments have been made).
4061 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4062 * This setting allows you to set a minimum dust limit for their commitment transactions,
4063 * reflecting the reality that tiny outputs are not considered standard transactions and will
4064 * not propagate through the Bitcoin network.
4066 * Default value: 546, the current dust limit on the Bitcoin network.
4068 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4071 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
4072 * required to always be higher than this value so this only applies to HTLC outputs (and
4073 * potentially to-self outputs before any payments have been made).
4074 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4075 * This setting allows you to set a minimum dust limit for their commitment transactions,
4076 * reflecting the reality that tiny outputs are not considered standard transactions and will
4077 * not propagate through the Bitcoin network.
4079 * Default value: 546, the current dust limit on the Bitcoin network.
4081 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4084 * Maximum allowed threshold above which outputs will not be generated in their commitment
4086 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4088 * Default value: u64::max_value.
4090 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4093 * Maximum allowed threshold above which outputs will not be generated in their commitment
4095 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4097 * Default value: u64::max_value.
4099 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4102 * Before a channel is usable the funding transaction will need to be confirmed by at least a
4103 * certain number of blocks, specified by the node which is not the funder (as the funder can
4104 * assume they aren't going to double-spend themselves).
4105 * This config allows you to set a limit on the maximum amount of time to wait.
4107 * Default value: 144, or roughly one day and only applies to outbound channels.
4109 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4112 * Before a channel is usable the funding transaction will need to be confirmed by at least a
4113 * certain number of blocks, specified by the node which is not the funder (as the funder can
4114 * assume they aren't going to double-spend themselves).
4115 * This config allows you to set a limit on the maximum amount of time to wait.
4117 * Default value: 144, or roughly one day and only applies to outbound channels.
4119 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
4122 * Set to force the incoming channel to match our announced channel preference in
4125 * Default value: true, to make the default that no announced channels are possible (which is
4126 * appropriate for any nodes which are not online very reliably).
4128 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4131 * Set to force the incoming channel to match our announced channel preference in
4134 * Default value: true, to make the default that no announced channels are possible (which is
4135 * appropriate for any nodes which are not online very reliably).
4137 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
4140 * Set to the amount of time we're willing to wait to claim money back to us.
4142 * Not checking this value would be a security issue, as our peer would be able to set it to
4143 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
4145 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
4146 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
4148 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4151 * Set to the amount of time we're willing to wait to claim money back to us.
4153 * Not checking this value would be a security issue, as our peer would be able to set it to
4154 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
4156 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
4157 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
4159 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
4161 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint64_t min_dust_limit_satoshis_arg, uint64_t max_dust_limit_satoshis_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
4163 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
4165 void ChannelConfig_free(struct LDKChannelConfig this_ptr);
4167 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
4170 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
4171 * This may be allowed to change at runtime in a later update, however doing so must result in
4172 * update messages sent to notify all nodes of our updated relay fee.
4176 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4179 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
4180 * This may be allowed to change at runtime in a later update, however doing so must result in
4181 * update messages sent to notify all nodes of our updated relay fee.
4185 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
4188 * Set to announce the channel publicly and notify all nodes that they can route via this
4191 * This should only be set to true for nodes which expect to be online reliably.
4193 * As the node which funds a channel picks this value this will only apply for new outbound
4194 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
4196 * This cannot be changed after the initial channel handshake.
4198 * Default value: false.
4200 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4203 * Set to announce the channel publicly and notify all nodes that they can route via this
4206 * This should only be set to true for nodes which expect to be online reliably.
4208 * As the node which funds a channel picks this value this will only apply for new outbound
4209 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
4211 * This cannot be changed after the initial channel handshake.
4213 * Default value: false.
4215 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
4218 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
4219 * supports it, they will then enforce the mutual-close output to us matches what we provided
4220 * at intialization, preventing us from closing to an alternate pubkey.
4222 * This is set to true by default to provide a slight increase in security, though ultimately
4223 * any attacker who is able to take control of a channel can just as easily send the funds via
4224 * lightning payments, so we never require that our counterparties support this option.
4226 * This cannot be changed after a channel has been initialized.
4228 * Default value: true.
4230 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4233 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
4234 * supports it, they will then enforce the mutual-close output to us matches what we provided
4235 * at intialization, preventing us from closing to an alternate pubkey.
4237 * This is set to true by default to provide a slight increase in security, though ultimately
4238 * any attacker who is able to take control of a channel can just as easily send the funds via
4239 * lightning payments, so we never require that our counterparties support this option.
4241 * This cannot be changed after a channel has been initialized.
4243 * Default value: true.
4245 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
4247 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
4249 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
4251 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
4253 struct LDKChannelConfig ChannelConfig_read(struct LDKu8slice ser);
4255 void UserConfig_free(struct LDKUserConfig this_ptr);
4257 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
4260 * Channel config that we propose to our counterparty.
4262 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4265 * Channel config that we propose to our counterparty.
4267 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
4270 * Limits applied to our counterparty's proposed channel config settings.
4272 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4275 * Limits applied to our counterparty's proposed channel config settings.
4277 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
4280 * Channel config which affects behavior during channel lifetime.
4282 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4285 * Channel config which affects behavior during channel lifetime.
4287 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
4289 MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg);
4291 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
4293 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
4296 * Calls the free function if one is set
4298 void Access_free(struct LDKAccess this_ptr);
4301 * Calls the free function if one is set
4303 void Watch_free(struct LDKWatch this_ptr);
4306 * Calls the free function if one is set
4308 void Filter_free(struct LDKFilter this_ptr);
4311 * Calls the free function if one is set
4313 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
4315 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
4318 * Calls the free function if one is set
4320 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
4322 void ChainMonitor_free(struct LDKChainMonitor this_ptr);
4325 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
4326 * of a channel and reacting accordingly based on transactions in the connected block. See
4327 * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
4328 * be returned by [`chain::Watch::release_pending_monitor_events`].
4330 * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
4331 * calls must not exclude any transactions matching the new outputs nor any in-block
4332 * descendants of such transactions. It is not necessary to re-fetch the block to obtain
4335 * [`ChannelMonitor::block_connected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_connected
4336 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
4337 * [`chain::Filter`]: ../trait.Filter.html
4339 void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
4342 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
4343 * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
4346 * [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
4348 void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
4351 * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
4353 * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
4354 * will call back to it indicating transactions and outputs of interest. This allows clients to
4355 * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
4356 * always need to fetch full blocks absent another means for determining which blocks contain
4357 * transactions relevant to the watched channels.
4359 * [`chain::Filter`]: ../trait.Filter.html
4361 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
4363 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
4365 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
4367 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_ptr);
4369 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
4372 * The sequence number of this update. Updates *must* be replayed in-order according to this
4373 * sequence number (and updates may panic if they are not). The update_id values are strictly
4374 * increasing and increase by one for each new update, with one exception specified below.
4376 * This sequence number is also used to track up to which points updates which returned
4377 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4378 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4380 * The only instance where update_id values are not strictly increasing is the case where we
4381 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
4382 * its docs for more details.
4384 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
4386 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
4389 * The sequence number of this update. Updates *must* be replayed in-order according to this
4390 * sequence number (and updates may panic if they are not). The update_id values are strictly
4391 * increasing and increase by one for each new update, with one exception specified below.
4393 * This sequence number is also used to track up to which points updates which returned
4394 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4395 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4397 * The only instance where update_id values are not strictly increasing is the case where we
4398 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
4399 * its docs for more details.
4401 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
4403 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
4405 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
4407 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
4409 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
4411 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_ptr);
4413 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
4415 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
4417 void HTLCUpdate_free(struct LDKHTLCUpdate this_ptr);
4419 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
4421 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
4423 struct LDKHTLCUpdate HTLCUpdate_read(struct LDKu8slice ser);
4425 void ChannelMonitor_free(struct LDKChannelMonitor this_ptr);
4427 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
4430 * Updates a ChannelMonitor on the basis of some new information provided by the Channel
4433 * panics if the given update is not the next update by update_id.
4435 MUST_USE_RES struct LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
4438 * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
4441 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
4444 * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
4446 MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
4449 * Get the list of HTLCs who's status has been updated on chain. This should be called by
4450 * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
4452 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
4454 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
4457 * Gets the list of pending events which were generated by previous actions, clearing the list
4460 * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
4461 * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
4462 * no internal locking in ChannelMonitors.
4464 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
4467 * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
4468 * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
4469 * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
4470 * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
4471 * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
4472 * broadcast them if counterparty don't close channel with his higher commitment transaction after a
4473 * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
4474 * out-of-band the other node operator to coordinate with him if option is available to you.
4475 * In any-case, choice is up to the user.
4477 MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger);
4480 * Processes transactions in a newly connected block, which may result in any of the following:
4481 * - update the monitor's state against resolved HTLCs
4482 * - punish the counterparty in the case of seeing a revoked commitment transaction
4483 * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
4484 * - detect settled outputs for later spending
4485 * - schedule and bump any in-flight claims
4487 * Returns any new outputs to watch from `txdata`; after called, these are also included in
4488 * [`get_outputs_to_watch`].
4490 * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
4492 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ChannelMonitor_block_connected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
4495 * Determines if the disconnected block contained any transactions of interest and updates
4498 void ChannelMonitor_block_disconnected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
4501 * Calls the free function if one is set
4503 void Persist_free(struct LDKPersist this_ptr);
4505 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
4507 void OutPoint_free(struct LDKOutPoint this_ptr);
4509 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
4512 * The referenced transaction's txid.
4514 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
4517 * The referenced transaction's txid.
4519 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4522 * The index of the referenced output in its transaction's vout.
4524 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
4527 * The index of the referenced output in its transaction's vout.
4529 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
4531 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
4534 * Convert an `OutPoint` to a lightning channel id.
4536 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
4538 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
4540 struct LDKOutPoint OutPoint_read(struct LDKu8slice ser);
4542 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
4544 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
4546 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
4548 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
4550 struct LDKChannelKeys ChannelKeys_clone(const struct LDKChannelKeys *NONNULL_PTR orig);
4553 * Calls the free function if one is set
4555 void ChannelKeys_free(struct LDKChannelKeys this_ptr);
4558 * Calls the free function if one is set
4560 void KeysInterface_free(struct LDKKeysInterface this_ptr);
4562 void InMemoryChannelKeys_free(struct LDKInMemoryChannelKeys this_ptr);
4564 struct LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const struct LDKInMemoryChannelKeys *NONNULL_PTR orig);
4567 * Private key of anchor tx
4569 const uint8_t (*InMemoryChannelKeys_get_funding_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4572 * Private key of anchor tx
4574 void InMemoryChannelKeys_set_funding_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4577 * Holder secret key for blinded revocation pubkey
4579 const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4582 * Holder secret key for blinded revocation pubkey
4584 void InMemoryChannelKeys_set_revocation_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4587 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4589 const uint8_t (*InMemoryChannelKeys_get_payment_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4592 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4594 void InMemoryChannelKeys_set_payment_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4597 * Holder secret key used in HTLC tx
4599 const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4602 * Holder secret key used in HTLC tx
4604 void InMemoryChannelKeys_set_delayed_payment_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4607 * Holder htlc secret key used in commitment tx htlc outputs
4609 const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4612 * Holder htlc secret key used in commitment tx htlc outputs
4614 void InMemoryChannelKeys_set_htlc_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4619 const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4624 void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4627 * Create a new InMemoryChannelKeys
4629 MUST_USE_RES struct LDKInMemoryChannelKeys InMemoryChannelKeys_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, LDKC2Tuple_u64u64Z key_derivation_params);
4632 * Counterparty pubkeys.
4633 * Will panic if ready_channel wasn't called.
4635 MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4638 * The contest_delay value specified by our counterparty and applied on holder-broadcastable
4639 * transactions, ie the amount of time that we have to wait to recover our funds if we
4640 * broadcast a transaction.
4641 * Will panic if ready_channel wasn't called.
4643 MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4646 * The contest_delay value specified by us and applied on transactions broadcastable
4647 * by our counterparty, ie the amount of time that they have to wait to recover their funds
4648 * if they broadcast a transaction.
4649 * Will panic if ready_channel wasn't called.
4651 MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4654 * Whether the holder is the initiator
4655 * Will panic if ready_channel wasn't called.
4657 MUST_USE_RES bool InMemoryChannelKeys_is_outbound(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4661 * Will panic if ready_channel wasn't called.
4663 MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4666 * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
4667 * building transactions.
4669 * Will panic if ready_channel wasn't called.
4671 MUST_USE_RES struct LDKChannelTransactionParameters InMemoryChannelKeys_get_channel_parameters(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4673 struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4675 struct LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj);
4677 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ InMemoryChannelKeys_read(struct LDKu8slice ser);
4679 void KeysManager_free(struct LDKKeysManager this_ptr);
4682 * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
4683 * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
4684 * starting_time isn't strictly required to actually be a time, but it must absolutely,
4685 * without a doubt, be unique to this instance. ie if you start multiple times with the same
4686 * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
4687 * simply use the current time (with very high precision).
4689 * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
4690 * obviously, starting_time should be unique every time you reload the library - it is only
4691 * used to generate new ephemeral key data (which will be stored by the individual channel if
4694 * Note that the seed is required to recover certain on-chain funds independent of
4695 * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
4696 * channel, and some on-chain during-closing funds.
4698 * Note that until the 0.1 release there is no guarantee of backward compatibility between
4699 * versions. Once the library is more fully supported, the docs will be updated to include a
4700 * detailed description of the guarantee.
4702 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], enum LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos);
4705 * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation
4707 * Key derivation parameters are accessible through a per-channel secrets
4708 * ChannelKeys::key_derivation_params and is provided inside DynamicOuputP2WSH in case of
4709 * onchain output detection for which a corresponding delayed_payment_key must be derived.
4711 MUST_USE_RES struct LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, uint64_t params_1, uint64_t params_2);
4713 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
4715 void ChannelManager_free(struct LDKChannelManager this_ptr);
4717 void ChannelDetails_free(struct LDKChannelDetails this_ptr);
4719 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
4722 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4723 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4724 * Note that this means this value is *not* persistent - it can change once during the
4725 * lifetime of the channel.
4727 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
4730 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4731 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4732 * Note that this means this value is *not* persistent - it can change once during the
4733 * lifetime of the channel.
4735 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4738 * The node_id of our counterparty
4740 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4743 * The node_id of our counterparty
4745 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
4748 * The Features the channel counterparty provided upon last connection.
4749 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4750 * many routing-relevant features are present in the init context.
4752 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4755 * The Features the channel counterparty provided upon last connection.
4756 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4757 * many routing-relevant features are present in the init context.
4759 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
4762 * The value, in satoshis, of this channel as appears in the funding output
4764 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4767 * The value, in satoshis, of this channel as appears in the funding output
4769 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4772 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4774 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4777 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4779 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4782 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4783 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4784 * available for inclusion in new outbound HTLCs). This further does not include any pending
4785 * outgoing HTLCs which are awaiting some other resolution to be sent.
4787 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4790 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4791 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4792 * available for inclusion in new outbound HTLCs). This further does not include any pending
4793 * outgoing HTLCs which are awaiting some other resolution to be sent.
4795 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4798 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4799 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4800 * available for inclusion in new inbound HTLCs).
4801 * Note that there are some corner cases not fully handled here, so the actual available
4802 * inbound capacity may be slightly higher than this.
4804 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4807 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4808 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4809 * available for inclusion in new inbound HTLCs).
4810 * Note that there are some corner cases not fully handled here, so the actual available
4811 * inbound capacity may be slightly higher than this.
4813 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4816 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4817 * the peer is connected, and (c) no monitor update failure is pending resolution.
4819 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4822 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4823 * the peer is connected, and (c) no monitor update failure is pending resolution.
4825 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
4827 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
4830 * Constructs a new ChannelManager to hold several channels and route between them.
4832 * This is the main \"logic hub\" for all channel-related actions, and implements
4833 * ChannelMessageHandler.
4835 * Non-proportional fees are fixed according to our risk using the provided fee estimator.
4837 * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
4839 * Users must provide the current blockchain height from which to track onchain channel
4840 * funding outpoints and send payments with reliable timelocks.
4842 * Users need to notify the new ChannelManager when a new block is connected or
4843 * disconnected using its `block_connected` and `block_disconnected` methods.
4845 MUST_USE_RES struct LDKChannelManager ChannelManager_new(enum LDKNetwork network, struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, uintptr_t current_blockchain_height);
4848 * Creates a new outbound channel to the given remote node and with the given value.
4850 * user_id will be provided back as user_channel_id in FundingGenerationReady and
4851 * FundingBroadcastSafe events to allow tracking of which events correspond with which
4852 * create_channel call. Note that user_channel_id defaults to 0 for inbound channels, so you
4853 * may wish to avoid using 0 for user_id here.
4855 * If successful, will generate a SendOpenChannel message event, so you should probably poll
4856 * PeerManager::process_events afterwards.
4858 * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
4859 * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
4861 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, struct LDKUserConfig override_config);
4864 * Gets the list of open channels, in random order. See ChannelDetail field documentation for
4867 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4870 * Gets the list of usable channels, in random order. Useful as an argument to
4871 * get_route to ensure non-announced channels are used.
4873 * These are guaranteed to have their is_live value set to true, see the documentation for
4874 * ChannelDetails::is_live for more info on exactly what the criteria are.
4876 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4879 * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
4880 * will be accepted on the given channel, and after additional timeout/the closing of all
4881 * pending HTLCs, the channel will be closed on chain.
4883 * May generate a SendShutdown message event on success, which should be relayed.
4885 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
4888 * Force closes a channel, immediately broadcasting the latest local commitment transaction to
4889 * the chain and rejecting new HTLCs on the given channel.
4891 void ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
4894 * Force close all channels, immediately broadcasting the latest local commitment transaction
4895 * for each to the chain and rejecting new HTLCs on each.
4897 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4900 * Sends a payment along a given route.
4902 * Value parameters are provided via the last hop in route, see documentation for RouteHop
4903 * fields for more info.
4905 * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
4906 * payment), we don't do anything to stop you! We always try to ensure that if the provided
4907 * next hop knows the preimage to payment_hash they can claim an additional amount as
4908 * specified in the last hop in the route! Thus, you should probably do your own
4909 * payment_preimage tracking (which you should already be doing as they represent \"proof of
4910 * payment\") and prevent double-sends yourself.
4912 * May generate SendHTLCs message(s) event on success, which should be relayed.
4914 * Each path may have a different return value, and PaymentSendValue may return a Vec with
4915 * each entry matching the corresponding-index entry in the route paths, see
4916 * PaymentSendFailure for more info.
4918 * In general, a path may raise:
4919 * * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
4920 * node public key) is specified.
4921 * * APIError::ChannelUnavailable if the next-hop channel is not available for updates
4922 * (including due to previous monitor update failure or new permanent monitor update
4924 * * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
4927 * Note that depending on the type of the PaymentSendFailure the HTLC may have been
4928 * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
4929 * different route unless you intend to pay twice!
4931 * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
4932 * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
4933 * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
4934 * must not contain multiple paths as multi-path payments require a recipient-provided
4936 * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
4937 * bit set (either as required or as available). If multiple paths are present in the Route,
4938 * we assume the invoice had the basic_mpp feature set.
4940 MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
4943 * Call this upon creation of a funding transaction for the given channel.
4945 * Note that ALL inputs in the transaction pointed to by funding_txo MUST spend SegWit outputs
4946 * or your counterparty can steal your funds!
4948 * Panics if a funding transaction has already been provided for this channel.
4950 * May panic if the funding_txo is duplicative with some other channel (note that this should
4951 * be trivially prevented by using unique funding transaction keys per-channel).
4953 void ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKOutPoint funding_txo);
4956 * Generates a signed node_announcement from the given arguments and creates a
4957 * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
4958 * seen a channel_announcement from us (ie unless we have public channels open).
4960 * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
4961 * to humans. They carry no in-protocol meaning.
4963 * addresses represent the set (possibly empty) of socket addresses on which this node accepts
4964 * incoming connections. These will be broadcast to the network, publicly tying these
4965 * addresses together. If you wish to preserve user privacy, addresses should likely contain
4966 * only Tor Onion addresses.
4968 * Panics if addresses is absurdly large (more than 500).
4970 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
4973 * Processes HTLCs which are pending waiting on random forward delay.
4975 * Should only really ever be called in response to a PendingHTLCsForwardable event.
4976 * Will likely generate further events.
4978 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
4981 * If a peer is disconnected we mark any channels with that peer as 'disabled'.
4982 * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
4983 * to inform the network about the uselessness of these channels.
4985 * This method handles all the details, and must be called roughly once per minute.
4987 void ChannelManager_timer_chan_freshness_every_min(const struct LDKChannelManager *NONNULL_PTR this_arg);
4990 * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
4991 * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
4992 * along the path (including in our own channel on which we received it).
4993 * Returns false if no payment was found to fail backwards, true if the process of failing the
4994 * HTLC backwards has been started.
4996 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKThirtyTwoBytes payment_secret);
4999 * Provides a payment preimage in response to a PaymentReceived event, returning true and
5000 * generating message events for the net layer to claim the payment, if possible. Thus, you
5001 * should probably kick the net layer to go send messages if this returns true!
5003 * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
5004 * available within a few percent of the expected amount. This is critical for several
5005 * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
5006 * payment_preimage without having provided the full value and b) it avoids certain
5007 * privacy-breaking recipient-probing attacks which may reveal payment activity to
5008 * motivated attackers.
5010 * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
5011 * set. Thus, for such payments we will claim any payments which do not under-pay.
5013 * May panic if called except in response to a PaymentReceived event.
5015 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t expected_amount);
5018 * Gets the node_id held by this ChannelManager
5020 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
5023 * Restores a single, given channel to normal operation after a
5024 * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
5027 * All ChannelMonitor updates up to and including highest_applied_update_id must have been
5028 * fully committed in every copy of the given channels' ChannelMonitors.
5030 * Note that there is no effect to calling with a highest_applied_update_id other than the
5031 * current latest ChannelMonitorUpdate and one call to this function after multiple
5032 * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
5033 * exists largely only to prevent races between this and concurrent update_monitor calls.
5035 * Thus, the anticipated use is, at a high level:
5036 * 1) You register a chain::Watch with this ChannelManager,
5037 * 2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
5038 * said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
5039 * any time it cannot do so instantly,
5040 * 3) update(s) are applied to each remote copy of a ChannelMonitor,
5041 * 4) once all remote copies are updated, you call this function with the update_id that
5042 * completed, and once it is the latest the Channel will be re-enabled.
5044 void ChannelManager_channel_monitor_updated(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOutPoint *NONNULL_PTR funding_txo, uint64_t highest_applied_update_id);
5046 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
5048 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
5051 * Updates channel state based on transactions seen in a connected block.
5053 void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
5056 * Updates channel state based on a disconnected block.
5058 * If necessary, the channel may be force-closed without letting the counterparty participate
5061 void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]);
5063 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
5065 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
5067 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_ptr);
5070 * The keys provider which will give us relevant keys. Some keys will be loaded during
5071 * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
5074 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5077 * The keys provider which will give us relevant keys. Some keys will be loaded during
5078 * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
5081 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
5084 * The fee_estimator for use in the ChannelManager in the future.
5086 * No calls to the FeeEstimator will be made during deserialization.
5088 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5091 * The fee_estimator for use in the ChannelManager in the future.
5093 * No calls to the FeeEstimator will be made during deserialization.
5095 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
5098 * The chain::Watch for use in the ChannelManager in the future.
5100 * No calls to the chain::Watch will be made during deserialization. It is assumed that
5101 * you have deserialized ChannelMonitors separately and will add them to your
5102 * chain::Watch after deserializing this ChannelManager.
5104 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5107 * The chain::Watch for use in the ChannelManager in the future.
5109 * No calls to the chain::Watch will be made during deserialization. It is assumed that
5110 * you have deserialized ChannelMonitors separately and will add them to your
5111 * chain::Watch after deserializing this ChannelManager.
5113 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
5116 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
5117 * used to broadcast the latest local commitment transactions of channels which must be
5118 * force-closed during deserialization.
5120 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5123 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
5124 * used to broadcast the latest local commitment transactions of channels which must be
5125 * force-closed during deserialization.
5127 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
5130 * The Logger for use in the ChannelManager and which may be used to log information during
5133 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5136 * The Logger for use in the ChannelManager and which may be used to log information during
5139 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
5142 * Default settings used for new channels. Any existing channels will continue to use the
5143 * runtime settings which were stored when the ChannelManager was serialized.
5145 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5148 * Default settings used for new channels. Any existing channels will continue to use the
5149 * runtime settings which were stored when the ChannelManager was serialized.
5151 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
5154 * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
5155 * HashMap for you. This is primarily useful for C bindings where it is not practical to
5156 * populate a HashMap directly from C.
5158 MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors);
5160 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
5162 void DecodeError_free(struct LDKDecodeError this_ptr);
5164 void Init_free(struct LDKInit this_ptr);
5166 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
5168 void ErrorMessage_free(struct LDKErrorMessage this_ptr);
5170 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
5173 * The channel ID involved in the error
5175 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
5178 * The channel ID involved in the error
5180 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5183 * A possibly human-readable error description.
5184 * The string should be sanitized before it is used (e.g. emitted to logs
5185 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
5186 * vulnerability in the terminal emulator or the logging subsystem.
5188 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
5191 * A possibly human-readable error description.
5192 * The string should be sanitized before it is used (e.g. emitted to logs
5193 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
5194 * vulnerability in the terminal emulator or the logging subsystem.
5196 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
5198 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg);
5200 void Ping_free(struct LDKPing this_ptr);
5202 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
5205 * The desired response length
5207 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
5210 * The desired response length
5212 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
5215 * The ping packet size.
5216 * This field is not sent on the wire. byteslen zeros are sent.
5218 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
5221 * The ping packet size.
5222 * This field is not sent on the wire. byteslen zeros are sent.
5224 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
5226 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
5228 void Pong_free(struct LDKPong this_ptr);
5230 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
5233 * The pong packet size.
5234 * This field is not sent on the wire. byteslen zeros are sent.
5236 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
5239 * The pong packet size.
5240 * This field is not sent on the wire. byteslen zeros are sent.
5242 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
5244 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
5246 void OpenChannel_free(struct LDKOpenChannel this_ptr);
5248 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
5251 * The genesis hash of the blockchain where the channel is to be opened
5253 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
5256 * The genesis hash of the blockchain where the channel is to be opened
5258 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5261 * A temporary channel ID, until the funding outpoint is announced
5263 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
5266 * A temporary channel ID, until the funding outpoint is announced
5268 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5273 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5278 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5281 * The amount to push to the counterparty as part of the open, in milli-satoshi
5283 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5286 * The amount to push to the counterparty as part of the open, in milli-satoshi
5288 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5291 * The threshold below which outputs on transactions broadcast by sender will be omitted
5293 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5296 * The threshold below which outputs on transactions broadcast by sender will be omitted
5298 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5301 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5303 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5306 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5308 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5311 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5313 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5316 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5318 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5321 * The minimum HTLC size incoming to sender, in milli-satoshi
5323 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5326 * The minimum HTLC size incoming to sender, in milli-satoshi
5328 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5331 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
5333 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5336 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
5338 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
5341 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5343 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5346 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5348 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
5351 * The maximum number of inbound HTLCs towards sender
5353 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5356 * The maximum number of inbound HTLCs towards sender
5358 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
5361 * The sender's key controlling the funding transaction
5363 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5366 * The sender's key controlling the funding transaction
5368 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5371 * Used to derive a revocation key for transactions broadcast by counterparty
5373 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5376 * Used to derive a revocation key for transactions broadcast by counterparty
5378 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5381 * A payment key to sender for transactions broadcast by counterparty
5383 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5386 * A payment key to sender for transactions broadcast by counterparty
5388 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5391 * Used to derive a payment key to sender for transactions broadcast by sender
5393 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5396 * Used to derive a payment key to sender for transactions broadcast by sender
5398 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5401 * Used to derive an HTLC payment key to sender
5403 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5406 * Used to derive an HTLC payment key to sender
5408 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5411 * The first to-be-broadcast-by-sender transaction's per commitment point
5413 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5416 * The first to-be-broadcast-by-sender transaction's per commitment point
5418 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5423 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5428 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
5430 void AcceptChannel_free(struct LDKAcceptChannel this_ptr);
5432 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
5435 * A temporary channel ID, until the funding outpoint is announced
5437 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
5440 * A temporary channel ID, until the funding outpoint is announced
5442 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5445 * The threshold below which outputs on transactions broadcast by sender will be omitted
5447 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5450 * The threshold below which outputs on transactions broadcast by sender will be omitted
5452 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5455 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5457 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5460 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5462 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5465 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5467 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5470 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5472 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5475 * The minimum HTLC size incoming to sender, in milli-satoshi
5477 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5480 * The minimum HTLC size incoming to sender, in milli-satoshi
5482 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5485 * Minimum depth of the funding transaction before the channel is considered open
5487 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5490 * Minimum depth of the funding transaction before the channel is considered open
5492 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
5495 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5497 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5500 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5502 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
5505 * The maximum number of inbound HTLCs towards sender
5507 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5510 * The maximum number of inbound HTLCs towards sender
5512 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
5515 * The sender's key controlling the funding transaction
5517 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5520 * The sender's key controlling the funding transaction
5522 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5525 * Used to derive a revocation key for transactions broadcast by counterparty
5527 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5530 * Used to derive a revocation key for transactions broadcast by counterparty
5532 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5535 * A payment key to sender for transactions broadcast by counterparty
5537 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5540 * A payment key to sender for transactions broadcast by counterparty
5542 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5545 * Used to derive a payment key to sender for transactions broadcast by sender
5547 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5550 * Used to derive a payment key to sender for transactions broadcast by sender
5552 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5555 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
5557 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5560 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
5562 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5565 * The first to-be-broadcast-by-sender transaction's per commitment point
5567 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5570 * The first to-be-broadcast-by-sender transaction's per commitment point
5572 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5574 void FundingCreated_free(struct LDKFundingCreated this_ptr);
5576 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
5579 * A temporary channel ID, until the funding is established
5581 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
5584 * A temporary channel ID, until the funding is established
5586 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5589 * The funding transaction ID
5591 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
5594 * The funding transaction ID
5596 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5599 * The specific output index funding this channel
5601 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
5604 * The specific output index funding this channel
5606 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
5609 * The signature of the channel initiator (funder) on the funding transaction
5611 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
5614 * The signature of the channel initiator (funder) on the funding transaction
5616 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
5618 MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKSignature signature_arg);
5620 void FundingSigned_free(struct LDKFundingSigned this_ptr);
5622 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
5627 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
5632 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5635 * The signature of the channel acceptor (fundee) on the funding transaction
5637 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
5640 * The signature of the channel acceptor (fundee) on the funding transaction
5642 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5644 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
5646 void FundingLocked_free(struct LDKFundingLocked this_ptr);
5648 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
5653 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
5658 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5661 * The per-commitment point of the second commitment transaction
5663 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
5666 * The per-commitment point of the second commitment transaction
5668 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5670 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
5672 void Shutdown_free(struct LDKShutdown this_ptr);
5674 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
5679 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
5684 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5687 * The destination of this peer's funds on closing.
5688 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5690 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
5693 * The destination of this peer's funds on closing.
5694 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5696 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
5698 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
5700 void ClosingSigned_free(struct LDKClosingSigned this_ptr);
5702 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
5707 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
5712 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5715 * The proposed total fee for the closing transaction
5717 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
5720 * The proposed total fee for the closing transaction
5722 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
5725 * A signature on the closing transaction
5727 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
5730 * A signature on the closing transaction
5732 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5734 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
5736 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_ptr);
5738 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
5743 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
5748 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5753 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5758 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
5761 * The HTLC value in milli-satoshi
5763 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5766 * The HTLC value in milli-satoshi
5768 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
5771 * The payment hash, the pre-image of which controls HTLC redemption
5773 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
5776 * The payment hash, the pre-image of which controls HTLC redemption
5778 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5781 * The expiry height of the HTLC
5783 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5786 * The expiry height of the HTLC
5788 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
5790 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_ptr);
5792 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
5797 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
5802 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5807 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
5812 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
5815 * The pre-image of the payment hash, allowing HTLC redemption
5817 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
5820 * The pre-image of the payment hash, allowing HTLC redemption
5822 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5824 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
5826 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_ptr);
5828 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
5833 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
5838 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5843 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
5848 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
5850 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_ptr);
5852 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
5857 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
5862 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5867 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
5872 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
5877 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
5882 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
5884 void CommitmentSigned_free(struct LDKCommitmentSigned this_ptr);
5886 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
5891 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
5896 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5899 * A signature on the commitment transaction
5901 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
5904 * A signature on the commitment transaction
5906 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5909 * Signatures on the HTLC transactions
5911 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
5913 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
5915 void RevokeAndACK_free(struct LDKRevokeAndACK this_ptr);
5917 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
5922 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
5927 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5930 * The secret corresponding to the per-commitment point
5932 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
5935 * The secret corresponding to the per-commitment point
5937 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5940 * The next sender-broadcast commitment transaction's per-commitment point
5942 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
5945 * The next sender-broadcast commitment transaction's per-commitment point
5947 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5949 MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg);
5951 void UpdateFee_free(struct LDKUpdateFee this_ptr);
5953 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
5958 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
5963 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5966 * Fee rate per 1000-weight of the transaction
5968 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
5971 * Fee rate per 1000-weight of the transaction
5973 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
5975 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
5977 void DataLossProtect_free(struct LDKDataLossProtect this_ptr);
5979 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
5982 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
5983 * belonging to the recipient
5985 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
5988 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
5989 * belonging to the recipient
5991 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5994 * The sender's per-commitment point for their current commitment transaction
5996 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
5999 * The sender's per-commitment point for their current commitment transaction
6001 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6003 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
6005 void ChannelReestablish_free(struct LDKChannelReestablish this_ptr);
6007 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
6012 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
6017 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6020 * The next commitment number for the sender
6022 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
6025 * The next commitment number for the sender
6027 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
6030 * The next commitment number for the recipient
6032 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
6035 * The next commitment number for the recipient
6037 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
6039 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_ptr);
6041 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
6046 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
6051 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6054 * The short channel ID
6056 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6059 * The short channel ID
6061 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
6064 * A signature by the node key
6066 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6069 * A signature by the node key
6071 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
6074 * A signature by the funding key
6076 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6079 * A signature by the funding key
6081 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
6083 MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKSignature node_signature_arg, struct LDKSignature bitcoin_signature_arg);
6085 void NetAddress_free(struct LDKNetAddress this_ptr);
6087 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
6089 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
6091 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
6093 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_ptr);
6095 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
6098 * The advertised features
6100 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6103 * The advertised features
6105 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
6108 * A strictly monotonic announcement counter, with gaps allowed
6110 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6113 * A strictly monotonic announcement counter, with gaps allowed
6115 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
6118 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
6121 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6124 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
6127 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6130 * An RGB color for UI purposes
6132 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
6135 * An RGB color for UI purposes
6137 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
6140 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
6143 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
6146 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
6149 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6152 * List of addresses on which this node is reachable
6154 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
6156 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_ptr);
6158 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
6161 * The signature by the node key
6163 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
6166 * The signature by the node key
6168 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6171 * The actual content of the announcement
6173 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
6176 * The actual content of the announcement
6178 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
6180 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
6182 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_ptr);
6184 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
6187 * The advertised channel features
6189 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6192 * The advertised channel features
6194 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
6197 * The genesis hash of the blockchain where the channel is to be opened
6199 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
6202 * The genesis hash of the blockchain where the channel is to be opened
6204 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6207 * The short channel ID
6209 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6212 * The short channel ID
6214 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
6217 * One of the two node_ids which are endpoints of this channel
6219 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6222 * One of the two node_ids which are endpoints of this channel
6224 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6227 * The other of the two node_ids which are endpoints of this channel
6229 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6232 * The other of the two node_ids which are endpoints of this channel
6234 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6237 * The funding key for the first node
6239 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6242 * The funding key for the first node
6244 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6247 * The funding key for the second node
6249 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6252 * The funding key for the second node
6254 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6256 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_ptr);
6258 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
6261 * Authentication of the announcement by the first public node
6263 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6266 * Authentication of the announcement by the first public node
6268 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6271 * Authentication of the announcement by the second public node
6273 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6276 * Authentication of the announcement by the second public node
6278 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6281 * Proof of funding UTXO ownership by the first public node
6283 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6286 * Proof of funding UTXO ownership by the first public node
6288 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6291 * Proof of funding UTXO ownership by the second public node
6293 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6296 * Proof of funding UTXO ownership by the second public node
6298 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6301 * The actual announcement
6303 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6306 * The actual announcement
6308 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
6310 MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKSignature node_signature_1_arg, struct LDKSignature node_signature_2_arg, struct LDKSignature bitcoin_signature_1_arg, struct LDKSignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg);
6312 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_ptr);
6314 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
6317 * The genesis hash of the blockchain where the channel is to be opened
6319 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
6322 * The genesis hash of the blockchain where the channel is to be opened
6324 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6327 * The short channel ID
6329 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6332 * The short channel ID
6334 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
6337 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
6339 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6342 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
6344 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6349 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6354 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
6357 * The number of blocks to subtract from incoming HTLC cltv_expiry values
6359 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6362 * The number of blocks to subtract from incoming HTLC cltv_expiry values
6364 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
6367 * The minimum HTLC size incoming to sender, in milli-satoshi
6369 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6372 * The minimum HTLC size incoming to sender, in milli-satoshi
6374 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
6377 * The base HTLC fee charged by sender, in milli-satoshi
6379 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6382 * The base HTLC fee charged by sender, in milli-satoshi
6384 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6387 * The amount to fee multiplier, in micro-satoshi
6389 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6392 * The amount to fee multiplier, in micro-satoshi
6394 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6396 void ChannelUpdate_free(struct LDKChannelUpdate this_ptr);
6398 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
6401 * A signature of the channel update
6403 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
6406 * A signature of the channel update
6408 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
6411 * The actual channel update
6413 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
6416 * The actual channel update
6418 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
6420 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
6422 void QueryChannelRange_free(struct LDKQueryChannelRange this_ptr);
6424 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
6427 * The genesis hash of the blockchain being queried
6429 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
6432 * The genesis hash of the blockchain being queried
6434 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6437 * The height of the first block for the channel UTXOs being queried
6439 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
6442 * The height of the first block for the channel UTXOs being queried
6444 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6447 * The number of blocks to include in the query results
6449 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
6452 * The number of blocks to include in the query results
6454 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6456 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
6458 void ReplyChannelRange_free(struct LDKReplyChannelRange this_ptr);
6460 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
6463 * The genesis hash of the blockchain being queried
6465 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
6468 * The genesis hash of the blockchain being queried
6470 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6473 * The height of the first block in the range of the reply
6475 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6478 * The height of the first block in the range of the reply
6480 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6483 * The number of blocks included in the range of the reply
6485 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6488 * The number of blocks included in the range of the reply
6490 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6493 * Indicates if the query recipient maintains up-to-date channel
6494 * information for the chain_hash
6496 bool ReplyChannelRange_get_full_information(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6499 * Indicates if the query recipient maintains up-to-date channel
6500 * information for the chain_hash
6502 void ReplyChannelRange_set_full_information(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
6505 * The short_channel_ids in the channel range
6507 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
6509 MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool full_information_arg, struct LDKCVec_u64Z short_channel_ids_arg);
6511 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_ptr);
6513 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
6516 * The genesis hash of the blockchain being queried
6518 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
6521 * The genesis hash of the blockchain being queried
6523 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6526 * The short_channel_ids that are being queried
6528 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
6530 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
6532 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_ptr);
6534 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
6537 * The genesis hash of the blockchain that was queried
6539 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
6542 * The genesis hash of the blockchain that was queried
6544 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6547 * Indicates if the query recipient maintains up-to-date channel
6548 * information for the chain_hash
6550 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
6553 * Indicates if the query recipient maintains up-to-date channel
6554 * information for the chain_hash
6556 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
6558 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
6560 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_ptr);
6562 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
6565 * The genesis hash of the blockchain for channel and node information
6567 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
6570 * The genesis hash of the blockchain for channel and node information
6572 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6575 * The starting unix timestamp
6577 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
6580 * The starting unix timestamp
6582 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
6585 * The range of information in seconds
6587 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
6590 * The range of information in seconds
6592 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
6594 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
6596 void ErrorAction_free(struct LDKErrorAction this_ptr);
6598 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
6600 void LightningError_free(struct LDKLightningError this_ptr);
6603 * A human-readable message describing the error
6605 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
6608 * A human-readable message describing the error
6610 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
6613 * The action which should be taken against the offending peer.
6615 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
6618 * The action which should be taken against the offending peer.
6620 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
6622 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
6624 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_ptr);
6626 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
6629 * update_add_htlc messages which should be sent
6631 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
6634 * update_fulfill_htlc messages which should be sent
6636 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
6639 * update_fail_htlc messages which should be sent
6641 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
6644 * update_fail_malformed_htlc messages which should be sent
6646 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
6649 * An update_fee message which should be sent
6651 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
6654 * An update_fee message which should be sent
6656 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
6659 * Finally, the commitment_signed message which should be sent
6661 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
6664 * Finally, the commitment_signed message which should be sent
6666 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
6668 MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, struct LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, struct LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, struct LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg);
6670 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
6672 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
6675 * Calls the free function if one is set
6677 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
6680 * Calls the free function if one is set
6682 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
6684 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
6686 struct LDKAcceptChannel AcceptChannel_read(struct LDKu8slice ser);
6688 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
6690 struct LDKAnnouncementSignatures AnnouncementSignatures_read(struct LDKu8slice ser);
6692 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
6694 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
6696 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
6698 struct LDKClosingSigned ClosingSigned_read(struct LDKu8slice ser);
6700 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
6702 struct LDKCommitmentSigned CommitmentSigned_read(struct LDKu8slice ser);
6704 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
6706 struct LDKFundingCreated FundingCreated_read(struct LDKu8slice ser);
6708 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
6710 struct LDKFundingSigned FundingSigned_read(struct LDKu8slice ser);
6712 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
6714 struct LDKFundingLocked FundingLocked_read(struct LDKu8slice ser);
6716 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
6718 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
6720 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
6722 struct LDKOpenChannel OpenChannel_read(struct LDKu8slice ser);
6724 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
6726 struct LDKRevokeAndACK RevokeAndACK_read(struct LDKu8slice ser);
6728 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
6730 struct LDKShutdown Shutdown_read(struct LDKu8slice ser);
6732 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
6734 struct LDKUpdateFailHTLC UpdateFailHTLC_read(struct LDKu8slice ser);
6736 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
6738 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
6740 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
6742 struct LDKUpdateFee UpdateFee_read(struct LDKu8slice ser);
6744 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
6746 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(struct LDKu8slice ser);
6748 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
6750 struct LDKUpdateAddHTLC UpdateAddHTLC_read(struct LDKu8slice ser);
6752 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
6754 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
6756 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
6758 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
6760 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
6762 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
6764 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
6766 struct LDKChannelAnnouncement ChannelAnnouncement_read(struct LDKu8slice ser);
6768 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
6770 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
6772 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
6774 struct LDKChannelUpdate ChannelUpdate_read(struct LDKu8slice ser);
6776 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
6778 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
6780 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
6782 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
6784 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
6786 struct LDKNodeAnnouncement NodeAnnouncement_read(struct LDKu8slice ser);
6788 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
6790 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
6792 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
6794 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
6796 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
6798 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
6800 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
6802 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
6804 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
6806 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
6808 void MessageHandler_free(struct LDKMessageHandler this_ptr);
6811 * A message handler which handles messages specific to channels. Usually this is just a
6812 * ChannelManager object.
6814 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
6817 * A message handler which handles messages specific to channels. Usually this is just a
6818 * ChannelManager object.
6820 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
6823 * A message handler which handles messages updating our knowledge of the network channel
6824 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6826 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
6829 * A message handler which handles messages updating our knowledge of the network channel
6830 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6832 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
6834 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
6836 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
6839 * Calls the free function if one is set
6841 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
6843 void PeerHandleError_free(struct LDKPeerHandleError this_ptr);
6846 * Used to indicate that we probably can't make any future connections to this peer, implying
6847 * we should go ahead and force-close any channels we have with it.
6849 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
6852 * Used to indicate that we probably can't make any future connections to this peer, implying
6853 * we should go ahead and force-close any channels we have with it.
6855 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
6857 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
6859 void PeerManager_free(struct LDKPeerManager this_ptr);
6862 * Constructs a new PeerManager with the given message handlers and node_id secret key
6863 * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
6864 * cryptographically secure random bytes.
6866 MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger);
6869 * Get the list of node ids for peers which have completed the initial handshake.
6871 * For outbound connections, this will be the same as the their_node_id parameter passed in to
6872 * new_outbound_connection, however entries will only appear once the initial handshake has
6873 * completed and we are sure the remote peer has the private key for the given node_id.
6875 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
6878 * Indicates a new outbound connection has been established to a node with the given node_id.
6879 * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
6880 * descriptor but must disconnect the connection immediately.
6882 * Returns a small number of bytes to send to the remote node (currently always 50).
6884 * Panics if descriptor is duplicative with some other descriptor which has not yet had a
6885 * socket_disconnected().
6887 MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor);
6890 * Indicates a new inbound connection has been established.
6892 * May refuse the connection by returning an Err, but will never write bytes to the remote end
6893 * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
6894 * call socket_disconnected for the new descriptor but must disconnect the connection
6897 * Panics if descriptor is duplicative with some other descriptor which has not yet had
6898 * socket_disconnected called.
6900 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
6903 * Indicates that there is room to write data to the given socket descriptor.
6905 * May return an Err to indicate that the connection should be closed.
6907 * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
6908 * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
6909 * invariants around calling write_buffer_space_avail in case a write did not fully complete
6910 * must still hold - be ready to call write_buffer_space_avail again if a write call generated
6911 * here isn't sufficient! Panics if the descriptor was not previously registered in a
6912 * new_\\*_connection event.
6914 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
6917 * Indicates that data was read from the given socket descriptor.
6919 * May return an Err to indicate that the connection should be closed.
6921 * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
6922 * Thus, however, you almost certainly want to call process_events() after any read_event to
6923 * generate send_data calls to handle responses.
6925 * If Ok(true) is returned, further read_events should not be triggered until a send_data call
6926 * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
6928 * Panics if the descriptor was not previously registered in a new_*_connection event.
6930 MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data);
6933 * Checks for any events generated by our handlers and processes them. Includes sending most
6934 * response messages as well as messages generated by calls to handler functions directly (eg
6935 * functions like ChannelManager::process_pending_htlc_forward or send_payment).
6937 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
6940 * Indicates that the given socket descriptor's connection is now closed.
6942 * This must only be called if the socket has been disconnected by the peer or your own
6943 * decision to disconnect it and must NOT be called in any case where other parts of this
6944 * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
6947 * Panics if the descriptor was not previously registered in a successful new_*_connection event.
6949 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
6952 * This function should be called roughly once every 30 seconds.
6953 * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
6954 * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
6956 void PeerManager_timer_tick_occured(const struct LDKPeerManager *NONNULL_PTR this_arg);
6959 * Build the commitment secret from the seed and the commitment number
6961 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
6964 * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
6965 * from the base secret and the per_commitment_point.
6967 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6968 * generated (ie our own).
6970 struct LDKCResult_SecretKeySecpErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
6973 * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
6974 * from the base point and the per_commitment_key. This is the public equivalent of
6975 * derive_private_key - using only public keys to derive a public key instead of private keys.
6977 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6978 * generated (ie our own).
6980 struct LDKCResult_PublicKeySecpErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
6983 * Derives a per-commitment-transaction revocation key from its constituent parts.
6985 * Only the cheating participant owns a valid witness to propagate a revoked
6986 * commitment transaction, thus per_commitment_secret always come from cheater
6987 * and revocation_base_secret always come from punisher, which is the broadcaster
6988 * of the transaction spending with this key knowledge.
6990 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6991 * generated (ie our own).
6993 struct LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
6996 * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
6997 * the public equivalend of derive_private_revocation_key - using only public keys to derive a
6998 * public key instead of private keys.
7000 * Only the cheating participant owns a valid witness to propagate a revoked
7001 * commitment transaction, thus per_commitment_point always come from cheater
7002 * and revocation_base_point always come from punisher, which is the broadcaster
7003 * of the transaction spending with this key knowledge.
7005 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7006 * generated (ie our own).
7008 struct LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
7010 void TxCreationKeys_free(struct LDKTxCreationKeys this_ptr);
7012 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
7015 * The broadcaster's per-commitment public key which was used to derive the other keys.
7017 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7020 * The broadcaster's per-commitment public key which was used to derive the other keys.
7022 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7025 * The revocation key which is used to allow the broadcaster of the commitment
7026 * transaction to provide their counterparty the ability to punish them if they broadcast
7029 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7032 * The revocation key which is used to allow the broadcaster of the commitment
7033 * transaction to provide their counterparty the ability to punish them if they broadcast
7036 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7039 * Broadcaster's HTLC Key
7041 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7044 * Broadcaster's HTLC Key
7046 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7049 * Countersignatory's HTLC Key
7051 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7054 * Countersignatory's HTLC Key
7056 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7059 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
7061 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7064 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
7066 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7068 MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKPublicKey revocation_key_arg, struct LDKPublicKey broadcaster_htlc_key_arg, struct LDKPublicKey countersignatory_htlc_key_arg, struct LDKPublicKey broadcaster_delayed_payment_key_arg);
7070 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
7072 struct LDKTxCreationKeys TxCreationKeys_read(struct LDKu8slice ser);
7074 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_ptr);
7076 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
7079 * The public key which is used to sign all commitment transactions, as it appears in the
7080 * on-chain channel lock-in 2-of-2 multisig output.
7082 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7085 * The public key which is used to sign all commitment transactions, as it appears in the
7086 * on-chain channel lock-in 2-of-2 multisig output.
7088 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7091 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
7092 * revocation keys. This is combined with the per-commitment-secret generated by the
7093 * counterparty to create a secret which the counterparty can reveal to revoke previous
7096 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7099 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
7100 * revocation keys. This is combined with the per-commitment-secret generated by the
7101 * counterparty to create a secret which the counterparty can reveal to revoke previous
7104 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7107 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
7108 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
7109 * static across every commitment transaction.
7111 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7114 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
7115 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
7116 * static across every commitment transaction.
7118 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7121 * The base point which is used (with derive_public_key) to derive a per-commitment payment
7122 * public key which receives non-HTLC-encumbered funds which are only available for spending
7123 * after some delay (or can be claimed via the revocation path).
7125 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7128 * The base point which is used (with derive_public_key) to derive a per-commitment payment
7129 * public key which receives non-HTLC-encumbered funds which are only available for spending
7130 * after some delay (or can be claimed via the revocation path).
7132 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7135 * The base point which is used (with derive_public_key) to derive a per-commitment public key
7136 * which is used to encumber HTLC-in-flight outputs.
7138 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7141 * The base point which is used (with derive_public_key) to derive a per-commitment public key
7142 * which is used to encumber HTLC-in-flight outputs.
7144 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7146 MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg);
7148 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
7150 struct LDKChannelPublicKeys ChannelPublicKeys_read(struct LDKu8slice ser);
7153 * Create per-state keys from channel base points and the per-commitment point.
7154 * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
7156 MUST_USE_RES struct LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, struct LDKPublicKey broadcaster_delayed_payment_base, struct LDKPublicKey broadcaster_htlc_base, struct LDKPublicKey countersignatory_revocation_base, struct LDKPublicKey countersignatory_htlc_base);
7159 * Generate per-state keys from channel static keys.
7160 * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
7162 MUST_USE_RES struct LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys);
7165 * A script either spendable by the revocation
7166 * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
7167 * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
7169 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
7171 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_ptr);
7173 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
7176 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
7177 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
7178 * need to compare this value to whether the commitment transaction in question is that of
7179 * the counterparty or our own.
7181 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7184 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
7185 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
7186 * need to compare this value to whether the commitment transaction in question is that of
7187 * the counterparty or our own.
7189 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
7192 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
7193 * this divided by 1000.
7195 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7198 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
7199 * this divided by 1000.
7201 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
7204 * The CLTV lock-time at which this HTLC expires.
7206 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7209 * The CLTV lock-time at which this HTLC expires.
7211 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
7214 * The hash of the preimage which unlocks this HTLC.
7216 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
7219 * The hash of the preimage which unlocks this HTLC.
7221 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7223 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
7225 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(struct LDKu8slice ser);
7228 * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
7229 * does not need to have its previous_output_index filled.
7231 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
7234 * Gets the redeemscript for a funding output from the two funding public keys.
7235 * Note that the order of funding public keys does not matter.
7237 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
7240 * panics if htlc.transaction_output_index.is_none()!
7242 struct LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
7244 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_ptr);
7246 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
7249 * Holder public keys
7251 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7254 * Holder public keys
7256 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
7259 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
7261 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7264 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
7266 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
7269 * Whether the holder is the initiator of this channel.
7270 * This is an input to the commitment number obscure factor computation.
7272 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7275 * Whether the holder is the initiator of this channel.
7276 * This is an input to the commitment number obscure factor computation.
7278 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
7281 * The late-bound counterparty channel transaction parameters.
7282 * These parameters are populated at the point in the protocol where the counterparty provides them.
7284 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7287 * The late-bound counterparty channel transaction parameters.
7288 * These parameters are populated at the point in the protocol where the counterparty provides them.
7290 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
7293 * The late-bound funding outpoint
7295 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7298 * The late-bound funding outpoint
7300 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
7302 MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg);
7304 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_ptr);
7306 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
7309 * Counter-party public keys
7311 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
7314 * Counter-party public keys
7316 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
7319 * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
7321 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
7324 * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
7326 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
7328 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
7331 * Whether the late bound parameters are populated.
7333 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7336 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
7337 * given that the holder is the broadcaster.
7339 * self.is_populated() must be true before calling this function.
7341 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7344 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
7345 * given that the counterparty is the broadcaster.
7347 * self.is_populated() must be true before calling this function.
7349 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7351 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
7353 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
7355 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
7357 struct LDKChannelTransactionParameters ChannelTransactionParameters_read(struct LDKu8slice ser);
7359 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_ptr);
7362 * Get the channel pubkeys for the broadcaster
7364 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7367 * Get the channel pubkeys for the countersignatory
7369 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7372 * Get the contest delay applicable to the transactions.
7373 * Note that the contest delay was selected by the countersignatory.
7375 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7378 * Whether the channel is outbound from the broadcaster.
7380 * The boolean representing the side that initiated the channel is
7381 * an input to the commitment number obscure factor computation.
7383 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7386 * The funding outpoint
7388 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7390 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_ptr);
7392 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
7395 * Our counterparty's signature for the transaction
7397 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
7400 * Our counterparty's signature for the transaction
7402 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
7405 * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
7407 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
7409 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
7411 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(struct LDKu8slice ser);
7414 * Create a new holder transaction with the given counterparty signatures.
7415 * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
7417 MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, struct LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key);
7419 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_ptr);
7421 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
7424 * The commitment transaction
7426 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
7429 * The commitment transaction
7431 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
7434 * The txid for the commitment transaction.
7436 * This is provided as a performance optimization, instead of calling transaction.txid()
7439 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
7442 * The txid for the commitment transaction.
7444 * This is provided as a performance optimization, instead of calling transaction.txid()
7447 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7449 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
7451 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
7453 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_read(struct LDKu8slice ser);
7456 * Get the SIGHASH_ALL sighash value of the transaction.
7458 * This can be used to verify a signature.
7460 MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
7463 * Sign a transaction, either because we are counter-signing the counterparty's transaction or
7464 * because we are about to broadcast a holder transaction.
7466 MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
7468 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_ptr);
7470 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
7472 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
7474 struct LDKCommitmentTransaction CommitmentTransaction_read(struct LDKu8slice ser);
7477 * The backwards-counting commitment number
7479 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7482 * The value to be sent to the broadcaster
7484 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7487 * The value to be sent to the counterparty
7489 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7492 * The feerate paid per 1000-weight-unit in this commitment transaction.
7494 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7497 * Trust our pre-built transaction and derived transaction creation public keys.
7499 * Applies a wrapper which allows access to these fields.
7501 * This should only be used if you fully trust the builder of this object. It should not
7502 *\tbe used by an external signer - instead use the verify function.
7504 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7507 * Verify our pre-built transaction and derived transaction creation public keys.
7509 * Applies a wrapper which allows access to these fields.
7511 * An external validating signer must call this method before signing
7512 * or using the built transaction.
7514 MUST_USE_RES struct LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys);
7516 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_ptr);
7519 * The transaction ID of the built Bitcoin transaction
7521 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7524 * The pre-built Bitcoin commitment transaction
7526 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7529 * The pre-calculated transaction creation public keys.
7531 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7534 * Get a signature for each HTLC which was included in the commitment transaction (ie for
7535 * which HTLCOutputInCommitment::transaction_output_index.is_some()).
7537 * The returned Vec has one entry for each HTLC, and in the same order.
7539 MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters);
7542 * Get the transaction number obscure factor
7544 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
7546 void InitFeatures_free(struct LDKInitFeatures this_ptr);
7548 void NodeFeatures_free(struct LDKNodeFeatures this_ptr);
7550 void ChannelFeatures_free(struct LDKChannelFeatures this_ptr);
7552 void RouteHop_free(struct LDKRouteHop this_ptr);
7554 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
7557 * The node_id of the node at this hop.
7559 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7562 * The node_id of the node at this hop.
7564 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7567 * The node_announcement features of the node at this hop. For the last hop, these may be
7568 * amended to match the features present in the invoice this node generated.
7570 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7573 * The node_announcement features of the node at this hop. For the last hop, these may be
7574 * amended to match the features present in the invoice this node generated.
7576 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
7579 * The channel that should be used from the previous hop to reach this node.
7581 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7584 * The channel that should be used from the previous hop to reach this node.
7586 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
7589 * The channel_announcement features of the channel that should be used from the previous hop
7590 * to reach this node.
7592 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7595 * The channel_announcement features of the channel that should be used from the previous hop
7596 * to reach this node.
7598 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
7601 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
7603 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7606 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
7608 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
7611 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
7612 * expected at the destination, in excess of the current block height.
7614 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7617 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
7618 * expected at the destination, in excess of the current block height.
7620 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
7622 MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg);
7624 void Route_free(struct LDKRoute this_ptr);
7626 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
7629 * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
7630 * last RouteHop in each path must be the same.
7631 * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
7632 * destination. Thus, this must always be at least length one. While the maximum length of any
7633 * given path is variable, keeping the length of any path to less than 20 should currently
7634 * ensure it is viable.
7636 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
7638 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
7640 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
7642 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
7644 void RouteHint_free(struct LDKRouteHint this_ptr);
7646 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
7649 * The node_id of the non-target end of the route
7651 struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7654 * The node_id of the non-target end of the route
7656 void RouteHint_set_src_node_id(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7659 * The short_channel_id of this channel
7661 uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7664 * The short_channel_id of this channel
7666 void RouteHint_set_short_channel_id(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
7669 * The fees which must be paid to use this channel
7671 struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7674 * The fees which must be paid to use this channel
7676 void RouteHint_set_fees(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
7679 * The difference in CLTV values between this node and the next node.
7681 uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7684 * The difference in CLTV values between this node and the next node.
7686 void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val);
7689 * The minimum value, in msat, which must be relayed to the next hop.
7691 uint64_t RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7694 * The minimum value, in msat, which must be relayed to the next hop.
7696 void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
7698 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg);
7701 * Gets a route from us to the given target node.
7703 * Extra routing hops between known nodes and the target will be used if they are included in
7706 * If some channels aren't announced, it may be useful to fill in a first_hops with the
7707 * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
7708 * view of our local channels (from net_graph_msg_handler) will be ignored, and only those in first_hops
7711 * Panics if first_hops contains channels without short_channel_ids
7712 * (ChannelManager::list_usable_channels will never include such channels).
7714 * The fees on channels from us to next-hops are ignored (as they are assumed to all be
7715 * equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat
7716 * *is* checked as they may change based on the receiving node.
7718 struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey target, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
7720 void NetworkGraph_free(struct LDKNetworkGraph this_ptr);
7722 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr);
7724 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_ptr);
7727 * Creates a new tracker of the actual state of the network of channels and nodes,
7728 * assuming a fresh network graph.
7729 * Chain monitor is used to make sure announced channels exist on-chain,
7730 * channel data is correct, and that the announcement is signed with
7731 * channel owners' keys.
7733 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
7736 * Creates a new tracker of the actual state of the network of channels and nodes,
7737 * assuming an existing Network Graph.
7739 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
7742 * Take a read lock on the network_graph and return it in the C-bindings
7743 * newtype helper. This is likely only useful when called via the C
7744 * bindings as you can call `self.network_graph.read().unwrap()` in Rust
7747 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7750 * Get a reference to the NetworkGraph which this read-lock contains.
7752 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
7754 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7756 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7758 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_ptr);
7761 * When the last update to the channel direction was issued.
7762 * Value is opaque, as set in the announcement.
7764 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7767 * When the last update to the channel direction was issued.
7768 * Value is opaque, as set in the announcement.
7770 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
7773 * Whether the channel can be currently used for payments (in this one direction).
7775 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7778 * Whether the channel can be currently used for payments (in this one direction).
7780 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
7783 * The difference in CLTV values that you must have when routing through this channel.
7785 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7788 * The difference in CLTV values that you must have when routing through this channel.
7790 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
7793 * The minimum value, which must be relayed to the next hop via the channel
7795 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7798 * The minimum value, which must be relayed to the next hop via the channel
7800 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
7803 * Fees charged when the channel is used for routing
7805 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7808 * Fees charged when the channel is used for routing
7810 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
7813 * Most recent update for the channel received from the network
7814 * Mostly redundant with the data we store in fields explicitly.
7815 * Everything else is useful only for sending out for initial routing sync.
7816 * Not stored if contains excess data to prevent DoS.
7818 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7821 * Most recent update for the channel received from the network
7822 * Mostly redundant with the data we store in fields explicitly.
7823 * Everything else is useful only for sending out for initial routing sync.
7824 * Not stored if contains excess data to prevent DoS.
7826 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
7828 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
7830 struct LDKDirectionalChannelInfo DirectionalChannelInfo_read(struct LDKu8slice ser);
7832 void ChannelInfo_free(struct LDKChannelInfo this_ptr);
7835 * Protocol features of a channel communicated during its announcement
7837 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7840 * Protocol features of a channel communicated during its announcement
7842 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
7845 * Source node of the first direction of a channel
7847 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7850 * Source node of the first direction of a channel
7852 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7855 * Details about the first direction of a channel
7857 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7860 * Details about the first direction of a channel
7862 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
7865 * Source node of the second direction of a channel
7867 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7870 * Source node of the second direction of a channel
7872 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7875 * Details about the second direction of a channel
7877 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7880 * Details about the second direction of a channel
7882 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
7885 * An initial announcement of the channel
7886 * Mostly redundant with the data we store in fields explicitly.
7887 * Everything else is useful only for sending out for initial routing sync.
7888 * Not stored if contains excess data to prevent DoS.
7890 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7893 * An initial announcement of the channel
7894 * Mostly redundant with the data we store in fields explicitly.
7895 * Everything else is useful only for sending out for initial routing sync.
7896 * Not stored if contains excess data to prevent DoS.
7898 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
7900 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
7902 struct LDKChannelInfo ChannelInfo_read(struct LDKu8slice ser);
7904 void RoutingFees_free(struct LDKRoutingFees this_ptr);
7906 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
7909 * Flat routing fee in satoshis
7911 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
7914 * Flat routing fee in satoshis
7916 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
7919 * Liquidity-based routing fee in millionths of a routed amount.
7920 * In other words, 10000 is 1%.
7922 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
7925 * Liquidity-based routing fee in millionths of a routed amount.
7926 * In other words, 10000 is 1%.
7928 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
7930 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
7932 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
7934 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
7936 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_ptr);
7939 * Protocol features the node announced support for
7941 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
7944 * Protocol features the node announced support for
7946 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
7949 * When the last known update to the node state was issued.
7950 * Value is opaque, as set in the announcement.
7952 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
7955 * When the last known update to the node state was issued.
7956 * Value is opaque, as set in the announcement.
7958 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
7961 * Color assigned to the node
7963 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
7966 * Color assigned to the node
7968 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
7971 * Moniker assigned to the node.
7972 * May be invalid or malicious (eg control chars),
7973 * should not be exposed to the user.
7975 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
7978 * Moniker assigned to the node.
7979 * May be invalid or malicious (eg control chars),
7980 * should not be exposed to the user.
7982 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7985 * Internet-level addresses via which one can connect to the node
7987 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
7990 * An initial announcement of the node
7991 * Mostly redundant with the data we store in fields explicitly.
7992 * Everything else is useful only for sending out for initial routing sync.
7993 * Not stored if contains excess data to prevent DoS.
7995 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
7998 * An initial announcement of the node
7999 * Mostly redundant with the data we store in fields explicitly.
8000 * Everything else is useful only for sending out for initial routing sync.
8001 * Not stored if contains excess data to prevent DoS.
8003 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
8005 MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg);
8007 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
8009 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
8011 void NodeInfo_free(struct LDKNodeInfo this_ptr);
8014 * All valid channels a node has announced
8016 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
8019 * Lowest fees enabling routing via any of the enabled, known channels to a node.
8020 * The two fields (flat and proportional fee) are independent,
8021 * meaning they don't have to refer to the same channel.
8023 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
8026 * Lowest fees enabling routing via any of the enabled, known channels to a node.
8027 * The two fields (flat and proportional fee) are independent,
8028 * meaning they don't have to refer to the same channel.
8030 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
8033 * More information about a node from node_announcement.
8034 * Optional because we store a Node entry after learning about it from
8035 * a channel announcement, but before receiving a node announcement.
8037 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
8040 * More information about a node from node_announcement.
8041 * Optional because we store a Node entry after learning about it from
8042 * a channel announcement, but before receiving a node announcement.
8044 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
8046 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
8048 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
8050 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
8052 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
8054 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
8057 * Creates a new, empty, network graph.
8059 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
8062 * For an already known node (from channel announcements), update its stored properties from a
8063 * given node announcement.
8065 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8066 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8067 * routing messages from a source using a protocol other than the lightning P2P protocol.
8069 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8072 * For an already known node (from channel announcements), update its stored properties from a
8073 * given node announcement without verifying the associated signatures. Because we aren't
8074 * given the associated signatures here we cannot relay the node announcement to any of our
8077 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
8080 * Store or update channel info from a channel announcement.
8082 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8083 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8084 * routing messages from a source using a protocol other than the lightning P2P protocol.
8086 * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
8087 * the corresponding UTXO exists on chain and is correctly-formatted.
8089 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
8092 * Store or update channel info from a channel announcement without verifying the associated
8093 * signatures. Because we aren't given the associated signatures here we cannot relay the
8094 * channel announcement to any of our peers.
8096 * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
8097 * the corresponding UTXO exists on chain and is correctly-formatted.
8099 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
8102 * Close a channel if a corresponding HTLC fail was sent.
8103 * If permanent, removes a channel from the local storage.
8104 * May cause the removal of nodes too, if this was their last channel.
8105 * If not permanent, makes channels unavailable for routing.
8107 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
8110 * For an already known (from announcement) channel, update info about one of the directions
8113 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8114 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8115 * routing messages from a source using a protocol other than the lightning P2P protocol.
8117 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8120 * For an already known (from announcement) channel, update info about one of the directions
8121 * of the channel without verifying the associated signatures. Because we aren't given the
8122 * associated signatures here we cannot relay the channel update to any of our peers.
8124 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
8126 /* Text to put at the end of the generated file */