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];
245 * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
246 * look up the corresponding function in rust-lightning's docs.
248 typedef struct LDKThirtyTwoBytes {
253 * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
254 * claim at any point in the future) an event is generated which you must track and be able to
255 * spend on-chain. The information needed to do this is provided in this enum, including the
256 * outpoint describing which txid and output index is available, the full output which exists at
257 * that txid/index, and any keys or other information required to sign.
259 typedef enum LDKSpendableOutputDescriptor_Tag {
261 * An output to a script which was provided via KeysInterface directly, either from
262 * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
263 * spend it. No secret keys are provided as rust-lightning was never given any key.
264 * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
265 * on-chain using the payment preimage or after it has timed out.
267 LDKSpendableOutputDescriptor_StaticOutput,
269 * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
271 * The witness in the spending input should be:
272 * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
274 * Note that the nSequence field in the spending input must be set to to_self_delay
275 * (which means the transaction is not broadcastable until at least to_self_delay
276 * blocks after the outpoint confirms).
278 * These are generally the result of a \"revocable\" output to us, spendable only by us unless
279 * it is an output from an old state which we broadcast (which should never happen).
281 * To derive the delayed_payment key which is used to sign for this input, you must pass the
282 * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
283 * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
284 * chan_utils::derive_private_key. The public key can be generated without the secret key
285 * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
286 * ChannelKeys::pubkeys().
288 * To derive the revocation_pubkey provided here (which is used in the witness
289 * script generation), you must pass the counterparty revocation_basepoint (which appears in the
290 * call to ChannelKeys::ready_channel) and the provided per_commitment point
291 * to chan_utils::derive_public_revocation_key.
293 * The witness script which is hashed and included in the output script_pubkey may be
294 * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
295 * (derived as above), and the to_self_delay contained here to
296 * chan_utils::get_revokeable_redeemscript.
298 LDKSpendableOutputDescriptor_DynamicOutputP2WSH,
300 * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
301 * corresponds to the public key in ChannelKeys::pubkeys().payment_point).
302 * The witness in the spending input, is, thus, simply:
303 * <BIP 143 signature> <payment key>
305 * These are generally the result of our counterparty having broadcast the current state,
306 * allowing us to claim the non-HTLC-encumbered outputs immediately.
308 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment,
310 * Must be last for serialization purposes
312 LDKSpendableOutputDescriptor_Sentinel,
313 } LDKSpendableOutputDescriptor_Tag;
315 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
316 struct LDKOutPoint outpoint;
317 struct LDKTxOut output;
318 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
320 typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body {
321 struct LDKOutPoint outpoint;
322 struct LDKPublicKey per_commitment_point;
323 uint16_t to_self_delay;
324 struct LDKTxOut output;
325 struct LDKPublicKey revocation_pubkey;
326 struct LDKThirtyTwoBytes channel_keys_id;
327 uint64_t channel_value_satoshis;
328 } LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
330 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
331 struct LDKOutPoint outpoint;
332 struct LDKTxOut output;
333 struct LDKThirtyTwoBytes channel_keys_id;
334 uint64_t channel_value_satoshis;
335 } LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body;
337 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
338 LDKSpendableOutputDescriptor_Tag tag;
340 LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
341 LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh;
342 LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment;
344 } LDKSpendableOutputDescriptor;
346 typedef struct LDKCVec_SpendableOutputDescriptorZ {
347 struct LDKSpendableOutputDescriptor *data;
349 } LDKCVec_SpendableOutputDescriptorZ;
354 * An accept_channel message to be sent or received from a peer
356 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
358 * Nearly everywhere, inner must be non-null, however in places where
359 * the Rust equivalent takes an Option, it may be set to null to indicate None.
361 LDKnativeAcceptChannel *inner;
368 * An open_channel message to be sent or received from a peer
370 typedef struct MUST_USE_STRUCT LDKOpenChannel {
372 * Nearly everywhere, inner must be non-null, however in places where
373 * the Rust equivalent takes an Option, it may be set to null to indicate None.
375 LDKnativeOpenChannel *inner;
382 * A funding_created message to be sent or received from a peer
384 typedef struct MUST_USE_STRUCT LDKFundingCreated {
386 * Nearly everywhere, inner must be non-null, however in places where
387 * the Rust equivalent takes an Option, it may be set to null to indicate None.
389 LDKnativeFundingCreated *inner;
396 * A funding_signed message to be sent or received from a peer
398 typedef struct MUST_USE_STRUCT LDKFundingSigned {
400 * Nearly everywhere, inner must be non-null, however in places where
401 * the Rust equivalent takes an Option, it may be set to null to indicate None.
403 LDKnativeFundingSigned *inner;
410 * A funding_locked message to be sent or received from a peer
412 typedef struct MUST_USE_STRUCT LDKFundingLocked {
414 * Nearly everywhere, inner must be non-null, however in places where
415 * the Rust equivalent takes an Option, it may be set to null to indicate None.
417 LDKnativeFundingLocked *inner;
424 * An announcement_signatures message to be sent or received from a peer
426 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
428 * Nearly everywhere, inner must be non-null, however in places where
429 * the Rust equivalent takes an Option, it may be set to null to indicate None.
431 LDKnativeAnnouncementSignatures *inner;
433 } LDKAnnouncementSignatures;
438 * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
439 * transaction updates if they were pending.
441 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
443 * Nearly everywhere, inner must be non-null, however in places where
444 * the Rust equivalent takes an Option, it may be set to null to indicate None.
446 LDKnativeCommitmentUpdate *inner;
448 } LDKCommitmentUpdate;
453 * A revoke_and_ack message to be sent or received from a peer
455 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
457 * Nearly everywhere, inner must be non-null, however in places where
458 * the Rust equivalent takes an Option, it may be set to null to indicate None.
460 LDKnativeRevokeAndACK *inner;
467 * A closing_signed message to be sent or received from a peer
469 typedef struct MUST_USE_STRUCT LDKClosingSigned {
471 * Nearly everywhere, inner must be non-null, however in places where
472 * the Rust equivalent takes an Option, it may be set to null to indicate None.
474 LDKnativeClosingSigned *inner;
481 * A shutdown message to be sent or received from a peer
483 typedef struct MUST_USE_STRUCT LDKShutdown {
485 * Nearly everywhere, inner must be non-null, however in places where
486 * the Rust equivalent takes an Option, it may be set to null to indicate None.
488 LDKnativeShutdown *inner;
495 * A channel_reestablish message to be sent or received from a peer
497 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
499 * Nearly everywhere, inner must be non-null, however in places where
500 * the Rust equivalent takes an Option, it may be set to null to indicate None.
502 LDKnativeChannelReestablish *inner;
504 } LDKChannelReestablish;
509 * A channel_announcement message to be sent or received from a peer
511 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
513 * Nearly everywhere, inner must be non-null, however in places where
514 * the Rust equivalent takes an Option, it may be set to null to indicate None.
516 LDKnativeChannelAnnouncement *inner;
518 } LDKChannelAnnouncement;
523 * A channel_update message to be sent or received from a peer
525 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
527 * Nearly everywhere, inner must be non-null, however in places where
528 * the Rust equivalent takes an Option, it may be set to null to indicate None.
530 LDKnativeChannelUpdate *inner;
537 * A node_announcement message to be sent or received from a peer
539 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
541 * Nearly everywhere, inner must be non-null, however in places where
542 * the Rust equivalent takes an Option, it may be set to null to indicate None.
544 LDKnativeNodeAnnouncement *inner;
546 } LDKNodeAnnouncement;
551 * An error message to be sent or received from a peer
553 typedef struct MUST_USE_STRUCT LDKErrorMessage {
555 * Nearly everywhere, inner must be non-null, however in places where
556 * the Rust equivalent takes an Option, it may be set to null to indicate None.
558 LDKnativeErrorMessage *inner;
563 * Used to put an error message in a LightningError
565 typedef enum LDKErrorAction_Tag {
567 * The peer took some action which made us think they were useless. Disconnect them.
569 LDKErrorAction_DisconnectPeer,
571 * The peer did something harmless that we weren't able to process, just log and ignore
573 LDKErrorAction_IgnoreError,
575 * The peer did something incorrect. Tell them.
577 LDKErrorAction_SendErrorMessage,
579 * Must be last for serialization purposes
581 LDKErrorAction_Sentinel,
582 } LDKErrorAction_Tag;
584 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
585 struct LDKErrorMessage msg;
586 } LDKErrorAction_LDKDisconnectPeer_Body;
588 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
589 struct LDKErrorMessage msg;
590 } LDKErrorAction_LDKSendErrorMessage_Body;
592 typedef struct MUST_USE_STRUCT LDKErrorAction {
593 LDKErrorAction_Tag tag;
595 LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
596 LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
601 * The information we received from a peer along the route of a payment we originated. This is
602 * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
603 * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
605 typedef enum LDKHTLCFailChannelUpdate_Tag {
607 * We received an error which included a full ChannelUpdate message.
609 LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
611 * We received an error which indicated only that a channel has been closed
613 LDKHTLCFailChannelUpdate_ChannelClosed,
615 * We received an error which indicated only that a node has failed
617 LDKHTLCFailChannelUpdate_NodeFailure,
619 * Must be last for serialization purposes
621 LDKHTLCFailChannelUpdate_Sentinel,
622 } LDKHTLCFailChannelUpdate_Tag;
624 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
625 struct LDKChannelUpdate msg;
626 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
628 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
629 uint64_t short_channel_id;
631 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
633 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
634 struct LDKPublicKey node_id;
636 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
638 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
639 LDKHTLCFailChannelUpdate_Tag tag;
641 LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
642 LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
643 LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
645 } LDKHTLCFailChannelUpdate;
650 * A query_channel_range message is used to query a peer for channel
651 * UTXOs in a range of blocks. The recipient of a query makes a best
652 * effort to reply to the query using one or more reply_channel_range
655 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
657 * Nearly everywhere, inner must be non-null, however in places where
658 * the Rust equivalent takes an Option, it may be set to null to indicate None.
660 LDKnativeQueryChannelRange *inner;
662 } LDKQueryChannelRange;
667 * A query_short_channel_ids message is used to query a peer for
668 * routing gossip messages related to one or more short_channel_ids.
669 * The query recipient will reply with the latest, if available,
670 * channel_announcement, channel_update and node_announcement messages
671 * it maintains for the requested short_channel_ids followed by a
672 * reply_short_channel_ids_end message. The short_channel_ids sent in
673 * this query are encoded. We only support encoding_type=0 uncompressed
674 * serialization and do not support encoding_type=1 zlib serialization.
676 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
678 * Nearly everywhere, inner must be non-null, however in places where
679 * the Rust equivalent takes an Option, it may be set to null to indicate None.
681 LDKnativeQueryShortChannelIds *inner;
683 } LDKQueryShortChannelIds;
686 * An event generated by ChannelManager which indicates a message should be sent to a peer (or
687 * broadcast to most peers).
688 * These events are handled by PeerManager::process_events if you are using a PeerManager.
690 typedef enum LDKMessageSendEvent_Tag {
692 * Used to indicate that we've accepted a channel open and should send the accept_channel
693 * message provided to the given peer.
695 LDKMessageSendEvent_SendAcceptChannel,
697 * Used to indicate that we've initiated a channel open and should send the open_channel
698 * message provided to the given peer.
700 LDKMessageSendEvent_SendOpenChannel,
702 * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
704 LDKMessageSendEvent_SendFundingCreated,
706 * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
708 LDKMessageSendEvent_SendFundingSigned,
710 * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
712 LDKMessageSendEvent_SendFundingLocked,
714 * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
716 LDKMessageSendEvent_SendAnnouncementSignatures,
718 * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
719 * message should be sent to the peer with the given node_id.
721 LDKMessageSendEvent_UpdateHTLCs,
723 * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
725 LDKMessageSendEvent_SendRevokeAndACK,
727 * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
729 LDKMessageSendEvent_SendClosingSigned,
731 * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
733 LDKMessageSendEvent_SendShutdown,
735 * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
737 LDKMessageSendEvent_SendChannelReestablish,
739 * Used to indicate that a channel_announcement and channel_update should be broadcast to all
740 * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
742 * Note that after doing so, you very likely (unless you did so very recently) want to call
743 * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
744 * This ensures that any nodes which see our channel_announcement also have a relevant
745 * node_announcement, including relevant feature flags which may be important for routing
748 LDKMessageSendEvent_BroadcastChannelAnnouncement,
750 * Used to indicate that a node_announcement should be broadcast to all peers.
752 LDKMessageSendEvent_BroadcastNodeAnnouncement,
754 * Used to indicate that a channel_update should be broadcast to all peers.
756 LDKMessageSendEvent_BroadcastChannelUpdate,
758 * Broadcast an error downstream to be handled
760 LDKMessageSendEvent_HandleError,
762 * When a payment fails we may receive updates back from the hop where it failed. In such
763 * cases this event is generated so that we can inform the network graph of this information.
765 LDKMessageSendEvent_PaymentFailureNetworkUpdate,
767 * Query a peer for channels with funding transaction UTXOs in a block range.
769 LDKMessageSendEvent_SendChannelRangeQuery,
771 * Request routing gossip messages from a peer for a list of channels identified by
772 * their short_channel_ids.
774 LDKMessageSendEvent_SendShortIdsQuery,
776 * Must be last for serialization purposes
778 LDKMessageSendEvent_Sentinel,
779 } LDKMessageSendEvent_Tag;
781 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
782 struct LDKPublicKey node_id;
783 struct LDKAcceptChannel msg;
784 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
786 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
787 struct LDKPublicKey node_id;
788 struct LDKOpenChannel msg;
789 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
791 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
792 struct LDKPublicKey node_id;
793 struct LDKFundingCreated msg;
794 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
796 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
797 struct LDKPublicKey node_id;
798 struct LDKFundingSigned msg;
799 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
801 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
802 struct LDKPublicKey node_id;
803 struct LDKFundingLocked msg;
804 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
806 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
807 struct LDKPublicKey node_id;
808 struct LDKAnnouncementSignatures msg;
809 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
811 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
812 struct LDKPublicKey node_id;
813 struct LDKCommitmentUpdate updates;
814 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
816 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
817 struct LDKPublicKey node_id;
818 struct LDKRevokeAndACK msg;
819 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
821 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
822 struct LDKPublicKey node_id;
823 struct LDKClosingSigned msg;
824 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
826 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
827 struct LDKPublicKey node_id;
828 struct LDKShutdown msg;
829 } LDKMessageSendEvent_LDKSendShutdown_Body;
831 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
832 struct LDKPublicKey node_id;
833 struct LDKChannelReestablish msg;
834 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
836 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
837 struct LDKChannelAnnouncement msg;
838 struct LDKChannelUpdate update_msg;
839 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
841 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
842 struct LDKNodeAnnouncement msg;
843 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
845 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
846 struct LDKChannelUpdate msg;
847 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
849 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
850 struct LDKPublicKey node_id;
851 struct LDKErrorAction action;
852 } LDKMessageSendEvent_LDKHandleError_Body;
854 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
855 struct LDKHTLCFailChannelUpdate update;
856 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
858 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
859 struct LDKPublicKey node_id;
860 struct LDKQueryChannelRange msg;
861 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
863 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
864 struct LDKPublicKey node_id;
865 struct LDKQueryShortChannelIds msg;
866 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
868 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
869 LDKMessageSendEvent_Tag tag;
871 LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
872 LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
873 LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
874 LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
875 LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
876 LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
877 LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
878 LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
879 LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
880 LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
881 LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
882 LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
883 LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
884 LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
885 LDKMessageSendEvent_LDKHandleError_Body handle_error;
886 LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
887 LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
888 LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
890 } LDKMessageSendEvent;
892 typedef struct LDKCVec_MessageSendEventZ {
893 struct LDKMessageSendEvent *data;
895 } LDKCVec_MessageSendEventZ;
898 * An Event which you should probably take some action in response to.
900 * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
901 * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
902 * written as it makes no sense to respond to it after reconnecting to peers).
904 typedef enum LDKEvent_Tag {
906 * Used to indicate that the client should generate a funding transaction with the given
907 * parameters and then call ChannelManager::funding_transaction_generated.
908 * Generated in ChannelManager message handling.
909 * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
910 * counterparty can steal your funds!
912 LDKEvent_FundingGenerationReady,
914 * Used to indicate that the client may now broadcast the funding transaction it created for a
915 * channel. Broadcasting such a transaction prior to this event may lead to our counterparty
916 * trivially stealing all funds in the funding transaction!
918 LDKEvent_FundingBroadcastSafe,
920 * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
921 * ChannelManager::claim_funds to get it....
922 * Note that if the preimage is not known or the amount paid is incorrect, you should call
923 * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
924 * network congestion.
925 * The amount paid should be considered 'incorrect' when it is less than or more than twice
926 * the amount expected.
927 * If you fail to call either ChannelManager::claim_funds or
928 * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
929 * automatically failed.
931 LDKEvent_PaymentReceived,
933 * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
934 * and we got back the payment preimage for it).
935 * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
936 * deduplicate them by payment_preimage (which MUST be unique)!
938 LDKEvent_PaymentSent,
940 * Indicates an outbound payment we made failed. Probably some intermediary node dropped
941 * something. You may wish to retry with a different route.
942 * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
943 * deduplicate them by payment_hash (which MUST be unique)!
945 LDKEvent_PaymentFailed,
947 * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
948 * time in the future.
950 LDKEvent_PendingHTLCsForwardable,
952 * Used to indicate that an output was generated on-chain which you should know how to spend.
953 * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
954 * counterparty spending them due to some kind of timeout. Thus, you need to store them
955 * somewhere and spend them when you create on-chain transactions.
957 LDKEvent_SpendableOutputs,
959 * Must be last for serialization purposes
964 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
965 struct LDKThirtyTwoBytes temporary_channel_id;
966 uint64_t channel_value_satoshis;
967 struct LDKCVec_u8Z output_script;
968 uint64_t user_channel_id;
969 } LDKEvent_LDKFundingGenerationReady_Body;
971 typedef struct LDKEvent_LDKFundingBroadcastSafe_Body {
972 struct LDKOutPoint funding_txo;
973 uint64_t user_channel_id;
974 } LDKEvent_LDKFundingBroadcastSafe_Body;
976 typedef struct LDKEvent_LDKPaymentReceived_Body {
977 struct LDKThirtyTwoBytes payment_hash;
978 struct LDKThirtyTwoBytes payment_secret;
980 } LDKEvent_LDKPaymentReceived_Body;
982 typedef struct LDKEvent_LDKPaymentSent_Body {
983 struct LDKThirtyTwoBytes payment_preimage;
984 } LDKEvent_LDKPaymentSent_Body;
986 typedef struct LDKEvent_LDKPaymentFailed_Body {
987 struct LDKThirtyTwoBytes payment_hash;
988 bool rejected_by_dest;
989 } LDKEvent_LDKPaymentFailed_Body;
991 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
992 uint64_t time_forwardable;
993 } LDKEvent_LDKPendingHTLCsForwardable_Body;
995 typedef struct LDKEvent_LDKSpendableOutputs_Body {
996 struct LDKCVec_SpendableOutputDescriptorZ outputs;
997 } LDKEvent_LDKSpendableOutputs_Body;
999 typedef struct MUST_USE_STRUCT LDKEvent {
1002 LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
1003 LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe;
1004 LDKEvent_LDKPaymentReceived_Body payment_received;
1005 LDKEvent_LDKPaymentSent_Body payment_sent;
1006 LDKEvent_LDKPaymentFailed_Body payment_failed;
1007 LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
1008 LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
1012 typedef struct LDKCVec_EventZ {
1013 struct LDKEvent *data;
1017 typedef struct LDKC2Tuple_usizeTransactionZ {
1019 struct LDKTransaction b;
1020 } LDKC2Tuple_usizeTransactionZ;
1022 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
1023 struct LDKC2Tuple_usizeTransactionZ *data;
1025 } LDKCVec_C2Tuple_usizeTransactionZZ;
1027 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
1029 * Note that this value is always NULL, as there are no contents in the OK variant
1032 enum LDKChannelMonitorUpdateErr *err;
1033 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
1035 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
1036 union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
1038 } LDKCResult_NoneChannelMonitorUpdateErrZ;
1043 * An event to be processed by the ChannelManager.
1045 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1047 * Nearly everywhere, inner must be non-null, however in places where
1048 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1050 LDKnativeMonitorEvent *inner;
1054 typedef struct LDKCVec_MonitorEventZ {
1055 struct LDKMonitorEvent *data;
1057 } LDKCVec_MonitorEventZ;
1062 * An update generated by the underlying Channel itself which contains some new information the
1063 * ChannelMonitor should be made aware of.
1065 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1067 * Nearly everywhere, inner must be non-null, however in places where
1068 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1070 LDKnativeChannelMonitorUpdate *inner;
1072 } LDKChannelMonitorUpdate;
1077 * An error in decoding a message or struct.
1079 typedef struct MUST_USE_STRUCT LDKDecodeError {
1081 * Nearly everywhere, inner must be non-null, however in places where
1082 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1084 LDKnativeDecodeError *inner;
1088 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
1089 struct LDKChannelMonitorUpdate *result;
1090 struct LDKDecodeError *err;
1091 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
1093 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
1094 union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
1096 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
1101 * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
1102 * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
1103 * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
1105 * Contains a developer-readable error message.
1107 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
1109 * Nearly everywhere, inner must be non-null, however in places where
1110 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1112 LDKnativeMonitorUpdateError *inner;
1114 } LDKMonitorUpdateError;
1116 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
1118 * Note that this value is always NULL, as there are no contents in the OK variant
1121 struct LDKMonitorUpdateError *err;
1122 } LDKCResult_NoneMonitorUpdateErrorZPtr;
1124 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
1125 union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
1127 } LDKCResult_NoneMonitorUpdateErrorZ;
1129 typedef struct LDKC2Tuple_OutPointScriptZ {
1130 struct LDKOutPoint a;
1131 struct LDKCVec_u8Z b;
1132 } LDKC2Tuple_OutPointScriptZ;
1134 typedef struct LDKCVec_TransactionZ {
1135 struct LDKTransaction *data;
1137 } LDKCVec_TransactionZ;
1139 typedef struct LDKC2Tuple_u32TxOutZ {
1142 } LDKC2Tuple_u32TxOutZ;
1144 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
1145 struct LDKC2Tuple_u32TxOutZ *data;
1147 } LDKCVec_C2Tuple_u32TxOutZZ;
1149 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
1150 struct LDKThirtyTwoBytes a;
1151 struct LDKCVec_C2Tuple_u32TxOutZZ b;
1152 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
1154 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
1155 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
1157 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ;
1162 * One counterparty's public keys which do not change over the life of a channel.
1164 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
1166 * Nearly everywhere, inner must be non-null, however in places where
1167 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1169 LDKnativeChannelPublicKeys *inner;
1171 } LDKChannelPublicKeys;
1173 typedef struct LDKSignature {
1174 uint8_t compact_form[64];
1177 typedef struct LDKCVec_SignatureZ {
1178 struct LDKSignature *data;
1180 } LDKCVec_SignatureZ;
1182 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
1183 struct LDKSignature a;
1184 struct LDKCVec_SignatureZ b;
1185 } LDKC2Tuple_SignatureCVec_SignatureZZ;
1187 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1188 struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
1190 * Note that this value is always NULL, as there are no contents in the Err variant
1193 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
1195 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1196 union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
1198 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
1203 * This class tracks the per-transaction information needed to build a commitment transaction and to
1204 * actually build it and sign. It is used for holder transactions that we sign only when needed
1205 * and for transactions we sign for the counterparty.
1207 * This class can be used inside a signer implementation to generate a signature given the relevant
1210 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1212 * Nearly everywhere, inner must be non-null, however in places where
1213 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1215 LDKnativeCommitmentTransaction *inner;
1217 } LDKCommitmentTransaction;
1222 * Information needed to build and sign a holder's commitment transaction.
1224 * The transaction is only signed once we are ready to broadcast.
1226 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1228 * Nearly everywhere, inner must be non-null, however in places where
1229 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1231 LDKnativeHolderCommitmentTransaction *inner;
1233 } LDKHolderCommitmentTransaction;
1235 typedef union LDKCResult_SignatureNoneZPtr {
1236 struct LDKSignature *result;
1238 * Note that this value is always NULL, as there are no contents in the Err variant
1241 } LDKCResult_SignatureNoneZPtr;
1243 typedef struct LDKCResult_SignatureNoneZ {
1244 union LDKCResult_SignatureNoneZPtr contents;
1246 } LDKCResult_SignatureNoneZ;
1251 * Information about an HTLC as it appears in a commitment transaction
1253 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
1255 * Nearly everywhere, inner must be non-null, however in places where
1256 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1258 LDKnativeHTLCOutputInCommitment *inner;
1260 } LDKHTLCOutputInCommitment;
1265 * The unsigned part of a channel_announcement
1267 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
1269 * Nearly everywhere, inner must be non-null, however in places where
1270 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1272 LDKnativeUnsignedChannelAnnouncement *inner;
1274 } LDKUnsignedChannelAnnouncement;
1279 * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
1280 * The fields are organized by holder/counterparty.
1282 * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
1283 * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
1285 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
1287 * Nearly everywhere, inner must be non-null, however in places where
1288 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1290 LDKnativeChannelTransactionParameters *inner;
1292 } LDKChannelTransactionParameters;
1295 * Set of lightning keys needed to operate a channel as described in BOLT 3.
1297 * Signing services could be implemented on a hardware wallet. In this case,
1298 * the current ChannelKeys would be a front-end on top of a communication
1299 * channel connected to your secure device and lightning key material wouldn't
1300 * reside on a hot server. Nevertheless, a this deployment would still need
1301 * to trust the ChannelManager to avoid loss of funds as this latest component
1302 * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
1304 * A more secure iteration would be to use hashlock (or payment points) to pair
1305 * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
1306 * at the price of more state and computation on the hardware wallet side. In the future,
1307 * we are looking forward to design such interface.
1309 * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
1310 * to act, as liveness and breach reply correctness are always going to be hard requirements
1311 * of LN security model, orthogonal of key management issues.
1313 * If you're implementing a custom signer, you almost certainly want to implement
1314 * Readable/Writable to serialize out a unique reference to this set of keys so
1315 * that you can serialize the full ChannelManager object.
1318 typedef struct LDKChannelKeys {
1321 * Gets the per-commitment point for a specific commitment number
1323 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1325 struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
1327 * Gets the commitment secret for a specific commitment number as part of the revocation process
1329 * An external signer implementation should error here if the commitment was already signed
1330 * and should refuse to sign it in the future.
1332 * May be called more than once for the same index.
1334 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1335 * TODO: return a Result so we can signal a validation error
1337 struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
1339 * Gets the holder's channel public keys and basepoints
1341 struct LDKChannelPublicKeys pubkeys;
1343 * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
1344 * Note that this takes a pointer to this object, not the this_ptr like other methods do
1345 * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
1347 void (*set_pubkeys)(const struct LDKChannelKeys*NONNULL_PTR );
1349 * Gets an arbitrary identifier describing the set of keys which are provided back to you in
1350 * some SpendableOutputDescriptor types. This should be sufficient to identify this
1351 * ChannelKeys object uniquely and lookup or re-derive its keys.
1353 struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
1355 * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
1357 * Note that if signing fails or is rejected, the channel will be force-closed.
1359 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
1361 * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
1362 * This will only ever be called with a non-revoked commitment_tx. This will be called with the
1363 * latest commitment_tx when we initiate a force-close.
1364 * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
1365 * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
1367 * This may be called multiple times for the same transaction.
1369 * An external signer implementation should check that the commitment has not been revoked.
1371 * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case.
1373 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
1375 * Create a signature for the given input in a transaction spending an HTLC or commitment
1376 * transaction output when our counterparty broadcasts an old state.
1378 * A justice transaction may claim multiples outputs at the same time if timelocks are
1379 * similar, but only a signature for the input at index `input` should be signed for here.
1380 * It may be called multiples time for same output(s) if a fee-bump is needed with regards
1381 * to an upcoming timelock expiration.
1383 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1385 * per_commitment_key is revocation secret which was provided by our counterparty when they
1386 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
1387 * not allow the spending of any funds by itself (you need our holder revocation_secret to do
1390 * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
1391 * changing the format of the witness script (which is committed to in the BIP 143
1394 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);
1396 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
1397 * transaction, either offered or received.
1399 * Such a transaction may claim multiples offered outputs at same time if we know the
1400 * preimage for each when we create it, but only the input at index `input` should be
1401 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
1402 * needed with regards to an upcoming timelock expiration.
1404 * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
1407 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1409 * Per_commitment_point is the dynamic point corresponding to the channel state
1410 * detected onchain. It has been generated by our counterparty and is used to derive
1411 * channel state keys, which are then included in the witness script and committed to in the
1412 * BIP 143 signature.
1414 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);
1416 * Create a signature for a (proposed) closing transaction.
1418 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
1419 * chosen to forgo their output as dust.
1421 struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
1423 * Signs a channel announcement message with our funding key, proving it comes from one
1424 * of the channel participants.
1426 * Note that if this fails or is rejected, the channel will not be publicly announced and
1427 * our counterparty may (though likely will not) close the channel on us for violating the
1430 struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
1432 * Set the counterparty static channel data, including basepoints,
1433 * counterparty_selected/holder_selected_contest_delay and funding outpoint.
1434 * This is done as soon as the funding outpoint is known. Since these are static channel data,
1435 * they MUST NOT be allowed to change to different values once set.
1437 * channel_parameters.is_populated() MUST be true.
1439 * We bind holder_selected_contest_delay late here for API convenience.
1441 * Will be called before any signatures are applied.
1443 void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
1444 void *(*clone)(const void *this_arg);
1445 struct LDKCVec_u8Z (*write)(const void *this_arg);
1446 void (*free)(void *this_arg);
1452 * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
1453 * on-chain transactions to ensure no loss of funds occurs.
1455 * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
1456 * information and are actively monitoring the chain.
1458 * Pending Events or updated HTLCs which have not yet been read out by
1459 * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
1460 * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
1461 * gotten are fully handled before re-serializing the new state.
1463 * Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which
1464 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
1465 * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
1466 * returned block hash and the the current chain and then reconnecting blocks to get to the
1467 * best chain) upon deserializing the object!
1469 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
1471 * Nearly everywhere, inner must be non-null, however in places where
1472 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1474 LDKnativeChannelMonitor *inner;
1476 } LDKChannelMonitor;
1478 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
1479 struct LDKThirtyTwoBytes a;
1480 struct LDKChannelMonitor b;
1481 } LDKC2Tuple_BlockHashChannelMonitorZ;
1483 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
1484 struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
1485 struct LDKDecodeError *err;
1486 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
1488 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
1489 union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
1491 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
1493 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
1494 struct LDKSpendableOutputDescriptor *result;
1495 struct LDKDecodeError *err;
1496 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
1498 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
1499 union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
1501 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
1503 typedef union LDKCResult_ChanKeySignerDecodeErrorZPtr {
1504 struct LDKChannelKeys *result;
1505 struct LDKDecodeError *err;
1506 } LDKCResult_ChanKeySignerDecodeErrorZPtr;
1508 typedef struct LDKCResult_ChanKeySignerDecodeErrorZ {
1509 union LDKCResult_ChanKeySignerDecodeErrorZPtr contents;
1511 } LDKCResult_ChanKeySignerDecodeErrorZ;
1516 * A simple implementation of ChannelKeys that just keeps the private keys in memory.
1518 * This implementation performs no policy checks and is insufficient by itself as
1519 * a secure external signer.
1521 typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys {
1523 * Nearly everywhere, inner must be non-null, however in places where
1524 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1526 LDKnativeInMemoryChannelKeys *inner;
1528 } LDKInMemoryChannelKeys;
1530 typedef union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr {
1531 struct LDKInMemoryChannelKeys *result;
1532 struct LDKDecodeError *err;
1533 } LDKCResult_InMemoryChannelKeysDecodeErrorZPtr;
1535 typedef struct LDKCResult_InMemoryChannelKeysDecodeErrorZ {
1536 union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr contents;
1538 } LDKCResult_InMemoryChannelKeysDecodeErrorZ;
1540 typedef union LDKCResult_TxOutAccessErrorZPtr {
1541 struct LDKTxOut *result;
1542 enum LDKAccessError *err;
1543 } LDKCResult_TxOutAccessErrorZPtr;
1545 typedef struct LDKCResult_TxOutAccessErrorZ {
1546 union LDKCResult_TxOutAccessErrorZPtr contents;
1548 } LDKCResult_TxOutAccessErrorZ;
1551 * A Rust str object, ie a reference to a UTF8-valid string.
1552 * This is *not* null-terminated so cannot be used directly as a C string!
1554 typedef struct LDKStr {
1555 const uint8_t *chars;
1560 * Indicates an error on the client's part (usually some variant of attempting to use too-low or
1563 typedef enum LDKAPIError_Tag {
1565 * Indicates the API was wholly misused (see err for more). Cases where these can be returned
1566 * are documented, but generally indicates some precondition of a function was violated.
1568 LDKAPIError_APIMisuseError,
1570 * Due to a high feerate, we were unable to complete the request.
1571 * For example, this may be returned if the feerate implies we cannot open a channel at the
1572 * requested value, but opening a larger channel would succeed.
1574 LDKAPIError_FeeRateTooHigh,
1576 * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
1577 * too-many-hops, etc).
1579 LDKAPIError_RouteError,
1581 * We were unable to complete the request as the Channel required to do so is unable to
1582 * complete the request (or was not found). This can take many forms, including disconnected
1583 * peer, channel at capacity, channel shutting down, etc.
1585 LDKAPIError_ChannelUnavailable,
1587 * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
1588 * attempted action to fail.
1590 LDKAPIError_MonitorUpdateFailed,
1592 * Must be last for serialization purposes
1594 LDKAPIError_Sentinel,
1597 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
1598 struct LDKCVec_u8Z err;
1599 } LDKAPIError_LDKAPIMisuseError_Body;
1601 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
1602 struct LDKCVec_u8Z err;
1604 } LDKAPIError_LDKFeeRateTooHigh_Body;
1606 typedef struct LDKAPIError_LDKRouteError_Body {
1608 } LDKAPIError_LDKRouteError_Body;
1610 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
1611 struct LDKCVec_u8Z err;
1612 } LDKAPIError_LDKChannelUnavailable_Body;
1614 typedef struct MUST_USE_STRUCT LDKAPIError {
1615 LDKAPIError_Tag tag;
1617 LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
1618 LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
1619 LDKAPIError_LDKRouteError_Body route_error;
1620 LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
1624 typedef union LDKCResult_NoneAPIErrorZPtr {
1626 * Note that this value is always NULL, as there are no contents in the OK variant
1629 struct LDKAPIError *err;
1630 } LDKCResult_NoneAPIErrorZPtr;
1632 typedef struct LDKCResult_NoneAPIErrorZ {
1633 union LDKCResult_NoneAPIErrorZPtr contents;
1635 } LDKCResult_NoneAPIErrorZ;
1640 * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
1642 typedef struct MUST_USE_STRUCT LDKChannelDetails {
1644 * Nearly everywhere, inner must be non-null, however in places where
1645 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1647 LDKnativeChannelDetails *inner;
1649 } LDKChannelDetails;
1651 typedef struct LDKCVec_ChannelDetailsZ {
1652 struct LDKChannelDetails *data;
1654 } LDKCVec_ChannelDetailsZ;
1659 * If a payment fails to send, it can be in one of several states. This enum is returned as the
1660 * Err() type describing which state the payment is in, see the description of individual enum
1663 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
1665 * Nearly everywhere, inner must be non-null, however in places where
1666 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1668 LDKnativePaymentSendFailure *inner;
1670 } LDKPaymentSendFailure;
1672 typedef union LDKCResult_NonePaymentSendFailureZPtr {
1674 * Note that this value is always NULL, as there are no contents in the OK variant
1677 struct LDKPaymentSendFailure *err;
1678 } LDKCResult_NonePaymentSendFailureZPtr;
1680 typedef struct LDKCResult_NonePaymentSendFailureZ {
1681 union LDKCResult_NonePaymentSendFailureZPtr contents;
1683 } LDKCResult_NonePaymentSendFailureZ;
1685 typedef struct LDKFourBytes {
1689 typedef struct LDKSixteenBytes {
1693 typedef struct LDKTenBytes {
1698 * An address which can be used to connect to a remote peer
1700 typedef enum LDKNetAddress_Tag {
1702 * An IPv4 address/port on which the peer is listening.
1706 * An IPv6 address/port on which the peer is listening.
1710 * An old-style Tor onion address/port on which the peer is listening.
1712 LDKNetAddress_OnionV2,
1714 * A new-style Tor onion address/port on which the peer is listening.
1715 * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
1716 * wrap as base32 and append \".onion\".
1718 LDKNetAddress_OnionV3,
1720 * Must be last for serialization purposes
1722 LDKNetAddress_Sentinel,
1723 } LDKNetAddress_Tag;
1725 typedef struct LDKNetAddress_LDKIPv4_Body {
1726 struct LDKFourBytes addr;
1728 } LDKNetAddress_LDKIPv4_Body;
1730 typedef struct LDKNetAddress_LDKIPv6_Body {
1731 struct LDKSixteenBytes addr;
1733 } LDKNetAddress_LDKIPv6_Body;
1735 typedef struct LDKNetAddress_LDKOnionV2_Body {
1736 struct LDKTenBytes addr;
1738 } LDKNetAddress_LDKOnionV2_Body;
1740 typedef struct LDKNetAddress_LDKOnionV3_Body {
1741 struct LDKThirtyTwoBytes ed25519_pubkey;
1745 } LDKNetAddress_LDKOnionV3_Body;
1747 typedef struct MUST_USE_STRUCT LDKNetAddress {
1748 LDKNetAddress_Tag tag;
1750 LDKNetAddress_LDKIPv4_Body i_pv4;
1751 LDKNetAddress_LDKIPv6_Body i_pv6;
1752 LDKNetAddress_LDKOnionV2_Body onion_v2;
1753 LDKNetAddress_LDKOnionV3_Body onion_v3;
1757 typedef struct LDKCVec_NetAddressZ {
1758 struct LDKNetAddress *data;
1760 } LDKCVec_NetAddressZ;
1762 typedef struct LDKCVec_ChannelMonitorZ {
1763 struct LDKChannelMonitor *data;
1765 } LDKCVec_ChannelMonitorZ;
1768 * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
1769 * blocks are connected and disconnected.
1771 * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
1772 * responsible for maintaining a set of monitors such that they can be updated accordingly as
1773 * channel state changes and HTLCs are resolved. See method documentation for specific
1776 * Implementations **must** ensure that updates are successfully applied and persisted upon method
1777 * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
1778 * without taking any further action such as persisting the current state.
1780 * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
1781 * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
1782 * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
1783 * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
1784 * multiple instances.
1786 * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
1787 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1788 * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
1790 typedef struct LDKWatch {
1793 * Watches a channel identified by `funding_txo` using `monitor`.
1795 * Implementations are responsible for watching the chain for the funding transaction along
1796 * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
1797 * calling [`block_connected`] and [`block_disconnected`] on the monitor.
1799 * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
1800 * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
1801 * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
1803 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
1805 * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
1807 * Implementations must call [`update_monitor`] with the given update. See
1808 * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
1810 * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
1811 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1813 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
1815 * Returns any monitor events since the last call. Subsequent calls must only return new
1818 struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
1819 void (*free)(void *this_arg);
1823 * An interface to send a transaction to the Bitcoin network.
1825 typedef struct LDKBroadcasterInterface {
1828 * Sends a transaction out to (hopefully) be mined.
1830 void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
1831 void (*free)(void *this_arg);
1832 } LDKBroadcasterInterface;
1834 typedef struct LDKSecretKey {
1838 typedef struct LDKu8slice {
1839 const uint8_t *data;
1844 * A trait to describe an object which can get user secrets and key material.
1846 typedef struct LDKKeysInterface {
1849 * Get node secret key (aka node_id or network_key).
1851 * This method must return the same value each time it is called.
1853 struct LDKSecretKey (*get_node_secret)(const void *this_arg);
1855 * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
1857 * This method should return a different value each time it is called, to avoid linking
1858 * on-chain funds across channels as controlled to the same user.
1860 struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
1862 * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
1865 * This method should return a different value each time it is called, to avoid linking
1866 * on-chain funds across channels as controlled to the same user.
1868 struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
1870 * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
1871 * restarted with some stale data!
1873 * This method must return a different value each time it is called.
1875 struct LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
1877 * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
1878 * onion packets and for temporary channel IDs. There is no requirement that these be
1879 * persisted anywhere, though they must be unique across restarts.
1881 * This method must return a different value each time it is called.
1883 struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
1885 * Reads a `ChanKeySigner` for this `KeysInterface` from the given input stream.
1886 * This is only called during deserialization of other objects which contain
1887 * `ChannelKeys`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
1888 * The bytes are exactly those which `<Self::ChanKeySigner as Writeable>::write()` writes, and
1889 * contain no versioning scheme. You may wish to include your own version prefix and ensure
1890 * you've read all of the provided bytes to ensure no corruption occurred.
1892 struct LDKCResult_ChanKeySignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
1893 void (*free)(void *this_arg);
1897 * A trait which should be implemented to provide feerate information on a number of time
1900 * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
1901 * called from inside the library in response to chain events, P2P events, or timer events).
1903 typedef struct LDKFeeEstimator {
1906 * Gets estimated satoshis of fee required per 1000 Weight-Units.
1908 * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
1909 * don't put us below 1 satoshi-per-byte).
1911 * This translates to:
1912 * * satoshis-per-byte * 250
1913 * * ceil(satoshis-per-kbyte / 4)
1915 uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
1916 void (*free)(void *this_arg);
1920 * A trait encapsulating the operations required of a logger
1922 typedef struct LDKLogger {
1927 void (*log)(const void *this_arg, const char *record);
1928 void (*free)(void *this_arg);
1934 * Manager which keeps track of a number of channels and sends messages to the appropriate
1935 * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
1937 * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
1938 * to individual Channels.
1940 * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
1941 * all peers during write/read (though does not modify this instance, only the instance being
1942 * serialized). This will result in any channels which have not yet exchanged funding_created (ie
1943 * called funding_transaction_generated for outbound channels).
1945 * Note that you can be a bit lazier about writing out ChannelManager than you can be with
1946 * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
1947 * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
1948 * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
1949 * the serialization process). If the deserialized version is out-of-date compared to the
1950 * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
1951 * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
1953 * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which
1954 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
1955 * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
1956 * block_connected() to step towards your best block) upon deserialization before using the
1959 * Note that ChannelManager is responsible for tracking liveness of its channels and generating
1960 * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
1961 * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
1962 * offline for a full minute. In order to track this, you must call
1963 * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect.
1965 * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
1966 * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
1967 * essentially you should default to using a SimpleRefChannelManager, and use a
1968 * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
1969 * you're using lightning-net-tokio.
1971 typedef struct MUST_USE_STRUCT LDKChannelManager {
1973 * Nearly everywhere, inner must be non-null, however in places where
1974 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1976 LDKnativeChannelManager *inner;
1978 } LDKChannelManager;
1980 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
1981 struct LDKThirtyTwoBytes a;
1982 struct LDKChannelManager b;
1983 } LDKC2Tuple_BlockHashChannelManagerZ;
1985 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
1986 struct LDKC2Tuple_BlockHashChannelManagerZ *result;
1987 struct LDKDecodeError *err;
1988 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
1990 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1991 union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
1993 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
1995 typedef union LDKCResult_NetAddressu8ZPtr {
1996 struct LDKNetAddress *result;
1998 } LDKCResult_NetAddressu8ZPtr;
2000 typedef struct LDKCResult_NetAddressu8Z {
2001 union LDKCResult_NetAddressu8ZPtr contents;
2003 } LDKCResult_NetAddressu8Z;
2005 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
2006 struct LDKCResult_NetAddressu8Z *result;
2007 struct LDKDecodeError *err;
2008 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
2010 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
2011 union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
2013 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
2015 typedef struct LDKCVec_u64Z {
2023 * An update_add_htlc message to be sent or received from a peer
2025 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
2027 * Nearly everywhere, inner must be non-null, however in places where
2028 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2030 LDKnativeUpdateAddHTLC *inner;
2034 typedef struct LDKCVec_UpdateAddHTLCZ {
2035 struct LDKUpdateAddHTLC *data;
2037 } LDKCVec_UpdateAddHTLCZ;
2042 * An update_fulfill_htlc message to be sent or received from a peer
2044 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
2046 * Nearly everywhere, inner must be non-null, however in places where
2047 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2049 LDKnativeUpdateFulfillHTLC *inner;
2051 } LDKUpdateFulfillHTLC;
2053 typedef struct LDKCVec_UpdateFulfillHTLCZ {
2054 struct LDKUpdateFulfillHTLC *data;
2056 } LDKCVec_UpdateFulfillHTLCZ;
2061 * An update_fail_htlc message to be sent or received from a peer
2063 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
2065 * Nearly everywhere, inner must be non-null, however in places where
2066 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2068 LDKnativeUpdateFailHTLC *inner;
2070 } LDKUpdateFailHTLC;
2072 typedef struct LDKCVec_UpdateFailHTLCZ {
2073 struct LDKUpdateFailHTLC *data;
2075 } LDKCVec_UpdateFailHTLCZ;
2080 * An update_fail_malformed_htlc message to be sent or received from a peer
2082 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
2084 * Nearly everywhere, inner must be non-null, however in places where
2085 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2087 LDKnativeUpdateFailMalformedHTLC *inner;
2089 } LDKUpdateFailMalformedHTLC;
2091 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
2092 struct LDKUpdateFailMalformedHTLC *data;
2094 } LDKCVec_UpdateFailMalformedHTLCZ;
2099 * An Err type for failure to process messages.
2101 typedef struct MUST_USE_STRUCT LDKLightningError {
2103 * Nearly everywhere, inner must be non-null, however in places where
2104 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2106 LDKnativeLightningError *inner;
2108 } LDKLightningError;
2110 typedef union LDKCResult_boolLightningErrorZPtr {
2112 struct LDKLightningError *err;
2113 } LDKCResult_boolLightningErrorZPtr;
2115 typedef struct LDKCResult_boolLightningErrorZ {
2116 union LDKCResult_boolLightningErrorZPtr contents;
2118 } LDKCResult_boolLightningErrorZ;
2120 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2121 struct LDKChannelAnnouncement a;
2122 struct LDKChannelUpdate b;
2123 struct LDKChannelUpdate c;
2124 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
2126 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2127 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
2129 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
2131 typedef struct LDKCVec_NodeAnnouncementZ {
2132 struct LDKNodeAnnouncement *data;
2134 } LDKCVec_NodeAnnouncementZ;
2136 typedef union LDKCResult_NoneLightningErrorZPtr {
2138 * Note that this value is always NULL, as there are no contents in the OK variant
2141 struct LDKLightningError *err;
2142 } LDKCResult_NoneLightningErrorZPtr;
2144 typedef struct LDKCResult_NoneLightningErrorZ {
2145 union LDKCResult_NoneLightningErrorZPtr contents;
2147 } LDKCResult_NoneLightningErrorZ;
2149 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
2150 struct LDKChannelReestablish *result;
2151 struct LDKDecodeError *err;
2152 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
2154 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
2155 union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
2157 } LDKCResult_ChannelReestablishDecodeErrorZ;
2162 * An init message to be sent or received from a peer
2164 typedef struct MUST_USE_STRUCT LDKInit {
2166 * Nearly everywhere, inner must be non-null, however in places where
2167 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2169 LDKnativeInit *inner;
2173 typedef union LDKCResult_InitDecodeErrorZPtr {
2174 struct LDKInit *result;
2175 struct LDKDecodeError *err;
2176 } LDKCResult_InitDecodeErrorZPtr;
2178 typedef struct LDKCResult_InitDecodeErrorZ {
2179 union LDKCResult_InitDecodeErrorZPtr contents;
2181 } LDKCResult_InitDecodeErrorZ;
2186 * A ping message to be sent or received from a peer
2188 typedef struct MUST_USE_STRUCT LDKPing {
2190 * Nearly everywhere, inner must be non-null, however in places where
2191 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2193 LDKnativePing *inner;
2197 typedef union LDKCResult_PingDecodeErrorZPtr {
2198 struct LDKPing *result;
2199 struct LDKDecodeError *err;
2200 } LDKCResult_PingDecodeErrorZPtr;
2202 typedef struct LDKCResult_PingDecodeErrorZ {
2203 union LDKCResult_PingDecodeErrorZPtr contents;
2205 } LDKCResult_PingDecodeErrorZ;
2210 * A pong message to be sent or received from a peer
2212 typedef struct MUST_USE_STRUCT LDKPong {
2214 * Nearly everywhere, inner must be non-null, however in places where
2215 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2217 LDKnativePong *inner;
2221 typedef union LDKCResult_PongDecodeErrorZPtr {
2222 struct LDKPong *result;
2223 struct LDKDecodeError *err;
2224 } LDKCResult_PongDecodeErrorZPtr;
2226 typedef struct LDKCResult_PongDecodeErrorZ {
2227 union LDKCResult_PongDecodeErrorZPtr contents;
2229 } LDKCResult_PongDecodeErrorZ;
2231 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2232 struct LDKUnsignedChannelAnnouncement *result;
2233 struct LDKDecodeError *err;
2234 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
2236 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
2237 union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
2239 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
2244 * The unsigned part of a channel_update
2246 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
2248 * Nearly everywhere, inner must be non-null, however in places where
2249 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2251 LDKnativeUnsignedChannelUpdate *inner;
2253 } LDKUnsignedChannelUpdate;
2255 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
2256 struct LDKUnsignedChannelUpdate *result;
2257 struct LDKDecodeError *err;
2258 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
2260 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
2261 union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
2263 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
2265 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
2266 struct LDKErrorMessage *result;
2267 struct LDKDecodeError *err;
2268 } LDKCResult_ErrorMessageDecodeErrorZPtr;
2270 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
2271 union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
2273 } LDKCResult_ErrorMessageDecodeErrorZ;
2278 * The unsigned part of a node_announcement
2280 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
2282 * Nearly everywhere, inner must be non-null, however in places where
2283 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2285 LDKnativeUnsignedNodeAnnouncement *inner;
2287 } LDKUnsignedNodeAnnouncement;
2289 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2290 struct LDKUnsignedNodeAnnouncement *result;
2291 struct LDKDecodeError *err;
2292 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
2294 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
2295 union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
2297 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
2299 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
2300 struct LDKQueryShortChannelIds *result;
2301 struct LDKDecodeError *err;
2302 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
2304 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
2305 union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
2307 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
2312 * A reply_short_channel_ids_end message is sent as a reply to a
2313 * query_short_channel_ids message. The query recipient makes a best
2314 * effort to respond based on their local network view which may not be
2315 * a perfect view of the network.
2317 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
2319 * Nearly everywhere, inner must be non-null, however in places where
2320 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2322 LDKnativeReplyShortChannelIdsEnd *inner;
2324 } LDKReplyShortChannelIdsEnd;
2326 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2327 struct LDKReplyShortChannelIdsEnd *result;
2328 struct LDKDecodeError *err;
2329 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
2331 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
2332 union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
2334 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
2336 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
2337 struct LDKQueryChannelRange *result;
2338 struct LDKDecodeError *err;
2339 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
2341 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
2342 union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
2344 } LDKCResult_QueryChannelRangeDecodeErrorZ;
2349 * A reply_channel_range message is a reply to a query_channel_range
2350 * message. Multiple reply_channel_range messages can be sent in reply
2351 * to a single query_channel_range message. The query recipient makes a
2352 * best effort to respond based on their local network view which may
2353 * not be a perfect view of the network. The short_channel_ids in the
2354 * reply are encoded. We only support encoding_type=0 uncompressed
2355 * serialization and do not support encoding_type=1 zlib serialization.
2357 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2359 * Nearly everywhere, inner must be non-null, however in places where
2360 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2362 LDKnativeReplyChannelRange *inner;
2364 } LDKReplyChannelRange;
2366 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
2367 struct LDKReplyChannelRange *result;
2368 struct LDKDecodeError *err;
2369 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
2371 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
2372 union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
2374 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
2379 * A gossip_timestamp_filter message is used by a node to request
2380 * gossip relay for messages in the requested time range when the
2381 * gossip_queries feature has been negotiated.
2383 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
2385 * Nearly everywhere, inner must be non-null, however in places where
2386 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2388 LDKnativeGossipTimestampFilter *inner;
2390 } LDKGossipTimestampFilter;
2392 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
2393 struct LDKGossipTimestampFilter *result;
2394 struct LDKDecodeError *err;
2395 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
2397 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
2398 union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
2400 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
2402 typedef struct LDKCVec_PublicKeyZ {
2403 struct LDKPublicKey *data;
2405 } LDKCVec_PublicKeyZ;
2410 * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
2411 * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
2414 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
2416 * Nearly everywhere, inner must be non-null, however in places where
2417 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2419 LDKnativePeerHandleError *inner;
2421 } LDKPeerHandleError;
2423 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
2424 struct LDKCVec_u8Z *result;
2425 struct LDKPeerHandleError *err;
2426 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
2428 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
2429 union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
2431 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
2433 typedef union LDKCResult_NonePeerHandleErrorZPtr {
2435 * Note that this value is always NULL, as there are no contents in the OK variant
2438 struct LDKPeerHandleError *err;
2439 } LDKCResult_NonePeerHandleErrorZPtr;
2441 typedef struct LDKCResult_NonePeerHandleErrorZ {
2442 union LDKCResult_NonePeerHandleErrorZPtr contents;
2444 } LDKCResult_NonePeerHandleErrorZ;
2446 typedef union LDKCResult_boolPeerHandleErrorZPtr {
2448 struct LDKPeerHandleError *err;
2449 } LDKCResult_boolPeerHandleErrorZPtr;
2451 typedef struct LDKCResult_boolPeerHandleErrorZ {
2452 union LDKCResult_boolPeerHandleErrorZPtr contents;
2454 } LDKCResult_boolPeerHandleErrorZ;
2456 typedef union LDKCResult_SecretKeySecpErrorZPtr {
2457 struct LDKSecretKey *result;
2458 enum LDKSecp256k1Error *err;
2459 } LDKCResult_SecretKeySecpErrorZPtr;
2461 typedef struct LDKCResult_SecretKeySecpErrorZ {
2462 union LDKCResult_SecretKeySecpErrorZPtr contents;
2464 } LDKCResult_SecretKeySecpErrorZ;
2466 typedef union LDKCResult_PublicKeySecpErrorZPtr {
2467 struct LDKPublicKey *result;
2468 enum LDKSecp256k1Error *err;
2469 } LDKCResult_PublicKeySecpErrorZPtr;
2471 typedef struct LDKCResult_PublicKeySecpErrorZ {
2472 union LDKCResult_PublicKeySecpErrorZPtr contents;
2474 } LDKCResult_PublicKeySecpErrorZ;
2479 * The set of public keys which are used in the creation of one commitment transaction.
2480 * These are derived from the channel base keys and per-commitment data.
2482 * A broadcaster key is provided from potential broadcaster of the computed transaction.
2483 * A countersignatory key is coming from a protocol participant unable to broadcast the
2486 * These keys are assumed to be good, either because the code derived them from
2487 * channel basepoints via the new function, or they were obtained via
2488 * CommitmentTransaction.trust().keys() because we trusted the source of the
2489 * pre-calculated keys.
2491 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
2493 * Nearly everywhere, inner must be non-null, however in places where
2494 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2496 LDKnativeTxCreationKeys *inner;
2498 } LDKTxCreationKeys;
2500 typedef union LDKCResult_TxCreationKeysSecpErrorZPtr {
2501 struct LDKTxCreationKeys *result;
2502 enum LDKSecp256k1Error *err;
2503 } LDKCResult_TxCreationKeysSecpErrorZPtr;
2505 typedef struct LDKCResult_TxCreationKeysSecpErrorZ {
2506 union LDKCResult_TxCreationKeysSecpErrorZPtr contents;
2508 } LDKCResult_TxCreationKeysSecpErrorZ;
2513 * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
2514 * transaction and the transaction creation keys) are trusted.
2516 * See trust() and verify() functions on CommitmentTransaction.
2518 * This structure implements Deref.
2520 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
2522 * Nearly everywhere, inner must be non-null, however in places where
2523 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2525 LDKnativeTrustedCommitmentTransaction *inner;
2527 } LDKTrustedCommitmentTransaction;
2529 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
2530 struct LDKTrustedCommitmentTransaction *result;
2532 * Note that this value is always NULL, as there are no contents in the Err variant
2535 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
2537 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
2538 union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
2540 } LDKCResult_TrustedCommitmentTransactionNoneZ;
2542 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
2543 struct LDKCVec_SignatureZ *result;
2545 * Note that this value is always NULL, as there are no contents in the Err variant
2548 } LDKCResult_CVec_SignatureZNoneZPtr;
2550 typedef struct LDKCResult_CVec_SignatureZNoneZ {
2551 union LDKCResult_CVec_SignatureZNoneZPtr contents;
2553 } LDKCResult_CVec_SignatureZNoneZ;
2560 typedef struct MUST_USE_STRUCT LDKRouteHop {
2562 * Nearly everywhere, inner must be non-null, however in places where
2563 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2565 LDKnativeRouteHop *inner;
2569 typedef struct LDKCVec_RouteHopZ {
2570 struct LDKRouteHop *data;
2572 } LDKCVec_RouteHopZ;
2574 typedef struct LDKCVec_CVec_RouteHopZZ {
2575 struct LDKCVec_RouteHopZ *data;
2577 } LDKCVec_CVec_RouteHopZZ;
2582 * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2583 * it can take multiple paths. Each path is composed of one or more hops through the network.
2585 typedef struct MUST_USE_STRUCT LDKRoute {
2587 * Nearly everywhere, inner must be non-null, however in places where
2588 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2590 LDKnativeRoute *inner;
2594 typedef union LDKCResult_RouteDecodeErrorZPtr {
2595 struct LDKRoute *result;
2596 struct LDKDecodeError *err;
2597 } LDKCResult_RouteDecodeErrorZPtr;
2599 typedef struct LDKCResult_RouteDecodeErrorZ {
2600 union LDKCResult_RouteDecodeErrorZPtr contents;
2602 } LDKCResult_RouteDecodeErrorZ;
2607 * A channel descriptor which provides a last-hop route to get_route
2609 typedef struct MUST_USE_STRUCT LDKRouteHint {
2611 * Nearly everywhere, inner must be non-null, however in places where
2612 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2614 LDKnativeRouteHint *inner;
2618 typedef struct LDKCVec_RouteHintZ {
2619 struct LDKRouteHint *data;
2621 } LDKCVec_RouteHintZ;
2623 typedef union LDKCResult_RouteLightningErrorZPtr {
2624 struct LDKRoute *result;
2625 struct LDKLightningError *err;
2626 } LDKCResult_RouteLightningErrorZPtr;
2628 typedef struct LDKCResult_RouteLightningErrorZ {
2629 union LDKCResult_RouteLightningErrorZPtr contents;
2631 } LDKCResult_RouteLightningErrorZ;
2636 * Fees for routing via a given channel or a node
2638 typedef struct MUST_USE_STRUCT LDKRoutingFees {
2640 * Nearly everywhere, inner must be non-null, however in places where
2641 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2643 LDKnativeRoutingFees *inner;
2647 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
2648 struct LDKRoutingFees *result;
2649 struct LDKDecodeError *err;
2650 } LDKCResult_RoutingFeesDecodeErrorZPtr;
2652 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
2653 union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
2655 } LDKCResult_RoutingFeesDecodeErrorZ;
2660 * Information received in the latest node_announcement from this node.
2662 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
2664 * Nearly everywhere, inner must be non-null, however in places where
2665 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2667 LDKnativeNodeAnnouncementInfo *inner;
2669 } LDKNodeAnnouncementInfo;
2671 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
2672 struct LDKNodeAnnouncementInfo *result;
2673 struct LDKDecodeError *err;
2674 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
2676 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
2677 union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
2679 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
2684 * Details about a node in the network, known from the network announcement.
2686 typedef struct MUST_USE_STRUCT LDKNodeInfo {
2688 * Nearly everywhere, inner must be non-null, however in places where
2689 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2691 LDKnativeNodeInfo *inner;
2695 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
2696 struct LDKNodeInfo *result;
2697 struct LDKDecodeError *err;
2698 } LDKCResult_NodeInfoDecodeErrorZPtr;
2700 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
2701 union LDKCResult_NodeInfoDecodeErrorZPtr contents;
2703 } LDKCResult_NodeInfoDecodeErrorZ;
2708 * Represents the network as nodes and channels between them
2710 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
2712 * Nearly everywhere, inner must be non-null, however in places where
2713 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2715 LDKnativeNetworkGraph *inner;
2719 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
2720 struct LDKNetworkGraph *result;
2721 struct LDKDecodeError *err;
2722 } LDKCResult_NetworkGraphDecodeErrorZPtr;
2724 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
2725 union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
2727 } LDKCResult_NetworkGraphDecodeErrorZ;
2730 * A trait indicating an object may generate message send events
2732 typedef struct LDKMessageSendEventsProvider {
2735 * Gets the list of pending events which were generated by previous actions, clearing the list
2738 struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
2739 void (*free)(void *this_arg);
2740 } LDKMessageSendEventsProvider;
2743 * A trait indicating an object may generate events
2745 typedef struct LDKEventsProvider {
2748 * Gets the list of pending events which were generated by previous actions, clearing the list
2751 struct LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
2752 void (*free)(void *this_arg);
2753 } LDKEventsProvider;
2758 * Configuration we set when applicable.
2760 * Default::default() provides sane defaults.
2762 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
2764 * Nearly everywhere, inner must be non-null, however in places where
2765 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2767 LDKnativeChannelHandshakeConfig *inner;
2769 } LDKChannelHandshakeConfig;
2774 * Optional channel limits which are applied during channel creation.
2776 * These limits are only applied to our counterparty's limits, not our own.
2778 * Use 0/<type>::max_value() as appropriate to skip checking.
2780 * Provides sane defaults for most configurations.
2782 * Most additional limits are disabled except those with which specify a default in individual
2783 * field documentation. Note that this may result in barely-usable channels, but since they
2784 * are applied mostly only to incoming channels that's not much of a problem.
2786 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
2788 * Nearly everywhere, inner must be non-null, however in places where
2789 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2791 LDKnativeChannelHandshakeLimits *inner;
2793 } LDKChannelHandshakeLimits;
2798 * Options which apply on a per-channel basis and may change at runtime or based on negotiation
2799 * with our counterparty.
2801 typedef struct MUST_USE_STRUCT LDKChannelConfig {
2803 * Nearly everywhere, inner must be non-null, however in places where
2804 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2806 LDKnativeChannelConfig *inner;
2813 * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
2815 * Default::default() provides sane defaults for most configurations
2816 * (but currently with 0 relay fees!)
2818 typedef struct MUST_USE_STRUCT LDKUserConfig {
2820 * Nearly everywhere, inner must be non-null, however in places where
2821 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2823 LDKnativeUserConfig *inner;
2828 * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
2831 typedef struct LDKAccess {
2834 * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
2835 * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
2838 * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
2840 struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
2841 void (*free)(void *this_arg);
2845 * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
2848 * This is useful in order to have a [`Watch`] implementation convey to a chain source which
2849 * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
2850 * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
2851 * receiving full blocks from a chain source, any further filtering is unnecessary.
2853 * After an output has been registered, subsequent block retrievals from the chain source must not
2854 * exclude any transactions matching the new criteria nor any in-block descendants of such
2857 * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
2858 * should not block on I/O. Implementations should instead queue the newly monitored data to be
2859 * processed later. Then, in order to block until the data has been processed, any `Watch`
2860 * invocation that has called the `Filter` must return [`TemporaryFailure`].
2862 * [`Watch`]: trait.Watch.html
2863 * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure
2864 * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
2865 * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
2867 typedef struct LDKFilter {
2870 * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
2871 * a spending condition.
2873 void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
2875 * Registers interest in spends of a transaction output identified by `outpoint` having
2876 * `script_pubkey` as the spending condition.
2878 void (*register_output)(const void *this_arg, const struct LDKOutPoint *NONNULL_PTR outpoint, struct LDKu8slice script_pubkey);
2879 void (*free)(void *this_arg);
2883 * `Persist` defines behavior for persisting channel monitors: this could mean
2884 * writing once to disk, and/or uploading to one or more backup services.
2886 * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
2887 * to disk/backups. And, on every update, you **must** persist either the
2888 * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
2889 * of situations such as revoking a transaction, then crashing before this
2890 * revocation can be persisted, then unintentionally broadcasting a revoked
2891 * transaction and losing money. This is a risk because previous channel states
2892 * are toxic, so it's important that whatever channel state is persisted is
2895 typedef struct LDKPersist {
2898 * Persist a new channel's data. The data can be stored any way you want, but
2899 * the identifier provided by Rust-Lightning is the channel's outpoint (and
2900 * it is up to you to maintain a correct mapping between the outpoint and the
2901 * stored channel data). Note that you **must** persist every new monitor to
2902 * disk. See the `Persist` trait documentation for more details.
2904 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
2905 * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
2907 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
2908 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
2910 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
2912 * Update one channel's data. The provided `ChannelMonitor` has already
2913 * applied the given update.
2915 * Note that on every update, you **must** persist either the
2916 * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
2917 * the `Persist` trait documentation for more details.
2919 * If an implementer chooses to persist the updates only, they need to make
2920 * sure that all the updates are applied to the `ChannelMonitors` *before*
2921 * the set of channel monitors is given to the `ChannelManager`
2922 * deserialization routine. See [`ChannelMonitor::update_monitor`] for
2923 * applying a monitor update to a monitor. If full `ChannelMonitors` are
2924 * persisted, then there is no need to persist individual updates.
2926 * Note that there could be a performance tradeoff between persisting complete
2927 * channel monitors on every update vs. persisting only updates and applying
2928 * them in batches. The size of each monitor grows `O(number of state updates)`
2929 * whereas updates are small and `O(1)`.
2931 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
2932 * [`ChannelMonitorUpdate::write`] for writing out an update, and
2933 * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
2935 * [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1
2936 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
2937 * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write
2938 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
2940 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);
2941 void (*free)(void *this_arg);
2947 * An implementation of [`chain::Watch`] for monitoring channels.
2949 * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
2950 * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
2951 * or used independently to monitor channels remotely. See the [module-level documentation] for
2954 * [`chain::Watch`]: ../trait.Watch.html
2955 * [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html
2956 * [module-level documentation]: index.html
2958 typedef struct MUST_USE_STRUCT LDKChainMonitor {
2960 * Nearly everywhere, inner must be non-null, however in places where
2961 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2963 LDKnativeChainMonitor *inner;
2970 * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2971 * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2972 * preimage claim backward will lead to loss of funds.
2974 * [`chain::Watch`]: ../trait.Watch.html
2976 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2978 * Nearly everywhere, inner must be non-null, however in places where
2979 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2981 LDKnativeHTLCUpdate *inner;
2988 * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
2989 * and derives keys from that.
2991 * Your node_id is seed/0'
2992 * ChannelMonitor closes may use seed/1'
2993 * Cooperative closes may use seed/2'
2994 * The two close keys may be needed to claim on-chain funds!
2996 typedef struct MUST_USE_STRUCT LDKKeysManager {
2998 * Nearly everywhere, inner must be non-null, however in places where
2999 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3001 LDKnativeKeysManager *inner;
3008 * Features used within an `init` message.
3010 typedef struct MUST_USE_STRUCT LDKInitFeatures {
3012 * Nearly everywhere, inner must be non-null, however in places where
3013 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3015 LDKnativeInitFeatures *inner;
3019 typedef struct LDKThreeBytes {
3026 * A commitment_signed message to be sent or received from a peer
3028 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
3030 * Nearly everywhere, inner must be non-null, however in places where
3031 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3033 LDKnativeCommitmentSigned *inner;
3035 } LDKCommitmentSigned;
3040 * An update_fee message to be sent or received from a peer
3042 typedef struct MUST_USE_STRUCT LDKUpdateFee {
3044 * Nearly everywhere, inner must be non-null, however in places where
3045 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3047 LDKnativeUpdateFee *inner;
3052 * A trait to describe an object which can receive channel messages.
3054 * Messages MAY be called in parallel when they originate from different their_node_ids, however
3055 * they MUST NOT be called in parallel when the two calls have the same their_node_id.
3057 typedef struct LDKChannelMessageHandler {
3060 * Handle an incoming open_channel message from the given peer.
3062 void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
3064 * Handle an incoming accept_channel message from the given peer.
3066 void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
3068 * Handle an incoming funding_created message from the given peer.
3070 void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
3072 * Handle an incoming funding_signed message from the given peer.
3074 void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
3076 * Handle an incoming funding_locked message from the given peer.
3078 void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
3080 * Handle an incoming shutdown message from the given peer.
3082 void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg);
3084 * Handle an incoming closing_signed message from the given peer.
3086 void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
3088 * Handle an incoming update_add_htlc message from the given peer.
3090 void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
3092 * Handle an incoming update_fulfill_htlc message from the given peer.
3094 void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
3096 * Handle an incoming update_fail_htlc message from the given peer.
3098 void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
3100 * Handle an incoming update_fail_malformed_htlc message from the given peer.
3102 void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
3104 * Handle an incoming commitment_signed message from the given peer.
3106 void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
3108 * Handle an incoming revoke_and_ack message from the given peer.
3110 void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
3112 * Handle an incoming update_fee message from the given peer.
3114 void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
3116 * Handle an incoming announcement_signatures message from the given peer.
3118 void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
3120 * Indicates a connection to the peer failed/an existing connection was lost. If no connection
3121 * is believed to be possible in the future (eg they're sending us messages we don't
3122 * understand or indicate they require unknown feature bits), no_connection_possible is set
3123 * and any outstanding channels should be failed.
3125 void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
3127 * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
3129 void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
3131 * Handle an incoming channel_reestablish message from the given peer.
3133 void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
3135 * Handle an incoming error message from the given peer.
3137 void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
3138 struct LDKMessageSendEventsProvider MessageSendEventsProvider;
3139 void (*free)(void *this_arg);
3140 } LDKChannelMessageHandler;
3145 * Arguments for the creation of a ChannelManager that are not deserialized.
3147 * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
3149 * 1) Deserialize all stored ChannelMonitors.
3150 * 2) Deserialize the ChannelManager by filling in this struct and calling <(Sha256dHash,
3151 * ChannelManager)>::read(reader, args).
3152 * This may result in closing some Channels if the ChannelMonitor is newer than the stored
3153 * ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
3154 * 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
3155 * ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo().
3156 * 4) Reconnect blocks on your ChannelMonitors.
3157 * 5) Move the ChannelMonitors into your local chain::Watch.
3158 * 6) Disconnect/connect blocks on the ChannelManager.
3160 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
3162 * Nearly everywhere, inner must be non-null, however in places where
3163 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3165 LDKnativeChannelManagerReadArgs *inner;
3167 } LDKChannelManagerReadArgs;
3172 * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
3173 * This is used to convince the recipient that the channel is at a certain commitment
3174 * number even if they lost that data due to a local failure. Of course, the peer may lie
3175 * and even later commitments may have been revoked.
3177 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
3179 * Nearly everywhere, inner must be non-null, however in places where
3180 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3182 LDKnativeDataLossProtect *inner;
3184 } LDKDataLossProtect;
3189 * Features used within a `node_announcement` message.
3191 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
3193 * Nearly everywhere, inner must be non-null, however in places where
3194 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3196 LDKnativeNodeFeatures *inner;
3203 * Features used within a `channel_announcement` message.
3205 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
3207 * Nearly everywhere, inner must be non-null, however in places where
3208 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3210 LDKnativeChannelFeatures *inner;
3212 } LDKChannelFeatures;
3215 * A trait to describe an object which can receive routing messages.
3217 * # Implementor DoS Warnings
3219 * For `gossip_queries` messages there are potential DoS vectors when handling
3220 * inbound queries. Implementors using an on-disk network graph should be aware of
3221 * repeated disk I/O for queries accessing different parts of the network graph.
3223 typedef struct LDKRoutingMessageHandler {
3226 * Handle an incoming node_announcement message, returning true if it should be forwarded on,
3227 * false or returning an Err otherwise.
3229 struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
3231 * Handle a channel_announcement message, returning true if it should be forwarded on, false
3232 * or returning an Err otherwise.
3234 struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
3236 * Handle an incoming channel_update message, returning true if it should be forwarded on,
3237 * false or returning an Err otherwise.
3239 struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
3241 * Handle some updates to the route graph that we learned due to an outbound failed payment.
3243 void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
3245 * Gets a subset of the channel announcements and updates required to dump our routing table
3246 * to a remote node, starting at the short_channel_id indicated by starting_point and
3247 * including the batch_amount entries immediately higher in numerical value than starting_point.
3249 struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
3251 * Gets a subset of the node announcements required to dump our routing table to a remote node,
3252 * starting at the node *after* the provided publickey and including batch_amount entries
3253 * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
3254 * If None is provided for starting_point, we start at the first node.
3256 struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
3258 * Called when a connection is established with a peer. This can be used to
3259 * perform routing table synchronization using a strategy defined by the
3262 void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
3264 * Handles the reply of a query we initiated to learn about channels
3265 * for a given range of blocks. We can expect to receive one or more
3266 * replies to a single query.
3268 struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
3270 * Handles the reply of a query we initiated asking for routing gossip
3271 * messages for a list of channels. We should receive this message when
3272 * a node has completed its best effort to send us the pertaining routing
3275 struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
3277 * Handles when a peer asks us to send a list of short_channel_ids
3278 * for the requested range of blocks.
3280 struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
3282 * Handles when a peer asks us to send routing gossip messages for a
3283 * list of short_channel_ids.
3285 struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
3286 struct LDKMessageSendEventsProvider MessageSendEventsProvider;
3287 void (*free)(void *this_arg);
3288 } LDKRoutingMessageHandler;
3293 * Provides references to trait impls which handle different types of messages.
3295 typedef struct MUST_USE_STRUCT LDKMessageHandler {
3297 * Nearly everywhere, inner must be non-null, however in places where
3298 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3300 LDKnativeMessageHandler *inner;
3302 } LDKMessageHandler;
3305 * Provides an object which can be used to send data to and which uniquely identifies a connection
3306 * to a remote host. You will need to be able to generate multiple of these which meet Eq and
3307 * implement Hash to meet the PeerManager API.
3309 * For efficiency, Clone should be relatively cheap for this type.
3311 * You probably want to just extend an int and put a file descriptor in a struct and implement
3312 * send_data. Note that if you are using a higher-level net library that may call close() itself,
3313 * be careful to ensure you don't have races whereby you might register a new connection with an
3314 * fd which is the same as a previous one which has yet to be removed via
3315 * PeerManager::socket_disconnected().
3317 typedef struct LDKSocketDescriptor {
3320 * Attempts to send some data from the given slice to the peer.
3322 * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
3323 * Note that in the disconnected case, socket_disconnected must still fire and further write
3324 * attempts may occur until that time.
3326 * If the returned size is smaller than data.len(), a write_available event must
3327 * trigger the next time more data can be written. Additionally, until the a send_data event
3328 * completes fully, no further read_events should trigger on the same peer!
3330 * If a read_event on this descriptor had previously returned true (indicating that read
3331 * events should be paused to prevent DoS in the send buffer), resume_read may be set
3332 * indicating that read events on this descriptor should resume. A resume_read of false does
3333 * *not* imply that further read events should be paused.
3335 uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
3337 * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
3338 * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
3339 * this descriptor. No socket_disconnected call should be generated as a result of this call,
3340 * though races may occur whereby disconnect_socket is called after a call to
3341 * socket_disconnected but prior to socket_disconnected returning.
3343 void (*disconnect_socket)(void *this_arg);
3344 bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
3345 uint64_t (*hash)(const void *this_arg);
3346 void *(*clone)(const void *this_arg);
3347 void (*free)(void *this_arg);
3348 } LDKSocketDescriptor;
3353 * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
3354 * events into messages which it passes on to its MessageHandlers.
3356 * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
3357 * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
3358 * essentially you should default to using a SimpleRefPeerManager, and use a
3359 * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
3360 * you're using lightning-net-tokio.
3362 typedef struct MUST_USE_STRUCT LDKPeerManager {
3364 * Nearly everywhere, inner must be non-null, however in places where
3365 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3367 LDKnativePeerManager *inner;
3374 * Late-bound per-channel counterparty data used to build transactions.
3376 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
3378 * Nearly everywhere, inner must be non-null, however in places where
3379 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3381 LDKnativeCounterpartyChannelTransactionParameters *inner;
3383 } LDKCounterpartyChannelTransactionParameters;
3388 * Static channel fields used to build transactions given per-commitment fields, organized by
3389 * broadcaster/countersignatory.
3391 * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
3392 * as_holder_broadcastable and as_counterparty_broadcastable functions.
3394 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
3396 * Nearly everywhere, inner must be non-null, however in places where
3397 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3399 LDKnativeDirectedChannelTransactionParameters *inner;
3401 } LDKDirectedChannelTransactionParameters;
3406 * A pre-built Bitcoin commitment transaction and its txid.
3408 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
3410 * Nearly everywhere, inner must be non-null, however in places where
3411 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3413 LDKnativeBuiltCommitmentTransaction *inner;
3415 } LDKBuiltCommitmentTransaction;
3420 * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
3421 * This exists only to make accessing a RwLock<NetworkGraph> possible from
3422 * the C bindings, as it can be done directly in Rust code.
3424 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
3426 * Nearly everywhere, inner must be non-null, however in places where
3427 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3429 LDKnativeLockedNetworkGraph *inner;
3431 } LDKLockedNetworkGraph;
3436 * Receives and validates network updates from peers,
3437 * stores authentic and relevant data as a network graph.
3438 * This network graph is then used for routing payments.
3439 * Provides interface to help with initial routing sync by
3440 * serving historical announcements.
3442 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
3444 * Nearly everywhere, inner must be non-null, however in places where
3445 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3447 LDKnativeNetGraphMsgHandler *inner;
3449 } LDKNetGraphMsgHandler;
3454 * Details about one direction of a channel. Received
3455 * within a channel update.
3457 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
3459 * Nearly everywhere, inner must be non-null, however in places where
3460 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3462 LDKnativeDirectionalChannelInfo *inner;
3464 } LDKDirectionalChannelInfo;
3469 * Details about a channel (both directions).
3470 * Received within a channel announcement.
3472 typedef struct MUST_USE_STRUCT LDKChannelInfo {
3474 * Nearly everywhere, inner must be non-null, however in places where
3475 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3477 LDKnativeChannelInfo *inner;
3481 extern const uintptr_t MAX_BUF_SIZE;
3483 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
3485 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
3487 void Transaction_free(struct LDKTransaction _res);
3489 void TxOut_free(struct LDKTxOut _res);
3491 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
3493 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
3495 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
3497 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
3499 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
3501 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
3503 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
3505 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
3507 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
3509 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
3511 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
3513 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
3515 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
3517 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
3519 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
3521 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
3523 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
3525 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
3527 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
3529 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
3531 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
3533 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
3535 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
3537 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
3539 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
3541 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
3543 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
3545 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
3547 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
3549 void CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res);
3551 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
3553 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
3555 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
3557 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
3559 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
3561 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
3563 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
3565 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
3567 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
3569 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
3571 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
3573 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
3575 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
3577 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
3579 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
3581 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
3583 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
3585 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
3587 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
3589 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
3591 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
3593 struct LDKCResult_ChanKeySignerDecodeErrorZ CResult_ChanKeySignerDecodeErrorZ_ok(struct LDKChannelKeys o);
3595 struct LDKCResult_ChanKeySignerDecodeErrorZ CResult_ChanKeySignerDecodeErrorZ_err(struct LDKDecodeError e);
3597 void CResult_ChanKeySignerDecodeErrorZ_free(struct LDKCResult_ChanKeySignerDecodeErrorZ _res);
3599 struct LDKCResult_ChanKeySignerDecodeErrorZ CResult_ChanKeySignerDecodeErrorZ_clone(const struct LDKCResult_ChanKeySignerDecodeErrorZ *NONNULL_PTR orig);
3601 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_ok(struct LDKInMemoryChannelKeys o);
3603 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_err(struct LDKDecodeError e);
3605 void CResult_InMemoryChannelKeysDecodeErrorZ_free(struct LDKCResult_InMemoryChannelKeysDecodeErrorZ _res);
3607 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_clone(const struct LDKCResult_InMemoryChannelKeysDecodeErrorZ *NONNULL_PTR orig);
3609 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
3611 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
3613 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
3615 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
3617 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
3619 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
3621 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
3623 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
3625 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
3627 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
3629 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
3631 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
3633 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
3635 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
3637 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
3639 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
3641 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
3643 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
3645 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
3647 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
3649 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
3651 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
3653 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
3655 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
3657 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
3659 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
3661 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
3663 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
3665 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
3667 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
3669 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
3671 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
3673 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
3675 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
3677 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
3679 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
3681 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
3683 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
3685 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
3687 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
3689 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
3691 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
3693 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
3695 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
3697 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
3699 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
3701 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
3703 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
3705 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
3707 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
3709 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
3711 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
3713 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
3715 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
3717 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
3719 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
3721 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
3723 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
3725 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
3727 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
3729 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
3731 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
3733 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
3735 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
3737 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
3739 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
3741 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
3743 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
3745 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
3747 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
3749 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
3751 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
3753 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
3755 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
3757 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
3759 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
3761 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
3763 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
3765 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
3767 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
3769 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
3771 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
3773 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
3775 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
3777 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
3779 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
3781 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
3783 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
3785 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
3787 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
3789 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
3791 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
3793 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
3795 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
3797 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
3799 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
3801 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
3803 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
3805 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
3807 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
3809 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
3811 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
3813 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
3815 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
3817 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
3819 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
3821 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
3823 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
3825 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
3827 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
3829 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
3831 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
3833 struct LDKCResult_SecretKeySecpErrorZ CResult_SecretKeySecpErrorZ_ok(struct LDKSecretKey o);
3835 struct LDKCResult_SecretKeySecpErrorZ CResult_SecretKeySecpErrorZ_err(enum LDKSecp256k1Error e);
3837 void CResult_SecretKeySecpErrorZ_free(struct LDKCResult_SecretKeySecpErrorZ _res);
3839 struct LDKCResult_PublicKeySecpErrorZ CResult_PublicKeySecpErrorZ_ok(struct LDKPublicKey o);
3841 struct LDKCResult_PublicKeySecpErrorZ CResult_PublicKeySecpErrorZ_err(enum LDKSecp256k1Error e);
3843 void CResult_PublicKeySecpErrorZ_free(struct LDKCResult_PublicKeySecpErrorZ _res);
3845 struct LDKCResult_TxCreationKeysSecpErrorZ CResult_TxCreationKeysSecpErrorZ_ok(struct LDKTxCreationKeys o);
3847 struct LDKCResult_TxCreationKeysSecpErrorZ CResult_TxCreationKeysSecpErrorZ_err(enum LDKSecp256k1Error e);
3849 void CResult_TxCreationKeysSecpErrorZ_free(struct LDKCResult_TxCreationKeysSecpErrorZ _res);
3851 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
3853 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
3855 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
3857 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
3859 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
3861 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
3863 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
3865 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
3867 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
3869 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
3871 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
3873 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
3875 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
3877 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
3879 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
3881 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
3883 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
3885 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
3887 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
3889 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
3891 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
3893 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
3895 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
3897 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
3899 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
3901 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
3903 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
3905 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
3907 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
3909 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
3911 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
3913 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
3915 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
3917 void Event_free(struct LDKEvent this_ptr);
3919 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
3921 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
3923 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
3925 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
3928 * Calls the free function if one is set
3930 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
3933 * Calls the free function if one is set
3935 void EventsProvider_free(struct LDKEventsProvider this_ptr);
3937 void APIError_free(struct LDKAPIError this_ptr);
3939 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
3941 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
3944 * Returns the most verbose logging level.
3946 MUST_USE_RES enum LDKLevel Level_max(void);
3949 * Calls the free function if one is set
3951 void Logger_free(struct LDKLogger this_ptr);
3953 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_ptr);
3955 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
3958 * Confirmations we will wait for before considering the channel locked in.
3959 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3960 * equivalent limit applied to outbound channels).
3964 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
3967 * Confirmations we will wait for before considering the channel locked in.
3968 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3969 * equivalent limit applied to outbound channels).
3973 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
3976 * Set to the amount of time we require our counterparty to wait to claim their money.
3978 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3979 * be online to check for peer having broadcast a revoked transaction to steal our funds
3980 * at least once every our_to_self_delay blocks.
3982 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3983 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3986 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3987 * opening so you can tweak config to ask for more security, not less.
3989 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
3992 * Set to the amount of time we require our counterparty to wait to claim their money.
3994 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3995 * be online to check for peer having broadcast a revoked transaction to steal our funds
3996 * at least once every our_to_self_delay blocks.
3998 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3999 * case of an honest unilateral channel close, which implicitly decrease the economic value of
4002 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
4003 * opening so you can tweak config to ask for more security, not less.
4005 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
4008 * Set to the smallest value HTLC we will accept to process.
4010 * This value is sent to our counterparty on channel-open and we close the channel any time
4011 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
4013 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
4016 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
4019 * Set to the smallest value HTLC we will accept to process.
4021 * This value is sent to our counterparty on channel-open and we close the channel any time
4022 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
4024 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
4027 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
4029 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);
4031 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
4033 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_ptr);
4035 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
4038 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
4039 * only applies to inbound channels.
4043 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4046 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
4047 * only applies to inbound channels.
4051 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4054 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
4055 * you to limit the maximum minimum-size they can require.
4057 * Default value: u64::max_value.
4059 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4062 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
4063 * you to limit the maximum minimum-size they can require.
4065 * Default value: u64::max_value.
4067 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4070 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
4071 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
4075 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4078 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
4079 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
4083 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4086 * The remote node will require we keep a certain amount in direct payment to ourselves at all
4087 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
4088 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
4090 * Default value: u64::max_value.
4092 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4095 * The remote node will require we keep a certain amount in direct payment to ourselves at all
4096 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
4097 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
4099 * Default value: u64::max_value.
4101 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4104 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
4105 * time. This allows you to set a minimum such value.
4109 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4112 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
4113 * time. This allows you to set a minimum such value.
4117 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
4120 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
4121 * required to always be higher than this value so this only applies to HTLC outputs (and
4122 * potentially to-self outputs before any payments have been made).
4123 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4124 * This setting allows you to set a minimum dust limit for their commitment transactions,
4125 * reflecting the reality that tiny outputs are not considered standard transactions and will
4126 * not propagate through the Bitcoin network.
4128 * Default value: 546, the current dust limit on the Bitcoin network.
4130 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4133 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
4134 * required to always be higher than this value so this only applies to HTLC outputs (and
4135 * potentially to-self outputs before any payments have been made).
4136 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4137 * This setting allows you to set a minimum dust limit for their commitment transactions,
4138 * reflecting the reality that tiny outputs are not considered standard transactions and will
4139 * not propagate through the Bitcoin network.
4141 * Default value: 546, the current dust limit on the Bitcoin network.
4143 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4146 * Maximum allowed threshold above which outputs will not be generated in their commitment
4148 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4150 * Default value: u64::max_value.
4152 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4155 * Maximum allowed threshold above which outputs will not be generated in their commitment
4157 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4159 * Default value: u64::max_value.
4161 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4164 * Before a channel is usable the funding transaction will need to be confirmed by at least a
4165 * certain number of blocks, specified by the node which is not the funder (as the funder can
4166 * assume they aren't going to double-spend themselves).
4167 * This config allows you to set a limit on the maximum amount of time to wait.
4169 * Default value: 144, or roughly one day and only applies to outbound channels.
4171 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4174 * Before a channel is usable the funding transaction will need to be confirmed by at least a
4175 * certain number of blocks, specified by the node which is not the funder (as the funder can
4176 * assume they aren't going to double-spend themselves).
4177 * This config allows you to set a limit on the maximum amount of time to wait.
4179 * Default value: 144, or roughly one day and only applies to outbound channels.
4181 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
4184 * Set to force the incoming channel to match our announced channel preference in
4187 * Default value: true, to make the default that no announced channels are possible (which is
4188 * appropriate for any nodes which are not online very reliably).
4190 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4193 * Set to force the incoming channel to match our announced channel preference in
4196 * Default value: true, to make the default that no announced channels are possible (which is
4197 * appropriate for any nodes which are not online very reliably).
4199 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
4202 * Set to the amount of time we're willing to wait to claim money back to us.
4204 * Not checking this value would be a security issue, as our peer would be able to set it to
4205 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
4207 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
4208 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
4210 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4213 * Set to the amount of time we're willing to wait to claim money back to us.
4215 * Not checking this value would be a security issue, as our peer would be able to set it to
4216 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
4218 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
4219 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
4221 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
4223 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);
4225 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
4227 void ChannelConfig_free(struct LDKChannelConfig this_ptr);
4229 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
4232 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
4233 * This may be allowed to change at runtime in a later update, however doing so must result in
4234 * update messages sent to notify all nodes of our updated relay fee.
4238 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4241 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
4242 * This may be allowed to change at runtime in a later update, however doing so must result in
4243 * update messages sent to notify all nodes of our updated relay fee.
4247 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
4250 * Set to announce the channel publicly and notify all nodes that they can route via this
4253 * This should only be set to true for nodes which expect to be online reliably.
4255 * As the node which funds a channel picks this value this will only apply for new outbound
4256 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
4258 * This cannot be changed after the initial channel handshake.
4260 * Default value: false.
4262 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4265 * Set to announce the channel publicly and notify all nodes that they can route via this
4268 * This should only be set to true for nodes which expect to be online reliably.
4270 * As the node which funds a channel picks this value this will only apply for new outbound
4271 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
4273 * This cannot be changed after the initial channel handshake.
4275 * Default value: false.
4277 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
4280 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
4281 * supports it, they will then enforce the mutual-close output to us matches what we provided
4282 * at intialization, preventing us from closing to an alternate pubkey.
4284 * This is set to true by default to provide a slight increase in security, though ultimately
4285 * any attacker who is able to take control of a channel can just as easily send the funds via
4286 * lightning payments, so we never require that our counterparties support this option.
4288 * This cannot be changed after a channel has been initialized.
4290 * Default value: true.
4292 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4295 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
4296 * supports it, they will then enforce the mutual-close output to us matches what we provided
4297 * at intialization, preventing us from closing to an alternate pubkey.
4299 * This is set to true by default to provide a slight increase in security, though ultimately
4300 * any attacker who is able to take control of a channel can just as easily send the funds via
4301 * lightning payments, so we never require that our counterparties support this option.
4303 * This cannot be changed after a channel has been initialized.
4305 * Default value: true.
4307 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
4309 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
4311 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
4313 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
4315 struct LDKChannelConfig ChannelConfig_read(struct LDKu8slice ser);
4317 void UserConfig_free(struct LDKUserConfig this_ptr);
4319 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
4322 * Channel config that we propose to our counterparty.
4324 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4327 * Channel config that we propose to our counterparty.
4329 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
4332 * Limits applied to our counterparty's proposed channel config settings.
4334 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4337 * Limits applied to our counterparty's proposed channel config settings.
4339 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
4342 * Channel config which affects behavior during channel lifetime.
4344 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4347 * Channel config which affects behavior during channel lifetime.
4349 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
4351 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);
4353 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
4355 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
4358 * Calls the free function if one is set
4360 void Access_free(struct LDKAccess this_ptr);
4363 * Calls the free function if one is set
4365 void Watch_free(struct LDKWatch this_ptr);
4368 * Calls the free function if one is set
4370 void Filter_free(struct LDKFilter this_ptr);
4373 * Calls the free function if one is set
4375 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
4377 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
4380 * Calls the free function if one is set
4382 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
4384 void ChainMonitor_free(struct LDKChainMonitor this_ptr);
4387 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
4388 * of a channel and reacting accordingly based on transactions in the connected block. See
4389 * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
4390 * be returned by [`chain::Watch::release_pending_monitor_events`].
4392 * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
4393 * calls must not exclude any transactions matching the new outputs nor any in-block
4394 * descendants of such transactions. It is not necessary to re-fetch the block to obtain
4397 * [`ChannelMonitor::block_connected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_connected
4398 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
4399 * [`chain::Filter`]: ../trait.Filter.html
4401 void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
4404 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
4405 * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
4408 * [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
4410 void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
4413 * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
4415 * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
4416 * will call back to it indicating transactions and outputs of interest. This allows clients to
4417 * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
4418 * always need to fetch full blocks absent another means for determining which blocks contain
4419 * transactions relevant to the watched channels.
4421 * [`chain::Filter`]: ../trait.Filter.html
4423 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
4425 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
4427 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
4429 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_ptr);
4431 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
4434 * The sequence number of this update. Updates *must* be replayed in-order according to this
4435 * sequence number (and updates may panic if they are not). The update_id values are strictly
4436 * increasing and increase by one for each new update, with one exception specified below.
4438 * This sequence number is also used to track up to which points updates which returned
4439 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4440 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4442 * The only instance where update_id values are not strictly increasing is the case where we
4443 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
4444 * its docs for more details.
4446 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
4448 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
4451 * The sequence number of this update. Updates *must* be replayed in-order according to this
4452 * sequence number (and updates may panic if they are not). The update_id values are strictly
4453 * increasing and increase by one for each new update, with one exception specified below.
4455 * This sequence number is also used to track up to which points updates which returned
4456 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4457 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4459 * The only instance where update_id values are not strictly increasing is the case where we
4460 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
4461 * its docs for more details.
4463 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
4465 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
4467 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
4469 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
4471 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
4473 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_ptr);
4475 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
4477 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
4479 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
4481 void HTLCUpdate_free(struct LDKHTLCUpdate this_ptr);
4483 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
4485 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
4487 struct LDKHTLCUpdate HTLCUpdate_read(struct LDKu8slice ser);
4489 void ChannelMonitor_free(struct LDKChannelMonitor this_ptr);
4491 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
4494 * Updates a ChannelMonitor on the basis of some new information provided by the Channel
4497 * panics if the given update is not the next update by update_id.
4499 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);
4502 * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
4505 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
4508 * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
4510 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
4513 * Get the list of HTLCs who's status has been updated on chain. This should be called by
4514 * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
4516 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
4518 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
4521 * Gets the list of pending events which were generated by previous actions, clearing the list
4524 * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
4525 * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
4526 * no internal locking in ChannelMonitors.
4528 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
4531 * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
4532 * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
4533 * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
4534 * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
4535 * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
4536 * broadcast them if counterparty don't close channel with his higher commitment transaction after a
4537 * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
4538 * out-of-band the other node operator to coordinate with him if option is available to you.
4539 * In any-case, choice is up to the user.
4541 MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger);
4544 * Processes transactions in a newly connected block, which may result in any of the following:
4545 * - update the monitor's state against resolved HTLCs
4546 * - punish the counterparty in the case of seeing a revoked commitment transaction
4547 * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
4548 * - detect settled outputs for later spending
4549 * - schedule and bump any in-flight claims
4551 * Returns any new outputs to watch from `txdata`; after called, these are also included in
4552 * [`get_outputs_to_watch`].
4554 * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
4556 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);
4559 * Determines if the disconnected block contained any transactions of interest and updates
4562 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);
4565 * Calls the free function if one is set
4567 void Persist_free(struct LDKPersist this_ptr);
4569 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
4571 void OutPoint_free(struct LDKOutPoint this_ptr);
4573 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
4576 * The referenced transaction's txid.
4578 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
4581 * The referenced transaction's txid.
4583 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4586 * The index of the referenced output in its transaction's vout.
4588 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
4591 * The index of the referenced output in its transaction's vout.
4593 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
4595 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
4598 * Convert an `OutPoint` to a lightning channel id.
4600 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
4602 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
4604 struct LDKOutPoint OutPoint_read(struct LDKu8slice ser);
4606 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
4608 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
4610 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
4612 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
4614 struct LDKChannelKeys ChannelKeys_clone(const struct LDKChannelKeys *NONNULL_PTR orig);
4617 * Calls the free function if one is set
4619 void ChannelKeys_free(struct LDKChannelKeys this_ptr);
4622 * Calls the free function if one is set
4624 void KeysInterface_free(struct LDKKeysInterface this_ptr);
4626 void InMemoryChannelKeys_free(struct LDKInMemoryChannelKeys this_ptr);
4628 struct LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const struct LDKInMemoryChannelKeys *NONNULL_PTR orig);
4631 * Private key of anchor tx
4633 const uint8_t (*InMemoryChannelKeys_get_funding_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4636 * Private key of anchor tx
4638 void InMemoryChannelKeys_set_funding_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4641 * Holder secret key for blinded revocation pubkey
4643 const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4646 * Holder secret key for blinded revocation pubkey
4648 void InMemoryChannelKeys_set_revocation_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4651 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4653 const uint8_t (*InMemoryChannelKeys_get_payment_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4656 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4658 void InMemoryChannelKeys_set_payment_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4661 * Holder secret key used in HTLC tx
4663 const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4666 * Holder secret key used in HTLC tx
4668 void InMemoryChannelKeys_set_delayed_payment_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4671 * Holder htlc secret key used in commitment tx htlc outputs
4673 const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4676 * Holder htlc secret key used in commitment tx htlc outputs
4678 void InMemoryChannelKeys_set_htlc_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4683 const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4688 void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4691 * Create a new InMemoryChannelKeys
4693 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 LDKThirtyTwoBytes channel_keys_id);
4696 * Counterparty pubkeys.
4697 * Will panic if ready_channel wasn't called.
4699 MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4702 * The contest_delay value specified by our counterparty and applied on holder-broadcastable
4703 * transactions, ie the amount of time that we have to wait to recover our funds if we
4704 * broadcast a transaction.
4705 * Will panic if ready_channel wasn't called.
4707 MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4710 * The contest_delay value specified by us and applied on transactions broadcastable
4711 * by our counterparty, ie the amount of time that they have to wait to recover their funds
4712 * if they broadcast a transaction.
4713 * Will panic if ready_channel wasn't called.
4715 MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4718 * Whether the holder is the initiator
4719 * Will panic if ready_channel wasn't called.
4721 MUST_USE_RES bool InMemoryChannelKeys_is_outbound(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4725 * Will panic if ready_channel wasn't called.
4727 MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4730 * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
4731 * building transactions.
4733 * Will panic if ready_channel wasn't called.
4735 MUST_USE_RES struct LDKChannelTransactionParameters InMemoryChannelKeys_get_channel_parameters(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4737 struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4739 struct LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj);
4741 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ InMemoryChannelKeys_read(struct LDKu8slice ser);
4743 void KeysManager_free(struct LDKKeysManager this_ptr);
4746 * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
4747 * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
4748 * starting_time isn't strictly required to actually be a time, but it must absolutely,
4749 * without a doubt, be unique to this instance. ie if you start multiple times with the same
4750 * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
4751 * simply use the current time (with very high precision).
4753 * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
4754 * obviously, starting_time should be unique every time you reload the library - it is only
4755 * used to generate new ephemeral key data (which will be stored by the individual channel if
4758 * Note that the seed is required to recover certain on-chain funds independent of
4759 * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
4760 * channel, and some on-chain during-closing funds.
4762 * Note that until the 0.1 release there is no guarantee of backward compatibility between
4763 * versions. Once the library is more fully supported, the docs will be updated to include a
4764 * detailed description of the guarantee.
4766 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);
4769 * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation
4771 * Key derivation parameters are accessible through a per-channel secrets
4772 * ChannelKeys::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
4773 * onchain output detection for which a corresponding delayed_payment_key must be derived.
4775 MUST_USE_RES struct LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]);
4777 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
4779 void ChannelManager_free(struct LDKChannelManager this_ptr);
4781 void ChannelDetails_free(struct LDKChannelDetails this_ptr);
4783 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
4786 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4787 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4788 * Note that this means this value is *not* persistent - it can change once during the
4789 * lifetime of the channel.
4791 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
4794 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4795 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4796 * Note that this means this value is *not* persistent - it can change once during the
4797 * lifetime of the channel.
4799 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4802 * The node_id of our counterparty
4804 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4807 * The node_id of our counterparty
4809 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
4812 * The Features the channel counterparty provided upon last connection.
4813 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4814 * many routing-relevant features are present in the init context.
4816 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4819 * The Features the channel counterparty provided upon last connection.
4820 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4821 * many routing-relevant features are present in the init context.
4823 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
4826 * The value, in satoshis, of this channel as appears in the funding output
4828 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4831 * The value, in satoshis, of this channel as appears in the funding output
4833 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4836 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4838 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4841 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4843 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4846 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4847 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4848 * available for inclusion in new outbound HTLCs). This further does not include any pending
4849 * outgoing HTLCs which are awaiting some other resolution to be sent.
4851 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4854 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4855 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4856 * available for inclusion in new outbound HTLCs). This further does not include any pending
4857 * outgoing HTLCs which are awaiting some other resolution to be sent.
4859 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4862 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4863 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4864 * available for inclusion in new inbound HTLCs).
4865 * Note that there are some corner cases not fully handled here, so the actual available
4866 * inbound capacity may be slightly higher than this.
4868 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4871 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4872 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4873 * available for inclusion in new inbound HTLCs).
4874 * Note that there are some corner cases not fully handled here, so the actual available
4875 * inbound capacity may be slightly higher than this.
4877 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4880 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4881 * the peer is connected, and (c) no monitor update failure is pending resolution.
4883 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4886 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4887 * the peer is connected, and (c) no monitor update failure is pending resolution.
4889 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
4891 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
4893 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
4896 * Constructs a new ChannelManager to hold several channels and route between them.
4898 * This is the main \"logic hub\" for all channel-related actions, and implements
4899 * ChannelMessageHandler.
4901 * Non-proportional fees are fixed according to our risk using the provided fee estimator.
4903 * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
4905 * Users must provide the current blockchain height from which to track onchain channel
4906 * funding outpoints and send payments with reliable timelocks.
4908 * Users need to notify the new ChannelManager when a new block is connected or
4909 * disconnected using its `block_connected` and `block_disconnected` methods.
4911 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);
4914 * Creates a new outbound channel to the given remote node and with the given value.
4916 * user_id will be provided back as user_channel_id in FundingGenerationReady and
4917 * FundingBroadcastSafe events to allow tracking of which events correspond with which
4918 * create_channel call. Note that user_channel_id defaults to 0 for inbound channels, so you
4919 * may wish to avoid using 0 for user_id here.
4921 * If successful, will generate a SendOpenChannel message event, so you should probably poll
4922 * PeerManager::process_events afterwards.
4924 * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
4925 * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
4927 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);
4930 * Gets the list of open channels, in random order. See ChannelDetail field documentation for
4933 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4936 * Gets the list of usable channels, in random order. Useful as an argument to
4937 * get_route to ensure non-announced channels are used.
4939 * These are guaranteed to have their is_live value set to true, see the documentation for
4940 * ChannelDetails::is_live for more info on exactly what the criteria are.
4942 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4945 * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
4946 * will be accepted on the given channel, and after additional timeout/the closing of all
4947 * pending HTLCs, the channel will be closed on chain.
4949 * May generate a SendShutdown message event on success, which should be relayed.
4951 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
4954 * Force closes a channel, immediately broadcasting the latest local commitment transaction to
4955 * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
4957 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
4960 * Force close all channels, immediately broadcasting the latest local commitment transaction
4961 * for each to the chain and rejecting new HTLCs on each.
4963 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4966 * Sends a payment along a given route.
4968 * Value parameters are provided via the last hop in route, see documentation for RouteHop
4969 * fields for more info.
4971 * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
4972 * payment), we don't do anything to stop you! We always try to ensure that if the provided
4973 * next hop knows the preimage to payment_hash they can claim an additional amount as
4974 * specified in the last hop in the route! Thus, you should probably do your own
4975 * payment_preimage tracking (which you should already be doing as they represent \"proof of
4976 * payment\") and prevent double-sends yourself.
4978 * May generate SendHTLCs message(s) event on success, which should be relayed.
4980 * Each path may have a different return value, and PaymentSendValue may return a Vec with
4981 * each entry matching the corresponding-index entry in the route paths, see
4982 * PaymentSendFailure for more info.
4984 * In general, a path may raise:
4985 * * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
4986 * node public key) is specified.
4987 * * APIError::ChannelUnavailable if the next-hop channel is not available for updates
4988 * (including due to previous monitor update failure or new permanent monitor update
4990 * * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
4993 * Note that depending on the type of the PaymentSendFailure the HTLC may have been
4994 * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
4995 * different route unless you intend to pay twice!
4997 * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
4998 * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
4999 * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
5000 * must not contain multiple paths as multi-path payments require a recipient-provided
5002 * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
5003 * bit set (either as required or as available). If multiple paths are present in the Route,
5004 * we assume the invoice had the basic_mpp feature set.
5006 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);
5009 * Call this upon creation of a funding transaction for the given channel.
5011 * Note that ALL inputs in the transaction pointed to by funding_txo MUST spend SegWit outputs
5012 * or your counterparty can steal your funds!
5014 * Panics if a funding transaction has already been provided for this channel.
5016 * May panic if the funding_txo is duplicative with some other channel (note that this should
5017 * be trivially prevented by using unique funding transaction keys per-channel).
5019 void ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKOutPoint funding_txo);
5022 * Generates a signed node_announcement from the given arguments and creates a
5023 * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
5024 * seen a channel_announcement from us (ie unless we have public channels open).
5026 * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
5027 * to humans. They carry no in-protocol meaning.
5029 * addresses represent the set (possibly empty) of socket addresses on which this node accepts
5030 * incoming connections. These will be broadcast to the network, publicly tying these
5031 * addresses together. If you wish to preserve user privacy, addresses should likely contain
5032 * only Tor Onion addresses.
5034 * Panics if addresses is absurdly large (more than 500).
5036 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
5039 * Processes HTLCs which are pending waiting on random forward delay.
5041 * Should only really ever be called in response to a PendingHTLCsForwardable event.
5042 * Will likely generate further events.
5044 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
5047 * If a peer is disconnected we mark any channels with that peer as 'disabled'.
5048 * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
5049 * to inform the network about the uselessness of these channels.
5051 * This method handles all the details, and must be called roughly once per minute.
5053 void ChannelManager_timer_chan_freshness_every_min(const struct LDKChannelManager *NONNULL_PTR this_arg);
5056 * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
5057 * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
5058 * along the path (including in our own channel on which we received it).
5059 * Returns false if no payment was found to fail backwards, true if the process of failing the
5060 * HTLC backwards has been started.
5062 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);
5065 * Provides a payment preimage in response to a PaymentReceived event, returning true and
5066 * generating message events for the net layer to claim the payment, if possible. Thus, you
5067 * should probably kick the net layer to go send messages if this returns true!
5069 * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
5070 * available within a few percent of the expected amount. This is critical for several
5071 * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
5072 * payment_preimage without having provided the full value and b) it avoids certain
5073 * privacy-breaking recipient-probing attacks which may reveal payment activity to
5074 * motivated attackers.
5076 * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
5077 * set. Thus, for such payments we will claim any payments which do not under-pay.
5079 * May panic if called except in response to a PaymentReceived event.
5081 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);
5084 * Gets the node_id held by this ChannelManager
5086 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
5089 * Restores a single, given channel to normal operation after a
5090 * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
5093 * All ChannelMonitor updates up to and including highest_applied_update_id must have been
5094 * fully committed in every copy of the given channels' ChannelMonitors.
5096 * Note that there is no effect to calling with a highest_applied_update_id other than the
5097 * current latest ChannelMonitorUpdate and one call to this function after multiple
5098 * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
5099 * exists largely only to prevent races between this and concurrent update_monitor calls.
5101 * Thus, the anticipated use is, at a high level:
5102 * 1) You register a chain::Watch with this ChannelManager,
5103 * 2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
5104 * said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
5105 * any time it cannot do so instantly,
5106 * 3) update(s) are applied to each remote copy of a ChannelMonitor,
5107 * 4) once all remote copies are updated, you call this function with the update_id that
5108 * completed, and once it is the latest the Channel will be re-enabled.
5110 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);
5112 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
5114 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
5117 * Updates channel state based on transactions seen in a connected block.
5119 void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
5122 * Updates channel state based on a disconnected block.
5124 * If necessary, the channel may be force-closed without letting the counterparty participate
5127 void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]);
5129 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
5131 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
5133 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_ptr);
5136 * The keys provider which will give us relevant keys. Some keys will be loaded during
5137 * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
5140 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5143 * The keys provider which will give us relevant keys. Some keys will be loaded during
5144 * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
5147 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
5150 * The fee_estimator for use in the ChannelManager in the future.
5152 * No calls to the FeeEstimator will be made during deserialization.
5154 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5157 * The fee_estimator for use in the ChannelManager in the future.
5159 * No calls to the FeeEstimator will be made during deserialization.
5161 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
5164 * The chain::Watch for use in the ChannelManager in the future.
5166 * No calls to the chain::Watch will be made during deserialization. It is assumed that
5167 * you have deserialized ChannelMonitors separately and will add them to your
5168 * chain::Watch after deserializing this ChannelManager.
5170 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5173 * The chain::Watch for use in the ChannelManager in the future.
5175 * No calls to the chain::Watch will be made during deserialization. It is assumed that
5176 * you have deserialized ChannelMonitors separately and will add them to your
5177 * chain::Watch after deserializing this ChannelManager.
5179 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
5182 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
5183 * used to broadcast the latest local commitment transactions of channels which must be
5184 * force-closed during deserialization.
5186 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5189 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
5190 * used to broadcast the latest local commitment transactions of channels which must be
5191 * force-closed during deserialization.
5193 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
5196 * The Logger for use in the ChannelManager and which may be used to log information during
5199 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5202 * The Logger for use in the ChannelManager and which may be used to log information during
5205 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
5208 * Default settings used for new channels. Any existing channels will continue to use the
5209 * runtime settings which were stored when the ChannelManager was serialized.
5211 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5214 * Default settings used for new channels. Any existing channels will continue to use the
5215 * runtime settings which were stored when the ChannelManager was serialized.
5217 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
5220 * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
5221 * HashMap for you. This is primarily useful for C bindings where it is not practical to
5222 * populate a HashMap directly from C.
5224 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);
5226 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
5228 void DecodeError_free(struct LDKDecodeError this_ptr);
5230 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
5232 void Init_free(struct LDKInit this_ptr);
5234 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
5236 void ErrorMessage_free(struct LDKErrorMessage this_ptr);
5238 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
5241 * The channel ID involved in the error
5243 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
5246 * The channel ID involved in the error
5248 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5251 * A possibly human-readable error description.
5252 * The string should be sanitized before it is used (e.g. emitted to logs
5253 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
5254 * vulnerability in the terminal emulator or the logging subsystem.
5256 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
5259 * A possibly human-readable error description.
5260 * The string should be sanitized before it is used (e.g. emitted to logs
5261 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
5262 * vulnerability in the terminal emulator or the logging subsystem.
5264 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
5266 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg);
5268 void Ping_free(struct LDKPing this_ptr);
5270 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
5273 * The desired response length
5275 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
5278 * The desired response length
5280 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
5283 * The ping packet size.
5284 * This field is not sent on the wire. byteslen zeros are sent.
5286 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
5289 * The ping packet size.
5290 * This field is not sent on the wire. byteslen zeros are sent.
5292 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
5294 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
5296 void Pong_free(struct LDKPong this_ptr);
5298 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
5301 * The pong packet size.
5302 * This field is not sent on the wire. byteslen zeros are sent.
5304 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
5307 * The pong packet size.
5308 * This field is not sent on the wire. byteslen zeros are sent.
5310 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
5312 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
5314 void OpenChannel_free(struct LDKOpenChannel this_ptr);
5316 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
5319 * The genesis hash of the blockchain where the channel is to be opened
5321 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
5324 * The genesis hash of the blockchain where the channel is to be opened
5326 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5329 * A temporary channel ID, until the funding outpoint is announced
5331 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
5334 * A temporary channel ID, until the funding outpoint is announced
5336 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5341 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5346 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5349 * The amount to push to the counterparty as part of the open, in milli-satoshi
5351 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5354 * The amount to push to the counterparty as part of the open, in milli-satoshi
5356 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5359 * The threshold below which outputs on transactions broadcast by sender will be omitted
5361 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5364 * The threshold below which outputs on transactions broadcast by sender will be omitted
5366 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5369 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5371 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5374 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5376 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5379 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5381 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5384 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5386 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5389 * The minimum HTLC size incoming to sender, in milli-satoshi
5391 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5394 * The minimum HTLC size incoming to sender, in milli-satoshi
5396 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5399 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
5401 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5404 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
5406 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
5409 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5411 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5414 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5416 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
5419 * The maximum number of inbound HTLCs towards sender
5421 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5424 * The maximum number of inbound HTLCs towards sender
5426 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
5429 * The sender's key controlling the funding transaction
5431 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5434 * The sender's key controlling the funding transaction
5436 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5439 * Used to derive a revocation key for transactions broadcast by counterparty
5441 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5444 * Used to derive a revocation key for transactions broadcast by counterparty
5446 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5449 * A payment key to sender for transactions broadcast by counterparty
5451 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5454 * A payment key to sender for transactions broadcast by counterparty
5456 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5459 * Used to derive a payment key to sender for transactions broadcast by sender
5461 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5464 * Used to derive a payment key to sender for transactions broadcast by sender
5466 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5469 * Used to derive an HTLC payment key to sender
5471 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5474 * Used to derive an HTLC payment key to sender
5476 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5479 * The first to-be-broadcast-by-sender transaction's per commitment point
5481 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5484 * The first to-be-broadcast-by-sender transaction's per commitment point
5486 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5491 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5496 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
5498 void AcceptChannel_free(struct LDKAcceptChannel this_ptr);
5500 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
5503 * A temporary channel ID, until the funding outpoint is announced
5505 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
5508 * A temporary channel ID, until the funding outpoint is announced
5510 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5513 * The threshold below which outputs on transactions broadcast by sender will be omitted
5515 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5518 * The threshold below which outputs on transactions broadcast by sender will be omitted
5520 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5523 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5525 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5528 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5530 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5533 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5535 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5538 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5540 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5543 * The minimum HTLC size incoming to sender, in milli-satoshi
5545 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5548 * The minimum HTLC size incoming to sender, in milli-satoshi
5550 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5553 * Minimum depth of the funding transaction before the channel is considered open
5555 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5558 * Minimum depth of the funding transaction before the channel is considered open
5560 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
5563 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5565 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5568 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5570 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
5573 * The maximum number of inbound HTLCs towards sender
5575 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5578 * The maximum number of inbound HTLCs towards sender
5580 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
5583 * The sender's key controlling the funding transaction
5585 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5588 * The sender's key controlling the funding transaction
5590 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5593 * Used to derive a revocation key for transactions broadcast by counterparty
5595 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5598 * Used to derive a revocation key for transactions broadcast by counterparty
5600 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5603 * A payment key to sender for transactions broadcast by counterparty
5605 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5608 * A payment key to sender for transactions broadcast by counterparty
5610 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5613 * Used to derive a payment key to sender for transactions broadcast by sender
5615 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5618 * Used to derive a payment key to sender for transactions broadcast by sender
5620 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5623 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
5625 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5628 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
5630 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5633 * The first to-be-broadcast-by-sender transaction's per commitment point
5635 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5638 * The first to-be-broadcast-by-sender transaction's per commitment point
5640 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5642 void FundingCreated_free(struct LDKFundingCreated this_ptr);
5644 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
5647 * A temporary channel ID, until the funding is established
5649 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
5652 * A temporary channel ID, until the funding is established
5654 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5657 * The funding transaction ID
5659 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
5662 * The funding transaction ID
5664 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5667 * The specific output index funding this channel
5669 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
5672 * The specific output index funding this channel
5674 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
5677 * The signature of the channel initiator (funder) on the funding transaction
5679 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
5682 * The signature of the channel initiator (funder) on the funding transaction
5684 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
5686 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);
5688 void FundingSigned_free(struct LDKFundingSigned this_ptr);
5690 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
5695 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
5700 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5703 * The signature of the channel acceptor (fundee) on the funding transaction
5705 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
5708 * The signature of the channel acceptor (fundee) on the funding transaction
5710 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5712 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
5714 void FundingLocked_free(struct LDKFundingLocked this_ptr);
5716 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
5721 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
5726 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5729 * The per-commitment point of the second commitment transaction
5731 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
5734 * The per-commitment point of the second commitment transaction
5736 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5738 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
5740 void Shutdown_free(struct LDKShutdown this_ptr);
5742 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
5747 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
5752 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5755 * The destination of this peer's funds on closing.
5756 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5758 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
5761 * The destination of this peer's funds on closing.
5762 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5764 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
5766 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
5768 void ClosingSigned_free(struct LDKClosingSigned this_ptr);
5770 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
5775 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
5780 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5783 * The proposed total fee for the closing transaction
5785 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
5788 * The proposed total fee for the closing transaction
5790 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
5793 * A signature on the closing transaction
5795 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
5798 * A signature on the closing transaction
5800 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5802 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
5804 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_ptr);
5806 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
5811 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
5816 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5821 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5826 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
5829 * The HTLC value in milli-satoshi
5831 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5834 * The HTLC value in milli-satoshi
5836 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
5839 * The payment hash, the pre-image of which controls HTLC redemption
5841 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
5844 * The payment hash, the pre-image of which controls HTLC redemption
5846 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5849 * The expiry height of the HTLC
5851 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5854 * The expiry height of the HTLC
5856 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
5858 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_ptr);
5860 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
5865 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
5870 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5875 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
5880 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
5883 * The pre-image of the payment hash, allowing HTLC redemption
5885 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
5888 * The pre-image of the payment hash, allowing HTLC redemption
5890 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5892 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
5894 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_ptr);
5896 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
5901 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
5906 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5911 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
5916 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
5918 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_ptr);
5920 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
5925 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
5930 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5935 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
5940 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
5945 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
5950 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
5952 void CommitmentSigned_free(struct LDKCommitmentSigned this_ptr);
5954 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
5959 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
5964 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5967 * A signature on the commitment transaction
5969 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
5972 * A signature on the commitment transaction
5974 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5977 * Signatures on the HTLC transactions
5979 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
5981 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
5983 void RevokeAndACK_free(struct LDKRevokeAndACK this_ptr);
5985 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
5990 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
5995 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5998 * The secret corresponding to the per-commitment point
6000 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
6003 * The secret corresponding to the per-commitment point
6005 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6008 * The next sender-broadcast commitment transaction's per-commitment point
6010 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
6013 * The next sender-broadcast commitment transaction's per-commitment point
6015 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6017 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);
6019 void UpdateFee_free(struct LDKUpdateFee this_ptr);
6021 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
6026 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
6031 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6034 * Fee rate per 1000-weight of the transaction
6036 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
6039 * Fee rate per 1000-weight of the transaction
6041 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
6043 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
6045 void DataLossProtect_free(struct LDKDataLossProtect this_ptr);
6047 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
6050 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
6051 * belonging to the recipient
6053 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
6056 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
6057 * belonging to the recipient
6059 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6062 * The sender's per-commitment point for their current commitment transaction
6064 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
6067 * The sender's per-commitment point for their current commitment transaction
6069 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6071 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
6073 void ChannelReestablish_free(struct LDKChannelReestablish this_ptr);
6075 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
6080 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
6085 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6088 * The next commitment number for the sender
6090 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
6093 * The next commitment number for the sender
6095 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
6098 * The next commitment number for the recipient
6100 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
6103 * The next commitment number for the recipient
6105 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
6107 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_ptr);
6109 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
6114 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
6119 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6122 * The short channel ID
6124 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6127 * The short channel ID
6129 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
6132 * A signature by the node key
6134 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6137 * A signature by the node key
6139 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
6142 * A signature by the funding key
6144 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6147 * A signature by the funding key
6149 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
6151 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);
6153 void NetAddress_free(struct LDKNetAddress this_ptr);
6155 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
6157 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
6159 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
6161 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_ptr);
6163 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
6166 * The advertised features
6168 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6171 * The advertised features
6173 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
6176 * A strictly monotonic announcement counter, with gaps allowed
6178 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6181 * A strictly monotonic announcement counter, with gaps allowed
6183 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
6186 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
6189 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6192 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
6195 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6198 * An RGB color for UI purposes
6200 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
6203 * An RGB color for UI purposes
6205 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
6208 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
6211 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
6214 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
6217 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6220 * List of addresses on which this node is reachable
6222 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
6224 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_ptr);
6226 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
6229 * The signature by the node key
6231 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
6234 * The signature by the node key
6236 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6239 * The actual content of the announcement
6241 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
6244 * The actual content of the announcement
6246 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
6248 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
6250 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_ptr);
6252 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
6255 * The advertised channel features
6257 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6260 * The advertised channel features
6262 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
6265 * The genesis hash of the blockchain where the channel is to be opened
6267 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
6270 * The genesis hash of the blockchain where the channel is to be opened
6272 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6275 * The short channel ID
6277 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6280 * The short channel ID
6282 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
6285 * One of the two node_ids which are endpoints of this channel
6287 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6290 * One of the two node_ids which are endpoints of this channel
6292 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6295 * The other of the two node_ids which are endpoints of this channel
6297 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6300 * The other of the two node_ids which are endpoints of this channel
6302 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6305 * The funding key for the first node
6307 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6310 * The funding key for the first node
6312 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6315 * The funding key for the second node
6317 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6320 * The funding key for the second node
6322 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6324 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_ptr);
6326 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
6329 * Authentication of the announcement by the first public node
6331 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6334 * Authentication of the announcement by the first public node
6336 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6339 * Authentication of the announcement by the second public node
6341 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6344 * Authentication of the announcement by the second public node
6346 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6349 * Proof of funding UTXO ownership by the first public node
6351 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6354 * Proof of funding UTXO ownership by the first public node
6356 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6359 * Proof of funding UTXO ownership by the second public node
6361 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6364 * Proof of funding UTXO ownership by the second public node
6366 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6369 * The actual announcement
6371 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6374 * The actual announcement
6376 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
6378 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);
6380 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_ptr);
6382 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
6385 * The genesis hash of the blockchain where the channel is to be opened
6387 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
6390 * The genesis hash of the blockchain where the channel is to be opened
6392 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6395 * The short channel ID
6397 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6400 * The short channel ID
6402 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
6405 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
6407 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6410 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
6412 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6417 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6422 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
6425 * The number of blocks to subtract from incoming HTLC cltv_expiry values
6427 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6430 * The number of blocks to subtract from incoming HTLC cltv_expiry values
6432 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
6435 * The minimum HTLC size incoming to sender, in milli-satoshi
6437 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6440 * The minimum HTLC size incoming to sender, in milli-satoshi
6442 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
6445 * The base HTLC fee charged by sender, in milli-satoshi
6447 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6450 * The base HTLC fee charged by sender, in milli-satoshi
6452 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6455 * The amount to fee multiplier, in micro-satoshi
6457 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6460 * The amount to fee multiplier, in micro-satoshi
6462 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6464 void ChannelUpdate_free(struct LDKChannelUpdate this_ptr);
6466 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
6469 * A signature of the channel update
6471 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
6474 * A signature of the channel update
6476 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
6479 * The actual channel update
6481 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
6484 * The actual channel update
6486 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
6488 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
6490 void QueryChannelRange_free(struct LDKQueryChannelRange this_ptr);
6492 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
6495 * The genesis hash of the blockchain being queried
6497 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
6500 * The genesis hash of the blockchain being queried
6502 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6505 * The height of the first block for the channel UTXOs being queried
6507 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
6510 * The height of the first block for the channel UTXOs being queried
6512 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6515 * The number of blocks to include in the query results
6517 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
6520 * The number of blocks to include in the query results
6522 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6524 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
6526 void ReplyChannelRange_free(struct LDKReplyChannelRange this_ptr);
6528 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
6531 * The genesis hash of the blockchain being queried
6533 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
6536 * The genesis hash of the blockchain being queried
6538 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6541 * The height of the first block in the range of the reply
6543 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6546 * The height of the first block in the range of the reply
6548 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6551 * The number of blocks included in the range of the reply
6553 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6556 * The number of blocks included in the range of the reply
6558 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6561 * True when this is the final reply for a query
6563 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6566 * True when this is the final reply for a query
6568 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
6571 * The short_channel_ids in the channel range
6573 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
6575 MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool sync_complete_arg, struct LDKCVec_u64Z short_channel_ids_arg);
6577 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_ptr);
6579 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
6582 * The genesis hash of the blockchain being queried
6584 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
6587 * The genesis hash of the blockchain being queried
6589 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6592 * The short_channel_ids that are being queried
6594 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
6596 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
6598 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_ptr);
6600 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
6603 * The genesis hash of the blockchain that was queried
6605 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
6608 * The genesis hash of the blockchain that was queried
6610 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6613 * Indicates if the query recipient maintains up-to-date channel
6614 * information for the chain_hash
6616 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
6619 * Indicates if the query recipient maintains up-to-date channel
6620 * information for the chain_hash
6622 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
6624 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
6626 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_ptr);
6628 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
6631 * The genesis hash of the blockchain for channel and node information
6633 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
6636 * The genesis hash of the blockchain for channel and node information
6638 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6641 * The starting unix timestamp
6643 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
6646 * The starting unix timestamp
6648 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
6651 * The range of information in seconds
6653 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
6656 * The range of information in seconds
6658 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
6660 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
6662 void ErrorAction_free(struct LDKErrorAction this_ptr);
6664 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
6666 void LightningError_free(struct LDKLightningError this_ptr);
6668 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
6671 * A human-readable message describing the error
6673 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
6676 * A human-readable message describing the error
6678 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
6681 * The action which should be taken against the offending peer.
6683 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
6686 * The action which should be taken against the offending peer.
6688 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
6690 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
6692 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_ptr);
6694 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
6697 * update_add_htlc messages which should be sent
6699 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
6702 * update_fulfill_htlc messages which should be sent
6704 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
6707 * update_fail_htlc messages which should be sent
6709 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
6712 * update_fail_malformed_htlc messages which should be sent
6714 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
6717 * An update_fee message which should be sent
6719 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
6722 * An update_fee message which should be sent
6724 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
6727 * Finally, the commitment_signed message which should be sent
6729 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
6732 * Finally, the commitment_signed message which should be sent
6734 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
6736 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);
6738 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
6740 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
6743 * Calls the free function if one is set
6745 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
6748 * Calls the free function if one is set
6750 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
6752 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
6754 struct LDKAcceptChannel AcceptChannel_read(struct LDKu8slice ser);
6756 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
6758 struct LDKAnnouncementSignatures AnnouncementSignatures_read(struct LDKu8slice ser);
6760 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
6762 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
6764 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
6766 struct LDKClosingSigned ClosingSigned_read(struct LDKu8slice ser);
6768 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
6770 struct LDKCommitmentSigned CommitmentSigned_read(struct LDKu8slice ser);
6772 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
6774 struct LDKFundingCreated FundingCreated_read(struct LDKu8slice ser);
6776 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
6778 struct LDKFundingSigned FundingSigned_read(struct LDKu8slice ser);
6780 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
6782 struct LDKFundingLocked FundingLocked_read(struct LDKu8slice ser);
6784 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
6786 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
6788 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
6790 struct LDKOpenChannel OpenChannel_read(struct LDKu8slice ser);
6792 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
6794 struct LDKRevokeAndACK RevokeAndACK_read(struct LDKu8slice ser);
6796 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
6798 struct LDKShutdown Shutdown_read(struct LDKu8slice ser);
6800 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
6802 struct LDKUpdateFailHTLC UpdateFailHTLC_read(struct LDKu8slice ser);
6804 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
6806 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
6808 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
6810 struct LDKUpdateFee UpdateFee_read(struct LDKu8slice ser);
6812 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
6814 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(struct LDKu8slice ser);
6816 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
6818 struct LDKUpdateAddHTLC UpdateAddHTLC_read(struct LDKu8slice ser);
6820 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
6822 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
6824 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
6826 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
6828 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
6830 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
6832 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
6834 struct LDKChannelAnnouncement ChannelAnnouncement_read(struct LDKu8slice ser);
6836 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
6838 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
6840 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
6842 struct LDKChannelUpdate ChannelUpdate_read(struct LDKu8slice ser);
6844 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
6846 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
6848 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
6850 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
6852 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
6854 struct LDKNodeAnnouncement NodeAnnouncement_read(struct LDKu8slice ser);
6856 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
6858 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
6860 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
6862 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
6864 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
6866 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
6868 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
6870 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
6872 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
6874 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
6876 void MessageHandler_free(struct LDKMessageHandler this_ptr);
6879 * A message handler which handles messages specific to channels. Usually this is just a
6880 * ChannelManager object.
6882 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
6885 * A message handler which handles messages specific to channels. Usually this is just a
6886 * ChannelManager object.
6888 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
6891 * A message handler which handles messages updating our knowledge of the network channel
6892 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6894 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
6897 * A message handler which handles messages updating our knowledge of the network channel
6898 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6900 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
6902 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
6904 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
6907 * Calls the free function if one is set
6909 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
6911 void PeerHandleError_free(struct LDKPeerHandleError this_ptr);
6913 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
6916 * Used to indicate that we probably can't make any future connections to this peer, implying
6917 * we should go ahead and force-close any channels we have with it.
6919 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
6922 * Used to indicate that we probably can't make any future connections to this peer, implying
6923 * we should go ahead and force-close any channels we have with it.
6925 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
6927 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
6929 void PeerManager_free(struct LDKPeerManager this_ptr);
6932 * Constructs a new PeerManager with the given message handlers and node_id secret key
6933 * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
6934 * cryptographically secure random bytes.
6936 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);
6939 * Get the list of node ids for peers which have completed the initial handshake.
6941 * For outbound connections, this will be the same as the their_node_id parameter passed in to
6942 * new_outbound_connection, however entries will only appear once the initial handshake has
6943 * completed and we are sure the remote peer has the private key for the given node_id.
6945 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
6948 * Indicates a new outbound connection has been established to a node with the given node_id.
6949 * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
6950 * descriptor but must disconnect the connection immediately.
6952 * Returns a small number of bytes to send to the remote node (currently always 50).
6954 * Panics if descriptor is duplicative with some other descriptor which has not yet had a
6955 * socket_disconnected().
6957 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);
6960 * Indicates a new inbound connection has been established.
6962 * May refuse the connection by returning an Err, but will never write bytes to the remote end
6963 * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
6964 * call socket_disconnected for the new descriptor but must disconnect the connection
6967 * Panics if descriptor is duplicative with some other descriptor which has not yet had
6968 * socket_disconnected called.
6970 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
6973 * Indicates that there is room to write data to the given socket descriptor.
6975 * May return an Err to indicate that the connection should be closed.
6977 * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
6978 * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
6979 * invariants around calling write_buffer_space_avail in case a write did not fully complete
6980 * must still hold - be ready to call write_buffer_space_avail again if a write call generated
6981 * here isn't sufficient! Panics if the descriptor was not previously registered in a
6982 * new_\\*_connection event.
6984 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
6987 * Indicates that data was read from the given socket descriptor.
6989 * May return an Err to indicate that the connection should be closed.
6991 * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
6992 * Thus, however, you almost certainly want to call process_events() after any read_event to
6993 * generate send_data calls to handle responses.
6995 * If Ok(true) is returned, further read_events should not be triggered until a send_data call
6996 * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
6998 * Panics if the descriptor was not previously registered in a new_*_connection event.
7000 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);
7003 * Checks for any events generated by our handlers and processes them. Includes sending most
7004 * response messages as well as messages generated by calls to handler functions directly (eg
7005 * functions like ChannelManager::process_pending_htlc_forward or send_payment).
7007 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
7010 * Indicates that the given socket descriptor's connection is now closed.
7012 * This must only be called if the socket has been disconnected by the peer or your own
7013 * decision to disconnect it and must NOT be called in any case where other parts of this
7014 * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
7017 * Panics if the descriptor was not previously registered in a successful new_*_connection event.
7019 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
7022 * Disconnect a peer given its node id.
7024 * Set no_connection_possible to true to prevent any further connection with this peer,
7025 * force-closing any channels we have with it.
7027 * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
7028 * so be careful about reentrancy issues.
7030 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
7033 * This function should be called roughly once every 30 seconds.
7034 * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
7035 * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
7037 void PeerManager_timer_tick_occured(const struct LDKPeerManager *NONNULL_PTR this_arg);
7040 * Build the commitment secret from the seed and the commitment number
7042 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
7045 * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
7046 * from the base secret and the per_commitment_point.
7048 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7049 * generated (ie our own).
7051 struct LDKCResult_SecretKeySecpErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
7054 * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
7055 * from the base point and the per_commitment_key. This is the public equivalent of
7056 * derive_private_key - using only public keys to derive a public key instead of private keys.
7058 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7059 * generated (ie our own).
7061 struct LDKCResult_PublicKeySecpErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
7064 * Derives a per-commitment-transaction revocation key from its constituent parts.
7066 * Only the cheating participant owns a valid witness to propagate a revoked
7067 * commitment transaction, thus per_commitment_secret always come from cheater
7068 * and revocation_base_secret always come from punisher, which is the broadcaster
7069 * of the transaction spending with this key knowledge.
7071 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7072 * generated (ie our own).
7074 struct LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
7077 * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
7078 * the public equivalend of derive_private_revocation_key - using only public keys to derive a
7079 * public key instead of private keys.
7081 * Only the cheating participant owns a valid witness to propagate a revoked
7082 * commitment transaction, thus per_commitment_point always come from cheater
7083 * and revocation_base_point always come from punisher, which is the broadcaster
7084 * of the transaction spending with this key knowledge.
7086 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7087 * generated (ie our own).
7089 struct LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
7091 void TxCreationKeys_free(struct LDKTxCreationKeys this_ptr);
7093 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
7096 * The broadcaster's per-commitment public key which was used to derive the other keys.
7098 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7101 * The broadcaster's per-commitment public key which was used to derive the other keys.
7103 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7106 * The revocation key which is used to allow the broadcaster of the commitment
7107 * transaction to provide their counterparty the ability to punish them if they broadcast
7110 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7113 * The revocation key which is used to allow the broadcaster of the commitment
7114 * transaction to provide their counterparty the ability to punish them if they broadcast
7117 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7120 * Broadcaster's HTLC Key
7122 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7125 * Broadcaster's HTLC Key
7127 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7130 * Countersignatory's HTLC Key
7132 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7135 * Countersignatory's HTLC Key
7137 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7140 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
7142 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7145 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
7147 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7149 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);
7151 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
7153 struct LDKTxCreationKeys TxCreationKeys_read(struct LDKu8slice ser);
7155 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_ptr);
7157 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
7160 * The public key which is used to sign all commitment transactions, as it appears in the
7161 * on-chain channel lock-in 2-of-2 multisig output.
7163 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7166 * The public key which is used to sign all commitment transactions, as it appears in the
7167 * on-chain channel lock-in 2-of-2 multisig output.
7169 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7172 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
7173 * revocation keys. This is combined with the per-commitment-secret generated by the
7174 * counterparty to create a secret which the counterparty can reveal to revoke previous
7177 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7180 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
7181 * revocation keys. This is combined with the per-commitment-secret generated by the
7182 * counterparty to create a secret which the counterparty can reveal to revoke previous
7185 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7188 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
7189 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
7190 * static across every commitment transaction.
7192 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7195 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
7196 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
7197 * static across every commitment transaction.
7199 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7202 * The base point which is used (with derive_public_key) to derive a per-commitment payment
7203 * public key which receives non-HTLC-encumbered funds which are only available for spending
7204 * after some delay (or can be claimed via the revocation path).
7206 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7209 * The base point which is used (with derive_public_key) to derive a per-commitment payment
7210 * public key which receives non-HTLC-encumbered funds which are only available for spending
7211 * after some delay (or can be claimed via the revocation path).
7213 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7216 * The base point which is used (with derive_public_key) to derive a per-commitment public key
7217 * which is used to encumber HTLC-in-flight outputs.
7219 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7222 * The base point which is used (with derive_public_key) to derive a per-commitment public key
7223 * which is used to encumber HTLC-in-flight outputs.
7225 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7227 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);
7229 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
7231 struct LDKChannelPublicKeys ChannelPublicKeys_read(struct LDKu8slice ser);
7234 * Create per-state keys from channel base points and the per-commitment point.
7235 * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
7237 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);
7240 * Generate per-state keys from channel static keys.
7241 * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
7243 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);
7246 * A script either spendable by the revocation
7247 * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
7248 * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
7250 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
7252 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_ptr);
7254 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
7257 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
7258 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
7259 * need to compare this value to whether the commitment transaction in question is that of
7260 * the counterparty or our own.
7262 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7265 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
7266 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
7267 * need to compare this value to whether the commitment transaction in question is that of
7268 * the counterparty or our own.
7270 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
7273 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
7274 * this divided by 1000.
7276 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7279 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
7280 * this divided by 1000.
7282 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
7285 * The CLTV lock-time at which this HTLC expires.
7287 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7290 * The CLTV lock-time at which this HTLC expires.
7292 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
7295 * The hash of the preimage which unlocks this HTLC.
7297 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
7300 * The hash of the preimage which unlocks this HTLC.
7302 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7304 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
7306 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(struct LDKu8slice ser);
7309 * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
7310 * does not need to have its previous_output_index filled.
7312 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
7315 * Gets the redeemscript for a funding output from the two funding public keys.
7316 * Note that the order of funding public keys does not matter.
7318 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
7321 * panics if htlc.transaction_output_index.is_none()!
7323 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);
7325 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_ptr);
7327 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
7330 * Holder public keys
7332 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7335 * Holder public keys
7337 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
7340 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
7342 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7345 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
7347 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
7350 * Whether the holder is the initiator of this channel.
7351 * This is an input to the commitment number obscure factor computation.
7353 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7356 * Whether the holder is the initiator of this channel.
7357 * This is an input to the commitment number obscure factor computation.
7359 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
7362 * The late-bound counterparty channel transaction parameters.
7363 * These parameters are populated at the point in the protocol where the counterparty provides them.
7365 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7368 * The late-bound counterparty channel transaction parameters.
7369 * These parameters are populated at the point in the protocol where the counterparty provides them.
7371 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
7374 * The late-bound funding outpoint
7376 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7379 * The late-bound funding outpoint
7381 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
7383 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);
7385 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_ptr);
7387 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
7390 * Counter-party public keys
7392 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
7395 * Counter-party public keys
7397 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
7400 * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
7402 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
7405 * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
7407 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
7409 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
7412 * Whether the late bound parameters are populated.
7414 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7417 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
7418 * given that the holder is the broadcaster.
7420 * self.is_populated() must be true before calling this function.
7422 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7425 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
7426 * given that the counterparty is the broadcaster.
7428 * self.is_populated() must be true before calling this function.
7430 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7432 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
7434 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
7436 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
7438 struct LDKChannelTransactionParameters ChannelTransactionParameters_read(struct LDKu8slice ser);
7440 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_ptr);
7443 * Get the channel pubkeys for the broadcaster
7445 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7448 * Get the channel pubkeys for the countersignatory
7450 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7453 * Get the contest delay applicable to the transactions.
7454 * Note that the contest delay was selected by the countersignatory.
7456 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7459 * Whether the channel is outbound from the broadcaster.
7461 * The boolean representing the side that initiated the channel is
7462 * an input to the commitment number obscure factor computation.
7464 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7467 * The funding outpoint
7469 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7471 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_ptr);
7473 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
7476 * Our counterparty's signature for the transaction
7478 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
7481 * Our counterparty's signature for the transaction
7483 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
7486 * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
7488 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
7490 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
7492 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(struct LDKu8slice ser);
7495 * Create a new holder transaction with the given counterparty signatures.
7496 * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
7498 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);
7500 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_ptr);
7502 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
7505 * The commitment transaction
7507 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
7510 * The commitment transaction
7512 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
7515 * The txid for the commitment transaction.
7517 * This is provided as a performance optimization, instead of calling transaction.txid()
7520 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
7523 * The txid for the commitment transaction.
7525 * This is provided as a performance optimization, instead of calling transaction.txid()
7528 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7530 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
7532 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
7534 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_read(struct LDKu8slice ser);
7537 * Get the SIGHASH_ALL sighash value of the transaction.
7539 * This can be used to verify a signature.
7541 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);
7544 * Sign a transaction, either because we are counter-signing the counterparty's transaction or
7545 * because we are about to broadcast a holder transaction.
7547 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);
7549 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_ptr);
7551 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
7553 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
7555 struct LDKCommitmentTransaction CommitmentTransaction_read(struct LDKu8slice ser);
7558 * The backwards-counting commitment number
7560 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7563 * The value to be sent to the broadcaster
7565 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7568 * The value to be sent to the counterparty
7570 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7573 * The feerate paid per 1000-weight-unit in this commitment transaction.
7575 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7578 * Trust our pre-built transaction and derived transaction creation public keys.
7580 * Applies a wrapper which allows access to these fields.
7582 * This should only be used if you fully trust the builder of this object. It should not
7583 *\tbe used by an external signer - instead use the verify function.
7585 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7588 * Verify our pre-built transaction and derived transaction creation public keys.
7590 * Applies a wrapper which allows access to these fields.
7592 * An external validating signer must call this method before signing
7593 * or using the built transaction.
7595 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);
7597 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_ptr);
7600 * The transaction ID of the built Bitcoin transaction
7602 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7605 * The pre-built Bitcoin commitment transaction
7607 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7610 * The pre-calculated transaction creation public keys.
7612 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7615 * Get a signature for each HTLC which was included in the commitment transaction (ie for
7616 * which HTLCOutputInCommitment::transaction_output_index.is_some()).
7618 * The returned Vec has one entry for each HTLC, and in the same order.
7620 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);
7623 * Get the transaction number obscure factor
7625 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
7627 void InitFeatures_free(struct LDKInitFeatures this_ptr);
7629 void NodeFeatures_free(struct LDKNodeFeatures this_ptr);
7631 void ChannelFeatures_free(struct LDKChannelFeatures this_ptr);
7633 void RouteHop_free(struct LDKRouteHop this_ptr);
7635 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
7638 * The node_id of the node at this hop.
7640 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7643 * The node_id of the node at this hop.
7645 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7648 * The node_announcement features of the node at this hop. For the last hop, these may be
7649 * amended to match the features present in the invoice this node generated.
7651 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7654 * The node_announcement features of the node at this hop. For the last hop, these may be
7655 * amended to match the features present in the invoice this node generated.
7657 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
7660 * The channel that should be used from the previous hop to reach this node.
7662 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7665 * The channel that should be used from the previous hop to reach this node.
7667 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
7670 * The channel_announcement features of the channel that should be used from the previous hop
7671 * to reach this node.
7673 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7676 * The channel_announcement features of the channel that should be used from the previous hop
7677 * to reach this node.
7679 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
7682 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
7684 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7687 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
7689 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
7692 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
7693 * expected at the destination, in excess of the current block height.
7695 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7698 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
7699 * expected at the destination, in excess of the current block height.
7701 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
7703 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);
7705 void Route_free(struct LDKRoute this_ptr);
7707 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
7710 * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
7711 * last RouteHop in each path must be the same.
7712 * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
7713 * destination. Thus, this must always be at least length one. While the maximum length of any
7714 * given path is variable, keeping the length of any path to less than 20 should currently
7715 * ensure it is viable.
7717 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
7719 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
7721 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
7723 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
7725 void RouteHint_free(struct LDKRouteHint this_ptr);
7727 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
7730 * The node_id of the non-target end of the route
7732 struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7735 * The node_id of the non-target end of the route
7737 void RouteHint_set_src_node_id(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7740 * The short_channel_id of this channel
7742 uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7745 * The short_channel_id of this channel
7747 void RouteHint_set_short_channel_id(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
7750 * The fees which must be paid to use this channel
7752 struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7755 * The fees which must be paid to use this channel
7757 void RouteHint_set_fees(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
7760 * The difference in CLTV values between this node and the next node.
7762 uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7765 * The difference in CLTV values between this node and the next node.
7767 void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val);
7770 * The minimum value, in msat, which must be relayed to the next hop.
7772 uint64_t RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7775 * The minimum value, in msat, which must be relayed to the next hop.
7777 void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
7779 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);
7782 * Gets a route from us to the given target node.
7784 * Extra routing hops between known nodes and the target will be used if they are included in
7787 * If some channels aren't announced, it may be useful to fill in a first_hops with the
7788 * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
7789 * view of our local channels (from net_graph_msg_handler) will be ignored, and only those in first_hops
7792 * Panics if first_hops contains channels without short_channel_ids
7793 * (ChannelManager::list_usable_channels will never include such channels).
7795 * The fees on channels from us to next-hops are ignored (as they are assumed to all be
7796 * equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat
7797 * *is* checked as they may change based on the receiving node.
7799 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);
7801 void NetworkGraph_free(struct LDKNetworkGraph this_ptr);
7803 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr);
7805 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_ptr);
7808 * Creates a new tracker of the actual state of the network of channels and nodes,
7809 * assuming a fresh network graph.
7810 * Chain monitor is used to make sure announced channels exist on-chain,
7811 * channel data is correct, and that the announcement is signed with
7812 * channel owners' keys.
7814 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
7817 * Creates a new tracker of the actual state of the network of channels and nodes,
7818 * assuming an existing Network Graph.
7820 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
7823 * Take a read lock on the network_graph and return it in the C-bindings
7824 * newtype helper. This is likely only useful when called via the C
7825 * bindings as you can call `self.network_graph.read().unwrap()` in Rust
7828 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7831 * Get a reference to the NetworkGraph which this read-lock contains.
7833 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
7835 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7837 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7839 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_ptr);
7841 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
7844 * When the last update to the channel direction was issued.
7845 * Value is opaque, as set in the announcement.
7847 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7850 * When the last update to the channel direction was issued.
7851 * Value is opaque, as set in the announcement.
7853 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
7856 * Whether the channel can be currently used for payments (in this one direction).
7858 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7861 * Whether the channel can be currently used for payments (in this one direction).
7863 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
7866 * The difference in CLTV values that you must have when routing through this channel.
7868 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7871 * The difference in CLTV values that you must have when routing through this channel.
7873 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
7876 * The minimum value, which must be relayed to the next hop via the channel
7878 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7881 * The minimum value, which must be relayed to the next hop via the channel
7883 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
7886 * Fees charged when the channel is used for routing
7888 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7891 * Fees charged when the channel is used for routing
7893 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
7896 * Most recent update for the channel received from the network
7897 * Mostly redundant with the data we store in fields explicitly.
7898 * Everything else is useful only for sending out for initial routing sync.
7899 * Not stored if contains excess data to prevent DoS.
7901 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7904 * Most recent update for the channel received from the network
7905 * Mostly redundant with the data we store in fields explicitly.
7906 * Everything else is useful only for sending out for initial routing sync.
7907 * Not stored if contains excess data to prevent DoS.
7909 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
7911 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
7913 struct LDKDirectionalChannelInfo DirectionalChannelInfo_read(struct LDKu8slice ser);
7915 void ChannelInfo_free(struct LDKChannelInfo this_ptr);
7918 * Protocol features of a channel communicated during its announcement
7920 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7923 * Protocol features of a channel communicated during its announcement
7925 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
7928 * Source node of the first direction of a channel
7930 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7933 * Source node of the first direction of a channel
7935 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7938 * Details about the first direction of a channel
7940 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7943 * Details about the first direction of a channel
7945 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
7948 * Source node of the second direction of a channel
7950 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7953 * Source node of the second direction of a channel
7955 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7958 * Details about the second direction of a channel
7960 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7963 * Details about the second direction of a channel
7965 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
7968 * An initial announcement of the channel
7969 * Mostly redundant with the data we store in fields explicitly.
7970 * Everything else is useful only for sending out for initial routing sync.
7971 * Not stored if contains excess data to prevent DoS.
7973 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7976 * An initial announcement of the channel
7977 * Mostly redundant with the data we store in fields explicitly.
7978 * Everything else is useful only for sending out for initial routing sync.
7979 * Not stored if contains excess data to prevent DoS.
7981 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
7983 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
7985 struct LDKChannelInfo ChannelInfo_read(struct LDKu8slice ser);
7987 void RoutingFees_free(struct LDKRoutingFees this_ptr);
7989 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
7992 * Flat routing fee in satoshis
7994 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
7997 * Flat routing fee in satoshis
7999 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
8002 * Liquidity-based routing fee in millionths of a routed amount.
8003 * In other words, 10000 is 1%.
8005 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
8008 * Liquidity-based routing fee in millionths of a routed amount.
8009 * In other words, 10000 is 1%.
8011 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
8013 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
8015 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
8017 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
8019 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_ptr);
8021 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
8024 * Protocol features the node announced support for
8026 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
8029 * Protocol features the node announced support for
8031 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
8034 * When the last known update to the node state was issued.
8035 * Value is opaque, as set in the announcement.
8037 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
8040 * When the last known update to the node state was issued.
8041 * Value is opaque, as set in the announcement.
8043 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
8046 * Color assigned to the node
8048 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
8051 * Color assigned to the node
8053 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
8056 * Moniker assigned to the node.
8057 * May be invalid or malicious (eg control chars),
8058 * should not be exposed to the user.
8060 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
8063 * Moniker assigned to the node.
8064 * May be invalid or malicious (eg control chars),
8065 * should not be exposed to the user.
8067 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8070 * Internet-level addresses via which one can connect to the node
8072 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
8075 * An initial announcement of the node
8076 * Mostly redundant with the data we store in fields explicitly.
8077 * Everything else is useful only for sending out for initial routing sync.
8078 * Not stored if contains excess data to prevent DoS.
8080 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
8083 * An initial announcement of the node
8084 * Mostly redundant with the data we store in fields explicitly.
8085 * Everything else is useful only for sending out for initial routing sync.
8086 * Not stored if contains excess data to prevent DoS.
8088 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
8090 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);
8092 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
8094 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
8096 void NodeInfo_free(struct LDKNodeInfo this_ptr);
8098 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
8101 * All valid channels a node has announced
8103 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
8106 * Lowest fees enabling routing via any of the enabled, known channels to a node.
8107 * The two fields (flat and proportional fee) are independent,
8108 * meaning they don't have to refer to the same channel.
8110 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
8113 * Lowest fees enabling routing via any of the enabled, known channels to a node.
8114 * The two fields (flat and proportional fee) are independent,
8115 * meaning they don't have to refer to the same channel.
8117 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
8120 * More information about a node from node_announcement.
8121 * Optional because we store a Node entry after learning about it from
8122 * a channel announcement, but before receiving a node announcement.
8124 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
8127 * More information about a node from node_announcement.
8128 * Optional because we store a Node entry after learning about it from
8129 * a channel announcement, but before receiving a node announcement.
8131 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
8133 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
8135 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
8137 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
8139 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
8141 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
8144 * Creates a new, empty, network graph.
8146 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
8149 * For an already known node (from channel announcements), update its stored properties from a
8150 * given node announcement.
8152 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8153 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8154 * routing messages from a source using a protocol other than the lightning P2P protocol.
8156 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8159 * For an already known node (from channel announcements), update its stored properties from a
8160 * given node announcement without verifying the associated signatures. Because we aren't
8161 * given the associated signatures here we cannot relay the node announcement to any of our
8164 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
8167 * Store or update channel info from a channel announcement.
8169 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8170 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8171 * routing messages from a source using a protocol other than the lightning P2P protocol.
8173 * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
8174 * the corresponding UTXO exists on chain and is correctly-formatted.
8176 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);
8179 * Store or update channel info from a channel announcement without verifying the associated
8180 * signatures. Because we aren't given the associated signatures here we cannot relay the
8181 * channel announcement to any of our peers.
8183 * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
8184 * the corresponding UTXO exists on chain and is correctly-formatted.
8186 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);
8189 * Close a channel if a corresponding HTLC fail was sent.
8190 * If permanent, removes a channel from the local storage.
8191 * May cause the removal of nodes too, if this was their last channel.
8192 * If not permanent, makes channels unavailable for routing.
8194 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
8197 * For an already known (from announcement) channel, update info about one of the directions
8200 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8201 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8202 * routing messages from a source using a protocol other than the lightning P2P protocol.
8204 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8207 * For an already known (from announcement) channel, update info about one of the directions
8208 * of the channel without verifying the associated signatures. Because we aren't given the
8209 * associated signatures here we cannot relay the channel update to any of our peers.
8211 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
8213 /* Text to put at the end of the generated file */