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 LDKC2Tuple_u64u64Z {
247 } LDKC2Tuple_u64u64Z;
250 * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
251 * claim at any point in the future) an event is generated which you must track and be able to
252 * spend on-chain. The information needed to do this is provided in this enum, including the
253 * outpoint describing which txid and output index is available, the full output which exists at
254 * that txid/index, and any keys or other information required to sign.
256 typedef enum LDKSpendableOutputDescriptor_Tag {
258 * An output to a script which was provided via KeysInterface, thus you should already know
259 * how to spend it. No keys are provided as rust-lightning was never given any keys - only the
260 * script_pubkey as it appears in the output.
261 * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
262 * on-chain using the payment preimage or after it has timed out.
264 LDKSpendableOutputDescriptor_StaticOutput,
266 * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
268 * The witness in the spending input should be:
269 * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
271 * Note that the nSequence field in the spending input must be set to to_self_delay
272 * (which means the transaction is not broadcastable until at least to_self_delay
273 * blocks after the outpoint confirms).
275 * These are generally the result of a \"revocable\" output to us, spendable only by us unless
276 * it is an output from an old state which we broadcast (which should never happen).
278 * To derive the delayed_payment key which is used to sign for this input, you must pass the
279 * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
280 * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
281 * chan_utils::derive_private_key. The public key can be generated without the secret key
282 * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
283 * ChannelKeys::pubkeys().
285 * To derive the revocation_pubkey provided here (which is used in the witness
286 * script generation), you must pass the counterparty revocation_basepoint (which appears in the
287 * call to ChannelKeys::ready_channel) and the provided per_commitment point
288 * to chan_utils::derive_public_revocation_key.
290 * The witness script which is hashed and included in the output script_pubkey may be
291 * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
292 * (derived as above), and the to_self_delay contained here to
293 * chan_utils::get_revokeable_redeemscript.
295 LDKSpendableOutputDescriptor_DynamicOutputP2WSH,
297 * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
298 * corresponds to the public key in ChannelKeys::pubkeys().payment_point).
299 * The witness in the spending input, is, thus, simply:
300 * <BIP 143 signature> <payment key>
302 * These are generally the result of our counterparty having broadcast the current state,
303 * allowing us to claim the non-HTLC-encumbered outputs immediately.
305 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment,
307 * Must be last for serialization purposes
309 LDKSpendableOutputDescriptor_Sentinel,
310 } LDKSpendableOutputDescriptor_Tag;
312 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
313 struct LDKOutPoint outpoint;
314 struct LDKTxOut output;
315 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
317 typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body {
318 struct LDKOutPoint outpoint;
319 struct LDKPublicKey per_commitment_point;
320 uint16_t to_self_delay;
321 struct LDKTxOut output;
322 struct LDKC2Tuple_u64u64Z key_derivation_params;
323 struct LDKPublicKey revocation_pubkey;
324 } LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
326 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
327 struct LDKOutPoint outpoint;
328 struct LDKTxOut output;
329 struct LDKC2Tuple_u64u64Z key_derivation_params;
330 } LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body;
332 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
333 LDKSpendableOutputDescriptor_Tag tag;
335 LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
336 LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh;
337 LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment;
339 } LDKSpendableOutputDescriptor;
341 typedef struct LDKCVec_SpendableOutputDescriptorZ {
342 struct LDKSpendableOutputDescriptor *data;
344 } LDKCVec_SpendableOutputDescriptorZ;
349 * An accept_channel message to be sent or received from a peer
351 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
353 * Nearly everywhere, inner must be non-null, however in places where
354 * the Rust equivalent takes an Option, it may be set to null to indicate None.
356 LDKnativeAcceptChannel *inner;
363 * An open_channel message to be sent or received from a peer
365 typedef struct MUST_USE_STRUCT LDKOpenChannel {
367 * Nearly everywhere, inner must be non-null, however in places where
368 * the Rust equivalent takes an Option, it may be set to null to indicate None.
370 LDKnativeOpenChannel *inner;
377 * A funding_created message to be sent or received from a peer
379 typedef struct MUST_USE_STRUCT LDKFundingCreated {
381 * Nearly everywhere, inner must be non-null, however in places where
382 * the Rust equivalent takes an Option, it may be set to null to indicate None.
384 LDKnativeFundingCreated *inner;
391 * A funding_signed message to be sent or received from a peer
393 typedef struct MUST_USE_STRUCT LDKFundingSigned {
395 * Nearly everywhere, inner must be non-null, however in places where
396 * the Rust equivalent takes an Option, it may be set to null to indicate None.
398 LDKnativeFundingSigned *inner;
405 * A funding_locked message to be sent or received from a peer
407 typedef struct MUST_USE_STRUCT LDKFundingLocked {
409 * Nearly everywhere, inner must be non-null, however in places where
410 * the Rust equivalent takes an Option, it may be set to null to indicate None.
412 LDKnativeFundingLocked *inner;
419 * An announcement_signatures message to be sent or received from a peer
421 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
423 * Nearly everywhere, inner must be non-null, however in places where
424 * the Rust equivalent takes an Option, it may be set to null to indicate None.
426 LDKnativeAnnouncementSignatures *inner;
428 } LDKAnnouncementSignatures;
433 * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
434 * transaction updates if they were pending.
436 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
438 * Nearly everywhere, inner must be non-null, however in places where
439 * the Rust equivalent takes an Option, it may be set to null to indicate None.
441 LDKnativeCommitmentUpdate *inner;
443 } LDKCommitmentUpdate;
448 * A revoke_and_ack message to be sent or received from a peer
450 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
452 * Nearly everywhere, inner must be non-null, however in places where
453 * the Rust equivalent takes an Option, it may be set to null to indicate None.
455 LDKnativeRevokeAndACK *inner;
462 * A closing_signed message to be sent or received from a peer
464 typedef struct MUST_USE_STRUCT LDKClosingSigned {
466 * Nearly everywhere, inner must be non-null, however in places where
467 * the Rust equivalent takes an Option, it may be set to null to indicate None.
469 LDKnativeClosingSigned *inner;
476 * A shutdown message to be sent or received from a peer
478 typedef struct MUST_USE_STRUCT LDKShutdown {
480 * Nearly everywhere, inner must be non-null, however in places where
481 * the Rust equivalent takes an Option, it may be set to null to indicate None.
483 LDKnativeShutdown *inner;
490 * A channel_reestablish message to be sent or received from a peer
492 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
494 * Nearly everywhere, inner must be non-null, however in places where
495 * the Rust equivalent takes an Option, it may be set to null to indicate None.
497 LDKnativeChannelReestablish *inner;
499 } LDKChannelReestablish;
504 * A channel_announcement message to be sent or received from a peer
506 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
508 * Nearly everywhere, inner must be non-null, however in places where
509 * the Rust equivalent takes an Option, it may be set to null to indicate None.
511 LDKnativeChannelAnnouncement *inner;
513 } LDKChannelAnnouncement;
518 * A channel_update message to be sent or received from a peer
520 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
522 * Nearly everywhere, inner must be non-null, however in places where
523 * the Rust equivalent takes an Option, it may be set to null to indicate None.
525 LDKnativeChannelUpdate *inner;
532 * A node_announcement message to be sent or received from a peer
534 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
536 * Nearly everywhere, inner must be non-null, however in places where
537 * the Rust equivalent takes an Option, it may be set to null to indicate None.
539 LDKnativeNodeAnnouncement *inner;
541 } LDKNodeAnnouncement;
546 * An error message to be sent or received from a peer
548 typedef struct MUST_USE_STRUCT LDKErrorMessage {
550 * Nearly everywhere, inner must be non-null, however in places where
551 * the Rust equivalent takes an Option, it may be set to null to indicate None.
553 LDKnativeErrorMessage *inner;
558 * Used to put an error message in a LightningError
560 typedef enum LDKErrorAction_Tag {
562 * The peer took some action which made us think they were useless. Disconnect them.
564 LDKErrorAction_DisconnectPeer,
566 * The peer did something harmless that we weren't able to process, just log and ignore
568 LDKErrorAction_IgnoreError,
570 * The peer did something incorrect. Tell them.
572 LDKErrorAction_SendErrorMessage,
574 * Must be last for serialization purposes
576 LDKErrorAction_Sentinel,
577 } LDKErrorAction_Tag;
579 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
580 struct LDKErrorMessage msg;
581 } LDKErrorAction_LDKDisconnectPeer_Body;
583 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
584 struct LDKErrorMessage msg;
585 } LDKErrorAction_LDKSendErrorMessage_Body;
587 typedef struct MUST_USE_STRUCT LDKErrorAction {
588 LDKErrorAction_Tag tag;
590 LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
591 LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
596 * The information we received from a peer along the route of a payment we originated. This is
597 * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
598 * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
600 typedef enum LDKHTLCFailChannelUpdate_Tag {
602 * We received an error which included a full ChannelUpdate message.
604 LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
606 * We received an error which indicated only that a channel has been closed
608 LDKHTLCFailChannelUpdate_ChannelClosed,
610 * We received an error which indicated only that a node has failed
612 LDKHTLCFailChannelUpdate_NodeFailure,
614 * Must be last for serialization purposes
616 LDKHTLCFailChannelUpdate_Sentinel,
617 } LDKHTLCFailChannelUpdate_Tag;
619 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
620 struct LDKChannelUpdate msg;
621 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
623 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
624 uint64_t short_channel_id;
626 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
628 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
629 struct LDKPublicKey node_id;
631 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
633 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
634 LDKHTLCFailChannelUpdate_Tag tag;
636 LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
637 LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
638 LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
640 } LDKHTLCFailChannelUpdate;
645 * A query_channel_range message is used to query a peer for channel
646 * UTXOs in a range of blocks. The recipient of a query makes a best
647 * effort to reply to the query using one or more reply_channel_range
650 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
652 * Nearly everywhere, inner must be non-null, however in places where
653 * the Rust equivalent takes an Option, it may be set to null to indicate None.
655 LDKnativeQueryChannelRange *inner;
657 } LDKQueryChannelRange;
662 * A query_short_channel_ids message is used to query a peer for
663 * routing gossip messages related to one or more short_channel_ids.
664 * The query recipient will reply with the latest, if available,
665 * channel_announcement, channel_update and node_announcement messages
666 * it maintains for the requested short_channel_ids followed by a
667 * reply_short_channel_ids_end message. The short_channel_ids sent in
668 * this query are encoded. We only support encoding_type=0 uncompressed
669 * serialization and do not support encoding_type=1 zlib serialization.
671 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
673 * Nearly everywhere, inner must be non-null, however in places where
674 * the Rust equivalent takes an Option, it may be set to null to indicate None.
676 LDKnativeQueryShortChannelIds *inner;
678 } LDKQueryShortChannelIds;
681 * An event generated by ChannelManager which indicates a message should be sent to a peer (or
682 * broadcast to most peers).
683 * These events are handled by PeerManager::process_events if you are using a PeerManager.
685 typedef enum LDKMessageSendEvent_Tag {
687 * Used to indicate that we've accepted a channel open and should send the accept_channel
688 * message provided to the given peer.
690 LDKMessageSendEvent_SendAcceptChannel,
692 * Used to indicate that we've initiated a channel open and should send the open_channel
693 * message provided to the given peer.
695 LDKMessageSendEvent_SendOpenChannel,
697 * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
699 LDKMessageSendEvent_SendFundingCreated,
701 * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
703 LDKMessageSendEvent_SendFundingSigned,
705 * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
707 LDKMessageSendEvent_SendFundingLocked,
709 * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
711 LDKMessageSendEvent_SendAnnouncementSignatures,
713 * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
714 * message should be sent to the peer with the given node_id.
716 LDKMessageSendEvent_UpdateHTLCs,
718 * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
720 LDKMessageSendEvent_SendRevokeAndACK,
722 * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
724 LDKMessageSendEvent_SendClosingSigned,
726 * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
728 LDKMessageSendEvent_SendShutdown,
730 * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
732 LDKMessageSendEvent_SendChannelReestablish,
734 * Used to indicate that a channel_announcement and channel_update should be broadcast to all
735 * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
737 * Note that after doing so, you very likely (unless you did so very recently) want to call
738 * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
739 * This ensures that any nodes which see our channel_announcement also have a relevant
740 * node_announcement, including relevant feature flags which may be important for routing
743 LDKMessageSendEvent_BroadcastChannelAnnouncement,
745 * Used to indicate that a node_announcement should be broadcast to all peers.
747 LDKMessageSendEvent_BroadcastNodeAnnouncement,
749 * Used to indicate that a channel_update should be broadcast to all peers.
751 LDKMessageSendEvent_BroadcastChannelUpdate,
753 * Broadcast an error downstream to be handled
755 LDKMessageSendEvent_HandleError,
757 * When a payment fails we may receive updates back from the hop where it failed. In such
758 * cases this event is generated so that we can inform the network graph of this information.
760 LDKMessageSendEvent_PaymentFailureNetworkUpdate,
762 * Query a peer for channels with funding transaction UTXOs in a block range.
764 LDKMessageSendEvent_SendChannelRangeQuery,
766 * Request routing gossip messages from a peer for a list of channels identified by
767 * their short_channel_ids.
769 LDKMessageSendEvent_SendShortIdsQuery,
771 * Must be last for serialization purposes
773 LDKMessageSendEvent_Sentinel,
774 } LDKMessageSendEvent_Tag;
776 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
777 struct LDKPublicKey node_id;
778 struct LDKAcceptChannel msg;
779 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
781 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
782 struct LDKPublicKey node_id;
783 struct LDKOpenChannel msg;
784 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
786 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
787 struct LDKPublicKey node_id;
788 struct LDKFundingCreated msg;
789 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
791 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
792 struct LDKPublicKey node_id;
793 struct LDKFundingSigned msg;
794 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
796 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
797 struct LDKPublicKey node_id;
798 struct LDKFundingLocked msg;
799 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
801 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
802 struct LDKPublicKey node_id;
803 struct LDKAnnouncementSignatures msg;
804 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
806 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
807 struct LDKPublicKey node_id;
808 struct LDKCommitmentUpdate updates;
809 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
811 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
812 struct LDKPublicKey node_id;
813 struct LDKRevokeAndACK msg;
814 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
816 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
817 struct LDKPublicKey node_id;
818 struct LDKClosingSigned msg;
819 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
821 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
822 struct LDKPublicKey node_id;
823 struct LDKShutdown msg;
824 } LDKMessageSendEvent_LDKSendShutdown_Body;
826 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
827 struct LDKPublicKey node_id;
828 struct LDKChannelReestablish msg;
829 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
831 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
832 struct LDKChannelAnnouncement msg;
833 struct LDKChannelUpdate update_msg;
834 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
836 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
837 struct LDKNodeAnnouncement msg;
838 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
840 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
841 struct LDKChannelUpdate msg;
842 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
844 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
845 struct LDKPublicKey node_id;
846 struct LDKErrorAction action;
847 } LDKMessageSendEvent_LDKHandleError_Body;
849 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
850 struct LDKHTLCFailChannelUpdate update;
851 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
853 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
854 struct LDKPublicKey node_id;
855 struct LDKQueryChannelRange msg;
856 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
858 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
859 struct LDKPublicKey node_id;
860 struct LDKQueryShortChannelIds msg;
861 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
863 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
864 LDKMessageSendEvent_Tag tag;
866 LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
867 LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
868 LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
869 LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
870 LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
871 LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
872 LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
873 LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
874 LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
875 LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
876 LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
877 LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
878 LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
879 LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
880 LDKMessageSendEvent_LDKHandleError_Body handle_error;
881 LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
882 LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
883 LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
885 } LDKMessageSendEvent;
887 typedef struct LDKCVec_MessageSendEventZ {
888 struct LDKMessageSendEvent *data;
890 } LDKCVec_MessageSendEventZ;
893 * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
894 * look up the corresponding function in rust-lightning's docs.
896 typedef struct LDKThirtyTwoBytes {
901 * An Event which you should probably take some action in response to.
903 * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
904 * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
905 * written as it makes no sense to respond to it after reconnecting to peers).
907 typedef enum LDKEvent_Tag {
909 * Used to indicate that the client should generate a funding transaction with the given
910 * parameters and then call ChannelManager::funding_transaction_generated.
911 * Generated in ChannelManager message handling.
912 * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
913 * counterparty can steal your funds!
915 LDKEvent_FundingGenerationReady,
917 * Used to indicate that the client may now broadcast the funding transaction it created for a
918 * channel. Broadcasting such a transaction prior to this event may lead to our counterparty
919 * trivially stealing all funds in the funding transaction!
921 LDKEvent_FundingBroadcastSafe,
923 * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
924 * ChannelManager::claim_funds to get it....
925 * Note that if the preimage is not known or the amount paid is incorrect, you should call
926 * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
927 * network congestion.
928 * The amount paid should be considered 'incorrect' when it is less than or more than twice
929 * the amount expected.
930 * If you fail to call either ChannelManager::claim_funds or
931 * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
932 * automatically failed.
934 LDKEvent_PaymentReceived,
936 * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
937 * and we got back the payment preimage for it).
938 * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
939 * deduplicate them by payment_preimage (which MUST be unique)!
941 LDKEvent_PaymentSent,
943 * Indicates an outbound payment we made failed. Probably some intermediary node dropped
944 * something. You may wish to retry with a different route.
945 * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
946 * deduplicate them by payment_hash (which MUST be unique)!
948 LDKEvent_PaymentFailed,
950 * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
951 * time in the future.
953 LDKEvent_PendingHTLCsForwardable,
955 * Used to indicate that an output was generated on-chain which you should know how to spend.
956 * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
957 * counterparty spending them due to some kind of timeout. Thus, you need to store them
958 * somewhere and spend them when you create on-chain transactions.
960 LDKEvent_SpendableOutputs,
962 * Must be last for serialization purposes
967 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
968 struct LDKThirtyTwoBytes temporary_channel_id;
969 uint64_t channel_value_satoshis;
970 struct LDKCVec_u8Z output_script;
971 uint64_t user_channel_id;
972 } LDKEvent_LDKFundingGenerationReady_Body;
974 typedef struct LDKEvent_LDKFundingBroadcastSafe_Body {
975 struct LDKOutPoint funding_txo;
976 uint64_t user_channel_id;
977 } LDKEvent_LDKFundingBroadcastSafe_Body;
979 typedef struct LDKEvent_LDKPaymentReceived_Body {
980 struct LDKThirtyTwoBytes payment_hash;
981 struct LDKThirtyTwoBytes payment_secret;
983 } LDKEvent_LDKPaymentReceived_Body;
985 typedef struct LDKEvent_LDKPaymentSent_Body {
986 struct LDKThirtyTwoBytes payment_preimage;
987 } LDKEvent_LDKPaymentSent_Body;
989 typedef struct LDKEvent_LDKPaymentFailed_Body {
990 struct LDKThirtyTwoBytes payment_hash;
991 bool rejected_by_dest;
992 } LDKEvent_LDKPaymentFailed_Body;
994 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
995 uint64_t time_forwardable;
996 } LDKEvent_LDKPendingHTLCsForwardable_Body;
998 typedef struct LDKEvent_LDKSpendableOutputs_Body {
999 struct LDKCVec_SpendableOutputDescriptorZ outputs;
1000 } LDKEvent_LDKSpendableOutputs_Body;
1002 typedef struct MUST_USE_STRUCT LDKEvent {
1005 LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
1006 LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe;
1007 LDKEvent_LDKPaymentReceived_Body payment_received;
1008 LDKEvent_LDKPaymentSent_Body payment_sent;
1009 LDKEvent_LDKPaymentFailed_Body payment_failed;
1010 LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
1011 LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
1015 typedef struct LDKCVec_EventZ {
1016 struct LDKEvent *data;
1020 typedef struct LDKC2Tuple_usizeTransactionZ {
1022 struct LDKTransaction b;
1023 } LDKC2Tuple_usizeTransactionZ;
1025 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
1026 struct LDKC2Tuple_usizeTransactionZ *data;
1028 } LDKCVec_C2Tuple_usizeTransactionZZ;
1030 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
1032 * Note that this value is always NULL, as there are no contents in the OK variant
1035 enum LDKChannelMonitorUpdateErr *err;
1036 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
1038 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
1039 union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
1041 } LDKCResult_NoneChannelMonitorUpdateErrZ;
1046 * An event to be processed by the ChannelManager.
1048 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1050 * Nearly everywhere, inner must be non-null, however in places where
1051 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1053 LDKnativeMonitorEvent *inner;
1057 typedef struct LDKCVec_MonitorEventZ {
1058 struct LDKMonitorEvent *data;
1060 } LDKCVec_MonitorEventZ;
1065 * An update generated by the underlying Channel itself which contains some new information the
1066 * ChannelMonitor should be made aware of.
1068 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1070 * Nearly everywhere, inner must be non-null, however in places where
1071 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1073 LDKnativeChannelMonitorUpdate *inner;
1075 } LDKChannelMonitorUpdate;
1080 * An error in decoding a message or struct.
1082 typedef struct MUST_USE_STRUCT LDKDecodeError {
1084 * Nearly everywhere, inner must be non-null, however in places where
1085 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1087 LDKnativeDecodeError *inner;
1091 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
1092 struct LDKChannelMonitorUpdate *result;
1093 struct LDKDecodeError *err;
1094 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
1096 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
1097 union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
1099 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
1104 * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
1105 * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
1106 * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
1108 * Contains a developer-readable error message.
1110 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
1112 * Nearly everywhere, inner must be non-null, however in places where
1113 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1115 LDKnativeMonitorUpdateError *inner;
1117 } LDKMonitorUpdateError;
1119 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
1121 * Note that this value is always NULL, as there are no contents in the OK variant
1124 struct LDKMonitorUpdateError *err;
1125 } LDKCResult_NoneMonitorUpdateErrorZPtr;
1127 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
1128 union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
1130 } LDKCResult_NoneMonitorUpdateErrorZ;
1132 typedef struct LDKC2Tuple_OutPointScriptZ {
1133 struct LDKOutPoint a;
1134 struct LDKCVec_u8Z b;
1135 } LDKC2Tuple_OutPointScriptZ;
1137 typedef struct LDKCVec_TransactionZ {
1138 struct LDKTransaction *data;
1140 } LDKCVec_TransactionZ;
1142 typedef struct LDKC2Tuple_u32TxOutZ {
1145 } LDKC2Tuple_u32TxOutZ;
1147 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
1148 struct LDKC2Tuple_u32TxOutZ *data;
1150 } LDKCVec_C2Tuple_u32TxOutZZ;
1152 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
1153 struct LDKThirtyTwoBytes a;
1154 struct LDKCVec_C2Tuple_u32TxOutZZ b;
1155 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
1157 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
1158 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
1160 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ;
1165 * One counterparty's public keys which do not change over the life of a channel.
1167 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
1169 * Nearly everywhere, inner must be non-null, however in places where
1170 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1172 LDKnativeChannelPublicKeys *inner;
1174 } LDKChannelPublicKeys;
1176 typedef struct LDKSignature {
1177 uint8_t compact_form[64];
1180 typedef struct LDKCVec_SignatureZ {
1181 struct LDKSignature *data;
1183 } LDKCVec_SignatureZ;
1185 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
1186 struct LDKSignature a;
1187 struct LDKCVec_SignatureZ b;
1188 } LDKC2Tuple_SignatureCVec_SignatureZZ;
1190 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1191 struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
1193 * Note that this value is always NULL, as there are no contents in the Err variant
1196 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
1198 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1199 union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
1201 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
1206 * This class tracks the per-transaction information needed to build a commitment transaction and to
1207 * actually build it and sign. It is used for holder transactions that we sign only when needed
1208 * and for transactions we sign for the counterparty.
1210 * This class can be used inside a signer implementation to generate a signature given the relevant
1213 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1215 * Nearly everywhere, inner must be non-null, however in places where
1216 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1218 LDKnativeCommitmentTransaction *inner;
1220 } LDKCommitmentTransaction;
1222 typedef union LDKCResult_SignatureNoneZPtr {
1223 struct LDKSignature *result;
1225 * Note that this value is always NULL, as there are no contents in the Err variant
1228 } LDKCResult_SignatureNoneZPtr;
1230 typedef struct LDKCResult_SignatureNoneZ {
1231 union LDKCResult_SignatureNoneZPtr contents;
1233 } LDKCResult_SignatureNoneZ;
1238 * Information needed to build and sign a holder's commitment transaction.
1240 * The transaction is only signed once we are ready to broadcast.
1242 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1244 * Nearly everywhere, inner must be non-null, however in places where
1245 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1247 LDKnativeHolderCommitmentTransaction *inner;
1249 } LDKHolderCommitmentTransaction;
1251 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1252 struct LDKCVec_SignatureZ *result;
1254 * Note that this value is always NULL, as there are no contents in the Err variant
1257 } LDKCResult_CVec_SignatureZNoneZPtr;
1259 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1260 union LDKCResult_CVec_SignatureZNoneZPtr contents;
1262 } LDKCResult_CVec_SignatureZNoneZ;
1267 * Information about an HTLC as it appears in a commitment transaction
1269 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
1271 * Nearly everywhere, inner must be non-null, however in places where
1272 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1274 LDKnativeHTLCOutputInCommitment *inner;
1276 } LDKHTLCOutputInCommitment;
1281 * The unsigned part of a channel_announcement
1283 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
1285 * Nearly everywhere, inner must be non-null, however in places where
1286 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1288 LDKnativeUnsignedChannelAnnouncement *inner;
1290 } LDKUnsignedChannelAnnouncement;
1295 * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
1296 * The fields are organized by holder/counterparty.
1298 * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
1299 * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
1301 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
1303 * Nearly everywhere, inner must be non-null, however in places where
1304 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1306 LDKnativeChannelTransactionParameters *inner;
1308 } LDKChannelTransactionParameters;
1311 * Set of lightning keys needed to operate a channel as described in BOLT 3.
1313 * Signing services could be implemented on a hardware wallet. In this case,
1314 * the current ChannelKeys would be a front-end on top of a communication
1315 * channel connected to your secure device and lightning key material wouldn't
1316 * reside on a hot server. Nevertheless, a this deployment would still need
1317 * to trust the ChannelManager to avoid loss of funds as this latest component
1318 * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
1320 * A more secure iteration would be to use hashlock (or payment points) to pair
1321 * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
1322 * at the price of more state and computation on the hardware wallet side. In the future,
1323 * we are looking forward to design such interface.
1325 * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
1326 * to act, as liveness and breach reply correctness are always going to be hard requirements
1327 * of LN security model, orthogonal of key management issues.
1329 * If you're implementing a custom signer, you almost certainly want to implement
1330 * Readable/Writable to serialize out a unique reference to this set of keys so
1331 * that you can serialize the full ChannelManager object.
1334 typedef struct LDKChannelKeys {
1337 * Gets the per-commitment point for a specific commitment number
1339 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1341 struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
1343 * Gets the commitment secret for a specific commitment number as part of the revocation process
1345 * An external signer implementation should error here if the commitment was already signed
1346 * and should refuse to sign it in the future.
1348 * May be called more than once for the same index.
1350 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1351 * TODO: return a Result so we can signal a validation error
1353 struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
1355 * Gets the holder's channel public keys and basepoints
1357 struct LDKChannelPublicKeys pubkeys;
1359 * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
1360 * Note that this takes a pointer to this object, not the this_ptr like other methods do
1361 * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
1363 void (*set_pubkeys)(const struct LDKChannelKeys*NONNULL_PTR );
1365 * Gets arbitrary identifiers describing the set of keys which are provided back to you in
1366 * some SpendableOutputDescriptor types. These should be sufficient to identify this
1367 * ChannelKeys object uniquely and lookup or re-derive its keys.
1369 struct LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg);
1371 * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
1373 * Note that if signing fails or is rejected, the channel will be force-closed.
1375 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
1377 * Create a signature for a holder's commitment transaction. This will only ever be called with
1378 * the same commitment_tx (or a copy thereof), though there are currently no guarantees
1379 * that it will not be called multiple times.
1380 * An external signer implementation should check that the commitment has not been revoked.
1382 struct LDKCResult_SignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
1384 * Create a signature for each HTLC transaction spending a holder's commitment transaction.
1386 * Unlike sign_holder_commitment, this may be called multiple times with *different*
1387 * commitment_tx values. While this will never be called with a revoked
1388 * commitment_tx, it is possible that it is called with the second-latest
1389 * commitment_tx (only if we haven't yet revoked it) if some watchtower/secondary
1390 * ChannelMonitor decided to broadcast before it had been updated to the latest.
1392 * Either an Err should be returned, or a Vec with one entry for each HTLC which exists in
1395 struct LDKCResult_CVec_SignatureZNoneZ (*sign_holder_commitment_htlc_transactions)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
1397 * Create a signature for the given input in a transaction spending an HTLC or commitment
1398 * transaction output when our counterparty broadcasts an old state.
1400 * A justice transaction may claim multiples outputs at the same time if timelocks are
1401 * similar, but only a signature for the input at index `input` should be signed for here.
1402 * It may be called multiples time for same output(s) if a fee-bump is needed with regards
1403 * to an upcoming timelock expiration.
1405 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1407 * per_commitment_key is revocation secret which was provided by our counterparty when they
1408 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
1409 * not allow the spending of any funds by itself (you need our holder revocation_secret to do
1412 * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
1413 * changing the format of the witness script (which is committed to in the BIP 143
1416 struct LDKCResult_SignatureNoneZ (*sign_justice_transaction)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
1418 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
1419 * transaction, either offered or received.
1421 * Such a transaction may claim multiples offered outputs at same time if we know the
1422 * preimage for each when we create it, but only the input at index `input` should be
1423 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
1424 * needed with regards to an upcoming timelock expiration.
1426 * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
1429 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1431 * Per_commitment_point is the dynamic point corresponding to the channel state
1432 * detected onchain. It has been generated by our counterparty and is used to derive
1433 * channel state keys, which are then included in the witness script and committed to in the
1434 * BIP 143 signature.
1436 struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
1438 * Create a signature for a (proposed) closing transaction.
1440 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
1441 * chosen to forgo their output as dust.
1443 struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
1445 * Signs a channel announcement message with our funding key, proving it comes from one
1446 * of the channel participants.
1448 * Note that if this fails or is rejected, the channel will not be publicly announced and
1449 * our counterparty may (though likely will not) close the channel on us for violating the
1452 struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
1454 * Set the counterparty static channel data, including basepoints,
1455 * counterparty_selected/holder_selected_contest_delay and funding outpoint.
1456 * This is done as soon as the funding outpoint is known. Since these are static channel data,
1457 * they MUST NOT be allowed to change to different values once set.
1459 * channel_parameters.is_populated() MUST be true.
1461 * We bind holder_selected_contest_delay late here for API convenience.
1463 * Will be called before any signatures are applied.
1465 void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
1466 void *(*clone)(const void *this_arg);
1467 struct LDKCVec_u8Z (*write)(const void *this_arg);
1468 void (*free)(void *this_arg);
1474 * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
1475 * on-chain transactions to ensure no loss of funds occurs.
1477 * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
1478 * information and are actively monitoring the chain.
1480 * Pending Events or updated HTLCs which have not yet been read out by
1481 * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
1482 * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
1483 * gotten are fully handled before re-serializing the new state.
1485 * Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which
1486 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
1487 * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
1488 * returned block hash and the the current chain and then reconnecting blocks to get to the
1489 * best chain) upon deserializing the object!
1491 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
1493 * Nearly everywhere, inner must be non-null, however in places where
1494 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1496 LDKnativeChannelMonitor *inner;
1498 } LDKChannelMonitor;
1500 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
1501 struct LDKThirtyTwoBytes a;
1502 struct LDKChannelMonitor b;
1503 } LDKC2Tuple_BlockHashChannelMonitorZ;
1505 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
1506 struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
1507 struct LDKDecodeError *err;
1508 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
1510 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
1511 union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
1513 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
1515 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
1516 struct LDKSpendableOutputDescriptor *result;
1517 struct LDKDecodeError *err;
1518 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
1520 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
1521 union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
1523 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
1525 typedef union LDKCResult_ChanKeySignerDecodeErrorZPtr {
1526 struct LDKChannelKeys *result;
1527 struct LDKDecodeError *err;
1528 } LDKCResult_ChanKeySignerDecodeErrorZPtr;
1530 typedef struct LDKCResult_ChanKeySignerDecodeErrorZ {
1531 union LDKCResult_ChanKeySignerDecodeErrorZPtr contents;
1533 } LDKCResult_ChanKeySignerDecodeErrorZ;
1538 * A simple implementation of ChannelKeys that just keeps the private keys in memory.
1540 * This implementation performs no policy checks and is insufficient by itself as
1541 * a secure external signer.
1543 typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys {
1545 * Nearly everywhere, inner must be non-null, however in places where
1546 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1548 LDKnativeInMemoryChannelKeys *inner;
1550 } LDKInMemoryChannelKeys;
1552 typedef union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr {
1553 struct LDKInMemoryChannelKeys *result;
1554 struct LDKDecodeError *err;
1555 } LDKCResult_InMemoryChannelKeysDecodeErrorZPtr;
1557 typedef struct LDKCResult_InMemoryChannelKeysDecodeErrorZ {
1558 union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr contents;
1560 } LDKCResult_InMemoryChannelKeysDecodeErrorZ;
1562 typedef union LDKCResult_TxOutAccessErrorZPtr {
1563 struct LDKTxOut *result;
1564 enum LDKAccessError *err;
1565 } LDKCResult_TxOutAccessErrorZPtr;
1567 typedef struct LDKCResult_TxOutAccessErrorZ {
1568 union LDKCResult_TxOutAccessErrorZPtr contents;
1570 } LDKCResult_TxOutAccessErrorZ;
1573 * A Rust str object, ie a reference to a UTF8-valid string.
1574 * This is *not* null-terminated so cannot be used directly as a C string!
1576 typedef struct LDKStr {
1577 const uint8_t *chars;
1582 * Indicates an error on the client's part (usually some variant of attempting to use too-low or
1585 typedef enum LDKAPIError_Tag {
1587 * Indicates the API was wholly misused (see err for more). Cases where these can be returned
1588 * are documented, but generally indicates some precondition of a function was violated.
1590 LDKAPIError_APIMisuseError,
1592 * Due to a high feerate, we were unable to complete the request.
1593 * For example, this may be returned if the feerate implies we cannot open a channel at the
1594 * requested value, but opening a larger channel would succeed.
1596 LDKAPIError_FeeRateTooHigh,
1598 * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
1599 * too-many-hops, etc).
1601 LDKAPIError_RouteError,
1603 * We were unable to complete the request as the Channel required to do so is unable to
1604 * complete the request (or was not found). This can take many forms, including disconnected
1605 * peer, channel at capacity, channel shutting down, etc.
1607 LDKAPIError_ChannelUnavailable,
1609 * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
1610 * attempted action to fail.
1612 LDKAPIError_MonitorUpdateFailed,
1614 * Must be last for serialization purposes
1616 LDKAPIError_Sentinel,
1619 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
1620 struct LDKCVec_u8Z err;
1621 } LDKAPIError_LDKAPIMisuseError_Body;
1623 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
1624 struct LDKCVec_u8Z err;
1626 } LDKAPIError_LDKFeeRateTooHigh_Body;
1628 typedef struct LDKAPIError_LDKRouteError_Body {
1630 } LDKAPIError_LDKRouteError_Body;
1632 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
1633 struct LDKCVec_u8Z err;
1634 } LDKAPIError_LDKChannelUnavailable_Body;
1636 typedef struct MUST_USE_STRUCT LDKAPIError {
1637 LDKAPIError_Tag tag;
1639 LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
1640 LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
1641 LDKAPIError_LDKRouteError_Body route_error;
1642 LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
1646 typedef union LDKCResult_NoneAPIErrorZPtr {
1648 * Note that this value is always NULL, as there are no contents in the OK variant
1651 struct LDKAPIError *err;
1652 } LDKCResult_NoneAPIErrorZPtr;
1654 typedef struct LDKCResult_NoneAPIErrorZ {
1655 union LDKCResult_NoneAPIErrorZPtr contents;
1657 } LDKCResult_NoneAPIErrorZ;
1662 * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
1664 typedef struct MUST_USE_STRUCT LDKChannelDetails {
1666 * Nearly everywhere, inner must be non-null, however in places where
1667 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1669 LDKnativeChannelDetails *inner;
1671 } LDKChannelDetails;
1673 typedef struct LDKCVec_ChannelDetailsZ {
1674 struct LDKChannelDetails *data;
1676 } LDKCVec_ChannelDetailsZ;
1681 * If a payment fails to send, it can be in one of several states. This enum is returned as the
1682 * Err() type describing which state the payment is in, see the description of individual enum
1685 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
1687 * Nearly everywhere, inner must be non-null, however in places where
1688 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1690 LDKnativePaymentSendFailure *inner;
1692 } LDKPaymentSendFailure;
1694 typedef union LDKCResult_NonePaymentSendFailureZPtr {
1696 * Note that this value is always NULL, as there are no contents in the OK variant
1699 struct LDKPaymentSendFailure *err;
1700 } LDKCResult_NonePaymentSendFailureZPtr;
1702 typedef struct LDKCResult_NonePaymentSendFailureZ {
1703 union LDKCResult_NonePaymentSendFailureZPtr contents;
1705 } LDKCResult_NonePaymentSendFailureZ;
1707 typedef struct LDKFourBytes {
1711 typedef struct LDKSixteenBytes {
1715 typedef struct LDKTenBytes {
1720 * An address which can be used to connect to a remote peer
1722 typedef enum LDKNetAddress_Tag {
1724 * An IPv4 address/port on which the peer is listening.
1728 * An IPv6 address/port on which the peer is listening.
1732 * An old-style Tor onion address/port on which the peer is listening.
1734 LDKNetAddress_OnionV2,
1736 * A new-style Tor onion address/port on which the peer is listening.
1737 * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
1738 * wrap as base32 and append \".onion\".
1740 LDKNetAddress_OnionV3,
1742 * Must be last for serialization purposes
1744 LDKNetAddress_Sentinel,
1745 } LDKNetAddress_Tag;
1747 typedef struct LDKNetAddress_LDKIPv4_Body {
1748 struct LDKFourBytes addr;
1750 } LDKNetAddress_LDKIPv4_Body;
1752 typedef struct LDKNetAddress_LDKIPv6_Body {
1753 struct LDKSixteenBytes addr;
1755 } LDKNetAddress_LDKIPv6_Body;
1757 typedef struct LDKNetAddress_LDKOnionV2_Body {
1758 struct LDKTenBytes addr;
1760 } LDKNetAddress_LDKOnionV2_Body;
1762 typedef struct LDKNetAddress_LDKOnionV3_Body {
1763 struct LDKThirtyTwoBytes ed25519_pubkey;
1767 } LDKNetAddress_LDKOnionV3_Body;
1769 typedef struct MUST_USE_STRUCT LDKNetAddress {
1770 LDKNetAddress_Tag tag;
1772 LDKNetAddress_LDKIPv4_Body i_pv4;
1773 LDKNetAddress_LDKIPv6_Body i_pv6;
1774 LDKNetAddress_LDKOnionV2_Body onion_v2;
1775 LDKNetAddress_LDKOnionV3_Body onion_v3;
1779 typedef struct LDKCVec_NetAddressZ {
1780 struct LDKNetAddress *data;
1782 } LDKCVec_NetAddressZ;
1784 typedef struct LDKCVec_ChannelMonitorZ {
1785 struct LDKChannelMonitor *data;
1787 } LDKCVec_ChannelMonitorZ;
1790 * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
1791 * blocks are connected and disconnected.
1793 * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
1794 * responsible for maintaining a set of monitors such that they can be updated accordingly as
1795 * channel state changes and HTLCs are resolved. See method documentation for specific
1798 * Implementations **must** ensure that updates are successfully applied and persisted upon method
1799 * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
1800 * without taking any further action such as persisting the current state.
1802 * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
1803 * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
1804 * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
1805 * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
1806 * multiple instances.
1808 * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
1809 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1810 * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
1812 typedef struct LDKWatch {
1815 * Watches a channel identified by `funding_txo` using `monitor`.
1817 * Implementations are responsible for watching the chain for the funding transaction along
1818 * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
1819 * calling [`block_connected`] and [`block_disconnected`] on the monitor.
1821 * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
1822 * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
1823 * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
1825 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
1827 * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
1829 * Implementations must call [`update_monitor`] with the given update. See
1830 * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
1832 * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
1833 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1835 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
1837 * Returns any monitor events since the last call. Subsequent calls must only return new
1840 struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
1841 void (*free)(void *this_arg);
1845 * An interface to send a transaction to the Bitcoin network.
1847 typedef struct LDKBroadcasterInterface {
1850 * Sends a transaction out to (hopefully) be mined.
1852 void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
1853 void (*free)(void *this_arg);
1854 } LDKBroadcasterInterface;
1856 typedef struct LDKSecretKey {
1860 typedef struct LDKu8slice {
1861 const uint8_t *data;
1866 * A trait to describe an object which can get user secrets and key material.
1868 typedef struct LDKKeysInterface {
1871 * Get node secret key (aka node_id or network_key)
1873 struct LDKSecretKey (*get_node_secret)(const void *this_arg);
1875 * Get destination redeemScript to encumber static protocol exit points.
1877 struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
1879 * Get shutdown_pubkey to use as PublicKey at channel closure
1881 struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
1883 * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
1884 * restarted with some stale data!
1886 struct LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
1888 * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
1889 * onion packets and for temporary channel IDs. There is no requirement that these be
1890 * persisted anywhere, though they must be unique across restarts.
1892 struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
1894 * Reads a `ChanKeySigner` for this `KeysInterface` from the given input stream.
1895 * This is only called during deserialization of other objects which contain
1896 * `ChannelKeys`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
1897 * The bytes are exactly those which `<Self::ChanKeySigner as Writeable>::write()` writes, and
1898 * contain no versioning scheme. You may wish to include your own version prefix and ensure
1899 * you've read all of the provided bytes to ensure no corruption occurred.
1901 struct LDKCResult_ChanKeySignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
1902 void (*free)(void *this_arg);
1906 * A trait which should be implemented to provide feerate information on a number of time
1909 * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
1910 * called from inside the library in response to chain events, P2P events, or timer events).
1912 typedef struct LDKFeeEstimator {
1915 * Gets estimated satoshis of fee required per 1000 Weight-Units.
1917 * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
1918 * don't put us below 1 satoshi-per-byte).
1920 * This translates to:
1921 * * satoshis-per-byte * 250
1922 * * ceil(satoshis-per-kbyte / 4)
1924 uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
1925 void (*free)(void *this_arg);
1929 * A trait encapsulating the operations required of a logger
1931 typedef struct LDKLogger {
1936 void (*log)(const void *this_arg, const char *record);
1937 void (*free)(void *this_arg);
1943 * Manager which keeps track of a number of channels and sends messages to the appropriate
1944 * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
1946 * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
1947 * to individual Channels.
1949 * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
1950 * all peers during write/read (though does not modify this instance, only the instance being
1951 * serialized). This will result in any channels which have not yet exchanged funding_created (ie
1952 * called funding_transaction_generated for outbound channels).
1954 * Note that you can be a bit lazier about writing out ChannelManager than you can be with
1955 * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
1956 * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
1957 * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
1958 * the serialization process). If the deserialized version is out-of-date compared to the
1959 * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
1960 * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
1962 * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which
1963 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
1964 * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
1965 * block_connected() to step towards your best block) upon deserialization before using the
1968 * Note that ChannelManager is responsible for tracking liveness of its channels and generating
1969 * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
1970 * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
1971 * offline for a full minute. In order to track this, you must call
1972 * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect.
1974 * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
1975 * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
1976 * essentially you should default to using a SimpleRefChannelManager, and use a
1977 * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
1978 * you're using lightning-net-tokio.
1980 typedef struct MUST_USE_STRUCT LDKChannelManager {
1982 * Nearly everywhere, inner must be non-null, however in places where
1983 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1985 LDKnativeChannelManager *inner;
1987 } LDKChannelManager;
1989 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
1990 struct LDKThirtyTwoBytes a;
1991 struct LDKChannelManager b;
1992 } LDKC2Tuple_BlockHashChannelManagerZ;
1994 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
1995 struct LDKC2Tuple_BlockHashChannelManagerZ *result;
1996 struct LDKDecodeError *err;
1997 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
1999 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
2000 union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
2002 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
2004 typedef union LDKCResult_NetAddressu8ZPtr {
2005 struct LDKNetAddress *result;
2007 } LDKCResult_NetAddressu8ZPtr;
2009 typedef struct LDKCResult_NetAddressu8Z {
2010 union LDKCResult_NetAddressu8ZPtr contents;
2012 } LDKCResult_NetAddressu8Z;
2014 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
2015 struct LDKCResult_NetAddressu8Z *result;
2016 struct LDKDecodeError *err;
2017 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
2019 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
2020 union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
2022 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
2024 typedef struct LDKCVec_u64Z {
2032 * An update_add_htlc message to be sent or received from a peer
2034 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
2036 * Nearly everywhere, inner must be non-null, however in places where
2037 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2039 LDKnativeUpdateAddHTLC *inner;
2043 typedef struct LDKCVec_UpdateAddHTLCZ {
2044 struct LDKUpdateAddHTLC *data;
2046 } LDKCVec_UpdateAddHTLCZ;
2051 * An update_fulfill_htlc message to be sent or received from a peer
2053 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
2055 * Nearly everywhere, inner must be non-null, however in places where
2056 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2058 LDKnativeUpdateFulfillHTLC *inner;
2060 } LDKUpdateFulfillHTLC;
2062 typedef struct LDKCVec_UpdateFulfillHTLCZ {
2063 struct LDKUpdateFulfillHTLC *data;
2065 } LDKCVec_UpdateFulfillHTLCZ;
2070 * An update_fail_htlc message to be sent or received from a peer
2072 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
2074 * Nearly everywhere, inner must be non-null, however in places where
2075 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2077 LDKnativeUpdateFailHTLC *inner;
2079 } LDKUpdateFailHTLC;
2081 typedef struct LDKCVec_UpdateFailHTLCZ {
2082 struct LDKUpdateFailHTLC *data;
2084 } LDKCVec_UpdateFailHTLCZ;
2089 * An update_fail_malformed_htlc message to be sent or received from a peer
2091 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
2093 * Nearly everywhere, inner must be non-null, however in places where
2094 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2096 LDKnativeUpdateFailMalformedHTLC *inner;
2098 } LDKUpdateFailMalformedHTLC;
2100 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
2101 struct LDKUpdateFailMalformedHTLC *data;
2103 } LDKCVec_UpdateFailMalformedHTLCZ;
2108 * An Err type for failure to process messages.
2110 typedef struct MUST_USE_STRUCT LDKLightningError {
2112 * Nearly everywhere, inner must be non-null, however in places where
2113 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2115 LDKnativeLightningError *inner;
2117 } LDKLightningError;
2119 typedef union LDKCResult_boolLightningErrorZPtr {
2121 struct LDKLightningError *err;
2122 } LDKCResult_boolLightningErrorZPtr;
2124 typedef struct LDKCResult_boolLightningErrorZ {
2125 union LDKCResult_boolLightningErrorZPtr contents;
2127 } LDKCResult_boolLightningErrorZ;
2129 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2130 struct LDKChannelAnnouncement a;
2131 struct LDKChannelUpdate b;
2132 struct LDKChannelUpdate c;
2133 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
2135 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2136 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
2138 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
2140 typedef struct LDKCVec_NodeAnnouncementZ {
2141 struct LDKNodeAnnouncement *data;
2143 } LDKCVec_NodeAnnouncementZ;
2145 typedef union LDKCResult_NoneLightningErrorZPtr {
2147 * Note that this value is always NULL, as there are no contents in the OK variant
2150 struct LDKLightningError *err;
2151 } LDKCResult_NoneLightningErrorZPtr;
2153 typedef struct LDKCResult_NoneLightningErrorZ {
2154 union LDKCResult_NoneLightningErrorZPtr contents;
2156 } LDKCResult_NoneLightningErrorZ;
2158 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
2159 struct LDKChannelReestablish *result;
2160 struct LDKDecodeError *err;
2161 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
2163 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
2164 union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
2166 } LDKCResult_ChannelReestablishDecodeErrorZ;
2171 * An init message to be sent or received from a peer
2173 typedef struct MUST_USE_STRUCT LDKInit {
2175 * Nearly everywhere, inner must be non-null, however in places where
2176 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2178 LDKnativeInit *inner;
2182 typedef union LDKCResult_InitDecodeErrorZPtr {
2183 struct LDKInit *result;
2184 struct LDKDecodeError *err;
2185 } LDKCResult_InitDecodeErrorZPtr;
2187 typedef struct LDKCResult_InitDecodeErrorZ {
2188 union LDKCResult_InitDecodeErrorZPtr contents;
2190 } LDKCResult_InitDecodeErrorZ;
2195 * A ping message to be sent or received from a peer
2197 typedef struct MUST_USE_STRUCT LDKPing {
2199 * Nearly everywhere, inner must be non-null, however in places where
2200 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2202 LDKnativePing *inner;
2206 typedef union LDKCResult_PingDecodeErrorZPtr {
2207 struct LDKPing *result;
2208 struct LDKDecodeError *err;
2209 } LDKCResult_PingDecodeErrorZPtr;
2211 typedef struct LDKCResult_PingDecodeErrorZ {
2212 union LDKCResult_PingDecodeErrorZPtr contents;
2214 } LDKCResult_PingDecodeErrorZ;
2219 * A pong message to be sent or received from a peer
2221 typedef struct MUST_USE_STRUCT LDKPong {
2223 * Nearly everywhere, inner must be non-null, however in places where
2224 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2226 LDKnativePong *inner;
2230 typedef union LDKCResult_PongDecodeErrorZPtr {
2231 struct LDKPong *result;
2232 struct LDKDecodeError *err;
2233 } LDKCResult_PongDecodeErrorZPtr;
2235 typedef struct LDKCResult_PongDecodeErrorZ {
2236 union LDKCResult_PongDecodeErrorZPtr contents;
2238 } LDKCResult_PongDecodeErrorZ;
2240 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2241 struct LDKUnsignedChannelAnnouncement *result;
2242 struct LDKDecodeError *err;
2243 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
2245 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
2246 union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
2248 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
2253 * The unsigned part of a channel_update
2255 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
2257 * Nearly everywhere, inner must be non-null, however in places where
2258 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2260 LDKnativeUnsignedChannelUpdate *inner;
2262 } LDKUnsignedChannelUpdate;
2264 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
2265 struct LDKUnsignedChannelUpdate *result;
2266 struct LDKDecodeError *err;
2267 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
2269 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
2270 union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
2272 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
2274 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
2275 struct LDKErrorMessage *result;
2276 struct LDKDecodeError *err;
2277 } LDKCResult_ErrorMessageDecodeErrorZPtr;
2279 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
2280 union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
2282 } LDKCResult_ErrorMessageDecodeErrorZ;
2287 * The unsigned part of a node_announcement
2289 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
2291 * Nearly everywhere, inner must be non-null, however in places where
2292 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2294 LDKnativeUnsignedNodeAnnouncement *inner;
2296 } LDKUnsignedNodeAnnouncement;
2298 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2299 struct LDKUnsignedNodeAnnouncement *result;
2300 struct LDKDecodeError *err;
2301 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
2303 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
2304 union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
2306 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
2308 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
2309 struct LDKQueryShortChannelIds *result;
2310 struct LDKDecodeError *err;
2311 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
2313 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
2314 union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
2316 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
2321 * A reply_short_channel_ids_end message is sent as a reply to a
2322 * query_short_channel_ids message. The query recipient makes a best
2323 * effort to respond based on their local network view which may not be
2324 * a perfect view of the network.
2326 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
2328 * Nearly everywhere, inner must be non-null, however in places where
2329 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2331 LDKnativeReplyShortChannelIdsEnd *inner;
2333 } LDKReplyShortChannelIdsEnd;
2335 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2336 struct LDKReplyShortChannelIdsEnd *result;
2337 struct LDKDecodeError *err;
2338 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
2340 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
2341 union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
2343 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
2345 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
2346 struct LDKQueryChannelRange *result;
2347 struct LDKDecodeError *err;
2348 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
2350 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
2351 union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
2353 } LDKCResult_QueryChannelRangeDecodeErrorZ;
2358 * A reply_channel_range message is a reply to a query_channel_range
2359 * message. Multiple reply_channel_range messages can be sent in reply
2360 * to a single query_channel_range message. The query recipient makes a
2361 * best effort to respond based on their local network view which may
2362 * not be a perfect view of the network. The short_channel_ids in the
2363 * reply are encoded. We only support encoding_type=0 uncompressed
2364 * serialization and do not support encoding_type=1 zlib serialization.
2366 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2368 * Nearly everywhere, inner must be non-null, however in places where
2369 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2371 LDKnativeReplyChannelRange *inner;
2373 } LDKReplyChannelRange;
2375 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
2376 struct LDKReplyChannelRange *result;
2377 struct LDKDecodeError *err;
2378 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
2380 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
2381 union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
2383 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
2388 * A gossip_timestamp_filter message is used by a node to request
2389 * gossip relay for messages in the requested time range when the
2390 * gossip_queries feature has been negotiated.
2392 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
2394 * Nearly everywhere, inner must be non-null, however in places where
2395 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2397 LDKnativeGossipTimestampFilter *inner;
2399 } LDKGossipTimestampFilter;
2401 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
2402 struct LDKGossipTimestampFilter *result;
2403 struct LDKDecodeError *err;
2404 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
2406 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
2407 union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
2409 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
2411 typedef struct LDKCVec_PublicKeyZ {
2412 struct LDKPublicKey *data;
2414 } LDKCVec_PublicKeyZ;
2419 * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
2420 * generate no further read_event/write_buffer_space_avail calls for the descriptor, only
2421 * triggering a single socket_disconnected call (unless it was provided in response to a
2422 * new_*_connection event, in which case no such socket_disconnected() must be called and the
2423 * socket silently disconencted).
2425 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
2427 * Nearly everywhere, inner must be non-null, however in places where
2428 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2430 LDKnativePeerHandleError *inner;
2432 } LDKPeerHandleError;
2434 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
2435 struct LDKCVec_u8Z *result;
2436 struct LDKPeerHandleError *err;
2437 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
2439 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
2440 union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
2442 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
2444 typedef union LDKCResult_NonePeerHandleErrorZPtr {
2446 * Note that this value is always NULL, as there are no contents in the OK variant
2449 struct LDKPeerHandleError *err;
2450 } LDKCResult_NonePeerHandleErrorZPtr;
2452 typedef struct LDKCResult_NonePeerHandleErrorZ {
2453 union LDKCResult_NonePeerHandleErrorZPtr contents;
2455 } LDKCResult_NonePeerHandleErrorZ;
2457 typedef union LDKCResult_boolPeerHandleErrorZPtr {
2459 struct LDKPeerHandleError *err;
2460 } LDKCResult_boolPeerHandleErrorZPtr;
2462 typedef struct LDKCResult_boolPeerHandleErrorZ {
2463 union LDKCResult_boolPeerHandleErrorZPtr contents;
2465 } LDKCResult_boolPeerHandleErrorZ;
2467 typedef union LDKCResult_SecretKeySecpErrorZPtr {
2468 struct LDKSecretKey *result;
2469 enum LDKSecp256k1Error *err;
2470 } LDKCResult_SecretKeySecpErrorZPtr;
2472 typedef struct LDKCResult_SecretKeySecpErrorZ {
2473 union LDKCResult_SecretKeySecpErrorZPtr contents;
2475 } LDKCResult_SecretKeySecpErrorZ;
2477 typedef union LDKCResult_PublicKeySecpErrorZPtr {
2478 struct LDKPublicKey *result;
2479 enum LDKSecp256k1Error *err;
2480 } LDKCResult_PublicKeySecpErrorZPtr;
2482 typedef struct LDKCResult_PublicKeySecpErrorZ {
2483 union LDKCResult_PublicKeySecpErrorZPtr contents;
2485 } LDKCResult_PublicKeySecpErrorZ;
2490 * The set of public keys which are used in the creation of one commitment transaction.
2491 * These are derived from the channel base keys and per-commitment data.
2493 * A broadcaster key is provided from potential broadcaster of the computed transaction.
2494 * A countersignatory key is coming from a protocol participant unable to broadcast the
2497 * These keys are assumed to be good, either because the code derived them from
2498 * channel basepoints via the new function, or they were obtained via
2499 * CommitmentTransaction.trust().keys() because we trusted the source of the
2500 * pre-calculated keys.
2502 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
2504 * Nearly everywhere, inner must be non-null, however in places where
2505 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2507 LDKnativeTxCreationKeys *inner;
2509 } LDKTxCreationKeys;
2511 typedef union LDKCResult_TxCreationKeysSecpErrorZPtr {
2512 struct LDKTxCreationKeys *result;
2513 enum LDKSecp256k1Error *err;
2514 } LDKCResult_TxCreationKeysSecpErrorZPtr;
2516 typedef struct LDKCResult_TxCreationKeysSecpErrorZ {
2517 union LDKCResult_TxCreationKeysSecpErrorZPtr contents;
2519 } LDKCResult_TxCreationKeysSecpErrorZ;
2524 * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
2525 * transaction and the transaction creation keys) are trusted.
2527 * See trust() and verify() functions on CommitmentTransaction.
2529 * This structure implements Deref.
2531 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
2533 * Nearly everywhere, inner must be non-null, however in places where
2534 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2536 LDKnativeTrustedCommitmentTransaction *inner;
2538 } LDKTrustedCommitmentTransaction;
2540 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
2541 struct LDKTrustedCommitmentTransaction *result;
2543 * Note that this value is always NULL, as there are no contents in the Err variant
2546 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
2548 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
2549 union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
2551 } LDKCResult_TrustedCommitmentTransactionNoneZ;
2558 typedef struct MUST_USE_STRUCT LDKRouteHop {
2560 * Nearly everywhere, inner must be non-null, however in places where
2561 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2563 LDKnativeRouteHop *inner;
2567 typedef struct LDKCVec_RouteHopZ {
2568 struct LDKRouteHop *data;
2570 } LDKCVec_RouteHopZ;
2572 typedef struct LDKCVec_CVec_RouteHopZZ {
2573 struct LDKCVec_RouteHopZ *data;
2575 } LDKCVec_CVec_RouteHopZZ;
2580 * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2581 * it can take multiple paths. Each path is composed of one or more hops through the network.
2583 typedef struct MUST_USE_STRUCT LDKRoute {
2585 * Nearly everywhere, inner must be non-null, however in places where
2586 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2588 LDKnativeRoute *inner;
2592 typedef union LDKCResult_RouteDecodeErrorZPtr {
2593 struct LDKRoute *result;
2594 struct LDKDecodeError *err;
2595 } LDKCResult_RouteDecodeErrorZPtr;
2597 typedef struct LDKCResult_RouteDecodeErrorZ {
2598 union LDKCResult_RouteDecodeErrorZPtr contents;
2600 } LDKCResult_RouteDecodeErrorZ;
2605 * A channel descriptor which provides a last-hop route to get_route
2607 typedef struct MUST_USE_STRUCT LDKRouteHint {
2609 * Nearly everywhere, inner must be non-null, however in places where
2610 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2612 LDKnativeRouteHint *inner;
2616 typedef struct LDKCVec_RouteHintZ {
2617 struct LDKRouteHint *data;
2619 } LDKCVec_RouteHintZ;
2621 typedef union LDKCResult_RouteLightningErrorZPtr {
2622 struct LDKRoute *result;
2623 struct LDKLightningError *err;
2624 } LDKCResult_RouteLightningErrorZPtr;
2626 typedef struct LDKCResult_RouteLightningErrorZ {
2627 union LDKCResult_RouteLightningErrorZPtr contents;
2629 } LDKCResult_RouteLightningErrorZ;
2634 * Fees for routing via a given channel or a node
2636 typedef struct MUST_USE_STRUCT LDKRoutingFees {
2638 * Nearly everywhere, inner must be non-null, however in places where
2639 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2641 LDKnativeRoutingFees *inner;
2645 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
2646 struct LDKRoutingFees *result;
2647 struct LDKDecodeError *err;
2648 } LDKCResult_RoutingFeesDecodeErrorZPtr;
2650 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
2651 union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
2653 } LDKCResult_RoutingFeesDecodeErrorZ;
2658 * Information received in the latest node_announcement from this node.
2660 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
2662 * Nearly everywhere, inner must be non-null, however in places where
2663 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2665 LDKnativeNodeAnnouncementInfo *inner;
2667 } LDKNodeAnnouncementInfo;
2669 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
2670 struct LDKNodeAnnouncementInfo *result;
2671 struct LDKDecodeError *err;
2672 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
2674 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
2675 union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
2677 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
2682 * Details about a node in the network, known from the network announcement.
2684 typedef struct MUST_USE_STRUCT LDKNodeInfo {
2686 * Nearly everywhere, inner must be non-null, however in places where
2687 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2689 LDKnativeNodeInfo *inner;
2693 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
2694 struct LDKNodeInfo *result;
2695 struct LDKDecodeError *err;
2696 } LDKCResult_NodeInfoDecodeErrorZPtr;
2698 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
2699 union LDKCResult_NodeInfoDecodeErrorZPtr contents;
2701 } LDKCResult_NodeInfoDecodeErrorZ;
2706 * Represents the network as nodes and channels between them
2708 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
2710 * Nearly everywhere, inner must be non-null, however in places where
2711 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2713 LDKnativeNetworkGraph *inner;
2717 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
2718 struct LDKNetworkGraph *result;
2719 struct LDKDecodeError *err;
2720 } LDKCResult_NetworkGraphDecodeErrorZPtr;
2722 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
2723 union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
2725 } LDKCResult_NetworkGraphDecodeErrorZ;
2728 * A trait indicating an object may generate message send events
2730 typedef struct LDKMessageSendEventsProvider {
2733 * Gets the list of pending events which were generated by previous actions, clearing the list
2736 struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
2737 void (*free)(void *this_arg);
2738 } LDKMessageSendEventsProvider;
2741 * A trait indicating an object may generate events
2743 typedef struct LDKEventsProvider {
2746 * Gets the list of pending events which were generated by previous actions, clearing the list
2749 struct LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
2750 void (*free)(void *this_arg);
2751 } LDKEventsProvider;
2756 * Configuration we set when applicable.
2758 * Default::default() provides sane defaults.
2760 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
2762 * Nearly everywhere, inner must be non-null, however in places where
2763 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2765 LDKnativeChannelHandshakeConfig *inner;
2767 } LDKChannelHandshakeConfig;
2772 * Optional channel limits which are applied during channel creation.
2774 * These limits are only applied to our counterparty's limits, not our own.
2776 * Use 0/<type>::max_value() as appropriate to skip checking.
2778 * Provides sane defaults for most configurations.
2780 * Most additional limits are disabled except those with which specify a default in individual
2781 * field documentation. Note that this may result in barely-usable channels, but since they
2782 * are applied mostly only to incoming channels that's not much of a problem.
2784 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
2786 * Nearly everywhere, inner must be non-null, however in places where
2787 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2789 LDKnativeChannelHandshakeLimits *inner;
2791 } LDKChannelHandshakeLimits;
2796 * Options which apply on a per-channel basis and may change at runtime or based on negotiation
2797 * with our counterparty.
2799 typedef struct MUST_USE_STRUCT LDKChannelConfig {
2801 * Nearly everywhere, inner must be non-null, however in places where
2802 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2804 LDKnativeChannelConfig *inner;
2811 * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
2813 * Default::default() provides sane defaults for most configurations
2814 * (but currently with 0 relay fees!)
2816 typedef struct MUST_USE_STRUCT LDKUserConfig {
2818 * Nearly everywhere, inner must be non-null, however in places where
2819 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2821 LDKnativeUserConfig *inner;
2826 * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
2829 typedef struct LDKAccess {
2832 * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
2833 * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
2836 * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
2838 struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
2839 void (*free)(void *this_arg);
2843 * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
2846 * This is useful in order to have a [`Watch`] implementation convey to a chain source which
2847 * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
2848 * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
2849 * receiving full blocks from a chain source, any further filtering is unnecessary.
2851 * After an output has been registered, subsequent block retrievals from the chain source must not
2852 * exclude any transactions matching the new criteria nor any in-block descendants of such
2855 * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
2856 * should not block on I/O. Implementations should instead queue the newly monitored data to be
2857 * processed later. Then, in order to block until the data has been processed, any `Watch`
2858 * invocation that has called the `Filter` must return [`TemporaryFailure`].
2860 * [`Watch`]: trait.Watch.html
2861 * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure
2862 * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
2863 * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
2865 typedef struct LDKFilter {
2868 * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
2869 * a spending condition.
2871 void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
2873 * Registers interest in spends of a transaction output identified by `outpoint` having
2874 * `script_pubkey` as the spending condition.
2876 void (*register_output)(const void *this_arg, const struct LDKOutPoint *NONNULL_PTR outpoint, struct LDKu8slice script_pubkey);
2877 void (*free)(void *this_arg);
2881 * `Persist` defines behavior for persisting channel monitors: this could mean
2882 * writing once to disk, and/or uploading to one or more backup services.
2884 * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
2885 * to disk/backups. And, on every update, you **must** persist either the
2886 * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
2887 * of situations such as revoking a transaction, then crashing before this
2888 * revocation can be persisted, then unintentionally broadcasting a revoked
2889 * transaction and losing money. This is a risk because previous channel states
2890 * are toxic, so it's important that whatever channel state is persisted is
2893 typedef struct LDKPersist {
2896 * Persist a new channel's data. The data can be stored any way you want, but
2897 * the identifier provided by Rust-Lightning is the channel's outpoint (and
2898 * it is up to you to maintain a correct mapping between the outpoint and the
2899 * stored channel data). Note that you **must** persist every new monitor to
2900 * disk. See the `Persist` trait documentation for more details.
2902 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
2903 * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
2905 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
2906 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
2908 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
2910 * Update one channel's data. The provided `ChannelMonitor` has already
2911 * applied the given update.
2913 * Note that on every update, you **must** persist either the
2914 * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
2915 * the `Persist` trait documentation for more details.
2917 * If an implementer chooses to persist the updates only, they need to make
2918 * sure that all the updates are applied to the `ChannelMonitors` *before*
2919 * the set of channel monitors is given to the `ChannelManager`
2920 * deserialization routine. See [`ChannelMonitor::update_monitor`] for
2921 * applying a monitor update to a monitor. If full `ChannelMonitors` are
2922 * persisted, then there is no need to persist individual updates.
2924 * Note that there could be a performance tradeoff between persisting complete
2925 * channel monitors on every update vs. persisting only updates and applying
2926 * them in batches. The size of each monitor grows `O(number of state updates)`
2927 * whereas updates are small and `O(1)`.
2929 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
2930 * [`ChannelMonitorUpdate::write`] for writing out an update, and
2931 * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
2933 * [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1
2934 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
2935 * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write
2936 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
2938 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data);
2939 void (*free)(void *this_arg);
2945 * An implementation of [`chain::Watch`] for monitoring channels.
2947 * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
2948 * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
2949 * or used independently to monitor channels remotely. See the [module-level documentation] for
2952 * [`chain::Watch`]: ../trait.Watch.html
2953 * [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html
2954 * [module-level documentation]: index.html
2956 typedef struct MUST_USE_STRUCT LDKChainMonitor {
2958 * Nearly everywhere, inner must be non-null, however in places where
2959 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2961 LDKnativeChainMonitor *inner;
2968 * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2969 * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2970 * preimage claim backward will lead to loss of funds.
2972 * [`chain::Watch`]: ../trait.Watch.html
2974 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
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 LDKnativeHTLCUpdate *inner;
2986 * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
2987 * and derives keys from that.
2989 * Your node_id is seed/0'
2990 * ChannelMonitor closes may use seed/1'
2991 * Cooperative closes may use seed/2'
2992 * The two close keys may be needed to claim on-chain funds!
2994 typedef struct MUST_USE_STRUCT LDKKeysManager {
2996 * Nearly everywhere, inner must be non-null, however in places where
2997 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2999 LDKnativeKeysManager *inner;
3006 * Features used within an `init` message.
3008 typedef struct MUST_USE_STRUCT LDKInitFeatures {
3010 * Nearly everywhere, inner must be non-null, however in places where
3011 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3013 LDKnativeInitFeatures *inner;
3017 typedef struct LDKThreeBytes {
3024 * A commitment_signed message to be sent or received from a peer
3026 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
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 LDKnativeCommitmentSigned *inner;
3033 } LDKCommitmentSigned;
3038 * An update_fee message to be sent or received from a peer
3040 typedef struct MUST_USE_STRUCT LDKUpdateFee {
3042 * Nearly everywhere, inner must be non-null, however in places where
3043 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3045 LDKnativeUpdateFee *inner;
3050 * A trait to describe an object which can receive channel messages.
3052 * Messages MAY be called in parallel when they originate from different their_node_ids, however
3053 * they MUST NOT be called in parallel when the two calls have the same their_node_id.
3055 typedef struct LDKChannelMessageHandler {
3058 * Handle an incoming open_channel message from the given peer.
3060 void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
3062 * Handle an incoming accept_channel message from the given peer.
3064 void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
3066 * Handle an incoming funding_created message from the given peer.
3068 void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
3070 * Handle an incoming funding_signed message from the given peer.
3072 void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
3074 * Handle an incoming funding_locked message from the given peer.
3076 void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
3078 * Handle an incoming shutdown message from the given peer.
3080 void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg);
3082 * Handle an incoming closing_signed message from the given peer.
3084 void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
3086 * Handle an incoming update_add_htlc message from the given peer.
3088 void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
3090 * Handle an incoming update_fulfill_htlc message from the given peer.
3092 void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
3094 * Handle an incoming update_fail_htlc message from the given peer.
3096 void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
3098 * Handle an incoming update_fail_malformed_htlc message from the given peer.
3100 void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
3102 * Handle an incoming commitment_signed message from the given peer.
3104 void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
3106 * Handle an incoming revoke_and_ack message from the given peer.
3108 void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
3110 * Handle an incoming update_fee message from the given peer.
3112 void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
3114 * Handle an incoming announcement_signatures message from the given peer.
3116 void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
3118 * Indicates a connection to the peer failed/an existing connection was lost. If no connection
3119 * is believed to be possible in the future (eg they're sending us messages we don't
3120 * understand or indicate they require unknown feature bits), no_connection_possible is set
3121 * and any outstanding channels should be failed.
3123 void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
3125 * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
3127 void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
3129 * Handle an incoming channel_reestablish message from the given peer.
3131 void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
3133 * Handle an incoming error message from the given peer.
3135 void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
3136 struct LDKMessageSendEventsProvider MessageSendEventsProvider;
3137 void (*free)(void *this_arg);
3138 } LDKChannelMessageHandler;
3143 * Arguments for the creation of a ChannelManager that are not deserialized.
3145 * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
3147 * 1) Deserialize all stored ChannelMonitors.
3148 * 2) Deserialize the ChannelManager by filling in this struct and calling <(Sha256dHash,
3149 * ChannelManager)>::read(reader, args).
3150 * This may result in closing some Channels if the ChannelMonitor is newer than the stored
3151 * ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
3152 * 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
3153 * ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo().
3154 * 4) Reconnect blocks on your ChannelMonitors.
3155 * 5) Move the ChannelMonitors into your local chain::Watch.
3156 * 6) Disconnect/connect blocks on the ChannelManager.
3158 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
3160 * Nearly everywhere, inner must be non-null, however in places where
3161 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3163 LDKnativeChannelManagerReadArgs *inner;
3165 } LDKChannelManagerReadArgs;
3170 * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
3171 * This is used to convince the recipient that the channel is at a certain commitment
3172 * number even if they lost that data due to a local failure. Of course, the peer may lie
3173 * and even later commitments may have been revoked.
3175 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
3177 * Nearly everywhere, inner must be non-null, however in places where
3178 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3180 LDKnativeDataLossProtect *inner;
3182 } LDKDataLossProtect;
3187 * Features used within a `node_announcement` message.
3189 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
3191 * Nearly everywhere, inner must be non-null, however in places where
3192 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3194 LDKnativeNodeFeatures *inner;
3201 * Features used within a `channel_announcement` message.
3203 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
3205 * Nearly everywhere, inner must be non-null, however in places where
3206 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3208 LDKnativeChannelFeatures *inner;
3210 } LDKChannelFeatures;
3213 * A trait to describe an object which can receive routing messages.
3215 * # Implementor DoS Warnings
3217 * For `gossip_queries` messages there are potential DoS vectors when handling
3218 * inbound queries. Implementors using an on-disk network graph should be aware of
3219 * repeated disk I/O for queries accessing different parts of the network graph.
3221 typedef struct LDKRoutingMessageHandler {
3224 * Handle an incoming node_announcement message, returning true if it should be forwarded on,
3225 * false or returning an Err otherwise.
3227 struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
3229 * Handle a channel_announcement message, returning true if it should be forwarded on, false
3230 * or returning an Err otherwise.
3232 struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
3234 * Handle an incoming channel_update message, returning true if it should be forwarded on,
3235 * false or returning an Err otherwise.
3237 struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
3239 * Handle some updates to the route graph that we learned due to an outbound failed payment.
3241 void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
3243 * Gets a subset of the channel announcements and updates required to dump our routing table
3244 * to a remote node, starting at the short_channel_id indicated by starting_point and
3245 * including the batch_amount entries immediately higher in numerical value than starting_point.
3247 struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
3249 * Gets a subset of the node announcements required to dump our routing table to a remote node,
3250 * starting at the node *after* the provided publickey and including batch_amount entries
3251 * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
3252 * If None is provided for starting_point, we start at the first node.
3254 struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
3256 * Called when a connection is established with a peer. This can be used to
3257 * perform routing table synchronization using a strategy defined by the
3260 void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
3262 * Handles the reply of a query we initiated to learn about channels
3263 * for a given range of blocks. We can expect to receive one or more
3264 * replies to a single query.
3266 struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
3268 * Handles the reply of a query we initiated asking for routing gossip
3269 * messages for a list of channels. We should receive this message when
3270 * a node has completed its best effort to send us the pertaining routing
3273 struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
3275 * Handles when a peer asks us to send a list of short_channel_ids
3276 * for the requested range of blocks.
3278 struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
3280 * Handles when a peer asks us to send routing gossip messages for a
3281 * list of short_channel_ids.
3283 struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
3284 struct LDKMessageSendEventsProvider MessageSendEventsProvider;
3285 void (*free)(void *this_arg);
3286 } LDKRoutingMessageHandler;
3291 * Provides references to trait impls which handle different types of messages.
3293 typedef struct MUST_USE_STRUCT LDKMessageHandler {
3295 * Nearly everywhere, inner must be non-null, however in places where
3296 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3298 LDKnativeMessageHandler *inner;
3300 } LDKMessageHandler;
3303 * Provides an object which can be used to send data to and which uniquely identifies a connection
3304 * to a remote host. You will need to be able to generate multiple of these which meet Eq and
3305 * implement Hash to meet the PeerManager API.
3307 * For efficiency, Clone should be relatively cheap for this type.
3309 * You probably want to just extend an int and put a file descriptor in a struct and implement
3310 * send_data. Note that if you are using a higher-level net library that may call close() itself,
3311 * be careful to ensure you don't have races whereby you might register a new connection with an
3312 * fd which is the same as a previous one which has yet to be removed via
3313 * PeerManager::socket_disconnected().
3315 typedef struct LDKSocketDescriptor {
3318 * Attempts to send some data from the given slice to the peer.
3320 * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
3321 * Note that in the disconnected case, socket_disconnected must still fire and further write
3322 * attempts may occur until that time.
3324 * If the returned size is smaller than data.len(), a write_available event must
3325 * trigger the next time more data can be written. Additionally, until the a send_data event
3326 * completes fully, no further read_events should trigger on the same peer!
3328 * If a read_event on this descriptor had previously returned true (indicating that read
3329 * events should be paused to prevent DoS in the send buffer), resume_read may be set
3330 * indicating that read events on this descriptor should resume. A resume_read of false does
3331 * *not* imply that further read events should be paused.
3333 uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
3335 * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
3336 * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
3337 * this descriptor. No socket_disconnected call should be generated as a result of this call,
3338 * though races may occur whereby disconnect_socket is called after a call to
3339 * socket_disconnected but prior to socket_disconnected returning.
3341 void (*disconnect_socket)(void *this_arg);
3342 bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
3343 uint64_t (*hash)(const void *this_arg);
3344 void *(*clone)(const void *this_arg);
3345 void (*free)(void *this_arg);
3346 } LDKSocketDescriptor;
3351 * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
3352 * events into messages which it passes on to its MessageHandlers.
3354 * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
3355 * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
3356 * essentially you should default to using a SimpleRefPeerManager, and use a
3357 * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
3358 * you're using lightning-net-tokio.
3360 typedef struct MUST_USE_STRUCT LDKPeerManager {
3362 * Nearly everywhere, inner must be non-null, however in places where
3363 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3365 LDKnativePeerManager *inner;
3372 * Late-bound per-channel counterparty data used to build transactions.
3374 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
3376 * Nearly everywhere, inner must be non-null, however in places where
3377 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3379 LDKnativeCounterpartyChannelTransactionParameters *inner;
3381 } LDKCounterpartyChannelTransactionParameters;
3386 * Static channel fields used to build transactions given per-commitment fields, organized by
3387 * broadcaster/countersignatory.
3389 * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
3390 * as_holder_broadcastable and as_counterparty_broadcastable functions.
3392 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
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 LDKnativeDirectedChannelTransactionParameters *inner;
3399 } LDKDirectedChannelTransactionParameters;
3404 * A pre-built Bitcoin commitment transaction and its txid.
3406 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
3408 * Nearly everywhere, inner must be non-null, however in places where
3409 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3411 LDKnativeBuiltCommitmentTransaction *inner;
3413 } LDKBuiltCommitmentTransaction;
3418 * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
3419 * This exists only to make accessing a RwLock<NetworkGraph> possible from
3420 * the C bindings, as it can be done directly in Rust code.
3422 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
3424 * Nearly everywhere, inner must be non-null, however in places where
3425 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3427 LDKnativeLockedNetworkGraph *inner;
3429 } LDKLockedNetworkGraph;
3434 * Receives and validates network updates from peers,
3435 * stores authentic and relevant data as a network graph.
3436 * This network graph is then used for routing payments.
3437 * Provides interface to help with initial routing sync by
3438 * serving historical announcements.
3440 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
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 LDKnativeNetGraphMsgHandler *inner;
3447 } LDKNetGraphMsgHandler;
3452 * Details about one direction of a channel. Received
3453 * within a channel update.
3455 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
3457 * Nearly everywhere, inner must be non-null, however in places where
3458 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3460 LDKnativeDirectionalChannelInfo *inner;
3462 } LDKDirectionalChannelInfo;
3467 * Details about a channel (both directions).
3468 * Received within a channel announcement.
3470 typedef struct MUST_USE_STRUCT LDKChannelInfo {
3472 * Nearly everywhere, inner must be non-null, however in places where
3473 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3475 LDKnativeChannelInfo *inner;
3479 extern const uintptr_t MAX_BUF_SIZE;
3481 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
3483 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
3485 void Transaction_free(struct LDKTransaction _res);
3487 void TxOut_free(struct LDKTxOut _res);
3489 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
3491 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
3493 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
3495 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
3497 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
3499 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
3501 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
3503 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
3505 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
3507 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
3509 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
3511 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
3513 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
3515 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
3517 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
3519 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
3521 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
3523 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
3525 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
3527 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
3529 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
3531 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
3533 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
3535 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
3537 void CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res);
3539 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
3541 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
3543 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
3545 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
3547 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
3549 void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res);
3551 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
3553 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
3555 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
3557 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
3559 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
3561 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
3563 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
3565 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
3567 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
3569 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
3571 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
3573 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
3575 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
3577 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
3579 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
3581 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
3583 struct LDKCResult_ChanKeySignerDecodeErrorZ CResult_ChanKeySignerDecodeErrorZ_ok(struct LDKChannelKeys o);
3585 struct LDKCResult_ChanKeySignerDecodeErrorZ CResult_ChanKeySignerDecodeErrorZ_err(struct LDKDecodeError e);
3587 void CResult_ChanKeySignerDecodeErrorZ_free(struct LDKCResult_ChanKeySignerDecodeErrorZ _res);
3589 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_ok(struct LDKInMemoryChannelKeys o);
3591 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_err(struct LDKDecodeError e);
3593 void CResult_InMemoryChannelKeysDecodeErrorZ_free(struct LDKCResult_InMemoryChannelKeysDecodeErrorZ _res);
3595 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
3597 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
3599 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
3601 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
3603 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
3605 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
3607 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
3609 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
3611 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
3613 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
3615 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
3617 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
3619 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
3621 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
3623 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
3625 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
3627 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
3629 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
3631 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
3633 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
3635 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
3637 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
3639 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
3641 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
3643 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
3645 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
3647 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
3649 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
3651 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
3653 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
3655 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
3657 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
3659 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
3661 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
3663 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
3665 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
3667 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
3669 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
3671 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
3673 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
3675 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
3677 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
3679 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
3681 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
3683 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
3685 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
3687 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
3689 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
3691 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
3693 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
3695 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
3697 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
3699 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
3701 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
3703 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
3705 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
3707 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
3709 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
3711 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
3713 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
3715 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
3717 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
3719 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
3721 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
3723 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
3725 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
3727 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
3729 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
3731 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
3733 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
3735 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
3737 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
3739 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
3741 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
3743 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
3745 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
3747 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
3749 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
3751 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
3753 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
3755 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
3757 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
3759 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
3761 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
3763 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
3765 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
3767 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
3769 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
3771 struct LDKCResult_SecretKeySecpErrorZ CResult_SecretKeySecpErrorZ_ok(struct LDKSecretKey o);
3773 struct LDKCResult_SecretKeySecpErrorZ CResult_SecretKeySecpErrorZ_err(enum LDKSecp256k1Error e);
3775 void CResult_SecretKeySecpErrorZ_free(struct LDKCResult_SecretKeySecpErrorZ _res);
3777 struct LDKCResult_PublicKeySecpErrorZ CResult_PublicKeySecpErrorZ_ok(struct LDKPublicKey o);
3779 struct LDKCResult_PublicKeySecpErrorZ CResult_PublicKeySecpErrorZ_err(enum LDKSecp256k1Error e);
3781 void CResult_PublicKeySecpErrorZ_free(struct LDKCResult_PublicKeySecpErrorZ _res);
3783 struct LDKCResult_TxCreationKeysSecpErrorZ CResult_TxCreationKeysSecpErrorZ_ok(struct LDKTxCreationKeys o);
3785 struct LDKCResult_TxCreationKeysSecpErrorZ CResult_TxCreationKeysSecpErrorZ_err(enum LDKSecp256k1Error e);
3787 void CResult_TxCreationKeysSecpErrorZ_free(struct LDKCResult_TxCreationKeysSecpErrorZ _res);
3789 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
3791 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
3793 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
3795 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
3797 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
3799 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
3801 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
3803 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
3805 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
3807 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
3809 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
3811 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
3813 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
3815 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
3817 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
3819 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
3821 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
3823 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
3825 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
3827 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
3829 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
3831 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
3833 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
3835 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
3837 void Event_free(struct LDKEvent this_ptr);
3839 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
3841 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
3843 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
3845 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
3848 * Calls the free function if one is set
3850 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
3853 * Calls the free function if one is set
3855 void EventsProvider_free(struct LDKEventsProvider this_ptr);
3857 void APIError_free(struct LDKAPIError this_ptr);
3859 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
3861 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
3864 * Returns the most verbose logging level.
3866 MUST_USE_RES enum LDKLevel Level_max(void);
3869 * Calls the free function if one is set
3871 void Logger_free(struct LDKLogger this_ptr);
3873 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_ptr);
3875 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
3878 * Confirmations we will wait for before considering the channel locked in.
3879 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3880 * equivalent limit applied to outbound channels).
3884 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
3887 * Confirmations we will wait for before considering the channel locked in.
3888 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3889 * equivalent limit applied to outbound channels).
3893 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
3896 * Set to the amount of time we require our counterparty to wait to claim their money.
3898 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3899 * be online to check for peer having broadcast a revoked transaction to steal our funds
3900 * at least once every our_to_self_delay blocks.
3902 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3903 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3906 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3907 * opening so you can tweak config to ask for more security, not less.
3909 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
3912 * Set to the amount of time we require our counterparty to wait to claim their money.
3914 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3915 * be online to check for peer having broadcast a revoked transaction to steal our funds
3916 * at least once every our_to_self_delay blocks.
3918 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3919 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3922 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3923 * opening so you can tweak config to ask for more security, not less.
3925 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
3928 * Set to the smallest value HTLC we will accept to process.
3930 * This value is sent to our counterparty on channel-open and we close the channel any time
3931 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3933 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
3936 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
3939 * Set to the smallest value HTLC we will accept to process.
3941 * This value is sent to our counterparty on channel-open and we close the channel any time
3942 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3944 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
3947 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
3949 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg);
3951 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
3953 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_ptr);
3955 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
3958 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
3959 * only applies to inbound channels.
3963 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
3966 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
3967 * only applies to inbound channels.
3971 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
3974 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
3975 * you to limit the maximum minimum-size they can require.
3977 * Default value: u64::max_value.
3979 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
3982 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
3983 * you to limit the maximum minimum-size they can require.
3985 * Default value: u64::max_value.
3987 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
3990 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
3991 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
3995 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
3998 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
3999 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
4003 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4006 * The remote node will require we keep a certain amount in direct payment to ourselves at all
4007 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
4008 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
4010 * Default value: u64::max_value.
4012 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4015 * The remote node will require we keep a certain amount in direct payment to ourselves at all
4016 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
4017 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
4019 * Default value: u64::max_value.
4021 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4024 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
4025 * time. This allows you to set a minimum such value.
4029 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4032 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
4033 * time. This allows you to set a minimum such value.
4037 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
4040 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
4041 * required to always be higher than this value so this only applies to HTLC outputs (and
4042 * potentially to-self outputs before any payments have been made).
4043 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4044 * This setting allows you to set a minimum dust limit for their commitment transactions,
4045 * reflecting the reality that tiny outputs are not considered standard transactions and will
4046 * not propagate through the Bitcoin network.
4048 * Default value: 546, the current dust limit on the Bitcoin network.
4050 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4053 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
4054 * required to always be higher than this value so this only applies to HTLC outputs (and
4055 * potentially to-self outputs before any payments have been made).
4056 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4057 * This setting allows you to set a minimum dust limit for their commitment transactions,
4058 * reflecting the reality that tiny outputs are not considered standard transactions and will
4059 * not propagate through the Bitcoin network.
4061 * Default value: 546, the current dust limit on the Bitcoin network.
4063 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4066 * Maximum allowed threshold above which outputs will not be generated in their commitment
4068 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4070 * Default value: u64::max_value.
4072 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4075 * Maximum allowed threshold above which outputs will not be generated in their commitment
4077 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4079 * Default value: u64::max_value.
4081 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4084 * Before a channel is usable the funding transaction will need to be confirmed by at least a
4085 * certain number of blocks, specified by the node which is not the funder (as the funder can
4086 * assume they aren't going to double-spend themselves).
4087 * This config allows you to set a limit on the maximum amount of time to wait.
4089 * Default value: 144, or roughly one day and only applies to outbound channels.
4091 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4094 * Before a channel is usable the funding transaction will need to be confirmed by at least a
4095 * certain number of blocks, specified by the node which is not the funder (as the funder can
4096 * assume they aren't going to double-spend themselves).
4097 * This config allows you to set a limit on the maximum amount of time to wait.
4099 * Default value: 144, or roughly one day and only applies to outbound channels.
4101 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
4104 * Set to force the incoming channel to match our announced channel preference in
4107 * Default value: true, to make the default that no announced channels are possible (which is
4108 * appropriate for any nodes which are not online very reliably).
4110 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4113 * Set to force the incoming channel to match our announced channel preference in
4116 * Default value: true, to make the default that no announced channels are possible (which is
4117 * appropriate for any nodes which are not online very reliably).
4119 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
4122 * Set to the amount of time we're willing to wait to claim money back to us.
4124 * Not checking this value would be a security issue, as our peer would be able to set it to
4125 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
4127 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
4128 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
4130 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4133 * Set to the amount of time we're willing to wait to claim money back to us.
4135 * Not checking this value would be a security issue, as our peer would be able to set it to
4136 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
4138 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
4139 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
4141 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
4143 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint64_t min_dust_limit_satoshis_arg, uint64_t max_dust_limit_satoshis_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
4145 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
4147 void ChannelConfig_free(struct LDKChannelConfig this_ptr);
4149 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
4152 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
4153 * This may be allowed to change at runtime in a later update, however doing so must result in
4154 * update messages sent to notify all nodes of our updated relay fee.
4158 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4161 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
4162 * This may be allowed to change at runtime in a later update, however doing so must result in
4163 * update messages sent to notify all nodes of our updated relay fee.
4167 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
4170 * Set to announce the channel publicly and notify all nodes that they can route via this
4173 * This should only be set to true for nodes which expect to be online reliably.
4175 * As the node which funds a channel picks this value this will only apply for new outbound
4176 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
4178 * This cannot be changed after the initial channel handshake.
4180 * Default value: false.
4182 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4185 * Set to announce the channel publicly and notify all nodes that they can route via this
4188 * This should only be set to true for nodes which expect to be online reliably.
4190 * As the node which funds a channel picks this value this will only apply for new outbound
4191 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
4193 * This cannot be changed after the initial channel handshake.
4195 * Default value: false.
4197 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
4200 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
4201 * supports it, they will then enforce the mutual-close output to us matches what we provided
4202 * at intialization, preventing us from closing to an alternate pubkey.
4204 * This is set to true by default to provide a slight increase in security, though ultimately
4205 * any attacker who is able to take control of a channel can just as easily send the funds via
4206 * lightning payments, so we never require that our counterparties support this option.
4208 * This cannot be changed after a channel has been initialized.
4210 * Default value: true.
4212 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4215 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
4216 * supports it, they will then enforce the mutual-close output to us matches what we provided
4217 * at intialization, preventing us from closing to an alternate pubkey.
4219 * This is set to true by default to provide a slight increase in security, though ultimately
4220 * any attacker who is able to take control of a channel can just as easily send the funds via
4221 * lightning payments, so we never require that our counterparties support this option.
4223 * This cannot be changed after a channel has been initialized.
4225 * Default value: true.
4227 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
4229 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
4231 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
4233 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
4235 struct LDKChannelConfig ChannelConfig_read(struct LDKu8slice ser);
4237 void UserConfig_free(struct LDKUserConfig this_ptr);
4239 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
4242 * Channel config that we propose to our counterparty.
4244 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4247 * Channel config that we propose to our counterparty.
4249 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
4252 * Limits applied to our counterparty's proposed channel config settings.
4254 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4257 * Limits applied to our counterparty's proposed channel config settings.
4259 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
4262 * Channel config which affects behavior during channel lifetime.
4264 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4267 * Channel config which affects behavior during channel lifetime.
4269 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
4271 MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg);
4273 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
4275 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
4278 * Calls the free function if one is set
4280 void Access_free(struct LDKAccess this_ptr);
4283 * Calls the free function if one is set
4285 void Watch_free(struct LDKWatch this_ptr);
4288 * Calls the free function if one is set
4290 void Filter_free(struct LDKFilter this_ptr);
4293 * Calls the free function if one is set
4295 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
4297 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
4300 * Calls the free function if one is set
4302 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
4304 void ChainMonitor_free(struct LDKChainMonitor this_ptr);
4307 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
4308 * of a channel and reacting accordingly based on transactions in the connected block. See
4309 * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
4310 * be returned by [`chain::Watch::release_pending_monitor_events`].
4312 * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
4313 * calls must not exclude any transactions matching the new outputs nor any in-block
4314 * descendants of such transactions. It is not necessary to re-fetch the block to obtain
4317 * [`ChannelMonitor::block_connected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_connected
4318 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
4319 * [`chain::Filter`]: ../trait.Filter.html
4321 void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
4324 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
4325 * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
4328 * [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
4330 void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
4333 * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
4335 * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
4336 * will call back to it indicating transactions and outputs of interest. This allows clients to
4337 * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
4338 * always need to fetch full blocks absent another means for determining which blocks contain
4339 * transactions relevant to the watched channels.
4341 * [`chain::Filter`]: ../trait.Filter.html
4343 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
4345 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
4347 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
4349 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_ptr);
4351 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
4354 * The sequence number of this update. Updates *must* be replayed in-order according to this
4355 * sequence number (and updates may panic if they are not). The update_id values are strictly
4356 * increasing and increase by one for each new update, with one exception specified below.
4358 * This sequence number is also used to track up to which points updates which returned
4359 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4360 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4362 * The only instance where update_id values are not strictly increasing is the case where we
4363 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
4364 * its docs for more details.
4366 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
4368 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
4371 * The sequence number of this update. Updates *must* be replayed in-order according to this
4372 * sequence number (and updates may panic if they are not). The update_id values are strictly
4373 * increasing and increase by one for each new update, with one exception specified below.
4375 * This sequence number is also used to track up to which points updates which returned
4376 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4377 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4379 * The only instance where update_id values are not strictly increasing is the case where we
4380 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
4381 * its docs for more details.
4383 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
4385 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
4387 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
4389 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
4391 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
4393 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_ptr);
4395 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
4397 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
4399 void HTLCUpdate_free(struct LDKHTLCUpdate this_ptr);
4401 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
4403 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
4405 struct LDKHTLCUpdate HTLCUpdate_read(struct LDKu8slice ser);
4407 void ChannelMonitor_free(struct LDKChannelMonitor this_ptr);
4409 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
4412 * Updates a ChannelMonitor on the basis of some new information provided by the Channel
4415 * panics if the given update is not the next update by update_id.
4417 MUST_USE_RES struct LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
4420 * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
4423 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
4426 * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
4428 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
4431 * Get the list of HTLCs who's status has been updated on chain. This should be called by
4432 * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
4434 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
4436 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
4439 * Gets the list of pending events which were generated by previous actions, clearing the list
4442 * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
4443 * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
4444 * no internal locking in ChannelMonitors.
4446 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
4449 * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
4450 * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
4451 * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
4452 * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
4453 * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
4454 * broadcast them if counterparty don't close channel with his higher commitment transaction after a
4455 * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
4456 * out-of-band the other node operator to coordinate with him if option is available to you.
4457 * In any-case, choice is up to the user.
4459 MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger);
4462 * Processes transactions in a newly connected block, which may result in any of the following:
4463 * - update the monitor's state against resolved HTLCs
4464 * - punish the counterparty in the case of seeing a revoked commitment transaction
4465 * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
4466 * - detect settled outputs for later spending
4467 * - schedule and bump any in-flight claims
4469 * Returns any new outputs to watch from `txdata`; after called, these are also included in
4470 * [`get_outputs_to_watch`].
4472 * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
4474 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ChannelMonitor_block_connected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
4477 * Determines if the disconnected block contained any transactions of interest and updates
4480 void ChannelMonitor_block_disconnected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
4483 * Calls the free function if one is set
4485 void Persist_free(struct LDKPersist this_ptr);
4487 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
4489 void OutPoint_free(struct LDKOutPoint this_ptr);
4491 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
4494 * The referenced transaction's txid.
4496 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
4499 * The referenced transaction's txid.
4501 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4504 * The index of the referenced output in its transaction's vout.
4506 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
4509 * The index of the referenced output in its transaction's vout.
4511 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
4513 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
4516 * Convert an `OutPoint` to a lightning channel id.
4518 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
4520 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
4522 struct LDKOutPoint OutPoint_read(struct LDKu8slice ser);
4524 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
4526 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
4528 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
4530 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
4532 struct LDKChannelKeys ChannelKeys_clone(const struct LDKChannelKeys *NONNULL_PTR orig);
4535 * Calls the free function if one is set
4537 void ChannelKeys_free(struct LDKChannelKeys this_ptr);
4540 * Calls the free function if one is set
4542 void KeysInterface_free(struct LDKKeysInterface this_ptr);
4544 void InMemoryChannelKeys_free(struct LDKInMemoryChannelKeys this_ptr);
4546 struct LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const struct LDKInMemoryChannelKeys *NONNULL_PTR orig);
4549 * Private key of anchor tx
4551 const uint8_t (*InMemoryChannelKeys_get_funding_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4554 * Private key of anchor tx
4556 void InMemoryChannelKeys_set_funding_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4559 * Holder secret key for blinded revocation pubkey
4561 const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4564 * Holder secret key for blinded revocation pubkey
4566 void InMemoryChannelKeys_set_revocation_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4569 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4571 const uint8_t (*InMemoryChannelKeys_get_payment_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4574 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4576 void InMemoryChannelKeys_set_payment_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4579 * Holder secret key used in HTLC tx
4581 const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4584 * Holder secret key used in HTLC tx
4586 void InMemoryChannelKeys_set_delayed_payment_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4589 * Holder htlc secret key used in commitment tx htlc outputs
4591 const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4594 * Holder htlc secret key used in commitment tx htlc outputs
4596 void InMemoryChannelKeys_set_htlc_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4601 const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4606 void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4609 * Create a new InMemoryChannelKeys
4611 MUST_USE_RES struct LDKInMemoryChannelKeys InMemoryChannelKeys_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKC2Tuple_u64u64Z key_derivation_params);
4614 * Counterparty pubkeys.
4615 * Will panic if ready_channel wasn't called.
4617 MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4620 * The contest_delay value specified by our counterparty and applied on holder-broadcastable
4621 * transactions, ie the amount of time that we have to wait to recover our funds if we
4622 * broadcast a transaction.
4623 * Will panic if ready_channel wasn't called.
4625 MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4628 * The contest_delay value specified by us and applied on transactions broadcastable
4629 * by our counterparty, ie the amount of time that they have to wait to recover their funds
4630 * if they broadcast a transaction.
4631 * Will panic if ready_channel wasn't called.
4633 MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4636 * Whether the holder is the initiator
4637 * Will panic if ready_channel wasn't called.
4639 MUST_USE_RES bool InMemoryChannelKeys_is_outbound(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4643 * Will panic if ready_channel wasn't called.
4645 MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4648 * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
4649 * building transactions.
4651 * Will panic if ready_channel wasn't called.
4653 MUST_USE_RES struct LDKChannelTransactionParameters InMemoryChannelKeys_get_channel_parameters(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4655 struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4657 struct LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj);
4659 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ InMemoryChannelKeys_read(struct LDKu8slice ser);
4661 void KeysManager_free(struct LDKKeysManager this_ptr);
4664 * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
4665 * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
4666 * starting_time isn't strictly required to actually be a time, but it must absolutely,
4667 * without a doubt, be unique to this instance. ie if you start multiple times with the same
4668 * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
4669 * simply use the current time (with very high precision).
4671 * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
4672 * obviously, starting_time should be unique every time you reload the library - it is only
4673 * used to generate new ephemeral key data (which will be stored by the individual channel if
4676 * Note that the seed is required to recover certain on-chain funds independent of
4677 * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
4678 * channel, and some on-chain during-closing funds.
4680 * Note that until the 0.1 release there is no guarantee of backward compatibility between
4681 * versions. Once the library is more fully supported, the docs will be updated to include a
4682 * detailed description of the guarantee.
4684 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], enum LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos);
4687 * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation
4689 * Key derivation parameters are accessible through a per-channel secrets
4690 * ChannelKeys::key_derivation_params and is provided inside DynamicOuputP2WSH in case of
4691 * onchain output detection for which a corresponding delayed_payment_key must be derived.
4693 MUST_USE_RES struct LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, uint64_t params_1, uint64_t params_2);
4695 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
4697 void ChannelManager_free(struct LDKChannelManager this_ptr);
4699 void ChannelDetails_free(struct LDKChannelDetails this_ptr);
4701 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
4704 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4705 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4706 * Note that this means this value is *not* persistent - it can change once during the
4707 * lifetime of the channel.
4709 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
4712 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4713 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4714 * Note that this means this value is *not* persistent - it can change once during the
4715 * lifetime of the channel.
4717 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4720 * The node_id of our counterparty
4722 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4725 * The node_id of our counterparty
4727 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
4730 * The Features the channel counterparty provided upon last connection.
4731 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4732 * many routing-relevant features are present in the init context.
4734 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4737 * The Features the channel counterparty provided upon last connection.
4738 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4739 * many routing-relevant features are present in the init context.
4741 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
4744 * The value, in satoshis, of this channel as appears in the funding output
4746 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4749 * The value, in satoshis, of this channel as appears in the funding output
4751 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4754 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4756 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4759 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4761 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4764 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4765 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4766 * available for inclusion in new outbound HTLCs). This further does not include any pending
4767 * outgoing HTLCs which are awaiting some other resolution to be sent.
4769 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4772 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4773 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4774 * available for inclusion in new outbound HTLCs). This further does not include any pending
4775 * outgoing HTLCs which are awaiting some other resolution to be sent.
4777 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4780 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4781 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4782 * available for inclusion in new inbound HTLCs).
4783 * Note that there are some corner cases not fully handled here, so the actual available
4784 * inbound capacity may be slightly higher than this.
4786 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4789 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4790 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4791 * available for inclusion in new inbound HTLCs).
4792 * Note that there are some corner cases not fully handled here, so the actual available
4793 * inbound capacity may be slightly higher than this.
4795 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4798 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4799 * the peer is connected, and (c) no monitor update failure is pending resolution.
4801 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4804 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4805 * the peer is connected, and (c) no monitor update failure is pending resolution.
4807 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
4809 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
4812 * Constructs a new ChannelManager to hold several channels and route between them.
4814 * This is the main \"logic hub\" for all channel-related actions, and implements
4815 * ChannelMessageHandler.
4817 * Non-proportional fees are fixed according to our risk using the provided fee estimator.
4819 * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
4821 * Users must provide the current blockchain height from which to track onchain channel
4822 * funding outpoints and send payments with reliable timelocks.
4824 * Users need to notify the new ChannelManager when a new block is connected or
4825 * disconnected using its `block_connected` and `block_disconnected` methods.
4827 MUST_USE_RES struct LDKChannelManager ChannelManager_new(enum LDKNetwork network, struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, uintptr_t current_blockchain_height);
4830 * Creates a new outbound channel to the given remote node and with the given value.
4832 * user_id will be provided back as user_channel_id in FundingGenerationReady and
4833 * FundingBroadcastSafe events to allow tracking of which events correspond with which
4834 * create_channel call. Note that user_channel_id defaults to 0 for inbound channels, so you
4835 * may wish to avoid using 0 for user_id here.
4837 * If successful, will generate a SendOpenChannel message event, so you should probably poll
4838 * PeerManager::process_events afterwards.
4840 * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
4841 * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
4843 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, struct LDKUserConfig override_config);
4846 * Gets the list of open channels, in random order. See ChannelDetail field documentation for
4849 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4852 * Gets the list of usable channels, in random order. Useful as an argument to
4853 * get_route to ensure non-announced channels are used.
4855 * These are guaranteed to have their is_live value set to true, see the documentation for
4856 * ChannelDetails::is_live for more info on exactly what the criteria are.
4858 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4861 * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
4862 * will be accepted on the given channel, and after additional timeout/the closing of all
4863 * pending HTLCs, the channel will be closed on chain.
4865 * May generate a SendShutdown message event on success, which should be relayed.
4867 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
4870 * Force closes a channel, immediately broadcasting the latest local commitment transaction to
4871 * the chain and rejecting new HTLCs on the given channel.
4873 void ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
4876 * Force close all channels, immediately broadcasting the latest local commitment transaction
4877 * for each to the chain and rejecting new HTLCs on each.
4879 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4882 * Sends a payment along a given route.
4884 * Value parameters are provided via the last hop in route, see documentation for RouteHop
4885 * fields for more info.
4887 * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
4888 * payment), we don't do anything to stop you! We always try to ensure that if the provided
4889 * next hop knows the preimage to payment_hash they can claim an additional amount as
4890 * specified in the last hop in the route! Thus, you should probably do your own
4891 * payment_preimage tracking (which you should already be doing as they represent \"proof of
4892 * payment\") and prevent double-sends yourself.
4894 * May generate SendHTLCs message(s) event on success, which should be relayed.
4896 * Each path may have a different return value, and PaymentSendValue may return a Vec with
4897 * each entry matching the corresponding-index entry in the route paths, see
4898 * PaymentSendFailure for more info.
4900 * In general, a path may raise:
4901 * * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
4902 * node public key) is specified.
4903 * * APIError::ChannelUnavailable if the next-hop channel is not available for updates
4904 * (including due to previous monitor update failure or new permanent monitor update
4906 * * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
4909 * Note that depending on the type of the PaymentSendFailure the HTLC may have been
4910 * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
4911 * different route unless you intend to pay twice!
4913 * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
4914 * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
4915 * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
4916 * must not contain multiple paths as multi-path payments require a recipient-provided
4918 * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
4919 * bit set (either as required or as available). If multiple paths are present in the Route,
4920 * we assume the invoice had the basic_mpp feature set.
4922 MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
4925 * Call this upon creation of a funding transaction for the given channel.
4927 * Note that ALL inputs in the transaction pointed to by funding_txo MUST spend SegWit outputs
4928 * or your counterparty can steal your funds!
4930 * Panics if a funding transaction has already been provided for this channel.
4932 * May panic if the funding_txo is duplicative with some other channel (note that this should
4933 * be trivially prevented by using unique funding transaction keys per-channel).
4935 void ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKOutPoint funding_txo);
4938 * Generates a signed node_announcement from the given arguments and creates a
4939 * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
4940 * seen a channel_announcement from us (ie unless we have public channels open).
4942 * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
4943 * to humans. They carry no in-protocol meaning.
4945 * addresses represent the set (possibly empty) of socket addresses on which this node accepts
4946 * incoming connections. These will be broadcast to the network, publicly tying these
4947 * addresses together. If you wish to preserve user privacy, addresses should likely contain
4948 * only Tor Onion addresses.
4950 * Panics if addresses is absurdly large (more than 500).
4952 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
4955 * Processes HTLCs which are pending waiting on random forward delay.
4957 * Should only really ever be called in response to a PendingHTLCsForwardable event.
4958 * Will likely generate further events.
4960 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
4963 * If a peer is disconnected we mark any channels with that peer as 'disabled'.
4964 * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
4965 * to inform the network about the uselessness of these channels.
4967 * This method handles all the details, and must be called roughly once per minute.
4969 void ChannelManager_timer_chan_freshness_every_min(const struct LDKChannelManager *NONNULL_PTR this_arg);
4972 * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
4973 * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
4974 * along the path (including in our own channel on which we received it).
4975 * Returns false if no payment was found to fail backwards, true if the process of failing the
4976 * HTLC backwards has been started.
4978 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKThirtyTwoBytes payment_secret);
4981 * Provides a payment preimage in response to a PaymentReceived event, returning true and
4982 * generating message events for the net layer to claim the payment, if possible. Thus, you
4983 * should probably kick the net layer to go send messages if this returns true!
4985 * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
4986 * available within a few percent of the expected amount. This is critical for several
4987 * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
4988 * payment_preimage without having provided the full value and b) it avoids certain
4989 * privacy-breaking recipient-probing attacks which may reveal payment activity to
4990 * motivated attackers.
4992 * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
4993 * set. Thus, for such payments we will claim any payments which do not under-pay.
4995 * May panic if called except in response to a PaymentReceived event.
4997 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t expected_amount);
5000 * Gets the node_id held by this ChannelManager
5002 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
5005 * Restores a single, given channel to normal operation after a
5006 * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
5009 * All ChannelMonitor updates up to and including highest_applied_update_id must have been
5010 * fully committed in every copy of the given channels' ChannelMonitors.
5012 * Note that there is no effect to calling with a highest_applied_update_id other than the
5013 * current latest ChannelMonitorUpdate and one call to this function after multiple
5014 * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
5015 * exists largely only to prevent races between this and concurrent update_monitor calls.
5017 * Thus, the anticipated use is, at a high level:
5018 * 1) You register a chain::Watch with this ChannelManager,
5019 * 2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
5020 * said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
5021 * any time it cannot do so instantly,
5022 * 3) update(s) are applied to each remote copy of a ChannelMonitor,
5023 * 4) once all remote copies are updated, you call this function with the update_id that
5024 * completed, and once it is the latest the Channel will be re-enabled.
5026 void ChannelManager_channel_monitor_updated(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOutPoint *NONNULL_PTR funding_txo, uint64_t highest_applied_update_id);
5028 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
5030 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
5033 * Updates channel state based on transactions seen in a connected block.
5035 void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
5038 * Updates channel state based on a disconnected block.
5040 * If necessary, the channel may be force-closed without letting the counterparty participate
5043 void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]);
5045 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
5047 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
5049 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_ptr);
5052 * The keys provider which will give us relevant keys. Some keys will be loaded during
5053 * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
5056 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5059 * The keys provider which will give us relevant keys. Some keys will be loaded during
5060 * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
5063 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
5066 * The fee_estimator for use in the ChannelManager in the future.
5068 * No calls to the FeeEstimator will be made during deserialization.
5070 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5073 * The fee_estimator for use in the ChannelManager in the future.
5075 * No calls to the FeeEstimator will be made during deserialization.
5077 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
5080 * The chain::Watch for use in the ChannelManager in the future.
5082 * No calls to the chain::Watch will be made during deserialization. It is assumed that
5083 * you have deserialized ChannelMonitors separately and will add them to your
5084 * chain::Watch after deserializing this ChannelManager.
5086 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5089 * The chain::Watch for use in the ChannelManager in the future.
5091 * No calls to the chain::Watch will be made during deserialization. It is assumed that
5092 * you have deserialized ChannelMonitors separately and will add them to your
5093 * chain::Watch after deserializing this ChannelManager.
5095 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
5098 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
5099 * used to broadcast the latest local commitment transactions of channels which must be
5100 * force-closed during deserialization.
5102 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5105 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
5106 * used to broadcast the latest local commitment transactions of channels which must be
5107 * force-closed during deserialization.
5109 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
5112 * The Logger for use in the ChannelManager and which may be used to log information during
5115 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5118 * The Logger for use in the ChannelManager and which may be used to log information during
5121 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
5124 * Default settings used for new channels. Any existing channels will continue to use the
5125 * runtime settings which were stored when the ChannelManager was serialized.
5127 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5130 * Default settings used for new channels. Any existing channels will continue to use the
5131 * runtime settings which were stored when the ChannelManager was serialized.
5133 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
5136 * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
5137 * HashMap for you. This is primarily useful for C bindings where it is not practical to
5138 * populate a HashMap directly from C.
5140 MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors);
5142 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
5144 void DecodeError_free(struct LDKDecodeError this_ptr);
5146 void Init_free(struct LDKInit this_ptr);
5148 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
5150 void ErrorMessage_free(struct LDKErrorMessage this_ptr);
5152 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
5155 * The channel ID involved in the error
5157 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
5160 * The channel ID involved in the error
5162 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5165 * A possibly human-readable error description.
5166 * The string should be sanitized before it is used (e.g. emitted to logs
5167 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
5168 * vulnerability in the terminal emulator or the logging subsystem.
5170 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
5173 * A possibly human-readable error description.
5174 * The string should be sanitized before it is used (e.g. emitted to logs
5175 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
5176 * vulnerability in the terminal emulator or the logging subsystem.
5178 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
5180 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg);
5182 void Ping_free(struct LDKPing this_ptr);
5184 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
5187 * The desired response length
5189 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
5192 * The desired response length
5194 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
5197 * The ping packet size.
5198 * This field is not sent on the wire. byteslen zeros are sent.
5200 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
5203 * The ping packet size.
5204 * This field is not sent on the wire. byteslen zeros are sent.
5206 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
5208 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
5210 void Pong_free(struct LDKPong this_ptr);
5212 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
5215 * The pong packet size.
5216 * This field is not sent on the wire. byteslen zeros are sent.
5218 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
5221 * The pong packet size.
5222 * This field is not sent on the wire. byteslen zeros are sent.
5224 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
5226 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
5228 void OpenChannel_free(struct LDKOpenChannel this_ptr);
5230 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
5233 * The genesis hash of the blockchain where the channel is to be opened
5235 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
5238 * The genesis hash of the blockchain where the channel is to be opened
5240 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5243 * A temporary channel ID, until the funding outpoint is announced
5245 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
5248 * A temporary channel ID, until the funding outpoint is announced
5250 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5255 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5260 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5263 * The amount to push to the counterparty as part of the open, in milli-satoshi
5265 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5268 * The amount to push to the counterparty as part of the open, in milli-satoshi
5270 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5273 * The threshold below which outputs on transactions broadcast by sender will be omitted
5275 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5278 * The threshold below which outputs on transactions broadcast by sender will be omitted
5280 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5283 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5285 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5288 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5290 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5293 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5295 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5298 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5300 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5303 * The minimum HTLC size incoming to sender, in milli-satoshi
5305 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5308 * The minimum HTLC size incoming to sender, in milli-satoshi
5310 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5313 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
5315 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5318 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
5320 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
5323 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5325 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5328 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5330 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
5333 * The maximum number of inbound HTLCs towards sender
5335 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5338 * The maximum number of inbound HTLCs towards sender
5340 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
5343 * The sender's key controlling the funding transaction
5345 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5348 * The sender's key controlling the funding transaction
5350 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5353 * Used to derive a revocation key for transactions broadcast by counterparty
5355 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5358 * Used to derive a revocation key for transactions broadcast by counterparty
5360 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5363 * A payment key to sender for transactions broadcast by counterparty
5365 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5368 * A payment key to sender for transactions broadcast by counterparty
5370 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5373 * Used to derive a payment key to sender for transactions broadcast by sender
5375 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5378 * Used to derive a payment key to sender for transactions broadcast by sender
5380 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5383 * Used to derive an HTLC payment key to sender
5385 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5388 * Used to derive an HTLC payment key to sender
5390 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5393 * The first to-be-broadcast-by-sender transaction's per commitment point
5395 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5398 * The first to-be-broadcast-by-sender transaction's per commitment point
5400 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5405 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5410 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
5412 void AcceptChannel_free(struct LDKAcceptChannel this_ptr);
5414 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
5417 * A temporary channel ID, until the funding outpoint is announced
5419 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
5422 * A temporary channel ID, until the funding outpoint is announced
5424 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5427 * The threshold below which outputs on transactions broadcast by sender will be omitted
5429 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5432 * The threshold below which outputs on transactions broadcast by sender will be omitted
5434 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5437 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5439 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5442 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5444 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5447 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5449 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5452 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5454 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5457 * The minimum HTLC size incoming to sender, in milli-satoshi
5459 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5462 * The minimum HTLC size incoming to sender, in milli-satoshi
5464 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5467 * Minimum depth of the funding transaction before the channel is considered open
5469 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5472 * Minimum depth of the funding transaction before the channel is considered open
5474 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
5477 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5479 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5482 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5484 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
5487 * The maximum number of inbound HTLCs towards sender
5489 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5492 * The maximum number of inbound HTLCs towards sender
5494 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
5497 * The sender's key controlling the funding transaction
5499 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5502 * The sender's key controlling the funding transaction
5504 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5507 * Used to derive a revocation key for transactions broadcast by counterparty
5509 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5512 * Used to derive a revocation key for transactions broadcast by counterparty
5514 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5517 * A payment key to sender for transactions broadcast by counterparty
5519 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5522 * A payment key to sender for transactions broadcast by counterparty
5524 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5527 * Used to derive a payment key to sender for transactions broadcast by sender
5529 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5532 * Used to derive a payment key to sender for transactions broadcast by sender
5534 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5537 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
5539 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5542 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
5544 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5547 * The first to-be-broadcast-by-sender transaction's per commitment point
5549 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5552 * The first to-be-broadcast-by-sender transaction's per commitment point
5554 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5556 void FundingCreated_free(struct LDKFundingCreated this_ptr);
5558 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
5561 * A temporary channel ID, until the funding is established
5563 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
5566 * A temporary channel ID, until the funding is established
5568 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5571 * The funding transaction ID
5573 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
5576 * The funding transaction ID
5578 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5581 * The specific output index funding this channel
5583 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
5586 * The specific output index funding this channel
5588 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
5591 * The signature of the channel initiator (funder) on the funding transaction
5593 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
5596 * The signature of the channel initiator (funder) on the funding transaction
5598 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
5600 MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKSignature signature_arg);
5602 void FundingSigned_free(struct LDKFundingSigned this_ptr);
5604 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
5609 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
5614 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5617 * The signature of the channel acceptor (fundee) on the funding transaction
5619 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
5622 * The signature of the channel acceptor (fundee) on the funding transaction
5624 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5626 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
5628 void FundingLocked_free(struct LDKFundingLocked this_ptr);
5630 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
5635 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
5640 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5643 * The per-commitment point of the second commitment transaction
5645 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
5648 * The per-commitment point of the second commitment transaction
5650 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5652 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
5654 void Shutdown_free(struct LDKShutdown this_ptr);
5656 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
5661 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
5666 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5669 * The destination of this peer's funds on closing.
5670 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5672 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
5675 * The destination of this peer's funds on closing.
5676 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5678 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
5680 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
5682 void ClosingSigned_free(struct LDKClosingSigned this_ptr);
5684 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
5689 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
5694 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5697 * The proposed total fee for the closing transaction
5699 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
5702 * The proposed total fee for the closing transaction
5704 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
5707 * A signature on the closing transaction
5709 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
5712 * A signature on the closing transaction
5714 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5716 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
5718 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_ptr);
5720 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
5725 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
5730 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5735 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5740 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
5743 * The HTLC value in milli-satoshi
5745 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5748 * The HTLC value in milli-satoshi
5750 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
5753 * The payment hash, the pre-image of which controls HTLC redemption
5755 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
5758 * The payment hash, the pre-image of which controls HTLC redemption
5760 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5763 * The expiry height of the HTLC
5765 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5768 * The expiry height of the HTLC
5770 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
5772 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_ptr);
5774 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
5779 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
5784 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5789 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
5794 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
5797 * The pre-image of the payment hash, allowing HTLC redemption
5799 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
5802 * The pre-image of the payment hash, allowing HTLC redemption
5804 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5806 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
5808 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_ptr);
5810 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
5815 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
5820 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5825 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
5830 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
5832 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_ptr);
5834 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
5839 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
5844 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5849 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
5854 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
5859 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
5864 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
5866 void CommitmentSigned_free(struct LDKCommitmentSigned this_ptr);
5868 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
5873 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
5878 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5881 * A signature on the commitment transaction
5883 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
5886 * A signature on the commitment transaction
5888 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5891 * Signatures on the HTLC transactions
5893 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
5895 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
5897 void RevokeAndACK_free(struct LDKRevokeAndACK this_ptr);
5899 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
5904 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
5909 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5912 * The secret corresponding to the per-commitment point
5914 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
5917 * The secret corresponding to the per-commitment point
5919 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5922 * The next sender-broadcast commitment transaction's per-commitment point
5924 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
5927 * The next sender-broadcast commitment transaction's per-commitment point
5929 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5931 MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg);
5933 void UpdateFee_free(struct LDKUpdateFee this_ptr);
5935 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
5940 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
5945 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5948 * Fee rate per 1000-weight of the transaction
5950 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
5953 * Fee rate per 1000-weight of the transaction
5955 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
5957 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
5959 void DataLossProtect_free(struct LDKDataLossProtect this_ptr);
5961 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
5964 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
5965 * belonging to the recipient
5967 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
5970 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
5971 * belonging to the recipient
5973 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5976 * The sender's per-commitment point for their current commitment transaction
5978 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
5981 * The sender's per-commitment point for their current commitment transaction
5983 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5985 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
5987 void ChannelReestablish_free(struct LDKChannelReestablish this_ptr);
5989 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
5994 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
5999 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6002 * The next commitment number for the sender
6004 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
6007 * The next commitment number for the sender
6009 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
6012 * The next commitment number for the recipient
6014 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
6017 * The next commitment number for the recipient
6019 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
6021 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_ptr);
6023 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
6028 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
6033 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6036 * The short channel ID
6038 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6041 * The short channel ID
6043 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
6046 * A signature by the node key
6048 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6051 * A signature by the node key
6053 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
6056 * A signature by the funding key
6058 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6061 * A signature by the funding key
6063 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
6065 MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKSignature node_signature_arg, struct LDKSignature bitcoin_signature_arg);
6067 void NetAddress_free(struct LDKNetAddress this_ptr);
6069 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
6071 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
6073 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
6075 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_ptr);
6077 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
6080 * The advertised features
6082 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6085 * The advertised features
6087 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
6090 * A strictly monotonic announcement counter, with gaps allowed
6092 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6095 * A strictly monotonic announcement counter, with gaps allowed
6097 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
6100 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
6103 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6106 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
6109 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6112 * An RGB color for UI purposes
6114 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
6117 * An RGB color for UI purposes
6119 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
6122 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
6125 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
6128 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
6131 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6134 * List of addresses on which this node is reachable
6136 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
6138 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_ptr);
6140 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
6143 * The signature by the node key
6145 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
6148 * The signature by the node key
6150 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6153 * The actual content of the announcement
6155 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
6158 * The actual content of the announcement
6160 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
6162 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
6164 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_ptr);
6166 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
6169 * The advertised channel features
6171 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6174 * The advertised channel features
6176 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
6179 * The genesis hash of the blockchain where the channel is to be opened
6181 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
6184 * The genesis hash of the blockchain where the channel is to be opened
6186 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6189 * The short channel ID
6191 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6194 * The short channel ID
6196 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
6199 * One of the two node_ids which are endpoints of this channel
6201 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6204 * One of the two node_ids which are endpoints of this channel
6206 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6209 * The other of the two node_ids which are endpoints of this channel
6211 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6214 * The other of the two node_ids which are endpoints of this channel
6216 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6219 * The funding key for the first node
6221 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6224 * The funding key for the first node
6226 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6229 * The funding key for the second node
6231 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6234 * The funding key for the second node
6236 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6238 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_ptr);
6240 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
6243 * Authentication of the announcement by the first public node
6245 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6248 * Authentication of the announcement by the first public node
6250 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6253 * Authentication of the announcement by the second public node
6255 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6258 * Authentication of the announcement by the second public node
6260 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6263 * Proof of funding UTXO ownership by the first public node
6265 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6268 * Proof of funding UTXO ownership by the first public node
6270 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6273 * Proof of funding UTXO ownership by the second public node
6275 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6278 * Proof of funding UTXO ownership by the second public node
6280 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6283 * The actual announcement
6285 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6288 * The actual announcement
6290 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
6292 MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKSignature node_signature_1_arg, struct LDKSignature node_signature_2_arg, struct LDKSignature bitcoin_signature_1_arg, struct LDKSignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg);
6294 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_ptr);
6296 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
6299 * The genesis hash of the blockchain where the channel is to be opened
6301 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
6304 * The genesis hash of the blockchain where the channel is to be opened
6306 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6309 * The short channel ID
6311 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6314 * The short channel ID
6316 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
6319 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
6321 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6324 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
6326 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6331 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6336 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
6339 * The number of blocks to subtract from incoming HTLC cltv_expiry values
6341 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6344 * The number of blocks to subtract from incoming HTLC cltv_expiry values
6346 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
6349 * The minimum HTLC size incoming to sender, in milli-satoshi
6351 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6354 * The minimum HTLC size incoming to sender, in milli-satoshi
6356 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
6359 * The base HTLC fee charged by sender, in milli-satoshi
6361 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6364 * The base HTLC fee charged by sender, in milli-satoshi
6366 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6369 * The amount to fee multiplier, in micro-satoshi
6371 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6374 * The amount to fee multiplier, in micro-satoshi
6376 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6378 void ChannelUpdate_free(struct LDKChannelUpdate this_ptr);
6380 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
6383 * A signature of the channel update
6385 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
6388 * A signature of the channel update
6390 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
6393 * The actual channel update
6395 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
6398 * The actual channel update
6400 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
6402 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
6404 void QueryChannelRange_free(struct LDKQueryChannelRange this_ptr);
6406 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
6409 * The genesis hash of the blockchain being queried
6411 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
6414 * The genesis hash of the blockchain being queried
6416 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6419 * The height of the first block for the channel UTXOs being queried
6421 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
6424 * The height of the first block for the channel UTXOs being queried
6426 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6429 * The number of blocks to include in the query results
6431 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
6434 * The number of blocks to include in the query results
6436 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6438 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
6440 void ReplyChannelRange_free(struct LDKReplyChannelRange this_ptr);
6442 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
6445 * The genesis hash of the blockchain being queried
6447 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
6450 * The genesis hash of the blockchain being queried
6452 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6455 * The height of the first block in the range of the reply
6457 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6460 * The height of the first block in the range of the reply
6462 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6465 * The number of blocks included in the range of the reply
6467 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6470 * The number of blocks included in the range of the reply
6472 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6475 * Indicates if the query recipient maintains up-to-date channel
6476 * information for the chain_hash
6478 bool ReplyChannelRange_get_full_information(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6481 * Indicates if the query recipient maintains up-to-date channel
6482 * information for the chain_hash
6484 void ReplyChannelRange_set_full_information(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
6487 * The short_channel_ids in the channel range
6489 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
6491 MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool full_information_arg, struct LDKCVec_u64Z short_channel_ids_arg);
6493 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_ptr);
6495 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
6498 * The genesis hash of the blockchain being queried
6500 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
6503 * The genesis hash of the blockchain being queried
6505 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6508 * The short_channel_ids that are being queried
6510 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
6512 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
6514 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_ptr);
6516 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
6519 * The genesis hash of the blockchain that was queried
6521 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
6524 * The genesis hash of the blockchain that was queried
6526 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6529 * Indicates if the query recipient maintains up-to-date channel
6530 * information for the chain_hash
6532 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
6535 * Indicates if the query recipient maintains up-to-date channel
6536 * information for the chain_hash
6538 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
6540 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
6542 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_ptr);
6544 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
6547 * The genesis hash of the blockchain for channel and node information
6549 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
6552 * The genesis hash of the blockchain for channel and node information
6554 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6557 * The starting unix timestamp
6559 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
6562 * The starting unix timestamp
6564 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
6567 * The range of information in seconds
6569 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
6572 * The range of information in seconds
6574 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
6576 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
6578 void ErrorAction_free(struct LDKErrorAction this_ptr);
6580 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
6582 void LightningError_free(struct LDKLightningError this_ptr);
6585 * A human-readable message describing the error
6587 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
6590 * A human-readable message describing the error
6592 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
6595 * The action which should be taken against the offending peer.
6597 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
6600 * The action which should be taken against the offending peer.
6602 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
6604 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
6606 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_ptr);
6608 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
6611 * update_add_htlc messages which should be sent
6613 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
6616 * update_fulfill_htlc messages which should be sent
6618 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
6621 * update_fail_htlc messages which should be sent
6623 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
6626 * update_fail_malformed_htlc messages which should be sent
6628 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
6631 * An update_fee message which should be sent
6633 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
6636 * An update_fee message which should be sent
6638 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
6641 * Finally, the commitment_signed message which should be sent
6643 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
6646 * Finally, the commitment_signed message which should be sent
6648 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
6650 MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, struct LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, struct LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, struct LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg);
6652 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
6654 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
6657 * Calls the free function if one is set
6659 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
6662 * Calls the free function if one is set
6664 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
6666 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
6668 struct LDKAcceptChannel AcceptChannel_read(struct LDKu8slice ser);
6670 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
6672 struct LDKAnnouncementSignatures AnnouncementSignatures_read(struct LDKu8slice ser);
6674 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
6676 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
6678 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
6680 struct LDKClosingSigned ClosingSigned_read(struct LDKu8slice ser);
6682 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
6684 struct LDKCommitmentSigned CommitmentSigned_read(struct LDKu8slice ser);
6686 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
6688 struct LDKFundingCreated FundingCreated_read(struct LDKu8slice ser);
6690 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
6692 struct LDKFundingSigned FundingSigned_read(struct LDKu8slice ser);
6694 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
6696 struct LDKFundingLocked FundingLocked_read(struct LDKu8slice ser);
6698 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
6700 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
6702 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
6704 struct LDKOpenChannel OpenChannel_read(struct LDKu8slice ser);
6706 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
6708 struct LDKRevokeAndACK RevokeAndACK_read(struct LDKu8slice ser);
6710 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
6712 struct LDKShutdown Shutdown_read(struct LDKu8slice ser);
6714 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
6716 struct LDKUpdateFailHTLC UpdateFailHTLC_read(struct LDKu8slice ser);
6718 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
6720 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
6722 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
6724 struct LDKUpdateFee UpdateFee_read(struct LDKu8slice ser);
6726 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
6728 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(struct LDKu8slice ser);
6730 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
6732 struct LDKUpdateAddHTLC UpdateAddHTLC_read(struct LDKu8slice ser);
6734 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
6736 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
6738 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
6740 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
6742 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
6744 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
6746 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
6748 struct LDKChannelAnnouncement ChannelAnnouncement_read(struct LDKu8slice ser);
6750 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
6752 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
6754 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
6756 struct LDKChannelUpdate ChannelUpdate_read(struct LDKu8slice ser);
6758 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
6760 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
6762 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
6764 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
6766 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
6768 struct LDKNodeAnnouncement NodeAnnouncement_read(struct LDKu8slice ser);
6770 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
6772 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
6774 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
6776 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
6778 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
6780 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
6782 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
6784 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
6786 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
6788 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
6790 void MessageHandler_free(struct LDKMessageHandler this_ptr);
6793 * A message handler which handles messages specific to channels. Usually this is just a
6794 * ChannelManager object.
6796 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
6799 * A message handler which handles messages specific to channels. Usually this is just a
6800 * ChannelManager object.
6802 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
6805 * A message handler which handles messages updating our knowledge of the network channel
6806 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6808 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
6811 * A message handler which handles messages updating our knowledge of the network channel
6812 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6814 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
6816 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
6818 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
6821 * Calls the free function if one is set
6823 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
6825 void PeerHandleError_free(struct LDKPeerHandleError this_ptr);
6828 * Used to indicate that we probably can't make any future connections to this peer, implying
6829 * we should go ahead and force-close any channels we have with it.
6831 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
6834 * Used to indicate that we probably can't make any future connections to this peer, implying
6835 * we should go ahead and force-close any channels we have with it.
6837 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
6839 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
6841 void PeerManager_free(struct LDKPeerManager this_ptr);
6844 * Constructs a new PeerManager with the given message handlers and node_id secret key
6845 * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
6846 * cryptographically secure random bytes.
6848 MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger);
6851 * Get the list of node ids for peers which have completed the initial handshake.
6853 * For outbound connections, this will be the same as the their_node_id parameter passed in to
6854 * new_outbound_connection, however entries will only appear once the initial handshake has
6855 * completed and we are sure the remote peer has the private key for the given node_id.
6857 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
6860 * Indicates a new outbound connection has been established to a node with the given node_id.
6861 * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
6862 * descriptor but must disconnect the connection immediately.
6864 * Returns a small number of bytes to send to the remote node (currently always 50).
6866 * Panics if descriptor is duplicative with some other descriptor which has not yet had a
6867 * socket_disconnected().
6869 MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor);
6872 * Indicates a new inbound connection has been established.
6874 * May refuse the connection by returning an Err, but will never write bytes to the remote end
6875 * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
6876 * call socket_disconnected for the new descriptor but must disconnect the connection
6879 * Panics if descriptor is duplicative with some other descriptor which has not yet had
6880 * socket_disconnected called.
6882 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
6885 * Indicates that there is room to write data to the given socket descriptor.
6887 * May return an Err to indicate that the connection should be closed.
6889 * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
6890 * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
6891 * invariants around calling write_buffer_space_avail in case a write did not fully complete
6892 * must still hold - be ready to call write_buffer_space_avail again if a write call generated
6893 * here isn't sufficient! Panics if the descriptor was not previously registered in a
6894 * new_\\*_connection event.
6896 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
6899 * Indicates that data was read from the given socket descriptor.
6901 * May return an Err to indicate that the connection should be closed.
6903 * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
6904 * Thus, however, you almost certainly want to call process_events() after any read_event to
6905 * generate send_data calls to handle responses.
6907 * If Ok(true) is returned, further read_events should not be triggered until a send_data call
6908 * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
6910 * Panics if the descriptor was not previously registered in a new_*_connection event.
6912 MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data);
6915 * Checks for any events generated by our handlers and processes them. Includes sending most
6916 * response messages as well as messages generated by calls to handler functions directly (eg
6917 * functions like ChannelManager::process_pending_htlc_forward or send_payment).
6919 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
6922 * Indicates that the given socket descriptor's connection is now closed.
6924 * This must only be called if the socket has been disconnected by the peer or your own
6925 * decision to disconnect it and must NOT be called in any case where other parts of this
6926 * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
6929 * Panics if the descriptor was not previously registered in a successful new_*_connection event.
6931 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
6934 * This function should be called roughly once every 30 seconds.
6935 * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
6936 * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
6938 void PeerManager_timer_tick_occured(const struct LDKPeerManager *NONNULL_PTR this_arg);
6941 * Build the commitment secret from the seed and the commitment number
6943 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
6946 * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
6947 * from the base secret and the per_commitment_point.
6949 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6950 * generated (ie our own).
6952 struct LDKCResult_SecretKeySecpErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
6955 * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
6956 * from the base point and the per_commitment_key. This is the public equivalent of
6957 * derive_private_key - using only public keys to derive a public key instead of private keys.
6959 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6960 * generated (ie our own).
6962 struct LDKCResult_PublicKeySecpErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
6965 * Derives a per-commitment-transaction revocation key from its constituent parts.
6967 * Only the cheating participant owns a valid witness to propagate a revoked
6968 * commitment transaction, thus per_commitment_secret always come from cheater
6969 * and revocation_base_secret always come from punisher, which is the broadcaster
6970 * of the transaction spending with this key knowledge.
6972 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6973 * generated (ie our own).
6975 struct LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
6978 * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
6979 * the public equivalend of derive_private_revocation_key - using only public keys to derive a
6980 * public key instead of private keys.
6982 * Only the cheating participant owns a valid witness to propagate a revoked
6983 * commitment transaction, thus per_commitment_point always come from cheater
6984 * and revocation_base_point always come from punisher, which is the broadcaster
6985 * of the transaction spending with this key knowledge.
6987 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6988 * generated (ie our own).
6990 struct LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
6992 void TxCreationKeys_free(struct LDKTxCreationKeys this_ptr);
6994 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
6997 * The broadcaster's per-commitment public key which was used to derive the other keys.
6999 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7002 * The broadcaster's per-commitment public key which was used to derive the other keys.
7004 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7007 * The revocation key which is used to allow the broadcaster of the commitment
7008 * transaction to provide their counterparty the ability to punish them if they broadcast
7011 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7014 * The revocation key which is used to allow the broadcaster of the commitment
7015 * transaction to provide their counterparty the ability to punish them if they broadcast
7018 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7021 * Broadcaster's HTLC Key
7023 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7026 * Broadcaster's HTLC Key
7028 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7031 * Countersignatory's HTLC Key
7033 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7036 * Countersignatory's HTLC Key
7038 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7041 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
7043 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7046 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
7048 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7050 MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKPublicKey revocation_key_arg, struct LDKPublicKey broadcaster_htlc_key_arg, struct LDKPublicKey countersignatory_htlc_key_arg, struct LDKPublicKey broadcaster_delayed_payment_key_arg);
7052 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
7054 struct LDKTxCreationKeys TxCreationKeys_read(struct LDKu8slice ser);
7056 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_ptr);
7058 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
7061 * The public key which is used to sign all commitment transactions, as it appears in the
7062 * on-chain channel lock-in 2-of-2 multisig output.
7064 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7067 * The public key which is used to sign all commitment transactions, as it appears in the
7068 * on-chain channel lock-in 2-of-2 multisig output.
7070 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7073 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
7074 * revocation keys. This is combined with the per-commitment-secret generated by the
7075 * counterparty to create a secret which the counterparty can reveal to revoke previous
7078 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7081 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
7082 * revocation keys. This is combined with the per-commitment-secret generated by the
7083 * counterparty to create a secret which the counterparty can reveal to revoke previous
7086 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7089 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
7090 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
7091 * static across every commitment transaction.
7093 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7096 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
7097 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
7098 * static across every commitment transaction.
7100 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7103 * The base point which is used (with derive_public_key) to derive a per-commitment payment
7104 * public key which receives non-HTLC-encumbered funds which are only available for spending
7105 * after some delay (or can be claimed via the revocation path).
7107 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7110 * The base point which is used (with derive_public_key) to derive a per-commitment payment
7111 * public key which receives non-HTLC-encumbered funds which are only available for spending
7112 * after some delay (or can be claimed via the revocation path).
7114 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7117 * The base point which is used (with derive_public_key) to derive a per-commitment public key
7118 * which is used to encumber HTLC-in-flight outputs.
7120 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7123 * The base point which is used (with derive_public_key) to derive a per-commitment public key
7124 * which is used to encumber HTLC-in-flight outputs.
7126 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7128 MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg);
7130 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
7132 struct LDKChannelPublicKeys ChannelPublicKeys_read(struct LDKu8slice ser);
7135 * Create per-state keys from channel base points and the per-commitment point.
7136 * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
7138 MUST_USE_RES struct LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, struct LDKPublicKey broadcaster_delayed_payment_base, struct LDKPublicKey broadcaster_htlc_base, struct LDKPublicKey countersignatory_revocation_base, struct LDKPublicKey countersignatory_htlc_base);
7141 * Generate per-state keys from channel static keys.
7142 * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
7144 MUST_USE_RES struct LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys);
7147 * A script either spendable by the revocation
7148 * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
7149 * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
7151 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
7153 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_ptr);
7155 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
7158 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
7159 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
7160 * need to compare this value to whether the commitment transaction in question is that of
7161 * the counterparty or our own.
7163 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7166 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
7167 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
7168 * need to compare this value to whether the commitment transaction in question is that of
7169 * the counterparty or our own.
7171 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
7174 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
7175 * this divided by 1000.
7177 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7180 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
7181 * this divided by 1000.
7183 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
7186 * The CLTV lock-time at which this HTLC expires.
7188 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7191 * The CLTV lock-time at which this HTLC expires.
7193 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
7196 * The hash of the preimage which unlocks this HTLC.
7198 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
7201 * The hash of the preimage which unlocks this HTLC.
7203 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7205 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
7207 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(struct LDKu8slice ser);
7210 * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
7211 * does not need to have its previous_output_index filled.
7213 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
7216 * Gets the redeemscript for a funding output from the two funding public keys.
7217 * Note that the order of funding public keys does not matter.
7219 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
7222 * panics if htlc.transaction_output_index.is_none()!
7224 struct LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
7226 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_ptr);
7228 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
7231 * Holder public keys
7233 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7236 * Holder public keys
7238 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
7241 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
7243 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7246 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
7248 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
7251 * Whether the holder is the initiator of this channel.
7252 * This is an input to the commitment number obscure factor computation.
7254 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7257 * Whether the holder is the initiator of this channel.
7258 * This is an input to the commitment number obscure factor computation.
7260 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
7263 * The late-bound counterparty channel transaction parameters.
7264 * These parameters are populated at the point in the protocol where the counterparty provides them.
7266 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7269 * The late-bound counterparty channel transaction parameters.
7270 * These parameters are populated at the point in the protocol where the counterparty provides them.
7272 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
7275 * The late-bound funding outpoint
7277 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7280 * The late-bound funding outpoint
7282 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
7284 MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg);
7286 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_ptr);
7288 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
7291 * Counter-party public keys
7293 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
7296 * Counter-party public keys
7298 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
7301 * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
7303 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
7306 * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
7308 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
7310 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
7313 * Whether the late bound parameters are populated.
7315 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7318 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
7319 * given that the holder is the broadcaster.
7321 * self.is_populated() must be true before calling this function.
7323 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7326 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
7327 * given that the counterparty is the broadcaster.
7329 * self.is_populated() must be true before calling this function.
7331 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7333 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
7335 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
7337 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
7339 struct LDKChannelTransactionParameters ChannelTransactionParameters_read(struct LDKu8slice ser);
7341 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_ptr);
7344 * Get the channel pubkeys for the broadcaster
7346 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7349 * Get the channel pubkeys for the countersignatory
7351 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7354 * Get the contest delay applicable to the transactions.
7355 * Note that the contest delay was selected by the countersignatory.
7357 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7360 * Whether the channel is outbound from the broadcaster.
7362 * The boolean representing the side that initiated the channel is
7363 * an input to the commitment number obscure factor computation.
7365 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7368 * The funding outpoint
7370 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7372 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_ptr);
7374 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
7377 * Our counterparty's signature for the transaction
7379 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
7382 * Our counterparty's signature for the transaction
7384 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
7387 * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
7389 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
7391 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
7393 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(struct LDKu8slice ser);
7396 * Create a new holder transaction with the given counterparty signatures.
7397 * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
7399 MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, struct LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key);
7401 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_ptr);
7403 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
7406 * The commitment transaction
7408 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
7411 * The commitment transaction
7413 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
7416 * The txid for the commitment transaction.
7418 * This is provided as a performance optimization, instead of calling transaction.txid()
7421 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
7424 * The txid for the commitment transaction.
7426 * This is provided as a performance optimization, instead of calling transaction.txid()
7429 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7431 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
7433 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
7435 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_read(struct LDKu8slice ser);
7438 * Get the SIGHASH_ALL sighash value of the transaction.
7440 * This can be used to verify a signature.
7442 MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
7445 * Sign a transaction, either because we are counter-signing the counterparty's transaction or
7446 * because we are about to broadcast a holder transaction.
7448 MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
7450 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_ptr);
7452 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
7454 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
7456 struct LDKCommitmentTransaction CommitmentTransaction_read(struct LDKu8slice ser);
7459 * The backwards-counting commitment number
7461 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7464 * The value to be sent to the broadcaster
7466 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7469 * The value to be sent to the counterparty
7471 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7474 * The feerate paid per 1000-weight-unit in this commitment transaction.
7476 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7479 * Trust our pre-built transaction and derived transaction creation public keys.
7481 * Applies a wrapper which allows access to these fields.
7483 * This should only be used if you fully trust the builder of this object. It should not
7484 *\tbe used by an external signer - instead use the verify function.
7486 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7489 * Verify our pre-built transaction and derived transaction creation public keys.
7491 * Applies a wrapper which allows access to these fields.
7493 * An external validating signer must call this method before signing
7494 * or using the built transaction.
7496 MUST_USE_RES struct LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys);
7498 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_ptr);
7501 * The transaction ID of the built Bitcoin transaction
7503 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7506 * The pre-built Bitcoin commitment transaction
7508 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7511 * The pre-calculated transaction creation public keys.
7513 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7516 * Get a signature for each HTLC which was included in the commitment transaction (ie for
7517 * which HTLCOutputInCommitment::transaction_output_index.is_some()).
7519 * The returned Vec has one entry for each HTLC, and in the same order.
7521 MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters);
7524 * Get the transaction number obscure factor
7526 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
7528 void InitFeatures_free(struct LDKInitFeatures this_ptr);
7530 void NodeFeatures_free(struct LDKNodeFeatures this_ptr);
7532 void ChannelFeatures_free(struct LDKChannelFeatures this_ptr);
7534 void RouteHop_free(struct LDKRouteHop this_ptr);
7536 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
7539 * The node_id of the node at this hop.
7541 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7544 * The node_id of the node at this hop.
7546 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7549 * The node_announcement features of the node at this hop. For the last hop, these may be
7550 * amended to match the features present in the invoice this node generated.
7552 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7555 * The node_announcement features of the node at this hop. For the last hop, these may be
7556 * amended to match the features present in the invoice this node generated.
7558 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
7561 * The channel that should be used from the previous hop to reach this node.
7563 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7566 * The channel that should be used from the previous hop to reach this node.
7568 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
7571 * The channel_announcement features of the channel that should be used from the previous hop
7572 * to reach this node.
7574 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7577 * The channel_announcement features of the channel that should be used from the previous hop
7578 * to reach this node.
7580 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
7583 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
7585 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7588 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
7590 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
7593 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
7594 * expected at the destination, in excess of the current block height.
7596 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7599 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
7600 * expected at the destination, in excess of the current block height.
7602 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
7604 MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg);
7606 void Route_free(struct LDKRoute this_ptr);
7608 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
7611 * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
7612 * last RouteHop in each path must be the same.
7613 * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
7614 * destination. Thus, this must always be at least length one. While the maximum length of any
7615 * given path is variable, keeping the length of any path to less than 20 should currently
7616 * ensure it is viable.
7618 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
7620 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
7622 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
7624 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
7626 void RouteHint_free(struct LDKRouteHint this_ptr);
7628 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
7631 * The node_id of the non-target end of the route
7633 struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7636 * The node_id of the non-target end of the route
7638 void RouteHint_set_src_node_id(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7641 * The short_channel_id of this channel
7643 uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7646 * The short_channel_id of this channel
7648 void RouteHint_set_short_channel_id(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
7651 * The fees which must be paid to use this channel
7653 struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7656 * The fees which must be paid to use this channel
7658 void RouteHint_set_fees(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
7661 * The difference in CLTV values between this node and the next node.
7663 uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7666 * The difference in CLTV values between this node and the next node.
7668 void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val);
7671 * The minimum value, in msat, which must be relayed to the next hop.
7673 uint64_t RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7676 * The minimum value, in msat, which must be relayed to the next hop.
7678 void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
7680 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg);
7683 * Gets a route from us to the given target node.
7685 * Extra routing hops between known nodes and the target will be used if they are included in
7688 * If some channels aren't announced, it may be useful to fill in a first_hops with the
7689 * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
7690 * view of our local channels (from net_graph_msg_handler) will be ignored, and only those in first_hops
7693 * Panics if first_hops contains channels without short_channel_ids
7694 * (ChannelManager::list_usable_channels will never include such channels).
7696 * The fees on channels from us to next-hops are ignored (as they are assumed to all be
7697 * equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat
7698 * *is* checked as they may change based on the receiving node.
7700 struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey target, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
7702 void NetworkGraph_free(struct LDKNetworkGraph this_ptr);
7704 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr);
7706 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_ptr);
7709 * Creates a new tracker of the actual state of the network of channels and nodes,
7710 * assuming a fresh network graph.
7711 * Chain monitor is used to make sure announced channels exist on-chain,
7712 * channel data is correct, and that the announcement is signed with
7713 * channel owners' keys.
7715 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
7718 * Creates a new tracker of the actual state of the network of channels and nodes,
7719 * assuming an existing Network Graph.
7721 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
7724 * Take a read lock on the network_graph and return it in the C-bindings
7725 * newtype helper. This is likely only useful when called via the C
7726 * bindings as you can call `self.network_graph.read().unwrap()` in Rust
7729 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7732 * Get a reference to the NetworkGraph which this read-lock contains.
7734 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
7736 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7738 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7740 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_ptr);
7743 * When the last update to the channel direction was issued.
7744 * Value is opaque, as set in the announcement.
7746 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7749 * When the last update to the channel direction was issued.
7750 * Value is opaque, as set in the announcement.
7752 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
7755 * Whether the channel can be currently used for payments (in this one direction).
7757 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7760 * Whether the channel can be currently used for payments (in this one direction).
7762 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
7765 * The difference in CLTV values that you must have when routing through this channel.
7767 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7770 * The difference in CLTV values that you must have when routing through this channel.
7772 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
7775 * The minimum value, which must be relayed to the next hop via the channel
7777 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7780 * The minimum value, which must be relayed to the next hop via the channel
7782 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
7785 * Fees charged when the channel is used for routing
7787 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7790 * Fees charged when the channel is used for routing
7792 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
7795 * Most recent update for the channel received from the network
7796 * Mostly redundant with the data we store in fields explicitly.
7797 * Everything else is useful only for sending out for initial routing sync.
7798 * Not stored if contains excess data to prevent DoS.
7800 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7803 * Most recent update for the channel received from the network
7804 * Mostly redundant with the data we store in fields explicitly.
7805 * Everything else is useful only for sending out for initial routing sync.
7806 * Not stored if contains excess data to prevent DoS.
7808 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
7810 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
7812 struct LDKDirectionalChannelInfo DirectionalChannelInfo_read(struct LDKu8slice ser);
7814 void ChannelInfo_free(struct LDKChannelInfo this_ptr);
7817 * Protocol features of a channel communicated during its announcement
7819 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7822 * Protocol features of a channel communicated during its announcement
7824 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
7827 * Source node of the first direction of a channel
7829 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7832 * Source node of the first direction of a channel
7834 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7837 * Details about the first direction of a channel
7839 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7842 * Details about the first direction of a channel
7844 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
7847 * Source node of the second direction of a channel
7849 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7852 * Source node of the second direction of a channel
7854 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7857 * Details about the second direction of a channel
7859 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7862 * Details about the second direction of a channel
7864 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
7867 * An initial announcement of the channel
7868 * Mostly redundant with the data we store in fields explicitly.
7869 * Everything else is useful only for sending out for initial routing sync.
7870 * Not stored if contains excess data to prevent DoS.
7872 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7875 * An initial announcement of the channel
7876 * Mostly redundant with the data we store in fields explicitly.
7877 * Everything else is useful only for sending out for initial routing sync.
7878 * Not stored if contains excess data to prevent DoS.
7880 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
7882 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
7884 struct LDKChannelInfo ChannelInfo_read(struct LDKu8slice ser);
7886 void RoutingFees_free(struct LDKRoutingFees this_ptr);
7888 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
7891 * Flat routing fee in satoshis
7893 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
7896 * Flat routing fee in satoshis
7898 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
7901 * Liquidity-based routing fee in millionths of a routed amount.
7902 * In other words, 10000 is 1%.
7904 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
7907 * Liquidity-based routing fee in millionths of a routed amount.
7908 * In other words, 10000 is 1%.
7910 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
7912 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
7914 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
7916 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
7918 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_ptr);
7921 * Protocol features the node announced support for
7923 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
7926 * Protocol features the node announced support for
7928 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
7931 * When the last known update to the node state was issued.
7932 * Value is opaque, as set in the announcement.
7934 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
7937 * When the last known update to the node state was issued.
7938 * Value is opaque, as set in the announcement.
7940 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
7943 * Color assigned to the node
7945 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
7948 * Color assigned to the node
7950 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
7953 * Moniker assigned to the node.
7954 * May be invalid or malicious (eg control chars),
7955 * should not be exposed to the user.
7957 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
7960 * Moniker assigned to the node.
7961 * May be invalid or malicious (eg control chars),
7962 * should not be exposed to the user.
7964 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7967 * Internet-level addresses via which one can connect to the node
7969 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
7972 * An initial announcement of the node
7973 * Mostly redundant with the data we store in fields explicitly.
7974 * Everything else is useful only for sending out for initial routing sync.
7975 * Not stored if contains excess data to prevent DoS.
7977 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
7980 * An initial announcement of the node
7981 * Mostly redundant with the data we store in fields explicitly.
7982 * Everything else is useful only for sending out for initial routing sync.
7983 * Not stored if contains excess data to prevent DoS.
7985 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
7987 MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg);
7989 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
7991 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
7993 void NodeInfo_free(struct LDKNodeInfo this_ptr);
7996 * All valid channels a node has announced
7998 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
8001 * Lowest fees enabling routing via any of the enabled, known channels to a node.
8002 * The two fields (flat and proportional fee) are independent,
8003 * meaning they don't have to refer to the same channel.
8005 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
8008 * Lowest fees enabling routing via any of the enabled, known channels to a node.
8009 * The two fields (flat and proportional fee) are independent,
8010 * meaning they don't have to refer to the same channel.
8012 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
8015 * More information about a node from node_announcement.
8016 * Optional because we store a Node entry after learning about it from
8017 * a channel announcement, but before receiving a node announcement.
8019 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
8022 * More information about a node from node_announcement.
8023 * Optional because we store a Node entry after learning about it from
8024 * a channel announcement, but before receiving a node announcement.
8026 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
8028 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
8030 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
8032 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
8034 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
8036 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
8039 * Creates a new, empty, network graph.
8041 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
8044 * For an already known node (from channel announcements), update its stored properties from a
8045 * given node announcement.
8047 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8048 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8049 * routing messages from a source using a protocol other than the lightning P2P protocol.
8051 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8054 * For an already known node (from channel announcements), update its stored properties from a
8055 * given node announcement without verifying the associated signatures. Because we aren't
8056 * given the associated signatures here we cannot relay the node announcement to any of our
8059 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
8062 * Store or update channel info from a channel announcement.
8064 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8065 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8066 * routing messages from a source using a protocol other than the lightning P2P protocol.
8068 * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
8069 * the corresponding UTXO exists on chain and is correctly-formatted.
8071 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
8074 * Store or update channel info from a channel announcement without verifying the associated
8075 * signatures. Because we aren't given the associated signatures here we cannot relay the
8076 * channel announcement to any of our peers.
8078 * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
8079 * the corresponding UTXO exists on chain and is correctly-formatted.
8081 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
8084 * Close a channel if a corresponding HTLC fail was sent.
8085 * If permanent, removes a channel from the local storage.
8086 * May cause the removal of nodes too, if this was their last channel.
8087 * If not permanent, makes channels unavailable for routing.
8089 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
8092 * For an already known (from announcement) channel, update info about one of the directions
8095 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8096 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8097 * routing messages from a source using a protocol other than the lightning P2P protocol.
8099 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8102 * For an already known (from announcement) channel, update info about one of the directions
8103 * of the channel without verifying the associated signatures. Because we aren't given the
8104 * associated signatures here we cannot relay the channel update to any of our peers.
8106 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
8108 /* Text to put at the end of the generated file */