1 /* Text to put at the beginning of the generated file. Probably a license. */
3 /* Generated with cbindgen:0.16.0 */
5 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
13 * An error when accessing the chain via [`Access`].
15 * [`Access`]: trait.Access.html
17 typedef enum LDKAccessError {
19 * The requested chain is unknown.
21 LDKAccessError_UnknownChain,
23 * The requested transaction doesn't exist or hasn't confirmed.
25 LDKAccessError_UnknownTx,
27 * Must be last for serialization purposes
29 LDKAccessError_Sentinel,
33 * An error enum representing a failure to persist a channel monitor update.
35 typedef enum LDKChannelMonitorUpdateErr {
37 * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
38 * our state failed, but is expected to succeed at some point in the future).
40 * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
41 * submitting new commitment transactions to the counterparty. Once the update(s) which failed
42 * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
43 * restore the channel to an operational state.
45 * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
46 * you return a TemporaryFailure you must ensure that it is written to disk safely before
47 * writing out the latest ChannelManager state.
49 * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
50 * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
51 * to claim it on this channel) and those updates must be applied wherever they can be. At
52 * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
53 * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
54 * the channel which would invalidate previous ChannelMonitors are not made when a channel has
57 * Note that even if updates made after TemporaryFailure succeed you must still call
58 * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
61 * Note that the update being processed here will not be replayed for you when you call
62 * ChannelManager::channel_monitor_updated, so you must store the update itself along
63 * with the persisted ChannelMonitor on your own local disk prior to returning a
64 * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
65 * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
68 * For deployments where a copy of ChannelMonitors and other local state are backed up in a
69 * remote location (with local copies persisted immediately), it is anticipated that all
70 * updates will return TemporaryFailure until the remote copies could be updated.
72 LDKChannelMonitorUpdateErr_TemporaryFailure,
74 * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
75 * different watchtower and cannot update with all watchtowers that were previously informed
78 * At reception of this error, ChannelManager will force-close the channel and return at
79 * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
80 * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
81 * update must be rejected.
83 * This failure may also signal a failure to update the local persisted copy of one of
84 * the channel monitor instance.
86 * Note that even when you fail a holder commitment transaction update, you must store the
87 * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
88 * broadcasts it (e.g distributed channel-monitor deployment)
90 * In case of distributed watchtowers deployment, the new version must be written to disk, as
91 * state may have been stored but rejected due to a block forcing a commitment broadcast. This
92 * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
93 * lagging behind on block processing.
95 LDKChannelMonitorUpdateErr_PermanentFailure,
97 * Must be last for serialization purposes
99 LDKChannelMonitorUpdateErr_Sentinel,
100 } LDKChannelMonitorUpdateErr;
103 * An enum that represents the speed at which we want a transaction to confirm used for feerate
106 typedef enum LDKConfirmationTarget {
108 * We are happy with this transaction confirming slowly when feerate drops some.
110 LDKConfirmationTarget_Background,
112 * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
114 LDKConfirmationTarget_Normal,
116 * We'd like this transaction to confirm in the next few blocks.
118 LDKConfirmationTarget_HighPriority,
120 * Must be last for serialization purposes
122 LDKConfirmationTarget_Sentinel,
123 } LDKConfirmationTarget;
126 * An enum representing the available verbosity levels of the logger.
128 typedef enum LDKLevel {
130 *Designates logger being silent
134 * Designates very serious errors
138 * Designates hazardous situations
142 * Designates useful information
146 * Designates lower priority information
150 * Designates very low priority, often extremely verbose, information
154 * Must be last for serialization purposes
159 typedef enum LDKNetwork {
164 * Must be last for serialization purposes
169 typedef enum LDKSecp256k1Error {
170 LDKSecp256k1Error_IncorrectSignature,
171 LDKSecp256k1Error_InvalidMessage,
172 LDKSecp256k1Error_InvalidPublicKey,
173 LDKSecp256k1Error_InvalidSignature,
174 LDKSecp256k1Error_InvalidSecretKey,
175 LDKSecp256k1Error_InvalidRecoveryId,
176 LDKSecp256k1Error_InvalidTweak,
177 LDKSecp256k1Error_NotEnoughMemory,
178 LDKSecp256k1Error_CallbackPanicked,
180 * Must be last for serialization purposes
182 LDKSecp256k1Error_Sentinel,
186 * A serialized transaction, in (pointer, length) form.
188 * This type optionally owns its own memory, and thus the semantics around access change based on
189 * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
190 * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
191 * access to the buffer after the scope in which the object was provided to you is invalid. eg,
192 * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
193 * you would be invalid.
195 * Note that, while it may change in the future, because transactions on the Rust side are stored
196 * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
197 * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
198 * `data_is_owned` either set or unset at your discretion.
200 typedef struct LDKTransaction {
202 * This is non-const for your convenience, an object passed to Rust is never written to.
209 typedef struct LDKCVec_u8Z {
215 * A transaction output including a scriptPubKey and value.
216 * This type *does* own its own memory, so must be free'd appropriately.
218 typedef struct LDKTxOut {
219 struct LDKCVec_u8Z script_pubkey;
226 * A reference to a transaction output.
228 * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
229 * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
231 typedef struct MUST_USE_STRUCT LDKOutPoint {
233 * Nearly everywhere, inner must be non-null, however in places where
234 * the Rust equivalent takes an Option, it may be set to null to indicate None.
236 LDKnativeOutPoint *inner;
240 typedef struct LDKPublicKey {
241 uint8_t compressed_form[33];
244 typedef struct LDKC2Tuple_u64u64Z {
247 } LDKC2Tuple_u64u64Z;
250 * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
251 * claim at any point in the future) an event is generated which you must track and be able to
252 * spend on-chain. The information needed to do this is provided in this enum, including the
253 * outpoint describing which txid and output index is available, the full output which exists at
254 * that txid/index, and any keys or other information required to sign.
256 typedef enum LDKSpendableOutputDescriptor_Tag {
258 * An output to a script which was provided via KeysInterface, thus you should already know
259 * how to spend it. No keys are provided as rust-lightning was never given any keys - only the
260 * script_pubkey as it appears in the output.
261 * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
262 * on-chain using the payment preimage or after it has timed out.
264 LDKSpendableOutputDescriptor_StaticOutput,
266 * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
268 * The witness in the spending input should be:
269 * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
271 * Note that the nSequence field in the spending input must be set to to_self_delay
272 * (which means the transaction is not broadcastable until at least to_self_delay
273 * blocks after the outpoint confirms).
275 * These are generally the result of a \"revocable\" output to us, spendable only by us unless
276 * it is an output from an old state which we broadcast (which should never happen).
278 * To derive the delayed_payment key which is used to sign for this input, you must pass the
279 * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
280 * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
281 * chan_utils::derive_private_key. The public key can be generated without the secret key
282 * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
283 * ChannelKeys::pubkeys().
285 * To derive the revocation_pubkey provided here (which is used in the witness
286 * script generation), you must pass the counterparty revocation_basepoint (which appears in the
287 * call to ChannelKeys::ready_channel) and the provided per_commitment point
288 * to chan_utils::derive_public_revocation_key.
290 * The witness script which is hashed and included in the output script_pubkey may be
291 * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
292 * (derived as above), and the to_self_delay contained here to
293 * chan_utils::get_revokeable_redeemscript.
295 LDKSpendableOutputDescriptor_DynamicOutputP2WSH,
297 * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
298 * corresponds to the public key in ChannelKeys::pubkeys().payment_point).
299 * The witness in the spending input, is, thus, simply:
300 * <BIP 143 signature> <payment key>
302 * These are generally the result of our counterparty having broadcast the current state,
303 * allowing us to claim the non-HTLC-encumbered outputs immediately.
305 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment,
307 * Must be last for serialization purposes
309 LDKSpendableOutputDescriptor_Sentinel,
310 } LDKSpendableOutputDescriptor_Tag;
312 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
313 struct LDKOutPoint outpoint;
314 struct LDKTxOut output;
315 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
317 typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body {
318 struct LDKOutPoint outpoint;
319 struct LDKPublicKey per_commitment_point;
320 uint16_t to_self_delay;
321 struct LDKTxOut output;
322 struct LDKC2Tuple_u64u64Z key_derivation_params;
323 struct LDKPublicKey revocation_pubkey;
324 } LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
326 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
327 struct LDKOutPoint outpoint;
328 struct LDKTxOut output;
329 struct LDKC2Tuple_u64u64Z key_derivation_params;
330 } LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body;
332 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
333 LDKSpendableOutputDescriptor_Tag tag;
335 LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
336 LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh;
337 LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment;
339 } LDKSpendableOutputDescriptor;
341 typedef struct LDKCVec_SpendableOutputDescriptorZ {
342 struct LDKSpendableOutputDescriptor *data;
344 } LDKCVec_SpendableOutputDescriptorZ;
349 * An accept_channel message to be sent or received from a peer
351 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
353 * Nearly everywhere, inner must be non-null, however in places where
354 * the Rust equivalent takes an Option, it may be set to null to indicate None.
356 LDKnativeAcceptChannel *inner;
363 * An open_channel message to be sent or received from a peer
365 typedef struct MUST_USE_STRUCT LDKOpenChannel {
367 * Nearly everywhere, inner must be non-null, however in places where
368 * the Rust equivalent takes an Option, it may be set to null to indicate None.
370 LDKnativeOpenChannel *inner;
377 * A funding_created message to be sent or received from a peer
379 typedef struct MUST_USE_STRUCT LDKFundingCreated {
381 * Nearly everywhere, inner must be non-null, however in places where
382 * the Rust equivalent takes an Option, it may be set to null to indicate None.
384 LDKnativeFundingCreated *inner;
391 * A funding_signed message to be sent or received from a peer
393 typedef struct MUST_USE_STRUCT LDKFundingSigned {
395 * Nearly everywhere, inner must be non-null, however in places where
396 * the Rust equivalent takes an Option, it may be set to null to indicate None.
398 LDKnativeFundingSigned *inner;
405 * A funding_locked message to be sent or received from a peer
407 typedef struct MUST_USE_STRUCT LDKFundingLocked {
409 * Nearly everywhere, inner must be non-null, however in places where
410 * the Rust equivalent takes an Option, it may be set to null to indicate None.
412 LDKnativeFundingLocked *inner;
419 * An announcement_signatures message to be sent or received from a peer
421 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
423 * Nearly everywhere, inner must be non-null, however in places where
424 * the Rust equivalent takes an Option, it may be set to null to indicate None.
426 LDKnativeAnnouncementSignatures *inner;
428 } LDKAnnouncementSignatures;
433 * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
434 * transaction updates if they were pending.
436 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
438 * Nearly everywhere, inner must be non-null, however in places where
439 * the Rust equivalent takes an Option, it may be set to null to indicate None.
441 LDKnativeCommitmentUpdate *inner;
443 } LDKCommitmentUpdate;
448 * A revoke_and_ack message to be sent or received from a peer
450 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
452 * Nearly everywhere, inner must be non-null, however in places where
453 * the Rust equivalent takes an Option, it may be set to null to indicate None.
455 LDKnativeRevokeAndACK *inner;
462 * A closing_signed message to be sent or received from a peer
464 typedef struct MUST_USE_STRUCT LDKClosingSigned {
466 * Nearly everywhere, inner must be non-null, however in places where
467 * the Rust equivalent takes an Option, it may be set to null to indicate None.
469 LDKnativeClosingSigned *inner;
476 * A shutdown message to be sent or received from a peer
478 typedef struct MUST_USE_STRUCT LDKShutdown {
480 * Nearly everywhere, inner must be non-null, however in places where
481 * the Rust equivalent takes an Option, it may be set to null to indicate None.
483 LDKnativeShutdown *inner;
490 * A channel_reestablish message to be sent or received from a peer
492 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
494 * Nearly everywhere, inner must be non-null, however in places where
495 * the Rust equivalent takes an Option, it may be set to null to indicate None.
497 LDKnativeChannelReestablish *inner;
499 } LDKChannelReestablish;
504 * A channel_announcement message to be sent or received from a peer
506 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
508 * Nearly everywhere, inner must be non-null, however in places where
509 * the Rust equivalent takes an Option, it may be set to null to indicate None.
511 LDKnativeChannelAnnouncement *inner;
513 } LDKChannelAnnouncement;
518 * A channel_update message to be sent or received from a peer
520 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
522 * Nearly everywhere, inner must be non-null, however in places where
523 * the Rust equivalent takes an Option, it may be set to null to indicate None.
525 LDKnativeChannelUpdate *inner;
532 * A node_announcement message to be sent or received from a peer
534 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
536 * Nearly everywhere, inner must be non-null, however in places where
537 * the Rust equivalent takes an Option, it may be set to null to indicate None.
539 LDKnativeNodeAnnouncement *inner;
541 } LDKNodeAnnouncement;
546 * An error message to be sent or received from a peer
548 typedef struct MUST_USE_STRUCT LDKErrorMessage {
550 * Nearly everywhere, inner must be non-null, however in places where
551 * the Rust equivalent takes an Option, it may be set to null to indicate None.
553 LDKnativeErrorMessage *inner;
558 * Used to put an error message in a LightningError
560 typedef enum LDKErrorAction_Tag {
562 * The peer took some action which made us think they were useless. Disconnect them.
564 LDKErrorAction_DisconnectPeer,
566 * The peer did something harmless that we weren't able to process, just log and ignore
568 LDKErrorAction_IgnoreError,
570 * The peer did something incorrect. Tell them.
572 LDKErrorAction_SendErrorMessage,
574 * Must be last for serialization purposes
576 LDKErrorAction_Sentinel,
577 } LDKErrorAction_Tag;
579 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
580 struct LDKErrorMessage msg;
581 } LDKErrorAction_LDKDisconnectPeer_Body;
583 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
584 struct LDKErrorMessage msg;
585 } LDKErrorAction_LDKSendErrorMessage_Body;
587 typedef struct MUST_USE_STRUCT LDKErrorAction {
588 LDKErrorAction_Tag tag;
590 LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
591 LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
596 * The information we received from a peer along the route of a payment we originated. This is
597 * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
598 * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
600 typedef enum LDKHTLCFailChannelUpdate_Tag {
602 * We received an error which included a full ChannelUpdate message.
604 LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
606 * We received an error which indicated only that a channel has been closed
608 LDKHTLCFailChannelUpdate_ChannelClosed,
610 * We received an error which indicated only that a node has failed
612 LDKHTLCFailChannelUpdate_NodeFailure,
614 * Must be last for serialization purposes
616 LDKHTLCFailChannelUpdate_Sentinel,
617 } LDKHTLCFailChannelUpdate_Tag;
619 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
620 struct LDKChannelUpdate msg;
621 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
623 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
624 uint64_t short_channel_id;
626 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
628 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
629 struct LDKPublicKey node_id;
631 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
633 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
634 LDKHTLCFailChannelUpdate_Tag tag;
636 LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
637 LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
638 LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
640 } LDKHTLCFailChannelUpdate;
645 * A query_channel_range message is used to query a peer for channel
646 * UTXOs in a range of blocks. The recipient of a query makes a best
647 * effort to reply to the query using one or more reply_channel_range
650 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
652 * Nearly everywhere, inner must be non-null, however in places where
653 * the Rust equivalent takes an Option, it may be set to null to indicate None.
655 LDKnativeQueryChannelRange *inner;
657 } LDKQueryChannelRange;
662 * A query_short_channel_ids message is used to query a peer for
663 * routing gossip messages related to one or more short_channel_ids.
664 * The query recipient will reply with the latest, if available,
665 * channel_announcement, channel_update and node_announcement messages
666 * it maintains for the requested short_channel_ids followed by a
667 * reply_short_channel_ids_end message. The short_channel_ids sent in
668 * this query are encoded. We only support encoding_type=0 uncompressed
669 * serialization and do not support encoding_type=1 zlib serialization.
671 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
673 * Nearly everywhere, inner must be non-null, however in places where
674 * the Rust equivalent takes an Option, it may be set to null to indicate None.
676 LDKnativeQueryShortChannelIds *inner;
678 } LDKQueryShortChannelIds;
681 * An event generated by ChannelManager which indicates a message should be sent to a peer (or
682 * broadcast to most peers).
683 * These events are handled by PeerManager::process_events if you are using a PeerManager.
685 typedef enum LDKMessageSendEvent_Tag {
687 * Used to indicate that we've accepted a channel open and should send the accept_channel
688 * message provided to the given peer.
690 LDKMessageSendEvent_SendAcceptChannel,
692 * Used to indicate that we've initiated a channel open and should send the open_channel
693 * message provided to the given peer.
695 LDKMessageSendEvent_SendOpenChannel,
697 * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
699 LDKMessageSendEvent_SendFundingCreated,
701 * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
703 LDKMessageSendEvent_SendFundingSigned,
705 * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
707 LDKMessageSendEvent_SendFundingLocked,
709 * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
711 LDKMessageSendEvent_SendAnnouncementSignatures,
713 * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
714 * message should be sent to the peer with the given node_id.
716 LDKMessageSendEvent_UpdateHTLCs,
718 * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
720 LDKMessageSendEvent_SendRevokeAndACK,
722 * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
724 LDKMessageSendEvent_SendClosingSigned,
726 * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
728 LDKMessageSendEvent_SendShutdown,
730 * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
732 LDKMessageSendEvent_SendChannelReestablish,
734 * Used to indicate that a channel_announcement and channel_update should be broadcast to all
735 * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
737 * Note that after doing so, you very likely (unless you did so very recently) want to call
738 * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
739 * This ensures that any nodes which see our channel_announcement also have a relevant
740 * node_announcement, including relevant feature flags which may be important for routing
743 LDKMessageSendEvent_BroadcastChannelAnnouncement,
745 * Used to indicate that a node_announcement should be broadcast to all peers.
747 LDKMessageSendEvent_BroadcastNodeAnnouncement,
749 * Used to indicate that a channel_update should be broadcast to all peers.
751 LDKMessageSendEvent_BroadcastChannelUpdate,
753 * Broadcast an error downstream to be handled
755 LDKMessageSendEvent_HandleError,
757 * When a payment fails we may receive updates back from the hop where it failed. In such
758 * cases this event is generated so that we can inform the network graph of this information.
760 LDKMessageSendEvent_PaymentFailureNetworkUpdate,
762 * Query a peer for channels with funding transaction UTXOs in a block range.
764 LDKMessageSendEvent_SendChannelRangeQuery,
766 * Request routing gossip messages from a peer for a list of channels identified by
767 * their short_channel_ids.
769 LDKMessageSendEvent_SendShortIdsQuery,
771 * Must be last for serialization purposes
773 LDKMessageSendEvent_Sentinel,
774 } LDKMessageSendEvent_Tag;
776 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
777 struct LDKPublicKey node_id;
778 struct LDKAcceptChannel msg;
779 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
781 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
782 struct LDKPublicKey node_id;
783 struct LDKOpenChannel msg;
784 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
786 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
787 struct LDKPublicKey node_id;
788 struct LDKFundingCreated msg;
789 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
791 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
792 struct LDKPublicKey node_id;
793 struct LDKFundingSigned msg;
794 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
796 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
797 struct LDKPublicKey node_id;
798 struct LDKFundingLocked msg;
799 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
801 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
802 struct LDKPublicKey node_id;
803 struct LDKAnnouncementSignatures msg;
804 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
806 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
807 struct LDKPublicKey node_id;
808 struct LDKCommitmentUpdate updates;
809 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
811 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
812 struct LDKPublicKey node_id;
813 struct LDKRevokeAndACK msg;
814 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
816 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
817 struct LDKPublicKey node_id;
818 struct LDKClosingSigned msg;
819 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
821 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
822 struct LDKPublicKey node_id;
823 struct LDKShutdown msg;
824 } LDKMessageSendEvent_LDKSendShutdown_Body;
826 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
827 struct LDKPublicKey node_id;
828 struct LDKChannelReestablish msg;
829 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
831 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
832 struct LDKChannelAnnouncement msg;
833 struct LDKChannelUpdate update_msg;
834 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
836 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
837 struct LDKNodeAnnouncement msg;
838 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
840 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
841 struct LDKChannelUpdate msg;
842 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
844 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
845 struct LDKPublicKey node_id;
846 struct LDKErrorAction action;
847 } LDKMessageSendEvent_LDKHandleError_Body;
849 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
850 struct LDKHTLCFailChannelUpdate update;
851 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
853 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
854 struct LDKPublicKey node_id;
855 struct LDKQueryChannelRange msg;
856 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
858 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
859 struct LDKPublicKey node_id;
860 struct LDKQueryShortChannelIds msg;
861 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
863 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
864 LDKMessageSendEvent_Tag tag;
866 LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
867 LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
868 LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
869 LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
870 LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
871 LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
872 LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
873 LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
874 LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
875 LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
876 LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
877 LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
878 LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
879 LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
880 LDKMessageSendEvent_LDKHandleError_Body handle_error;
881 LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
882 LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
883 LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
885 } LDKMessageSendEvent;
887 typedef struct LDKCVec_MessageSendEventZ {
888 struct LDKMessageSendEvent *data;
890 } LDKCVec_MessageSendEventZ;
893 * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
894 * look up the corresponding function in rust-lightning's docs.
896 typedef struct LDKThirtyTwoBytes {
901 * An Event which you should probably take some action in response to.
903 * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
904 * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
905 * written as it makes no sense to respond to it after reconnecting to peers).
907 typedef enum LDKEvent_Tag {
909 * Used to indicate that the client should generate a funding transaction with the given
910 * parameters and then call ChannelManager::funding_transaction_generated.
911 * Generated in ChannelManager message handling.
912 * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
913 * counterparty can steal your funds!
915 LDKEvent_FundingGenerationReady,
917 * Used to indicate that the client may now broadcast the funding transaction it created for a
918 * channel. Broadcasting such a transaction prior to this event may lead to our counterparty
919 * trivially stealing all funds in the funding transaction!
921 LDKEvent_FundingBroadcastSafe,
923 * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
924 * ChannelManager::claim_funds to get it....
925 * Note that if the preimage is not known or the amount paid is incorrect, you should call
926 * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
927 * network congestion.
928 * The amount paid should be considered 'incorrect' when it is less than or more than twice
929 * the amount expected.
930 * If you fail to call either ChannelManager::claim_funds or
931 * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
932 * automatically failed.
934 LDKEvent_PaymentReceived,
936 * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
937 * and we got back the payment preimage for it).
938 * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
939 * deduplicate them by payment_preimage (which MUST be unique)!
941 LDKEvent_PaymentSent,
943 * Indicates an outbound payment we made failed. Probably some intermediary node dropped
944 * something. You may wish to retry with a different route.
945 * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
946 * deduplicate them by payment_hash (which MUST be unique)!
948 LDKEvent_PaymentFailed,
950 * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
951 * time in the future.
953 LDKEvent_PendingHTLCsForwardable,
955 * Used to indicate that an output was generated on-chain which you should know how to spend.
956 * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
957 * counterparty spending them due to some kind of timeout. Thus, you need to store them
958 * somewhere and spend them when you create on-chain transactions.
960 LDKEvent_SpendableOutputs,
962 * Must be last for serialization purposes
967 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
968 struct LDKThirtyTwoBytes temporary_channel_id;
969 uint64_t channel_value_satoshis;
970 struct LDKCVec_u8Z output_script;
971 uint64_t user_channel_id;
972 } LDKEvent_LDKFundingGenerationReady_Body;
974 typedef struct LDKEvent_LDKFundingBroadcastSafe_Body {
975 struct LDKOutPoint funding_txo;
976 uint64_t user_channel_id;
977 } LDKEvent_LDKFundingBroadcastSafe_Body;
979 typedef struct LDKEvent_LDKPaymentReceived_Body {
980 struct LDKThirtyTwoBytes payment_hash;
981 struct LDKThirtyTwoBytes payment_secret;
983 } LDKEvent_LDKPaymentReceived_Body;
985 typedef struct LDKEvent_LDKPaymentSent_Body {
986 struct LDKThirtyTwoBytes payment_preimage;
987 } LDKEvent_LDKPaymentSent_Body;
989 typedef struct LDKEvent_LDKPaymentFailed_Body {
990 struct LDKThirtyTwoBytes payment_hash;
991 bool rejected_by_dest;
992 } LDKEvent_LDKPaymentFailed_Body;
994 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
995 uint64_t time_forwardable;
996 } LDKEvent_LDKPendingHTLCsForwardable_Body;
998 typedef struct LDKEvent_LDKSpendableOutputs_Body {
999 struct LDKCVec_SpendableOutputDescriptorZ outputs;
1000 } LDKEvent_LDKSpendableOutputs_Body;
1002 typedef struct MUST_USE_STRUCT LDKEvent {
1005 LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
1006 LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe;
1007 LDKEvent_LDKPaymentReceived_Body payment_received;
1008 LDKEvent_LDKPaymentSent_Body payment_sent;
1009 LDKEvent_LDKPaymentFailed_Body payment_failed;
1010 LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
1011 LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
1015 typedef struct LDKCVec_EventZ {
1016 struct LDKEvent *data;
1020 typedef struct LDKC2Tuple_usizeTransactionZ {
1022 struct LDKTransaction b;
1023 } LDKC2Tuple_usizeTransactionZ;
1025 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
1026 struct LDKC2Tuple_usizeTransactionZ *data;
1028 } LDKCVec_C2Tuple_usizeTransactionZZ;
1030 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
1032 * Note that this value is always NULL, as there are no contents in the OK variant
1035 enum LDKChannelMonitorUpdateErr *err;
1036 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
1038 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
1039 union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
1041 } LDKCResult_NoneChannelMonitorUpdateErrZ;
1046 * An event to be processed by the ChannelManager.
1048 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1050 * Nearly everywhere, inner must be non-null, however in places where
1051 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1053 LDKnativeMonitorEvent *inner;
1057 typedef struct LDKCVec_MonitorEventZ {
1058 struct LDKMonitorEvent *data;
1060 } LDKCVec_MonitorEventZ;
1065 * An update generated by the underlying Channel itself which contains some new information the
1066 * ChannelMonitor should be made aware of.
1068 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1070 * Nearly everywhere, inner must be non-null, however in places where
1071 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1073 LDKnativeChannelMonitorUpdate *inner;
1075 } LDKChannelMonitorUpdate;
1080 * An error in decoding a message or struct.
1082 typedef struct MUST_USE_STRUCT LDKDecodeError {
1084 * Nearly everywhere, inner must be non-null, however in places where
1085 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1087 LDKnativeDecodeError *inner;
1091 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
1092 struct LDKChannelMonitorUpdate *result;
1093 struct LDKDecodeError *err;
1094 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
1096 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
1097 union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
1099 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
1104 * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
1105 * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
1106 * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
1108 * Contains a developer-readable error message.
1110 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
1112 * Nearly everywhere, inner must be non-null, however in places where
1113 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1115 LDKnativeMonitorUpdateError *inner;
1117 } LDKMonitorUpdateError;
1119 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
1121 * Note that this value is always NULL, as there are no contents in the OK variant
1124 struct LDKMonitorUpdateError *err;
1125 } LDKCResult_NoneMonitorUpdateErrorZPtr;
1127 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
1128 union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
1130 } LDKCResult_NoneMonitorUpdateErrorZ;
1132 typedef struct LDKC2Tuple_OutPointScriptZ {
1133 struct LDKOutPoint a;
1134 struct LDKCVec_u8Z b;
1135 } LDKC2Tuple_OutPointScriptZ;
1137 typedef struct LDKCVec_TransactionZ {
1138 struct LDKTransaction *data;
1140 } LDKCVec_TransactionZ;
1142 typedef struct LDKC2Tuple_u32TxOutZ {
1145 } LDKC2Tuple_u32TxOutZ;
1147 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
1148 struct LDKC2Tuple_u32TxOutZ *data;
1150 } LDKCVec_C2Tuple_u32TxOutZZ;
1152 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
1153 struct LDKThirtyTwoBytes a;
1154 struct LDKCVec_C2Tuple_u32TxOutZZ b;
1155 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
1157 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
1158 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
1160 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ;
1165 * One counterparty's public keys which do not change over the life of a channel.
1167 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
1169 * Nearly everywhere, inner must be non-null, however in places where
1170 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1172 LDKnativeChannelPublicKeys *inner;
1174 } LDKChannelPublicKeys;
1176 typedef struct LDKSignature {
1177 uint8_t compact_form[64];
1180 typedef struct LDKCVec_SignatureZ {
1181 struct LDKSignature *data;
1183 } LDKCVec_SignatureZ;
1185 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
1186 struct LDKSignature a;
1187 struct LDKCVec_SignatureZ b;
1188 } LDKC2Tuple_SignatureCVec_SignatureZZ;
1190 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1191 struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
1193 * Note that this value is always NULL, as there are no contents in the Err variant
1196 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
1198 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1199 union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
1201 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
1206 * This class tracks the per-transaction information needed to build a commitment transaction and to
1207 * actually build it and sign. It is used for holder transactions that we sign only when needed
1208 * and for transactions we sign for the counterparty.
1210 * This class can be used inside a signer implementation to generate a signature given the relevant
1213 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1215 * Nearly everywhere, inner must be non-null, however in places where
1216 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1218 LDKnativeCommitmentTransaction *inner;
1220 } LDKCommitmentTransaction;
1225 * Information needed to build and sign a holder's commitment transaction.
1227 * The transaction is only signed once we are ready to broadcast.
1229 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1231 * Nearly everywhere, inner must be non-null, however in places where
1232 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1234 LDKnativeHolderCommitmentTransaction *inner;
1236 } LDKHolderCommitmentTransaction;
1238 typedef union LDKCResult_SignatureNoneZPtr {
1239 struct LDKSignature *result;
1241 * Note that this value is always NULL, as there are no contents in the Err variant
1244 } LDKCResult_SignatureNoneZPtr;
1246 typedef struct LDKCResult_SignatureNoneZ {
1247 union LDKCResult_SignatureNoneZPtr contents;
1249 } LDKCResult_SignatureNoneZ;
1254 * Information about an HTLC as it appears in a commitment transaction
1256 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
1258 * Nearly everywhere, inner must be non-null, however in places where
1259 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1261 LDKnativeHTLCOutputInCommitment *inner;
1263 } LDKHTLCOutputInCommitment;
1268 * The unsigned part of a channel_announcement
1270 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
1272 * Nearly everywhere, inner must be non-null, however in places where
1273 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1275 LDKnativeUnsignedChannelAnnouncement *inner;
1277 } LDKUnsignedChannelAnnouncement;
1282 * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
1283 * The fields are organized by holder/counterparty.
1285 * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
1286 * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
1288 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
1290 * Nearly everywhere, inner must be non-null, however in places where
1291 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1293 LDKnativeChannelTransactionParameters *inner;
1295 } LDKChannelTransactionParameters;
1298 * Set of lightning keys needed to operate a channel as described in BOLT 3.
1300 * Signing services could be implemented on a hardware wallet. In this case,
1301 * the current ChannelKeys would be a front-end on top of a communication
1302 * channel connected to your secure device and lightning key material wouldn't
1303 * reside on a hot server. Nevertheless, a this deployment would still need
1304 * to trust the ChannelManager to avoid loss of funds as this latest component
1305 * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
1307 * A more secure iteration would be to use hashlock (or payment points) to pair
1308 * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
1309 * at the price of more state and computation on the hardware wallet side. In the future,
1310 * we are looking forward to design such interface.
1312 * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
1313 * to act, as liveness and breach reply correctness are always going to be hard requirements
1314 * of LN security model, orthogonal of key management issues.
1316 * If you're implementing a custom signer, you almost certainly want to implement
1317 * Readable/Writable to serialize out a unique reference to this set of keys so
1318 * that you can serialize the full ChannelManager object.
1321 typedef struct LDKChannelKeys {
1324 * Gets the per-commitment point for a specific commitment number
1326 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1328 struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
1330 * Gets the commitment secret for a specific commitment number as part of the revocation process
1332 * An external signer implementation should error here if the commitment was already signed
1333 * and should refuse to sign it in the future.
1335 * May be called more than once for the same index.
1337 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1338 * TODO: return a Result so we can signal a validation error
1340 struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
1342 * Gets the holder's channel public keys and basepoints
1344 struct LDKChannelPublicKeys pubkeys;
1346 * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
1347 * Note that this takes a pointer to this object, not the this_ptr like other methods do
1348 * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
1350 void (*set_pubkeys)(const struct LDKChannelKeys*NONNULL_PTR );
1352 * Gets arbitrary identifiers describing the set of keys which are provided back to you in
1353 * some SpendableOutputDescriptor types. These should be sufficient to identify this
1354 * ChannelKeys object uniquely and lookup or re-derive its keys.
1356 struct LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg);
1358 * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
1360 * Note that if signing fails or is rejected, the channel will be force-closed.
1362 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
1364 * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
1365 * This will only ever be called with a non-revoked commitment_tx. This will be called with the
1366 * latest commitment_tx when we initiate a force-close.
1367 * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
1368 * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
1370 * This may be called multiple times for the same transaction.
1372 * An external signer implementation should check that the commitment has not been revoked.
1374 * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case.
1376 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
1378 * Create a signature for the given input in a transaction spending an HTLC or commitment
1379 * transaction output when our counterparty broadcasts an old state.
1381 * A justice transaction may claim multiples outputs at the same time if timelocks are
1382 * similar, but only a signature for the input at index `input` should be signed for here.
1383 * It may be called multiples time for same output(s) if a fee-bump is needed with regards
1384 * to an upcoming timelock expiration.
1386 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1388 * per_commitment_key is revocation secret which was provided by our counterparty when they
1389 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
1390 * not allow the spending of any funds by itself (you need our holder revocation_secret to do
1393 * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
1394 * changing the format of the witness script (which is committed to in the BIP 143
1397 struct LDKCResult_SignatureNoneZ (*sign_justice_transaction)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
1399 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
1400 * transaction, either offered or received.
1402 * Such a transaction may claim multiples offered outputs at same time if we know the
1403 * preimage for each when we create it, but only the input at index `input` should be
1404 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
1405 * needed with regards to an upcoming timelock expiration.
1407 * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
1410 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1412 * Per_commitment_point is the dynamic point corresponding to the channel state
1413 * detected onchain. It has been generated by our counterparty and is used to derive
1414 * channel state keys, which are then included in the witness script and committed to in the
1415 * BIP 143 signature.
1417 struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
1419 * Create a signature for a (proposed) closing transaction.
1421 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
1422 * chosen to forgo their output as dust.
1424 struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
1426 * Signs a channel announcement message with our funding key, proving it comes from one
1427 * of the channel participants.
1429 * Note that if this fails or is rejected, the channel will not be publicly announced and
1430 * our counterparty may (though likely will not) close the channel on us for violating the
1433 struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
1435 * Set the counterparty static channel data, including basepoints,
1436 * counterparty_selected/holder_selected_contest_delay and funding outpoint.
1437 * This is done as soon as the funding outpoint is known. Since these are static channel data,
1438 * they MUST NOT be allowed to change to different values once set.
1440 * channel_parameters.is_populated() MUST be true.
1442 * We bind holder_selected_contest_delay late here for API convenience.
1444 * Will be called before any signatures are applied.
1446 void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
1447 void *(*clone)(const void *this_arg);
1448 struct LDKCVec_u8Z (*write)(const void *this_arg);
1449 void (*free)(void *this_arg);
1455 * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
1456 * on-chain transactions to ensure no loss of funds occurs.
1458 * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
1459 * information and are actively monitoring the chain.
1461 * Pending Events or updated HTLCs which have not yet been read out by
1462 * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
1463 * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
1464 * gotten are fully handled before re-serializing the new state.
1466 * Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which
1467 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
1468 * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
1469 * returned block hash and the the current chain and then reconnecting blocks to get to the
1470 * best chain) upon deserializing the object!
1472 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
1474 * Nearly everywhere, inner must be non-null, however in places where
1475 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1477 LDKnativeChannelMonitor *inner;
1479 } LDKChannelMonitor;
1481 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
1482 struct LDKThirtyTwoBytes a;
1483 struct LDKChannelMonitor b;
1484 } LDKC2Tuple_BlockHashChannelMonitorZ;
1486 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
1487 struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
1488 struct LDKDecodeError *err;
1489 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
1491 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
1492 union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
1494 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
1496 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
1497 struct LDKSpendableOutputDescriptor *result;
1498 struct LDKDecodeError *err;
1499 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
1501 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
1502 union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
1504 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
1506 typedef union LDKCResult_ChanKeySignerDecodeErrorZPtr {
1507 struct LDKChannelKeys *result;
1508 struct LDKDecodeError *err;
1509 } LDKCResult_ChanKeySignerDecodeErrorZPtr;
1511 typedef struct LDKCResult_ChanKeySignerDecodeErrorZ {
1512 union LDKCResult_ChanKeySignerDecodeErrorZPtr contents;
1514 } LDKCResult_ChanKeySignerDecodeErrorZ;
1519 * A simple implementation of ChannelKeys that just keeps the private keys in memory.
1521 * This implementation performs no policy checks and is insufficient by itself as
1522 * a secure external signer.
1524 typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys {
1526 * Nearly everywhere, inner must be non-null, however in places where
1527 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1529 LDKnativeInMemoryChannelKeys *inner;
1531 } LDKInMemoryChannelKeys;
1533 typedef union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr {
1534 struct LDKInMemoryChannelKeys *result;
1535 struct LDKDecodeError *err;
1536 } LDKCResult_InMemoryChannelKeysDecodeErrorZPtr;
1538 typedef struct LDKCResult_InMemoryChannelKeysDecodeErrorZ {
1539 union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr contents;
1541 } LDKCResult_InMemoryChannelKeysDecodeErrorZ;
1543 typedef union LDKCResult_TxOutAccessErrorZPtr {
1544 struct LDKTxOut *result;
1545 enum LDKAccessError *err;
1546 } LDKCResult_TxOutAccessErrorZPtr;
1548 typedef struct LDKCResult_TxOutAccessErrorZ {
1549 union LDKCResult_TxOutAccessErrorZPtr contents;
1551 } LDKCResult_TxOutAccessErrorZ;
1554 * A Rust str object, ie a reference to a UTF8-valid string.
1555 * This is *not* null-terminated so cannot be used directly as a C string!
1557 typedef struct LDKStr {
1558 const uint8_t *chars;
1563 * Indicates an error on the client's part (usually some variant of attempting to use too-low or
1566 typedef enum LDKAPIError_Tag {
1568 * Indicates the API was wholly misused (see err for more). Cases where these can be returned
1569 * are documented, but generally indicates some precondition of a function was violated.
1571 LDKAPIError_APIMisuseError,
1573 * Due to a high feerate, we were unable to complete the request.
1574 * For example, this may be returned if the feerate implies we cannot open a channel at the
1575 * requested value, but opening a larger channel would succeed.
1577 LDKAPIError_FeeRateTooHigh,
1579 * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
1580 * too-many-hops, etc).
1582 LDKAPIError_RouteError,
1584 * We were unable to complete the request as the Channel required to do so is unable to
1585 * complete the request (or was not found). This can take many forms, including disconnected
1586 * peer, channel at capacity, channel shutting down, etc.
1588 LDKAPIError_ChannelUnavailable,
1590 * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
1591 * attempted action to fail.
1593 LDKAPIError_MonitorUpdateFailed,
1595 * Must be last for serialization purposes
1597 LDKAPIError_Sentinel,
1600 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
1601 struct LDKCVec_u8Z err;
1602 } LDKAPIError_LDKAPIMisuseError_Body;
1604 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
1605 struct LDKCVec_u8Z err;
1607 } LDKAPIError_LDKFeeRateTooHigh_Body;
1609 typedef struct LDKAPIError_LDKRouteError_Body {
1611 } LDKAPIError_LDKRouteError_Body;
1613 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
1614 struct LDKCVec_u8Z err;
1615 } LDKAPIError_LDKChannelUnavailable_Body;
1617 typedef struct MUST_USE_STRUCT LDKAPIError {
1618 LDKAPIError_Tag tag;
1620 LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
1621 LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
1622 LDKAPIError_LDKRouteError_Body route_error;
1623 LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
1627 typedef union LDKCResult_NoneAPIErrorZPtr {
1629 * Note that this value is always NULL, as there are no contents in the OK variant
1632 struct LDKAPIError *err;
1633 } LDKCResult_NoneAPIErrorZPtr;
1635 typedef struct LDKCResult_NoneAPIErrorZ {
1636 union LDKCResult_NoneAPIErrorZPtr contents;
1638 } LDKCResult_NoneAPIErrorZ;
1643 * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
1645 typedef struct MUST_USE_STRUCT LDKChannelDetails {
1647 * Nearly everywhere, inner must be non-null, however in places where
1648 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1650 LDKnativeChannelDetails *inner;
1652 } LDKChannelDetails;
1654 typedef struct LDKCVec_ChannelDetailsZ {
1655 struct LDKChannelDetails *data;
1657 } LDKCVec_ChannelDetailsZ;
1662 * If a payment fails to send, it can be in one of several states. This enum is returned as the
1663 * Err() type describing which state the payment is in, see the description of individual enum
1666 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
1668 * Nearly everywhere, inner must be non-null, however in places where
1669 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1671 LDKnativePaymentSendFailure *inner;
1673 } LDKPaymentSendFailure;
1675 typedef union LDKCResult_NonePaymentSendFailureZPtr {
1677 * Note that this value is always NULL, as there are no contents in the OK variant
1680 struct LDKPaymentSendFailure *err;
1681 } LDKCResult_NonePaymentSendFailureZPtr;
1683 typedef struct LDKCResult_NonePaymentSendFailureZ {
1684 union LDKCResult_NonePaymentSendFailureZPtr contents;
1686 } LDKCResult_NonePaymentSendFailureZ;
1688 typedef struct LDKFourBytes {
1692 typedef struct LDKSixteenBytes {
1696 typedef struct LDKTenBytes {
1701 * An address which can be used to connect to a remote peer
1703 typedef enum LDKNetAddress_Tag {
1705 * An IPv4 address/port on which the peer is listening.
1709 * An IPv6 address/port on which the peer is listening.
1713 * An old-style Tor onion address/port on which the peer is listening.
1715 LDKNetAddress_OnionV2,
1717 * A new-style Tor onion address/port on which the peer is listening.
1718 * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
1719 * wrap as base32 and append \".onion\".
1721 LDKNetAddress_OnionV3,
1723 * Must be last for serialization purposes
1725 LDKNetAddress_Sentinel,
1726 } LDKNetAddress_Tag;
1728 typedef struct LDKNetAddress_LDKIPv4_Body {
1729 struct LDKFourBytes addr;
1731 } LDKNetAddress_LDKIPv4_Body;
1733 typedef struct LDKNetAddress_LDKIPv6_Body {
1734 struct LDKSixteenBytes addr;
1736 } LDKNetAddress_LDKIPv6_Body;
1738 typedef struct LDKNetAddress_LDKOnionV2_Body {
1739 struct LDKTenBytes addr;
1741 } LDKNetAddress_LDKOnionV2_Body;
1743 typedef struct LDKNetAddress_LDKOnionV3_Body {
1744 struct LDKThirtyTwoBytes ed25519_pubkey;
1748 } LDKNetAddress_LDKOnionV3_Body;
1750 typedef struct MUST_USE_STRUCT LDKNetAddress {
1751 LDKNetAddress_Tag tag;
1753 LDKNetAddress_LDKIPv4_Body i_pv4;
1754 LDKNetAddress_LDKIPv6_Body i_pv6;
1755 LDKNetAddress_LDKOnionV2_Body onion_v2;
1756 LDKNetAddress_LDKOnionV3_Body onion_v3;
1760 typedef struct LDKCVec_NetAddressZ {
1761 struct LDKNetAddress *data;
1763 } LDKCVec_NetAddressZ;
1765 typedef struct LDKCVec_ChannelMonitorZ {
1766 struct LDKChannelMonitor *data;
1768 } LDKCVec_ChannelMonitorZ;
1771 * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
1772 * blocks are connected and disconnected.
1774 * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
1775 * responsible for maintaining a set of monitors such that they can be updated accordingly as
1776 * channel state changes and HTLCs are resolved. See method documentation for specific
1779 * Implementations **must** ensure that updates are successfully applied and persisted upon method
1780 * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
1781 * without taking any further action such as persisting the current state.
1783 * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
1784 * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
1785 * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
1786 * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
1787 * multiple instances.
1789 * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
1790 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1791 * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
1793 typedef struct LDKWatch {
1796 * Watches a channel identified by `funding_txo` using `monitor`.
1798 * Implementations are responsible for watching the chain for the funding transaction along
1799 * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
1800 * calling [`block_connected`] and [`block_disconnected`] on the monitor.
1802 * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
1803 * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
1804 * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
1806 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
1808 * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
1810 * Implementations must call [`update_monitor`] with the given update. See
1811 * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
1813 * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
1814 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1816 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
1818 * Returns any monitor events since the last call. Subsequent calls must only return new
1821 struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
1822 void (*free)(void *this_arg);
1826 * An interface to send a transaction to the Bitcoin network.
1828 typedef struct LDKBroadcasterInterface {
1831 * Sends a transaction out to (hopefully) be mined.
1833 void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
1834 void (*free)(void *this_arg);
1835 } LDKBroadcasterInterface;
1837 typedef struct LDKSecretKey {
1841 typedef struct LDKu8slice {
1842 const uint8_t *data;
1847 * A trait to describe an object which can get user secrets and key material.
1849 typedef struct LDKKeysInterface {
1852 * Get node secret key (aka node_id or network_key)
1854 struct LDKSecretKey (*get_node_secret)(const void *this_arg);
1856 * Get destination redeemScript to encumber static protocol exit points.
1858 struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
1860 * Get shutdown_pubkey to use as PublicKey at channel closure
1862 struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
1864 * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
1865 * restarted with some stale data!
1867 struct LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
1869 * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
1870 * onion packets and for temporary channel IDs. There is no requirement that these be
1871 * persisted anywhere, though they must be unique across restarts.
1873 struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
1875 * Reads a `ChanKeySigner` for this `KeysInterface` from the given input stream.
1876 * This is only called during deserialization of other objects which contain
1877 * `ChannelKeys`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
1878 * The bytes are exactly those which `<Self::ChanKeySigner as Writeable>::write()` writes, and
1879 * contain no versioning scheme. You may wish to include your own version prefix and ensure
1880 * you've read all of the provided bytes to ensure no corruption occurred.
1882 struct LDKCResult_ChanKeySignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
1883 void (*free)(void *this_arg);
1887 * A trait which should be implemented to provide feerate information on a number of time
1890 * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
1891 * called from inside the library in response to chain events, P2P events, or timer events).
1893 typedef struct LDKFeeEstimator {
1896 * Gets estimated satoshis of fee required per 1000 Weight-Units.
1898 * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
1899 * don't put us below 1 satoshi-per-byte).
1901 * This translates to:
1902 * * satoshis-per-byte * 250
1903 * * ceil(satoshis-per-kbyte / 4)
1905 uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
1906 void (*free)(void *this_arg);
1910 * A trait encapsulating the operations required of a logger
1912 typedef struct LDKLogger {
1917 void (*log)(const void *this_arg, const char *record);
1918 void (*free)(void *this_arg);
1924 * Manager which keeps track of a number of channels and sends messages to the appropriate
1925 * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
1927 * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
1928 * to individual Channels.
1930 * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
1931 * all peers during write/read (though does not modify this instance, only the instance being
1932 * serialized). This will result in any channels which have not yet exchanged funding_created (ie
1933 * called funding_transaction_generated for outbound channels).
1935 * Note that you can be a bit lazier about writing out ChannelManager than you can be with
1936 * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
1937 * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
1938 * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
1939 * the serialization process). If the deserialized version is out-of-date compared to the
1940 * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
1941 * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
1943 * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which
1944 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
1945 * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
1946 * block_connected() to step towards your best block) upon deserialization before using the
1949 * Note that ChannelManager is responsible for tracking liveness of its channels and generating
1950 * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
1951 * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
1952 * offline for a full minute. In order to track this, you must call
1953 * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect.
1955 * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
1956 * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
1957 * essentially you should default to using a SimpleRefChannelManager, and use a
1958 * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
1959 * you're using lightning-net-tokio.
1961 typedef struct MUST_USE_STRUCT LDKChannelManager {
1963 * Nearly everywhere, inner must be non-null, however in places where
1964 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1966 LDKnativeChannelManager *inner;
1968 } LDKChannelManager;
1970 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
1971 struct LDKThirtyTwoBytes a;
1972 struct LDKChannelManager b;
1973 } LDKC2Tuple_BlockHashChannelManagerZ;
1975 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
1976 struct LDKC2Tuple_BlockHashChannelManagerZ *result;
1977 struct LDKDecodeError *err;
1978 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
1980 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1981 union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
1983 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
1985 typedef union LDKCResult_NetAddressu8ZPtr {
1986 struct LDKNetAddress *result;
1988 } LDKCResult_NetAddressu8ZPtr;
1990 typedef struct LDKCResult_NetAddressu8Z {
1991 union LDKCResult_NetAddressu8ZPtr contents;
1993 } LDKCResult_NetAddressu8Z;
1995 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1996 struct LDKCResult_NetAddressu8Z *result;
1997 struct LDKDecodeError *err;
1998 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
2000 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
2001 union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
2003 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
2005 typedef struct LDKCVec_u64Z {
2013 * An update_add_htlc message to be sent or received from a peer
2015 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
2017 * Nearly everywhere, inner must be non-null, however in places where
2018 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2020 LDKnativeUpdateAddHTLC *inner;
2024 typedef struct LDKCVec_UpdateAddHTLCZ {
2025 struct LDKUpdateAddHTLC *data;
2027 } LDKCVec_UpdateAddHTLCZ;
2032 * An update_fulfill_htlc message to be sent or received from a peer
2034 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
2036 * Nearly everywhere, inner must be non-null, however in places where
2037 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2039 LDKnativeUpdateFulfillHTLC *inner;
2041 } LDKUpdateFulfillHTLC;
2043 typedef struct LDKCVec_UpdateFulfillHTLCZ {
2044 struct LDKUpdateFulfillHTLC *data;
2046 } LDKCVec_UpdateFulfillHTLCZ;
2051 * An update_fail_htlc message to be sent or received from a peer
2053 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
2055 * Nearly everywhere, inner must be non-null, however in places where
2056 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2058 LDKnativeUpdateFailHTLC *inner;
2060 } LDKUpdateFailHTLC;
2062 typedef struct LDKCVec_UpdateFailHTLCZ {
2063 struct LDKUpdateFailHTLC *data;
2065 } LDKCVec_UpdateFailHTLCZ;
2070 * An update_fail_malformed_htlc message to be sent or received from a peer
2072 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
2074 * Nearly everywhere, inner must be non-null, however in places where
2075 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2077 LDKnativeUpdateFailMalformedHTLC *inner;
2079 } LDKUpdateFailMalformedHTLC;
2081 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
2082 struct LDKUpdateFailMalformedHTLC *data;
2084 } LDKCVec_UpdateFailMalformedHTLCZ;
2089 * An Err type for failure to process messages.
2091 typedef struct MUST_USE_STRUCT LDKLightningError {
2093 * Nearly everywhere, inner must be non-null, however in places where
2094 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2096 LDKnativeLightningError *inner;
2098 } LDKLightningError;
2100 typedef union LDKCResult_boolLightningErrorZPtr {
2102 struct LDKLightningError *err;
2103 } LDKCResult_boolLightningErrorZPtr;
2105 typedef struct LDKCResult_boolLightningErrorZ {
2106 union LDKCResult_boolLightningErrorZPtr contents;
2108 } LDKCResult_boolLightningErrorZ;
2110 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2111 struct LDKChannelAnnouncement a;
2112 struct LDKChannelUpdate b;
2113 struct LDKChannelUpdate c;
2114 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
2116 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2117 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
2119 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
2121 typedef struct LDKCVec_NodeAnnouncementZ {
2122 struct LDKNodeAnnouncement *data;
2124 } LDKCVec_NodeAnnouncementZ;
2126 typedef union LDKCResult_NoneLightningErrorZPtr {
2128 * Note that this value is always NULL, as there are no contents in the OK variant
2131 struct LDKLightningError *err;
2132 } LDKCResult_NoneLightningErrorZPtr;
2134 typedef struct LDKCResult_NoneLightningErrorZ {
2135 union LDKCResult_NoneLightningErrorZPtr contents;
2137 } LDKCResult_NoneLightningErrorZ;
2139 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
2140 struct LDKChannelReestablish *result;
2141 struct LDKDecodeError *err;
2142 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
2144 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
2145 union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
2147 } LDKCResult_ChannelReestablishDecodeErrorZ;
2152 * An init message to be sent or received from a peer
2154 typedef struct MUST_USE_STRUCT LDKInit {
2156 * Nearly everywhere, inner must be non-null, however in places where
2157 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2159 LDKnativeInit *inner;
2163 typedef union LDKCResult_InitDecodeErrorZPtr {
2164 struct LDKInit *result;
2165 struct LDKDecodeError *err;
2166 } LDKCResult_InitDecodeErrorZPtr;
2168 typedef struct LDKCResult_InitDecodeErrorZ {
2169 union LDKCResult_InitDecodeErrorZPtr contents;
2171 } LDKCResult_InitDecodeErrorZ;
2176 * A ping message to be sent or received from a peer
2178 typedef struct MUST_USE_STRUCT LDKPing {
2180 * Nearly everywhere, inner must be non-null, however in places where
2181 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2183 LDKnativePing *inner;
2187 typedef union LDKCResult_PingDecodeErrorZPtr {
2188 struct LDKPing *result;
2189 struct LDKDecodeError *err;
2190 } LDKCResult_PingDecodeErrorZPtr;
2192 typedef struct LDKCResult_PingDecodeErrorZ {
2193 union LDKCResult_PingDecodeErrorZPtr contents;
2195 } LDKCResult_PingDecodeErrorZ;
2200 * A pong message to be sent or received from a peer
2202 typedef struct MUST_USE_STRUCT LDKPong {
2204 * Nearly everywhere, inner must be non-null, however in places where
2205 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2207 LDKnativePong *inner;
2211 typedef union LDKCResult_PongDecodeErrorZPtr {
2212 struct LDKPong *result;
2213 struct LDKDecodeError *err;
2214 } LDKCResult_PongDecodeErrorZPtr;
2216 typedef struct LDKCResult_PongDecodeErrorZ {
2217 union LDKCResult_PongDecodeErrorZPtr contents;
2219 } LDKCResult_PongDecodeErrorZ;
2221 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
2222 struct LDKUnsignedChannelAnnouncement *result;
2223 struct LDKDecodeError *err;
2224 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
2226 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
2227 union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
2229 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
2234 * The unsigned part of a channel_update
2236 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
2238 * Nearly everywhere, inner must be non-null, however in places where
2239 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2241 LDKnativeUnsignedChannelUpdate *inner;
2243 } LDKUnsignedChannelUpdate;
2245 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
2246 struct LDKUnsignedChannelUpdate *result;
2247 struct LDKDecodeError *err;
2248 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
2250 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
2251 union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
2253 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
2255 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
2256 struct LDKErrorMessage *result;
2257 struct LDKDecodeError *err;
2258 } LDKCResult_ErrorMessageDecodeErrorZPtr;
2260 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
2261 union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
2263 } LDKCResult_ErrorMessageDecodeErrorZ;
2268 * The unsigned part of a node_announcement
2270 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
2272 * Nearly everywhere, inner must be non-null, however in places where
2273 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2275 LDKnativeUnsignedNodeAnnouncement *inner;
2277 } LDKUnsignedNodeAnnouncement;
2279 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
2280 struct LDKUnsignedNodeAnnouncement *result;
2281 struct LDKDecodeError *err;
2282 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
2284 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
2285 union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
2287 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
2289 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
2290 struct LDKQueryShortChannelIds *result;
2291 struct LDKDecodeError *err;
2292 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
2294 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
2295 union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
2297 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
2302 * A reply_short_channel_ids_end message is sent as a reply to a
2303 * query_short_channel_ids message. The query recipient makes a best
2304 * effort to respond based on their local network view which may not be
2305 * a perfect view of the network.
2307 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
2309 * Nearly everywhere, inner must be non-null, however in places where
2310 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2312 LDKnativeReplyShortChannelIdsEnd *inner;
2314 } LDKReplyShortChannelIdsEnd;
2316 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
2317 struct LDKReplyShortChannelIdsEnd *result;
2318 struct LDKDecodeError *err;
2319 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
2321 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
2322 union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
2324 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
2326 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
2327 struct LDKQueryChannelRange *result;
2328 struct LDKDecodeError *err;
2329 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
2331 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
2332 union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
2334 } LDKCResult_QueryChannelRangeDecodeErrorZ;
2339 * A reply_channel_range message is a reply to a query_channel_range
2340 * message. Multiple reply_channel_range messages can be sent in reply
2341 * to a single query_channel_range message. The query recipient makes a
2342 * best effort to respond based on their local network view which may
2343 * not be a perfect view of the network. The short_channel_ids in the
2344 * reply are encoded. We only support encoding_type=0 uncompressed
2345 * serialization and do not support encoding_type=1 zlib serialization.
2347 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2349 * Nearly everywhere, inner must be non-null, however in places where
2350 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2352 LDKnativeReplyChannelRange *inner;
2354 } LDKReplyChannelRange;
2356 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
2357 struct LDKReplyChannelRange *result;
2358 struct LDKDecodeError *err;
2359 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
2361 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
2362 union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
2364 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
2369 * A gossip_timestamp_filter message is used by a node to request
2370 * gossip relay for messages in the requested time range when the
2371 * gossip_queries feature has been negotiated.
2373 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
2375 * Nearly everywhere, inner must be non-null, however in places where
2376 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2378 LDKnativeGossipTimestampFilter *inner;
2380 } LDKGossipTimestampFilter;
2382 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
2383 struct LDKGossipTimestampFilter *result;
2384 struct LDKDecodeError *err;
2385 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
2387 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
2388 union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
2390 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
2392 typedef struct LDKCVec_PublicKeyZ {
2393 struct LDKPublicKey *data;
2395 } LDKCVec_PublicKeyZ;
2400 * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
2401 * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
2404 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
2406 * Nearly everywhere, inner must be non-null, however in places where
2407 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2409 LDKnativePeerHandleError *inner;
2411 } LDKPeerHandleError;
2413 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
2414 struct LDKCVec_u8Z *result;
2415 struct LDKPeerHandleError *err;
2416 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
2418 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
2419 union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
2421 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
2423 typedef union LDKCResult_NonePeerHandleErrorZPtr {
2425 * Note that this value is always NULL, as there are no contents in the OK variant
2428 struct LDKPeerHandleError *err;
2429 } LDKCResult_NonePeerHandleErrorZPtr;
2431 typedef struct LDKCResult_NonePeerHandleErrorZ {
2432 union LDKCResult_NonePeerHandleErrorZPtr contents;
2434 } LDKCResult_NonePeerHandleErrorZ;
2436 typedef union LDKCResult_boolPeerHandleErrorZPtr {
2438 struct LDKPeerHandleError *err;
2439 } LDKCResult_boolPeerHandleErrorZPtr;
2441 typedef struct LDKCResult_boolPeerHandleErrorZ {
2442 union LDKCResult_boolPeerHandleErrorZPtr contents;
2444 } LDKCResult_boolPeerHandleErrorZ;
2446 typedef union LDKCResult_SecretKeySecpErrorZPtr {
2447 struct LDKSecretKey *result;
2448 enum LDKSecp256k1Error *err;
2449 } LDKCResult_SecretKeySecpErrorZPtr;
2451 typedef struct LDKCResult_SecretKeySecpErrorZ {
2452 union LDKCResult_SecretKeySecpErrorZPtr contents;
2454 } LDKCResult_SecretKeySecpErrorZ;
2456 typedef union LDKCResult_PublicKeySecpErrorZPtr {
2457 struct LDKPublicKey *result;
2458 enum LDKSecp256k1Error *err;
2459 } LDKCResult_PublicKeySecpErrorZPtr;
2461 typedef struct LDKCResult_PublicKeySecpErrorZ {
2462 union LDKCResult_PublicKeySecpErrorZPtr contents;
2464 } LDKCResult_PublicKeySecpErrorZ;
2469 * The set of public keys which are used in the creation of one commitment transaction.
2470 * These are derived from the channel base keys and per-commitment data.
2472 * A broadcaster key is provided from potential broadcaster of the computed transaction.
2473 * A countersignatory key is coming from a protocol participant unable to broadcast the
2476 * These keys are assumed to be good, either because the code derived them from
2477 * channel basepoints via the new function, or they were obtained via
2478 * CommitmentTransaction.trust().keys() because we trusted the source of the
2479 * pre-calculated keys.
2481 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
2483 * Nearly everywhere, inner must be non-null, however in places where
2484 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2486 LDKnativeTxCreationKeys *inner;
2488 } LDKTxCreationKeys;
2490 typedef union LDKCResult_TxCreationKeysSecpErrorZPtr {
2491 struct LDKTxCreationKeys *result;
2492 enum LDKSecp256k1Error *err;
2493 } LDKCResult_TxCreationKeysSecpErrorZPtr;
2495 typedef struct LDKCResult_TxCreationKeysSecpErrorZ {
2496 union LDKCResult_TxCreationKeysSecpErrorZPtr contents;
2498 } LDKCResult_TxCreationKeysSecpErrorZ;
2503 * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
2504 * transaction and the transaction creation keys) are trusted.
2506 * See trust() and verify() functions on CommitmentTransaction.
2508 * This structure implements Deref.
2510 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
2512 * Nearly everywhere, inner must be non-null, however in places where
2513 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2515 LDKnativeTrustedCommitmentTransaction *inner;
2517 } LDKTrustedCommitmentTransaction;
2519 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
2520 struct LDKTrustedCommitmentTransaction *result;
2522 * Note that this value is always NULL, as there are no contents in the Err variant
2525 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
2527 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
2528 union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
2530 } LDKCResult_TrustedCommitmentTransactionNoneZ;
2532 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
2533 struct LDKCVec_SignatureZ *result;
2535 * Note that this value is always NULL, as there are no contents in the Err variant
2538 } LDKCResult_CVec_SignatureZNoneZPtr;
2540 typedef struct LDKCResult_CVec_SignatureZNoneZ {
2541 union LDKCResult_CVec_SignatureZNoneZPtr contents;
2543 } LDKCResult_CVec_SignatureZNoneZ;
2550 typedef struct MUST_USE_STRUCT LDKRouteHop {
2552 * Nearly everywhere, inner must be non-null, however in places where
2553 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2555 LDKnativeRouteHop *inner;
2559 typedef struct LDKCVec_RouteHopZ {
2560 struct LDKRouteHop *data;
2562 } LDKCVec_RouteHopZ;
2564 typedef struct LDKCVec_CVec_RouteHopZZ {
2565 struct LDKCVec_RouteHopZ *data;
2567 } LDKCVec_CVec_RouteHopZZ;
2572 * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2573 * it can take multiple paths. Each path is composed of one or more hops through the network.
2575 typedef struct MUST_USE_STRUCT LDKRoute {
2577 * Nearly everywhere, inner must be non-null, however in places where
2578 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2580 LDKnativeRoute *inner;
2584 typedef union LDKCResult_RouteDecodeErrorZPtr {
2585 struct LDKRoute *result;
2586 struct LDKDecodeError *err;
2587 } LDKCResult_RouteDecodeErrorZPtr;
2589 typedef struct LDKCResult_RouteDecodeErrorZ {
2590 union LDKCResult_RouteDecodeErrorZPtr contents;
2592 } LDKCResult_RouteDecodeErrorZ;
2597 * A channel descriptor which provides a last-hop route to get_route
2599 typedef struct MUST_USE_STRUCT LDKRouteHint {
2601 * Nearly everywhere, inner must be non-null, however in places where
2602 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2604 LDKnativeRouteHint *inner;
2608 typedef struct LDKCVec_RouteHintZ {
2609 struct LDKRouteHint *data;
2611 } LDKCVec_RouteHintZ;
2613 typedef union LDKCResult_RouteLightningErrorZPtr {
2614 struct LDKRoute *result;
2615 struct LDKLightningError *err;
2616 } LDKCResult_RouteLightningErrorZPtr;
2618 typedef struct LDKCResult_RouteLightningErrorZ {
2619 union LDKCResult_RouteLightningErrorZPtr contents;
2621 } LDKCResult_RouteLightningErrorZ;
2626 * Fees for routing via a given channel or a node
2628 typedef struct MUST_USE_STRUCT LDKRoutingFees {
2630 * Nearly everywhere, inner must be non-null, however in places where
2631 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2633 LDKnativeRoutingFees *inner;
2637 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
2638 struct LDKRoutingFees *result;
2639 struct LDKDecodeError *err;
2640 } LDKCResult_RoutingFeesDecodeErrorZPtr;
2642 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
2643 union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
2645 } LDKCResult_RoutingFeesDecodeErrorZ;
2650 * Information received in the latest node_announcement from this node.
2652 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
2654 * Nearly everywhere, inner must be non-null, however in places where
2655 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2657 LDKnativeNodeAnnouncementInfo *inner;
2659 } LDKNodeAnnouncementInfo;
2661 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
2662 struct LDKNodeAnnouncementInfo *result;
2663 struct LDKDecodeError *err;
2664 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
2666 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
2667 union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
2669 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
2674 * Details about a node in the network, known from the network announcement.
2676 typedef struct MUST_USE_STRUCT LDKNodeInfo {
2678 * Nearly everywhere, inner must be non-null, however in places where
2679 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2681 LDKnativeNodeInfo *inner;
2685 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
2686 struct LDKNodeInfo *result;
2687 struct LDKDecodeError *err;
2688 } LDKCResult_NodeInfoDecodeErrorZPtr;
2690 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
2691 union LDKCResult_NodeInfoDecodeErrorZPtr contents;
2693 } LDKCResult_NodeInfoDecodeErrorZ;
2698 * Represents the network as nodes and channels between them
2700 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
2702 * Nearly everywhere, inner must be non-null, however in places where
2703 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2705 LDKnativeNetworkGraph *inner;
2709 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
2710 struct LDKNetworkGraph *result;
2711 struct LDKDecodeError *err;
2712 } LDKCResult_NetworkGraphDecodeErrorZPtr;
2714 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
2715 union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
2717 } LDKCResult_NetworkGraphDecodeErrorZ;
2720 * A trait indicating an object may generate message send events
2722 typedef struct LDKMessageSendEventsProvider {
2725 * Gets the list of pending events which were generated by previous actions, clearing the list
2728 struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
2729 void (*free)(void *this_arg);
2730 } LDKMessageSendEventsProvider;
2733 * A trait indicating an object may generate events
2735 typedef struct LDKEventsProvider {
2738 * Gets the list of pending events which were generated by previous actions, clearing the list
2741 struct LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
2742 void (*free)(void *this_arg);
2743 } LDKEventsProvider;
2748 * Configuration we set when applicable.
2750 * Default::default() provides sane defaults.
2752 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
2754 * Nearly everywhere, inner must be non-null, however in places where
2755 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2757 LDKnativeChannelHandshakeConfig *inner;
2759 } LDKChannelHandshakeConfig;
2764 * Optional channel limits which are applied during channel creation.
2766 * These limits are only applied to our counterparty's limits, not our own.
2768 * Use 0/<type>::max_value() as appropriate to skip checking.
2770 * Provides sane defaults for most configurations.
2772 * Most additional limits are disabled except those with which specify a default in individual
2773 * field documentation. Note that this may result in barely-usable channels, but since they
2774 * are applied mostly only to incoming channels that's not much of a problem.
2776 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
2778 * Nearly everywhere, inner must be non-null, however in places where
2779 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2781 LDKnativeChannelHandshakeLimits *inner;
2783 } LDKChannelHandshakeLimits;
2788 * Options which apply on a per-channel basis and may change at runtime or based on negotiation
2789 * with our counterparty.
2791 typedef struct MUST_USE_STRUCT LDKChannelConfig {
2793 * Nearly everywhere, inner must be non-null, however in places where
2794 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2796 LDKnativeChannelConfig *inner;
2803 * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
2805 * Default::default() provides sane defaults for most configurations
2806 * (but currently with 0 relay fees!)
2808 typedef struct MUST_USE_STRUCT LDKUserConfig {
2810 * Nearly everywhere, inner must be non-null, however in places where
2811 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2813 LDKnativeUserConfig *inner;
2818 * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
2821 typedef struct LDKAccess {
2824 * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
2825 * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
2828 * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
2830 struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
2831 void (*free)(void *this_arg);
2835 * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
2838 * This is useful in order to have a [`Watch`] implementation convey to a chain source which
2839 * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
2840 * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
2841 * receiving full blocks from a chain source, any further filtering is unnecessary.
2843 * After an output has been registered, subsequent block retrievals from the chain source must not
2844 * exclude any transactions matching the new criteria nor any in-block descendants of such
2847 * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
2848 * should not block on I/O. Implementations should instead queue the newly monitored data to be
2849 * processed later. Then, in order to block until the data has been processed, any `Watch`
2850 * invocation that has called the `Filter` must return [`TemporaryFailure`].
2852 * [`Watch`]: trait.Watch.html
2853 * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure
2854 * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
2855 * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
2857 typedef struct LDKFilter {
2860 * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
2861 * a spending condition.
2863 void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
2865 * Registers interest in spends of a transaction output identified by `outpoint` having
2866 * `script_pubkey` as the spending condition.
2868 void (*register_output)(const void *this_arg, const struct LDKOutPoint *NONNULL_PTR outpoint, struct LDKu8slice script_pubkey);
2869 void (*free)(void *this_arg);
2873 * `Persist` defines behavior for persisting channel monitors: this could mean
2874 * writing once to disk, and/or uploading to one or more backup services.
2876 * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
2877 * to disk/backups. And, on every update, you **must** persist either the
2878 * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
2879 * of situations such as revoking a transaction, then crashing before this
2880 * revocation can be persisted, then unintentionally broadcasting a revoked
2881 * transaction and losing money. This is a risk because previous channel states
2882 * are toxic, so it's important that whatever channel state is persisted is
2885 typedef struct LDKPersist {
2888 * Persist a new channel's data. The data can be stored any way you want, but
2889 * the identifier provided by Rust-Lightning is the channel's outpoint (and
2890 * it is up to you to maintain a correct mapping between the outpoint and the
2891 * stored channel data). Note that you **must** persist every new monitor to
2892 * disk. See the `Persist` trait documentation for more details.
2894 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
2895 * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
2897 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
2898 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
2900 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
2902 * Update one channel's data. The provided `ChannelMonitor` has already
2903 * applied the given update.
2905 * Note that on every update, you **must** persist either the
2906 * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
2907 * the `Persist` trait documentation for more details.
2909 * If an implementer chooses to persist the updates only, they need to make
2910 * sure that all the updates are applied to the `ChannelMonitors` *before*
2911 * the set of channel monitors is given to the `ChannelManager`
2912 * deserialization routine. See [`ChannelMonitor::update_monitor`] for
2913 * applying a monitor update to a monitor. If full `ChannelMonitors` are
2914 * persisted, then there is no need to persist individual updates.
2916 * Note that there could be a performance tradeoff between persisting complete
2917 * channel monitors on every update vs. persisting only updates and applying
2918 * them in batches. The size of each monitor grows `O(number of state updates)`
2919 * whereas updates are small and `O(1)`.
2921 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
2922 * [`ChannelMonitorUpdate::write`] for writing out an update, and
2923 * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
2925 * [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1
2926 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
2927 * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write
2928 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
2930 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data);
2931 void (*free)(void *this_arg);
2937 * An implementation of [`chain::Watch`] for monitoring channels.
2939 * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
2940 * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
2941 * or used independently to monitor channels remotely. See the [module-level documentation] for
2944 * [`chain::Watch`]: ../trait.Watch.html
2945 * [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html
2946 * [module-level documentation]: index.html
2948 typedef struct MUST_USE_STRUCT LDKChainMonitor {
2950 * Nearly everywhere, inner must be non-null, however in places where
2951 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2953 LDKnativeChainMonitor *inner;
2960 * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2961 * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2962 * preimage claim backward will lead to loss of funds.
2964 * [`chain::Watch`]: ../trait.Watch.html
2966 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2968 * Nearly everywhere, inner must be non-null, however in places where
2969 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2971 LDKnativeHTLCUpdate *inner;
2978 * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
2979 * and derives keys from that.
2981 * Your node_id is seed/0'
2982 * ChannelMonitor closes may use seed/1'
2983 * Cooperative closes may use seed/2'
2984 * The two close keys may be needed to claim on-chain funds!
2986 typedef struct MUST_USE_STRUCT LDKKeysManager {
2988 * Nearly everywhere, inner must be non-null, however in places where
2989 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2991 LDKnativeKeysManager *inner;
2998 * Features used within an `init` message.
3000 typedef struct MUST_USE_STRUCT LDKInitFeatures {
3002 * Nearly everywhere, inner must be non-null, however in places where
3003 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3005 LDKnativeInitFeatures *inner;
3009 typedef struct LDKThreeBytes {
3016 * A commitment_signed message to be sent or received from a peer
3018 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
3020 * Nearly everywhere, inner must be non-null, however in places where
3021 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3023 LDKnativeCommitmentSigned *inner;
3025 } LDKCommitmentSigned;
3030 * An update_fee message to be sent or received from a peer
3032 typedef struct MUST_USE_STRUCT LDKUpdateFee {
3034 * Nearly everywhere, inner must be non-null, however in places where
3035 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3037 LDKnativeUpdateFee *inner;
3042 * A trait to describe an object which can receive channel messages.
3044 * Messages MAY be called in parallel when they originate from different their_node_ids, however
3045 * they MUST NOT be called in parallel when the two calls have the same their_node_id.
3047 typedef struct LDKChannelMessageHandler {
3050 * Handle an incoming open_channel message from the given peer.
3052 void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
3054 * Handle an incoming accept_channel message from the given peer.
3056 void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
3058 * Handle an incoming funding_created message from the given peer.
3060 void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
3062 * Handle an incoming funding_signed message from the given peer.
3064 void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
3066 * Handle an incoming funding_locked message from the given peer.
3068 void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
3070 * Handle an incoming shutdown message from the given peer.
3072 void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg);
3074 * Handle an incoming closing_signed message from the given peer.
3076 void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
3078 * Handle an incoming update_add_htlc message from the given peer.
3080 void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
3082 * Handle an incoming update_fulfill_htlc message from the given peer.
3084 void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
3086 * Handle an incoming update_fail_htlc message from the given peer.
3088 void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
3090 * Handle an incoming update_fail_malformed_htlc message from the given peer.
3092 void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
3094 * Handle an incoming commitment_signed message from the given peer.
3096 void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
3098 * Handle an incoming revoke_and_ack message from the given peer.
3100 void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
3102 * Handle an incoming update_fee message from the given peer.
3104 void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
3106 * Handle an incoming announcement_signatures message from the given peer.
3108 void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
3110 * Indicates a connection to the peer failed/an existing connection was lost. If no connection
3111 * is believed to be possible in the future (eg they're sending us messages we don't
3112 * understand or indicate they require unknown feature bits), no_connection_possible is set
3113 * and any outstanding channels should be failed.
3115 void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
3117 * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
3119 void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
3121 * Handle an incoming channel_reestablish message from the given peer.
3123 void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
3125 * Handle an incoming error message from the given peer.
3127 void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
3128 struct LDKMessageSendEventsProvider MessageSendEventsProvider;
3129 void (*free)(void *this_arg);
3130 } LDKChannelMessageHandler;
3135 * Arguments for the creation of a ChannelManager that are not deserialized.
3137 * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
3139 * 1) Deserialize all stored ChannelMonitors.
3140 * 2) Deserialize the ChannelManager by filling in this struct and calling <(Sha256dHash,
3141 * ChannelManager)>::read(reader, args).
3142 * This may result in closing some Channels if the ChannelMonitor is newer than the stored
3143 * ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
3144 * 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
3145 * ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo().
3146 * 4) Reconnect blocks on your ChannelMonitors.
3147 * 5) Move the ChannelMonitors into your local chain::Watch.
3148 * 6) Disconnect/connect blocks on the ChannelManager.
3150 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
3152 * Nearly everywhere, inner must be non-null, however in places where
3153 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3155 LDKnativeChannelManagerReadArgs *inner;
3157 } LDKChannelManagerReadArgs;
3162 * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
3163 * This is used to convince the recipient that the channel is at a certain commitment
3164 * number even if they lost that data due to a local failure. Of course, the peer may lie
3165 * and even later commitments may have been revoked.
3167 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
3169 * Nearly everywhere, inner must be non-null, however in places where
3170 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3172 LDKnativeDataLossProtect *inner;
3174 } LDKDataLossProtect;
3179 * Features used within a `node_announcement` message.
3181 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
3183 * Nearly everywhere, inner must be non-null, however in places where
3184 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3186 LDKnativeNodeFeatures *inner;
3193 * Features used within a `channel_announcement` message.
3195 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
3197 * Nearly everywhere, inner must be non-null, however in places where
3198 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3200 LDKnativeChannelFeatures *inner;
3202 } LDKChannelFeatures;
3205 * A trait to describe an object which can receive routing messages.
3207 * # Implementor DoS Warnings
3209 * For `gossip_queries` messages there are potential DoS vectors when handling
3210 * inbound queries. Implementors using an on-disk network graph should be aware of
3211 * repeated disk I/O for queries accessing different parts of the network graph.
3213 typedef struct LDKRoutingMessageHandler {
3216 * Handle an incoming node_announcement message, returning true if it should be forwarded on,
3217 * false or returning an Err otherwise.
3219 struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
3221 * Handle a channel_announcement message, returning true if it should be forwarded on, false
3222 * or returning an Err otherwise.
3224 struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
3226 * Handle an incoming channel_update message, returning true if it should be forwarded on,
3227 * false or returning an Err otherwise.
3229 struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
3231 * Handle some updates to the route graph that we learned due to an outbound failed payment.
3233 void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
3235 * Gets a subset of the channel announcements and updates required to dump our routing table
3236 * to a remote node, starting at the short_channel_id indicated by starting_point and
3237 * including the batch_amount entries immediately higher in numerical value than starting_point.
3239 struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
3241 * Gets a subset of the node announcements required to dump our routing table to a remote node,
3242 * starting at the node *after* the provided publickey and including batch_amount entries
3243 * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
3244 * If None is provided for starting_point, we start at the first node.
3246 struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
3248 * Called when a connection is established with a peer. This can be used to
3249 * perform routing table synchronization using a strategy defined by the
3252 void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
3254 * Handles the reply of a query we initiated to learn about channels
3255 * for a given range of blocks. We can expect to receive one or more
3256 * replies to a single query.
3258 struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
3260 * Handles the reply of a query we initiated asking for routing gossip
3261 * messages for a list of channels. We should receive this message when
3262 * a node has completed its best effort to send us the pertaining routing
3265 struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
3267 * Handles when a peer asks us to send a list of short_channel_ids
3268 * for the requested range of blocks.
3270 struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
3272 * Handles when a peer asks us to send routing gossip messages for a
3273 * list of short_channel_ids.
3275 struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
3276 struct LDKMessageSendEventsProvider MessageSendEventsProvider;
3277 void (*free)(void *this_arg);
3278 } LDKRoutingMessageHandler;
3283 * Provides references to trait impls which handle different types of messages.
3285 typedef struct MUST_USE_STRUCT LDKMessageHandler {
3287 * Nearly everywhere, inner must be non-null, however in places where
3288 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3290 LDKnativeMessageHandler *inner;
3292 } LDKMessageHandler;
3295 * Provides an object which can be used to send data to and which uniquely identifies a connection
3296 * to a remote host. You will need to be able to generate multiple of these which meet Eq and
3297 * implement Hash to meet the PeerManager API.
3299 * For efficiency, Clone should be relatively cheap for this type.
3301 * You probably want to just extend an int and put a file descriptor in a struct and implement
3302 * send_data. Note that if you are using a higher-level net library that may call close() itself,
3303 * be careful to ensure you don't have races whereby you might register a new connection with an
3304 * fd which is the same as a previous one which has yet to be removed via
3305 * PeerManager::socket_disconnected().
3307 typedef struct LDKSocketDescriptor {
3310 * Attempts to send some data from the given slice to the peer.
3312 * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
3313 * Note that in the disconnected case, socket_disconnected must still fire and further write
3314 * attempts may occur until that time.
3316 * If the returned size is smaller than data.len(), a write_available event must
3317 * trigger the next time more data can be written. Additionally, until the a send_data event
3318 * completes fully, no further read_events should trigger on the same peer!
3320 * If a read_event on this descriptor had previously returned true (indicating that read
3321 * events should be paused to prevent DoS in the send buffer), resume_read may be set
3322 * indicating that read events on this descriptor should resume. A resume_read of false does
3323 * *not* imply that further read events should be paused.
3325 uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
3327 * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
3328 * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
3329 * this descriptor. No socket_disconnected call should be generated as a result of this call,
3330 * though races may occur whereby disconnect_socket is called after a call to
3331 * socket_disconnected but prior to socket_disconnected returning.
3333 void (*disconnect_socket)(void *this_arg);
3334 bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
3335 uint64_t (*hash)(const void *this_arg);
3336 void *(*clone)(const void *this_arg);
3337 void (*free)(void *this_arg);
3338 } LDKSocketDescriptor;
3343 * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
3344 * events into messages which it passes on to its MessageHandlers.
3346 * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
3347 * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
3348 * essentially you should default to using a SimpleRefPeerManager, and use a
3349 * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
3350 * you're using lightning-net-tokio.
3352 typedef struct MUST_USE_STRUCT LDKPeerManager {
3354 * Nearly everywhere, inner must be non-null, however in places where
3355 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3357 LDKnativePeerManager *inner;
3364 * Late-bound per-channel counterparty data used to build transactions.
3366 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
3368 * Nearly everywhere, inner must be non-null, however in places where
3369 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3371 LDKnativeCounterpartyChannelTransactionParameters *inner;
3373 } LDKCounterpartyChannelTransactionParameters;
3378 * Static channel fields used to build transactions given per-commitment fields, organized by
3379 * broadcaster/countersignatory.
3381 * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
3382 * as_holder_broadcastable and as_counterparty_broadcastable functions.
3384 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
3386 * Nearly everywhere, inner must be non-null, however in places where
3387 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3389 LDKnativeDirectedChannelTransactionParameters *inner;
3391 } LDKDirectedChannelTransactionParameters;
3396 * A pre-built Bitcoin commitment transaction and its txid.
3398 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
3400 * Nearly everywhere, inner must be non-null, however in places where
3401 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3403 LDKnativeBuiltCommitmentTransaction *inner;
3405 } LDKBuiltCommitmentTransaction;
3410 * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
3411 * This exists only to make accessing a RwLock<NetworkGraph> possible from
3412 * the C bindings, as it can be done directly in Rust code.
3414 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
3416 * Nearly everywhere, inner must be non-null, however in places where
3417 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3419 LDKnativeLockedNetworkGraph *inner;
3421 } LDKLockedNetworkGraph;
3426 * Receives and validates network updates from peers,
3427 * stores authentic and relevant data as a network graph.
3428 * This network graph is then used for routing payments.
3429 * Provides interface to help with initial routing sync by
3430 * serving historical announcements.
3432 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
3434 * Nearly everywhere, inner must be non-null, however in places where
3435 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3437 LDKnativeNetGraphMsgHandler *inner;
3439 } LDKNetGraphMsgHandler;
3444 * Details about one direction of a channel. Received
3445 * within a channel update.
3447 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
3449 * Nearly everywhere, inner must be non-null, however in places where
3450 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3452 LDKnativeDirectionalChannelInfo *inner;
3454 } LDKDirectionalChannelInfo;
3459 * Details about a channel (both directions).
3460 * Received within a channel announcement.
3462 typedef struct MUST_USE_STRUCT LDKChannelInfo {
3464 * Nearly everywhere, inner must be non-null, however in places where
3465 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3467 LDKnativeChannelInfo *inner;
3471 extern const uintptr_t MAX_BUF_SIZE;
3473 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
3475 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
3477 void Transaction_free(struct LDKTransaction _res);
3479 void TxOut_free(struct LDKTxOut _res);
3481 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
3483 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
3485 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
3487 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
3489 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
3491 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
3493 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
3495 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
3497 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
3499 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
3501 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
3503 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
3505 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
3507 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
3509 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
3511 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
3513 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
3515 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
3517 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
3519 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
3521 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
3523 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
3525 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
3527 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
3529 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
3531 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
3533 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
3535 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
3537 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
3539 void CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res);
3541 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
3543 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
3545 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
3547 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
3549 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
3551 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig);
3553 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
3555 void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res);
3557 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
3559 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
3561 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
3563 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
3565 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
3567 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
3569 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
3571 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
3573 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
3575 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
3577 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
3579 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
3581 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
3583 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
3585 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
3587 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
3589 struct LDKCResult_ChanKeySignerDecodeErrorZ CResult_ChanKeySignerDecodeErrorZ_ok(struct LDKChannelKeys o);
3591 struct LDKCResult_ChanKeySignerDecodeErrorZ CResult_ChanKeySignerDecodeErrorZ_err(struct LDKDecodeError e);
3593 void CResult_ChanKeySignerDecodeErrorZ_free(struct LDKCResult_ChanKeySignerDecodeErrorZ _res);
3595 struct LDKCResult_ChanKeySignerDecodeErrorZ CResult_ChanKeySignerDecodeErrorZ_clone(const struct LDKCResult_ChanKeySignerDecodeErrorZ *NONNULL_PTR orig);
3597 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_ok(struct LDKInMemoryChannelKeys o);
3599 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_err(struct LDKDecodeError e);
3601 void CResult_InMemoryChannelKeysDecodeErrorZ_free(struct LDKCResult_InMemoryChannelKeysDecodeErrorZ _res);
3603 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_clone(const struct LDKCResult_InMemoryChannelKeysDecodeErrorZ *NONNULL_PTR orig);
3605 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
3607 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
3609 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
3611 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
3613 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
3615 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
3617 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
3619 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
3621 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
3623 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
3625 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
3627 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
3629 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
3631 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
3633 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
3635 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
3637 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
3639 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
3641 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
3643 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
3645 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
3647 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
3649 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
3651 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
3653 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
3655 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
3657 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
3659 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
3661 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
3663 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
3665 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
3667 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
3669 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
3671 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
3673 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
3675 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
3677 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
3679 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
3681 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
3683 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
3685 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
3687 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
3689 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
3691 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
3693 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
3695 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
3697 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
3699 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
3701 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
3703 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
3705 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
3707 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
3709 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
3711 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
3713 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
3715 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
3717 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
3719 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
3721 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
3723 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
3725 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
3727 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
3729 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
3731 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
3733 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
3735 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
3737 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
3739 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
3741 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
3743 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
3745 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
3747 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
3749 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
3751 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
3753 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
3755 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
3757 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
3759 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
3761 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
3763 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
3765 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
3767 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
3769 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
3771 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
3773 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
3775 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
3777 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
3779 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
3781 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
3783 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
3785 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
3787 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
3789 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
3791 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
3793 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
3795 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
3797 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
3799 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
3801 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
3803 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
3805 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
3807 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
3809 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
3811 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
3813 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
3815 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
3817 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
3819 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
3821 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
3823 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
3825 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
3827 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
3829 struct LDKCResult_SecretKeySecpErrorZ CResult_SecretKeySecpErrorZ_ok(struct LDKSecretKey o);
3831 struct LDKCResult_SecretKeySecpErrorZ CResult_SecretKeySecpErrorZ_err(enum LDKSecp256k1Error e);
3833 void CResult_SecretKeySecpErrorZ_free(struct LDKCResult_SecretKeySecpErrorZ _res);
3835 struct LDKCResult_PublicKeySecpErrorZ CResult_PublicKeySecpErrorZ_ok(struct LDKPublicKey o);
3837 struct LDKCResult_PublicKeySecpErrorZ CResult_PublicKeySecpErrorZ_err(enum LDKSecp256k1Error e);
3839 void CResult_PublicKeySecpErrorZ_free(struct LDKCResult_PublicKeySecpErrorZ _res);
3841 struct LDKCResult_TxCreationKeysSecpErrorZ CResult_TxCreationKeysSecpErrorZ_ok(struct LDKTxCreationKeys o);
3843 struct LDKCResult_TxCreationKeysSecpErrorZ CResult_TxCreationKeysSecpErrorZ_err(enum LDKSecp256k1Error e);
3845 void CResult_TxCreationKeysSecpErrorZ_free(struct LDKCResult_TxCreationKeysSecpErrorZ _res);
3847 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
3849 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
3851 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
3853 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
3855 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
3857 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
3859 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
3861 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
3863 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
3865 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
3867 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
3869 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
3871 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
3873 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
3875 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
3877 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
3879 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
3881 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
3883 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
3885 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
3887 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
3889 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
3891 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
3893 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
3895 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
3897 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
3899 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
3901 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
3903 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
3905 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
3907 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
3909 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
3911 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
3913 void Event_free(struct LDKEvent this_ptr);
3915 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
3917 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
3919 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
3921 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
3924 * Calls the free function if one is set
3926 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
3929 * Calls the free function if one is set
3931 void EventsProvider_free(struct LDKEventsProvider this_ptr);
3933 void APIError_free(struct LDKAPIError this_ptr);
3935 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
3937 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
3940 * Returns the most verbose logging level.
3942 MUST_USE_RES enum LDKLevel Level_max(void);
3945 * Calls the free function if one is set
3947 void Logger_free(struct LDKLogger this_ptr);
3949 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_ptr);
3951 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
3954 * Confirmations we will wait for before considering the channel locked in.
3955 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3956 * equivalent limit applied to outbound channels).
3960 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
3963 * Confirmations we will wait for before considering the channel locked in.
3964 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3965 * equivalent limit applied to outbound channels).
3969 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
3972 * Set to the amount of time we require our counterparty to wait to claim their money.
3974 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3975 * be online to check for peer having broadcast a revoked transaction to steal our funds
3976 * at least once every our_to_self_delay blocks.
3978 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3979 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3982 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3983 * opening so you can tweak config to ask for more security, not less.
3985 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
3988 * Set to the amount of time we require our counterparty to wait to claim their money.
3990 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3991 * be online to check for peer having broadcast a revoked transaction to steal our funds
3992 * at least once every our_to_self_delay blocks.
3994 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3995 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3998 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3999 * opening so you can tweak config to ask for more security, not less.
4001 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
4004 * Set to the smallest value HTLC we will accept to process.
4006 * This value is sent to our counterparty on channel-open and we close the channel any time
4007 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
4009 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
4012 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
4015 * Set to the smallest value HTLC we will accept to process.
4017 * This value is sent to our counterparty on channel-open and we close the channel any time
4018 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
4020 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
4023 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
4025 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg);
4027 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
4029 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_ptr);
4031 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
4034 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
4035 * only applies to inbound channels.
4039 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4042 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
4043 * only applies to inbound channels.
4047 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4050 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
4051 * you to limit the maximum minimum-size they can require.
4053 * Default value: u64::max_value.
4055 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4058 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
4059 * you to limit the maximum minimum-size they can require.
4061 * Default value: u64::max_value.
4063 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4066 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
4067 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
4071 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4074 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
4075 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
4079 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4082 * The remote node will require we keep a certain amount in direct payment to ourselves at all
4083 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
4084 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
4086 * Default value: u64::max_value.
4088 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4091 * The remote node will require we keep a certain amount in direct payment to ourselves at all
4092 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
4093 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
4095 * Default value: u64::max_value.
4097 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4100 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
4101 * time. This allows you to set a minimum such value.
4105 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4108 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
4109 * time. This allows you to set a minimum such value.
4113 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
4116 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
4117 * required to always be higher than this value so this only applies to HTLC outputs (and
4118 * potentially to-self outputs before any payments have been made).
4119 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4120 * This setting allows you to set a minimum dust limit for their commitment transactions,
4121 * reflecting the reality that tiny outputs are not considered standard transactions and will
4122 * not propagate through the Bitcoin network.
4124 * Default value: 546, the current dust limit on the Bitcoin network.
4126 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4129 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
4130 * required to always be higher than this value so this only applies to HTLC outputs (and
4131 * potentially to-self outputs before any payments have been made).
4132 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4133 * This setting allows you to set a minimum dust limit for their commitment transactions,
4134 * reflecting the reality that tiny outputs are not considered standard transactions and will
4135 * not propagate through the Bitcoin network.
4137 * Default value: 546, the current dust limit on the Bitcoin network.
4139 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4142 * Maximum allowed threshold above which outputs will not be generated in their commitment
4144 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4146 * Default value: u64::max_value.
4148 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4151 * Maximum allowed threshold above which outputs will not be generated in their commitment
4153 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4155 * Default value: u64::max_value.
4157 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4160 * Before a channel is usable the funding transaction will need to be confirmed by at least a
4161 * certain number of blocks, specified by the node which is not the funder (as the funder can
4162 * assume they aren't going to double-spend themselves).
4163 * This config allows you to set a limit on the maximum amount of time to wait.
4165 * Default value: 144, or roughly one day and only applies to outbound channels.
4167 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4170 * Before a channel is usable the funding transaction will need to be confirmed by at least a
4171 * certain number of blocks, specified by the node which is not the funder (as the funder can
4172 * assume they aren't going to double-spend themselves).
4173 * This config allows you to set a limit on the maximum amount of time to wait.
4175 * Default value: 144, or roughly one day and only applies to outbound channels.
4177 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
4180 * Set to force the incoming channel to match our announced channel preference in
4183 * Default value: true, to make the default that no announced channels are possible (which is
4184 * appropriate for any nodes which are not online very reliably).
4186 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4189 * Set to force the incoming channel to match our announced channel preference in
4192 * Default value: true, to make the default that no announced channels are possible (which is
4193 * appropriate for any nodes which are not online very reliably).
4195 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
4198 * Set to the amount of time we're willing to wait to claim money back to us.
4200 * Not checking this value would be a security issue, as our peer would be able to set it to
4201 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
4203 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
4204 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
4206 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4209 * Set to the amount of time we're willing to wait to claim money back to us.
4211 * Not checking this value would be a security issue, as our peer would be able to set it to
4212 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
4214 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
4215 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
4217 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
4219 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint64_t min_dust_limit_satoshis_arg, uint64_t max_dust_limit_satoshis_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
4221 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
4223 void ChannelConfig_free(struct LDKChannelConfig this_ptr);
4225 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
4228 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
4229 * This may be allowed to change at runtime in a later update, however doing so must result in
4230 * update messages sent to notify all nodes of our updated relay fee.
4234 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4237 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
4238 * This may be allowed to change at runtime in a later update, however doing so must result in
4239 * update messages sent to notify all nodes of our updated relay fee.
4243 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
4246 * Set to announce the channel publicly and notify all nodes that they can route via this
4249 * This should only be set to true for nodes which expect to be online reliably.
4251 * As the node which funds a channel picks this value this will only apply for new outbound
4252 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
4254 * This cannot be changed after the initial channel handshake.
4256 * Default value: false.
4258 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4261 * Set to announce the channel publicly and notify all nodes that they can route via this
4264 * This should only be set to true for nodes which expect to be online reliably.
4266 * As the node which funds a channel picks this value this will only apply for new outbound
4267 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
4269 * This cannot be changed after the initial channel handshake.
4271 * Default value: false.
4273 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
4276 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
4277 * supports it, they will then enforce the mutual-close output to us matches what we provided
4278 * at intialization, preventing us from closing to an alternate pubkey.
4280 * This is set to true by default to provide a slight increase in security, though ultimately
4281 * any attacker who is able to take control of a channel can just as easily send the funds via
4282 * lightning payments, so we never require that our counterparties support this option.
4284 * This cannot be changed after a channel has been initialized.
4286 * Default value: true.
4288 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4291 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
4292 * supports it, they will then enforce the mutual-close output to us matches what we provided
4293 * at intialization, preventing us from closing to an alternate pubkey.
4295 * This is set to true by default to provide a slight increase in security, though ultimately
4296 * any attacker who is able to take control of a channel can just as easily send the funds via
4297 * lightning payments, so we never require that our counterparties support this option.
4299 * This cannot be changed after a channel has been initialized.
4301 * Default value: true.
4303 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
4305 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
4307 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
4309 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
4311 struct LDKChannelConfig ChannelConfig_read(struct LDKu8slice ser);
4313 void UserConfig_free(struct LDKUserConfig this_ptr);
4315 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
4318 * Channel config that we propose to our counterparty.
4320 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4323 * Channel config that we propose to our counterparty.
4325 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
4328 * Limits applied to our counterparty's proposed channel config settings.
4330 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4333 * Limits applied to our counterparty's proposed channel config settings.
4335 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
4338 * Channel config which affects behavior during channel lifetime.
4340 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4343 * Channel config which affects behavior during channel lifetime.
4345 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
4347 MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg);
4349 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
4351 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
4354 * Calls the free function if one is set
4356 void Access_free(struct LDKAccess this_ptr);
4359 * Calls the free function if one is set
4361 void Watch_free(struct LDKWatch this_ptr);
4364 * Calls the free function if one is set
4366 void Filter_free(struct LDKFilter this_ptr);
4369 * Calls the free function if one is set
4371 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
4373 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
4376 * Calls the free function if one is set
4378 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
4380 void ChainMonitor_free(struct LDKChainMonitor this_ptr);
4383 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
4384 * of a channel and reacting accordingly based on transactions in the connected block. See
4385 * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
4386 * be returned by [`chain::Watch::release_pending_monitor_events`].
4388 * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
4389 * calls must not exclude any transactions matching the new outputs nor any in-block
4390 * descendants of such transactions. It is not necessary to re-fetch the block to obtain
4393 * [`ChannelMonitor::block_connected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_connected
4394 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
4395 * [`chain::Filter`]: ../trait.Filter.html
4397 void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
4400 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
4401 * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
4404 * [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
4406 void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
4409 * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
4411 * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
4412 * will call back to it indicating transactions and outputs of interest. This allows clients to
4413 * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
4414 * always need to fetch full blocks absent another means for determining which blocks contain
4415 * transactions relevant to the watched channels.
4417 * [`chain::Filter`]: ../trait.Filter.html
4419 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
4421 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
4423 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
4425 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_ptr);
4427 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
4430 * The sequence number of this update. Updates *must* be replayed in-order according to this
4431 * sequence number (and updates may panic if they are not). The update_id values are strictly
4432 * increasing and increase by one for each new update, with one exception specified below.
4434 * This sequence number is also used to track up to which points updates which returned
4435 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4436 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4438 * The only instance where update_id values are not strictly increasing is the case where we
4439 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
4440 * its docs for more details.
4442 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
4444 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
4447 * The sequence number of this update. Updates *must* be replayed in-order according to this
4448 * sequence number (and updates may panic if they are not). The update_id values are strictly
4449 * increasing and increase by one for each new update, with one exception specified below.
4451 * This sequence number is also used to track up to which points updates which returned
4452 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4453 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4455 * The only instance where update_id values are not strictly increasing is the case where we
4456 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
4457 * its docs for more details.
4459 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
4461 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
4463 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
4465 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
4467 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
4469 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_ptr);
4471 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
4473 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
4475 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
4477 void HTLCUpdate_free(struct LDKHTLCUpdate this_ptr);
4479 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
4481 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
4483 struct LDKHTLCUpdate HTLCUpdate_read(struct LDKu8slice ser);
4485 void ChannelMonitor_free(struct LDKChannelMonitor this_ptr);
4487 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
4490 * Updates a ChannelMonitor on the basis of some new information provided by the Channel
4493 * panics if the given update is not the next update by update_id.
4495 MUST_USE_RES struct LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
4498 * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
4501 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
4504 * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
4506 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
4509 * Get the list of HTLCs who's status has been updated on chain. This should be called by
4510 * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
4512 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
4514 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
4517 * Gets the list of pending events which were generated by previous actions, clearing the list
4520 * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
4521 * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
4522 * no internal locking in ChannelMonitors.
4524 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
4527 * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
4528 * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
4529 * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
4530 * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
4531 * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
4532 * broadcast them if counterparty don't close channel with his higher commitment transaction after a
4533 * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
4534 * out-of-band the other node operator to coordinate with him if option is available to you.
4535 * In any-case, choice is up to the user.
4537 MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger);
4540 * Processes transactions in a newly connected block, which may result in any of the following:
4541 * - update the monitor's state against resolved HTLCs
4542 * - punish the counterparty in the case of seeing a revoked commitment transaction
4543 * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
4544 * - detect settled outputs for later spending
4545 * - schedule and bump any in-flight claims
4547 * Returns any new outputs to watch from `txdata`; after called, these are also included in
4548 * [`get_outputs_to_watch`].
4550 * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
4552 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ChannelMonitor_block_connected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
4555 * Determines if the disconnected block contained any transactions of interest and updates
4558 void ChannelMonitor_block_disconnected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
4561 * Calls the free function if one is set
4563 void Persist_free(struct LDKPersist this_ptr);
4565 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
4567 void OutPoint_free(struct LDKOutPoint this_ptr);
4569 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
4572 * The referenced transaction's txid.
4574 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
4577 * The referenced transaction's txid.
4579 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4582 * The index of the referenced output in its transaction's vout.
4584 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
4587 * The index of the referenced output in its transaction's vout.
4589 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
4591 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
4594 * Convert an `OutPoint` to a lightning channel id.
4596 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
4598 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
4600 struct LDKOutPoint OutPoint_read(struct LDKu8slice ser);
4602 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
4604 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
4606 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
4608 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
4610 struct LDKChannelKeys ChannelKeys_clone(const struct LDKChannelKeys *NONNULL_PTR orig);
4613 * Calls the free function if one is set
4615 void ChannelKeys_free(struct LDKChannelKeys this_ptr);
4618 * Calls the free function if one is set
4620 void KeysInterface_free(struct LDKKeysInterface this_ptr);
4622 void InMemoryChannelKeys_free(struct LDKInMemoryChannelKeys this_ptr);
4624 struct LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const struct LDKInMemoryChannelKeys *NONNULL_PTR orig);
4627 * Private key of anchor tx
4629 const uint8_t (*InMemoryChannelKeys_get_funding_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4632 * Private key of anchor tx
4634 void InMemoryChannelKeys_set_funding_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4637 * Holder secret key for blinded revocation pubkey
4639 const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4642 * Holder secret key for blinded revocation pubkey
4644 void InMemoryChannelKeys_set_revocation_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4647 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4649 const uint8_t (*InMemoryChannelKeys_get_payment_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4652 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4654 void InMemoryChannelKeys_set_payment_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4657 * Holder secret key used in HTLC tx
4659 const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4662 * Holder secret key used in HTLC tx
4664 void InMemoryChannelKeys_set_delayed_payment_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4667 * Holder htlc secret key used in commitment tx htlc outputs
4669 const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4672 * Holder htlc secret key used in commitment tx htlc outputs
4674 void InMemoryChannelKeys_set_htlc_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4679 const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4684 void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4687 * Create a new InMemoryChannelKeys
4689 MUST_USE_RES struct LDKInMemoryChannelKeys InMemoryChannelKeys_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKC2Tuple_u64u64Z key_derivation_params);
4692 * Counterparty pubkeys.
4693 * Will panic if ready_channel wasn't called.
4695 MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4698 * The contest_delay value specified by our counterparty and applied on holder-broadcastable
4699 * transactions, ie the amount of time that we have to wait to recover our funds if we
4700 * broadcast a transaction.
4701 * Will panic if ready_channel wasn't called.
4703 MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4706 * The contest_delay value specified by us and applied on transactions broadcastable
4707 * by our counterparty, ie the amount of time that they have to wait to recover their funds
4708 * if they broadcast a transaction.
4709 * Will panic if ready_channel wasn't called.
4711 MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4714 * Whether the holder is the initiator
4715 * Will panic if ready_channel wasn't called.
4717 MUST_USE_RES bool InMemoryChannelKeys_is_outbound(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4721 * Will panic if ready_channel wasn't called.
4723 MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4726 * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
4727 * building transactions.
4729 * Will panic if ready_channel wasn't called.
4731 MUST_USE_RES struct LDKChannelTransactionParameters InMemoryChannelKeys_get_channel_parameters(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4733 struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4735 struct LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj);
4737 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ InMemoryChannelKeys_read(struct LDKu8slice ser);
4739 void KeysManager_free(struct LDKKeysManager this_ptr);
4742 * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
4743 * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
4744 * starting_time isn't strictly required to actually be a time, but it must absolutely,
4745 * without a doubt, be unique to this instance. ie if you start multiple times with the same
4746 * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
4747 * simply use the current time (with very high precision).
4749 * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
4750 * obviously, starting_time should be unique every time you reload the library - it is only
4751 * used to generate new ephemeral key data (which will be stored by the individual channel if
4754 * Note that the seed is required to recover certain on-chain funds independent of
4755 * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
4756 * channel, and some on-chain during-closing funds.
4758 * Note that until the 0.1 release there is no guarantee of backward compatibility between
4759 * versions. Once the library is more fully supported, the docs will be updated to include a
4760 * detailed description of the guarantee.
4762 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], enum LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos);
4765 * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation
4767 * Key derivation parameters are accessible through a per-channel secrets
4768 * ChannelKeys::key_derivation_params and is provided inside DynamicOuputP2WSH in case of
4769 * onchain output detection for which a corresponding delayed_payment_key must be derived.
4771 MUST_USE_RES struct LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, uint64_t params_1, uint64_t params_2);
4773 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
4775 void ChannelManager_free(struct LDKChannelManager this_ptr);
4777 void ChannelDetails_free(struct LDKChannelDetails this_ptr);
4779 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
4782 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4783 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4784 * Note that this means this value is *not* persistent - it can change once during the
4785 * lifetime of the channel.
4787 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
4790 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4791 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4792 * Note that this means this value is *not* persistent - it can change once during the
4793 * lifetime of the channel.
4795 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4798 * The node_id of our counterparty
4800 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4803 * The node_id of our counterparty
4805 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
4808 * The Features the channel counterparty provided upon last connection.
4809 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4810 * many routing-relevant features are present in the init context.
4812 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4815 * The Features the channel counterparty provided upon last connection.
4816 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4817 * many routing-relevant features are present in the init context.
4819 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
4822 * The value, in satoshis, of this channel as appears in the funding output
4824 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4827 * The value, in satoshis, of this channel as appears in the funding output
4829 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4832 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4834 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4837 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4839 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4842 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4843 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4844 * available for inclusion in new outbound HTLCs). This further does not include any pending
4845 * outgoing HTLCs which are awaiting some other resolution to be sent.
4847 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4850 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4851 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4852 * available for inclusion in new outbound HTLCs). This further does not include any pending
4853 * outgoing HTLCs which are awaiting some other resolution to be sent.
4855 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4858 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4859 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4860 * available for inclusion in new inbound HTLCs).
4861 * Note that there are some corner cases not fully handled here, so the actual available
4862 * inbound capacity may be slightly higher than this.
4864 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4867 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4868 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4869 * available for inclusion in new inbound HTLCs).
4870 * Note that there are some corner cases not fully handled here, so the actual available
4871 * inbound capacity may be slightly higher than this.
4873 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4876 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4877 * the peer is connected, and (c) no monitor update failure is pending resolution.
4879 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4882 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4883 * the peer is connected, and (c) no monitor update failure is pending resolution.
4885 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
4887 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
4889 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
4892 * Constructs a new ChannelManager to hold several channels and route between them.
4894 * This is the main \"logic hub\" for all channel-related actions, and implements
4895 * ChannelMessageHandler.
4897 * Non-proportional fees are fixed according to our risk using the provided fee estimator.
4899 * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
4901 * Users must provide the current blockchain height from which to track onchain channel
4902 * funding outpoints and send payments with reliable timelocks.
4904 * Users need to notify the new ChannelManager when a new block is connected or
4905 * disconnected using its `block_connected` and `block_disconnected` methods.
4907 MUST_USE_RES struct LDKChannelManager ChannelManager_new(enum LDKNetwork network, struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, uintptr_t current_blockchain_height);
4910 * Creates a new outbound channel to the given remote node and with the given value.
4912 * user_id will be provided back as user_channel_id in FundingGenerationReady and
4913 * FundingBroadcastSafe events to allow tracking of which events correspond with which
4914 * create_channel call. Note that user_channel_id defaults to 0 for inbound channels, so you
4915 * may wish to avoid using 0 for user_id here.
4917 * If successful, will generate a SendOpenChannel message event, so you should probably poll
4918 * PeerManager::process_events afterwards.
4920 * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
4921 * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
4923 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, struct LDKUserConfig override_config);
4926 * Gets the list of open channels, in random order. See ChannelDetail field documentation for
4929 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4932 * Gets the list of usable channels, in random order. Useful as an argument to
4933 * get_route to ensure non-announced channels are used.
4935 * These are guaranteed to have their is_live value set to true, see the documentation for
4936 * ChannelDetails::is_live for more info on exactly what the criteria are.
4938 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4941 * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
4942 * will be accepted on the given channel, and after additional timeout/the closing of all
4943 * pending HTLCs, the channel will be closed on chain.
4945 * May generate a SendShutdown message event on success, which should be relayed.
4947 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
4950 * Force closes a channel, immediately broadcasting the latest local commitment transaction to
4951 * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
4953 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
4956 * Force close all channels, immediately broadcasting the latest local commitment transaction
4957 * for each to the chain and rejecting new HTLCs on each.
4959 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4962 * Sends a payment along a given route.
4964 * Value parameters are provided via the last hop in route, see documentation for RouteHop
4965 * fields for more info.
4967 * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
4968 * payment), we don't do anything to stop you! We always try to ensure that if the provided
4969 * next hop knows the preimage to payment_hash they can claim an additional amount as
4970 * specified in the last hop in the route! Thus, you should probably do your own
4971 * payment_preimage tracking (which you should already be doing as they represent \"proof of
4972 * payment\") and prevent double-sends yourself.
4974 * May generate SendHTLCs message(s) event on success, which should be relayed.
4976 * Each path may have a different return value, and PaymentSendValue may return a Vec with
4977 * each entry matching the corresponding-index entry in the route paths, see
4978 * PaymentSendFailure for more info.
4980 * In general, a path may raise:
4981 * * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
4982 * node public key) is specified.
4983 * * APIError::ChannelUnavailable if the next-hop channel is not available for updates
4984 * (including due to previous monitor update failure or new permanent monitor update
4986 * * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
4989 * Note that depending on the type of the PaymentSendFailure the HTLC may have been
4990 * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
4991 * different route unless you intend to pay twice!
4993 * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
4994 * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
4995 * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
4996 * must not contain multiple paths as multi-path payments require a recipient-provided
4998 * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
4999 * bit set (either as required or as available). If multiple paths are present in the Route,
5000 * we assume the invoice had the basic_mpp feature set.
5002 MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
5005 * Call this upon creation of a funding transaction for the given channel.
5007 * Note that ALL inputs in the transaction pointed to by funding_txo MUST spend SegWit outputs
5008 * or your counterparty can steal your funds!
5010 * Panics if a funding transaction has already been provided for this channel.
5012 * May panic if the funding_txo is duplicative with some other channel (note that this should
5013 * be trivially prevented by using unique funding transaction keys per-channel).
5015 void ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKOutPoint funding_txo);
5018 * Generates a signed node_announcement from the given arguments and creates a
5019 * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
5020 * seen a channel_announcement from us (ie unless we have public channels open).
5022 * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
5023 * to humans. They carry no in-protocol meaning.
5025 * addresses represent the set (possibly empty) of socket addresses on which this node accepts
5026 * incoming connections. These will be broadcast to the network, publicly tying these
5027 * addresses together. If you wish to preserve user privacy, addresses should likely contain
5028 * only Tor Onion addresses.
5030 * Panics if addresses is absurdly large (more than 500).
5032 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
5035 * Processes HTLCs which are pending waiting on random forward delay.
5037 * Should only really ever be called in response to a PendingHTLCsForwardable event.
5038 * Will likely generate further events.
5040 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
5043 * If a peer is disconnected we mark any channels with that peer as 'disabled'.
5044 * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
5045 * to inform the network about the uselessness of these channels.
5047 * This method handles all the details, and must be called roughly once per minute.
5049 void ChannelManager_timer_chan_freshness_every_min(const struct LDKChannelManager *NONNULL_PTR this_arg);
5052 * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
5053 * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
5054 * along the path (including in our own channel on which we received it).
5055 * Returns false if no payment was found to fail backwards, true if the process of failing the
5056 * HTLC backwards has been started.
5058 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKThirtyTwoBytes payment_secret);
5061 * Provides a payment preimage in response to a PaymentReceived event, returning true and
5062 * generating message events for the net layer to claim the payment, if possible. Thus, you
5063 * should probably kick the net layer to go send messages if this returns true!
5065 * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
5066 * available within a few percent of the expected amount. This is critical for several
5067 * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
5068 * payment_preimage without having provided the full value and b) it avoids certain
5069 * privacy-breaking recipient-probing attacks which may reveal payment activity to
5070 * motivated attackers.
5072 * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
5073 * set. Thus, for such payments we will claim any payments which do not under-pay.
5075 * May panic if called except in response to a PaymentReceived event.
5077 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t expected_amount);
5080 * Gets the node_id held by this ChannelManager
5082 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
5085 * Restores a single, given channel to normal operation after a
5086 * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
5089 * All ChannelMonitor updates up to and including highest_applied_update_id must have been
5090 * fully committed in every copy of the given channels' ChannelMonitors.
5092 * Note that there is no effect to calling with a highest_applied_update_id other than the
5093 * current latest ChannelMonitorUpdate and one call to this function after multiple
5094 * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
5095 * exists largely only to prevent races between this and concurrent update_monitor calls.
5097 * Thus, the anticipated use is, at a high level:
5098 * 1) You register a chain::Watch with this ChannelManager,
5099 * 2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
5100 * said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
5101 * any time it cannot do so instantly,
5102 * 3) update(s) are applied to each remote copy of a ChannelMonitor,
5103 * 4) once all remote copies are updated, you call this function with the update_id that
5104 * completed, and once it is the latest the Channel will be re-enabled.
5106 void ChannelManager_channel_monitor_updated(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOutPoint *NONNULL_PTR funding_txo, uint64_t highest_applied_update_id);
5108 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
5110 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
5113 * Updates channel state based on transactions seen in a connected block.
5115 void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
5118 * Updates channel state based on a disconnected block.
5120 * If necessary, the channel may be force-closed without letting the counterparty participate
5123 void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]);
5125 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
5127 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
5129 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_ptr);
5132 * The keys provider which will give us relevant keys. Some keys will be loaded during
5133 * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
5136 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5139 * The keys provider which will give us relevant keys. Some keys will be loaded during
5140 * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
5143 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
5146 * The fee_estimator for use in the ChannelManager in the future.
5148 * No calls to the FeeEstimator will be made during deserialization.
5150 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5153 * The fee_estimator for use in the ChannelManager in the future.
5155 * No calls to the FeeEstimator will be made during deserialization.
5157 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
5160 * The chain::Watch for use in the ChannelManager in the future.
5162 * No calls to the chain::Watch will be made during deserialization. It is assumed that
5163 * you have deserialized ChannelMonitors separately and will add them to your
5164 * chain::Watch after deserializing this ChannelManager.
5166 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5169 * The chain::Watch for use in the ChannelManager in the future.
5171 * No calls to the chain::Watch will be made during deserialization. It is assumed that
5172 * you have deserialized ChannelMonitors separately and will add them to your
5173 * chain::Watch after deserializing this ChannelManager.
5175 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
5178 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
5179 * used to broadcast the latest local commitment transactions of channels which must be
5180 * force-closed during deserialization.
5182 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5185 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
5186 * used to broadcast the latest local commitment transactions of channels which must be
5187 * force-closed during deserialization.
5189 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
5192 * The Logger for use in the ChannelManager and which may be used to log information during
5195 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5198 * The Logger for use in the ChannelManager and which may be used to log information during
5201 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
5204 * Default settings used for new channels. Any existing channels will continue to use the
5205 * runtime settings which were stored when the ChannelManager was serialized.
5207 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5210 * Default settings used for new channels. Any existing channels will continue to use the
5211 * runtime settings which were stored when the ChannelManager was serialized.
5213 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
5216 * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
5217 * HashMap for you. This is primarily useful for C bindings where it is not practical to
5218 * populate a HashMap directly from C.
5220 MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors);
5222 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
5224 void DecodeError_free(struct LDKDecodeError this_ptr);
5226 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
5228 void Init_free(struct LDKInit this_ptr);
5230 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
5232 void ErrorMessage_free(struct LDKErrorMessage this_ptr);
5234 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
5237 * The channel ID involved in the error
5239 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
5242 * The channel ID involved in the error
5244 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5247 * A possibly human-readable error description.
5248 * The string should be sanitized before it is used (e.g. emitted to logs
5249 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
5250 * vulnerability in the terminal emulator or the logging subsystem.
5252 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
5255 * A possibly human-readable error description.
5256 * The string should be sanitized before it is used (e.g. emitted to logs
5257 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
5258 * vulnerability in the terminal emulator or the logging subsystem.
5260 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
5262 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg);
5264 void Ping_free(struct LDKPing this_ptr);
5266 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
5269 * The desired response length
5271 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
5274 * The desired response length
5276 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
5279 * The ping packet size.
5280 * This field is not sent on the wire. byteslen zeros are sent.
5282 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
5285 * The ping packet size.
5286 * This field is not sent on the wire. byteslen zeros are sent.
5288 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
5290 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
5292 void Pong_free(struct LDKPong this_ptr);
5294 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
5297 * The pong packet size.
5298 * This field is not sent on the wire. byteslen zeros are sent.
5300 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
5303 * The pong packet size.
5304 * This field is not sent on the wire. byteslen zeros are sent.
5306 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
5308 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
5310 void OpenChannel_free(struct LDKOpenChannel this_ptr);
5312 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
5315 * The genesis hash of the blockchain where the channel is to be opened
5317 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
5320 * The genesis hash of the blockchain where the channel is to be opened
5322 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5325 * A temporary channel ID, until the funding outpoint is announced
5327 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
5330 * A temporary channel ID, until the funding outpoint is announced
5332 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5337 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5342 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5345 * The amount to push to the counterparty as part of the open, in milli-satoshi
5347 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5350 * The amount to push to the counterparty as part of the open, in milli-satoshi
5352 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5355 * The threshold below which outputs on transactions broadcast by sender will be omitted
5357 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5360 * The threshold below which outputs on transactions broadcast by sender will be omitted
5362 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5365 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5367 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5370 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5372 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5375 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5377 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5380 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5382 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5385 * The minimum HTLC size incoming to sender, in milli-satoshi
5387 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5390 * The minimum HTLC size incoming to sender, in milli-satoshi
5392 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5395 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
5397 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5400 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
5402 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
5405 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5407 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5410 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5412 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
5415 * The maximum number of inbound HTLCs towards sender
5417 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5420 * The maximum number of inbound HTLCs towards sender
5422 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
5425 * The sender's key controlling the funding transaction
5427 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5430 * The sender's key controlling the funding transaction
5432 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5435 * Used to derive a revocation key for transactions broadcast by counterparty
5437 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5440 * Used to derive a revocation key for transactions broadcast by counterparty
5442 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5445 * A payment key to sender for transactions broadcast by counterparty
5447 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5450 * A payment key to sender for transactions broadcast by counterparty
5452 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5455 * Used to derive a payment key to sender for transactions broadcast by sender
5457 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5460 * Used to derive a payment key to sender for transactions broadcast by sender
5462 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5465 * Used to derive an HTLC payment key to sender
5467 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5470 * Used to derive an HTLC payment key to sender
5472 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5475 * The first to-be-broadcast-by-sender transaction's per commitment point
5477 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5480 * The first to-be-broadcast-by-sender transaction's per commitment point
5482 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5487 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5492 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
5494 void AcceptChannel_free(struct LDKAcceptChannel this_ptr);
5496 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
5499 * A temporary channel ID, until the funding outpoint is announced
5501 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
5504 * A temporary channel ID, until the funding outpoint is announced
5506 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5509 * The threshold below which outputs on transactions broadcast by sender will be omitted
5511 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5514 * The threshold below which outputs on transactions broadcast by sender will be omitted
5516 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5519 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5521 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5524 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5526 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5529 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5531 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5534 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5536 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5539 * The minimum HTLC size incoming to sender, in milli-satoshi
5541 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5544 * The minimum HTLC size incoming to sender, in milli-satoshi
5546 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5549 * Minimum depth of the funding transaction before the channel is considered open
5551 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5554 * Minimum depth of the funding transaction before the channel is considered open
5556 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
5559 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5561 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5564 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5566 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
5569 * The maximum number of inbound HTLCs towards sender
5571 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5574 * The maximum number of inbound HTLCs towards sender
5576 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
5579 * The sender's key controlling the funding transaction
5581 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5584 * The sender's key controlling the funding transaction
5586 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5589 * Used to derive a revocation key for transactions broadcast by counterparty
5591 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5594 * Used to derive a revocation key for transactions broadcast by counterparty
5596 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5599 * A payment key to sender for transactions broadcast by counterparty
5601 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5604 * A payment key to sender for transactions broadcast by counterparty
5606 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5609 * Used to derive a payment key to sender for transactions broadcast by sender
5611 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5614 * Used to derive a payment key to sender for transactions broadcast by sender
5616 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5619 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
5621 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5624 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
5626 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5629 * The first to-be-broadcast-by-sender transaction's per commitment point
5631 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5634 * The first to-be-broadcast-by-sender transaction's per commitment point
5636 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5638 void FundingCreated_free(struct LDKFundingCreated this_ptr);
5640 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
5643 * A temporary channel ID, until the funding is established
5645 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
5648 * A temporary channel ID, until the funding is established
5650 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5653 * The funding transaction ID
5655 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
5658 * The funding transaction ID
5660 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5663 * The specific output index funding this channel
5665 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
5668 * The specific output index funding this channel
5670 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
5673 * The signature of the channel initiator (funder) on the funding transaction
5675 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
5678 * The signature of the channel initiator (funder) on the funding transaction
5680 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
5682 MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKSignature signature_arg);
5684 void FundingSigned_free(struct LDKFundingSigned this_ptr);
5686 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
5691 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
5696 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5699 * The signature of the channel acceptor (fundee) on the funding transaction
5701 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
5704 * The signature of the channel acceptor (fundee) on the funding transaction
5706 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5708 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
5710 void FundingLocked_free(struct LDKFundingLocked this_ptr);
5712 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
5717 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
5722 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5725 * The per-commitment point of the second commitment transaction
5727 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
5730 * The per-commitment point of the second commitment transaction
5732 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5734 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
5736 void Shutdown_free(struct LDKShutdown this_ptr);
5738 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
5743 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
5748 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5751 * The destination of this peer's funds on closing.
5752 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5754 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
5757 * The destination of this peer's funds on closing.
5758 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5760 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
5762 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
5764 void ClosingSigned_free(struct LDKClosingSigned this_ptr);
5766 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
5771 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
5776 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5779 * The proposed total fee for the closing transaction
5781 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
5784 * The proposed total fee for the closing transaction
5786 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
5789 * A signature on the closing transaction
5791 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
5794 * A signature on the closing transaction
5796 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5798 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
5800 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_ptr);
5802 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
5807 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
5812 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5817 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5822 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
5825 * The HTLC value in milli-satoshi
5827 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5830 * The HTLC value in milli-satoshi
5832 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
5835 * The payment hash, the pre-image of which controls HTLC redemption
5837 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
5840 * The payment hash, the pre-image of which controls HTLC redemption
5842 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5845 * The expiry height of the HTLC
5847 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5850 * The expiry height of the HTLC
5852 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
5854 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_ptr);
5856 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
5861 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
5866 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5871 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
5876 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
5879 * The pre-image of the payment hash, allowing HTLC redemption
5881 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
5884 * The pre-image of the payment hash, allowing HTLC redemption
5886 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5888 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
5890 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_ptr);
5892 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
5897 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
5902 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5907 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
5912 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
5914 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_ptr);
5916 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
5921 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
5926 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5931 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
5936 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
5941 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
5946 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
5948 void CommitmentSigned_free(struct LDKCommitmentSigned this_ptr);
5950 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
5955 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
5960 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5963 * A signature on the commitment transaction
5965 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
5968 * A signature on the commitment transaction
5970 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5973 * Signatures on the HTLC transactions
5975 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
5977 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
5979 void RevokeAndACK_free(struct LDKRevokeAndACK this_ptr);
5981 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
5986 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
5991 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5994 * The secret corresponding to the per-commitment point
5996 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
5999 * The secret corresponding to the per-commitment point
6001 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6004 * The next sender-broadcast commitment transaction's per-commitment point
6006 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
6009 * The next sender-broadcast commitment transaction's per-commitment point
6011 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6013 MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg);
6015 void UpdateFee_free(struct LDKUpdateFee this_ptr);
6017 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
6022 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
6027 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6030 * Fee rate per 1000-weight of the transaction
6032 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
6035 * Fee rate per 1000-weight of the transaction
6037 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
6039 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
6041 void DataLossProtect_free(struct LDKDataLossProtect this_ptr);
6043 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
6046 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
6047 * belonging to the recipient
6049 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
6052 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
6053 * belonging to the recipient
6055 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6058 * The sender's per-commitment point for their current commitment transaction
6060 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
6063 * The sender's per-commitment point for their current commitment transaction
6065 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6067 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
6069 void ChannelReestablish_free(struct LDKChannelReestablish this_ptr);
6071 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
6076 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
6081 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6084 * The next commitment number for the sender
6086 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
6089 * The next commitment number for the sender
6091 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
6094 * The next commitment number for the recipient
6096 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
6099 * The next commitment number for the recipient
6101 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
6103 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_ptr);
6105 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
6110 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
6115 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6118 * The short channel ID
6120 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6123 * The short channel ID
6125 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
6128 * A signature by the node key
6130 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6133 * A signature by the node key
6135 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
6138 * A signature by the funding key
6140 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6143 * A signature by the funding key
6145 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
6147 MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKSignature node_signature_arg, struct LDKSignature bitcoin_signature_arg);
6149 void NetAddress_free(struct LDKNetAddress this_ptr);
6151 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
6153 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
6155 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
6157 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_ptr);
6159 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
6162 * The advertised features
6164 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6167 * The advertised features
6169 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
6172 * A strictly monotonic announcement counter, with gaps allowed
6174 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6177 * A strictly monotonic announcement counter, with gaps allowed
6179 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
6182 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
6185 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6188 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
6191 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6194 * An RGB color for UI purposes
6196 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
6199 * An RGB color for UI purposes
6201 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
6204 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
6207 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
6210 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
6213 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6216 * List of addresses on which this node is reachable
6218 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
6220 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_ptr);
6222 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
6225 * The signature by the node key
6227 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
6230 * The signature by the node key
6232 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6235 * The actual content of the announcement
6237 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
6240 * The actual content of the announcement
6242 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
6244 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
6246 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_ptr);
6248 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
6251 * The advertised channel features
6253 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6256 * The advertised channel features
6258 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
6261 * The genesis hash of the blockchain where the channel is to be opened
6263 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
6266 * The genesis hash of the blockchain where the channel is to be opened
6268 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6271 * The short channel ID
6273 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6276 * The short channel ID
6278 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
6281 * One of the two node_ids which are endpoints of this channel
6283 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6286 * One of the two node_ids which are endpoints of this channel
6288 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6291 * The other of the two node_ids which are endpoints of this channel
6293 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6296 * The other of the two node_ids which are endpoints of this channel
6298 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6301 * The funding key for the first node
6303 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6306 * The funding key for the first node
6308 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6311 * The funding key for the second node
6313 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6316 * The funding key for the second node
6318 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6320 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_ptr);
6322 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
6325 * Authentication of the announcement by the first public node
6327 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6330 * Authentication of the announcement by the first public node
6332 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6335 * Authentication of the announcement by the second public node
6337 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6340 * Authentication of the announcement by the second public node
6342 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6345 * Proof of funding UTXO ownership by the first public node
6347 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6350 * Proof of funding UTXO ownership by the first public node
6352 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6355 * Proof of funding UTXO ownership by the second public node
6357 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6360 * Proof of funding UTXO ownership by the second public node
6362 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6365 * The actual announcement
6367 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6370 * The actual announcement
6372 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
6374 MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKSignature node_signature_1_arg, struct LDKSignature node_signature_2_arg, struct LDKSignature bitcoin_signature_1_arg, struct LDKSignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg);
6376 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_ptr);
6378 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
6381 * The genesis hash of the blockchain where the channel is to be opened
6383 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
6386 * The genesis hash of the blockchain where the channel is to be opened
6388 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6391 * The short channel ID
6393 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6396 * The short channel ID
6398 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
6401 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
6403 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6406 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
6408 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6413 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6418 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
6421 * The number of blocks to subtract from incoming HTLC cltv_expiry values
6423 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6426 * The number of blocks to subtract from incoming HTLC cltv_expiry values
6428 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
6431 * The minimum HTLC size incoming to sender, in milli-satoshi
6433 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6436 * The minimum HTLC size incoming to sender, in milli-satoshi
6438 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
6441 * The base HTLC fee charged by sender, in milli-satoshi
6443 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6446 * The base HTLC fee charged by sender, in milli-satoshi
6448 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6451 * The amount to fee multiplier, in micro-satoshi
6453 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6456 * The amount to fee multiplier, in micro-satoshi
6458 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6460 void ChannelUpdate_free(struct LDKChannelUpdate this_ptr);
6462 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
6465 * A signature of the channel update
6467 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
6470 * A signature of the channel update
6472 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
6475 * The actual channel update
6477 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
6480 * The actual channel update
6482 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
6484 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
6486 void QueryChannelRange_free(struct LDKQueryChannelRange this_ptr);
6488 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
6491 * The genesis hash of the blockchain being queried
6493 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
6496 * The genesis hash of the blockchain being queried
6498 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6501 * The height of the first block for the channel UTXOs being queried
6503 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
6506 * The height of the first block for the channel UTXOs being queried
6508 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6511 * The number of blocks to include in the query results
6513 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
6516 * The number of blocks to include in the query results
6518 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6520 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
6522 void ReplyChannelRange_free(struct LDKReplyChannelRange this_ptr);
6524 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
6527 * The genesis hash of the blockchain being queried
6529 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
6532 * The genesis hash of the blockchain being queried
6534 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6537 * The height of the first block in the range of the reply
6539 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6542 * The height of the first block in the range of the reply
6544 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6547 * The number of blocks included in the range of the reply
6549 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6552 * The number of blocks included in the range of the reply
6554 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6557 * True when this is the final reply for a query
6559 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6562 * True when this is the final reply for a query
6564 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
6567 * The short_channel_ids in the channel range
6569 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
6571 MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool sync_complete_arg, struct LDKCVec_u64Z short_channel_ids_arg);
6573 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_ptr);
6575 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
6578 * The genesis hash of the blockchain being queried
6580 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
6583 * The genesis hash of the blockchain being queried
6585 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6588 * The short_channel_ids that are being queried
6590 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
6592 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
6594 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_ptr);
6596 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
6599 * The genesis hash of the blockchain that was queried
6601 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
6604 * The genesis hash of the blockchain that was queried
6606 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6609 * Indicates if the query recipient maintains up-to-date channel
6610 * information for the chain_hash
6612 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
6615 * Indicates if the query recipient maintains up-to-date channel
6616 * information for the chain_hash
6618 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
6620 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
6622 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_ptr);
6624 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
6627 * The genesis hash of the blockchain for channel and node information
6629 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
6632 * The genesis hash of the blockchain for channel and node information
6634 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6637 * The starting unix timestamp
6639 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
6642 * The starting unix timestamp
6644 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
6647 * The range of information in seconds
6649 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
6652 * The range of information in seconds
6654 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
6656 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
6658 void ErrorAction_free(struct LDKErrorAction this_ptr);
6660 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
6662 void LightningError_free(struct LDKLightningError this_ptr);
6664 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
6667 * A human-readable message describing the error
6669 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
6672 * A human-readable message describing the error
6674 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
6677 * The action which should be taken against the offending peer.
6679 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
6682 * The action which should be taken against the offending peer.
6684 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
6686 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
6688 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_ptr);
6690 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
6693 * update_add_htlc messages which should be sent
6695 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
6698 * update_fulfill_htlc messages which should be sent
6700 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
6703 * update_fail_htlc messages which should be sent
6705 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
6708 * update_fail_malformed_htlc messages which should be sent
6710 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
6713 * An update_fee message which should be sent
6715 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
6718 * An update_fee message which should be sent
6720 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
6723 * Finally, the commitment_signed message which should be sent
6725 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
6728 * Finally, the commitment_signed message which should be sent
6730 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
6732 MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, struct LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, struct LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, struct LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg);
6734 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
6736 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
6739 * Calls the free function if one is set
6741 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
6744 * Calls the free function if one is set
6746 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
6748 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
6750 struct LDKAcceptChannel AcceptChannel_read(struct LDKu8slice ser);
6752 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
6754 struct LDKAnnouncementSignatures AnnouncementSignatures_read(struct LDKu8slice ser);
6756 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
6758 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
6760 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
6762 struct LDKClosingSigned ClosingSigned_read(struct LDKu8slice ser);
6764 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
6766 struct LDKCommitmentSigned CommitmentSigned_read(struct LDKu8slice ser);
6768 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
6770 struct LDKFundingCreated FundingCreated_read(struct LDKu8slice ser);
6772 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
6774 struct LDKFundingSigned FundingSigned_read(struct LDKu8slice ser);
6776 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
6778 struct LDKFundingLocked FundingLocked_read(struct LDKu8slice ser);
6780 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
6782 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
6784 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
6786 struct LDKOpenChannel OpenChannel_read(struct LDKu8slice ser);
6788 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
6790 struct LDKRevokeAndACK RevokeAndACK_read(struct LDKu8slice ser);
6792 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
6794 struct LDKShutdown Shutdown_read(struct LDKu8slice ser);
6796 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
6798 struct LDKUpdateFailHTLC UpdateFailHTLC_read(struct LDKu8slice ser);
6800 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
6802 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
6804 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
6806 struct LDKUpdateFee UpdateFee_read(struct LDKu8slice ser);
6808 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
6810 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(struct LDKu8slice ser);
6812 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
6814 struct LDKUpdateAddHTLC UpdateAddHTLC_read(struct LDKu8slice ser);
6816 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
6818 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
6820 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
6822 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
6824 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
6826 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
6828 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
6830 struct LDKChannelAnnouncement ChannelAnnouncement_read(struct LDKu8slice ser);
6832 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
6834 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
6836 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
6838 struct LDKChannelUpdate ChannelUpdate_read(struct LDKu8slice ser);
6840 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
6842 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
6844 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
6846 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
6848 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
6850 struct LDKNodeAnnouncement NodeAnnouncement_read(struct LDKu8slice ser);
6852 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
6854 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
6856 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
6858 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
6860 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
6862 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
6864 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
6866 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
6868 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
6870 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
6872 void MessageHandler_free(struct LDKMessageHandler this_ptr);
6875 * A message handler which handles messages specific to channels. Usually this is just a
6876 * ChannelManager object.
6878 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
6881 * A message handler which handles messages specific to channels. Usually this is just a
6882 * ChannelManager object.
6884 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
6887 * A message handler which handles messages updating our knowledge of the network channel
6888 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6890 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
6893 * A message handler which handles messages updating our knowledge of the network channel
6894 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6896 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
6898 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
6900 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
6903 * Calls the free function if one is set
6905 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
6907 void PeerHandleError_free(struct LDKPeerHandleError this_ptr);
6909 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
6912 * Used to indicate that we probably can't make any future connections to this peer, implying
6913 * we should go ahead and force-close any channels we have with it.
6915 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
6918 * Used to indicate that we probably can't make any future connections to this peer, implying
6919 * we should go ahead and force-close any channels we have with it.
6921 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
6923 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
6925 void PeerManager_free(struct LDKPeerManager this_ptr);
6928 * Constructs a new PeerManager with the given message handlers and node_id secret key
6929 * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
6930 * cryptographically secure random bytes.
6932 MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger);
6935 * Get the list of node ids for peers which have completed the initial handshake.
6937 * For outbound connections, this will be the same as the their_node_id parameter passed in to
6938 * new_outbound_connection, however entries will only appear once the initial handshake has
6939 * completed and we are sure the remote peer has the private key for the given node_id.
6941 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
6944 * Indicates a new outbound connection has been established to a node with the given node_id.
6945 * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
6946 * descriptor but must disconnect the connection immediately.
6948 * Returns a small number of bytes to send to the remote node (currently always 50).
6950 * Panics if descriptor is duplicative with some other descriptor which has not yet had a
6951 * socket_disconnected().
6953 MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor);
6956 * Indicates a new inbound connection has been established.
6958 * May refuse the connection by returning an Err, but will never write bytes to the remote end
6959 * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
6960 * call socket_disconnected for the new descriptor but must disconnect the connection
6963 * Panics if descriptor is duplicative with some other descriptor which has not yet had
6964 * socket_disconnected called.
6966 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
6969 * Indicates that there is room to write data to the given socket descriptor.
6971 * May return an Err to indicate that the connection should be closed.
6973 * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
6974 * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
6975 * invariants around calling write_buffer_space_avail in case a write did not fully complete
6976 * must still hold - be ready to call write_buffer_space_avail again if a write call generated
6977 * here isn't sufficient! Panics if the descriptor was not previously registered in a
6978 * new_\\*_connection event.
6980 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
6983 * Indicates that data was read from the given socket descriptor.
6985 * May return an Err to indicate that the connection should be closed.
6987 * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
6988 * Thus, however, you almost certainly want to call process_events() after any read_event to
6989 * generate send_data calls to handle responses.
6991 * If Ok(true) is returned, further read_events should not be triggered until a send_data call
6992 * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
6994 * Panics if the descriptor was not previously registered in a new_*_connection event.
6996 MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data);
6999 * Checks for any events generated by our handlers and processes them. Includes sending most
7000 * response messages as well as messages generated by calls to handler functions directly (eg
7001 * functions like ChannelManager::process_pending_htlc_forward or send_payment).
7003 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
7006 * Indicates that the given socket descriptor's connection is now closed.
7008 * This must only be called if the socket has been disconnected by the peer or your own
7009 * decision to disconnect it and must NOT be called in any case where other parts of this
7010 * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
7013 * Panics if the descriptor was not previously registered in a successful new_*_connection event.
7015 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
7018 * Disconnect a peer given its node id.
7020 * Set no_connection_possible to true to prevent any further connection with this peer,
7021 * force-closing any channels we have with it.
7023 * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
7024 * so be careful about reentrancy issues.
7026 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
7029 * This function should be called roughly once every 30 seconds.
7030 * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
7031 * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
7033 void PeerManager_timer_tick_occured(const struct LDKPeerManager *NONNULL_PTR this_arg);
7036 * Build the commitment secret from the seed and the commitment number
7038 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
7041 * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
7042 * from the base secret and the per_commitment_point.
7044 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7045 * generated (ie our own).
7047 struct LDKCResult_SecretKeySecpErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
7050 * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
7051 * from the base point and the per_commitment_key. This is the public equivalent of
7052 * derive_private_key - using only public keys to derive a public key instead of private keys.
7054 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7055 * generated (ie our own).
7057 struct LDKCResult_PublicKeySecpErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
7060 * Derives a per-commitment-transaction revocation key from its constituent parts.
7062 * Only the cheating participant owns a valid witness to propagate a revoked
7063 * commitment transaction, thus per_commitment_secret always come from cheater
7064 * and revocation_base_secret always come from punisher, which is the broadcaster
7065 * of the transaction spending with this key knowledge.
7067 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7068 * generated (ie our own).
7070 struct LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
7073 * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
7074 * the public equivalend of derive_private_revocation_key - using only public keys to derive a
7075 * public key instead of private keys.
7077 * Only the cheating participant owns a valid witness to propagate a revoked
7078 * commitment transaction, thus per_commitment_point always come from cheater
7079 * and revocation_base_point always come from punisher, which is the broadcaster
7080 * of the transaction spending with this key knowledge.
7082 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7083 * generated (ie our own).
7085 struct LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
7087 void TxCreationKeys_free(struct LDKTxCreationKeys this_ptr);
7089 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
7092 * The broadcaster's per-commitment public key which was used to derive the other keys.
7094 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7097 * The broadcaster's per-commitment public key which was used to derive the other keys.
7099 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7102 * The revocation key which is used to allow the broadcaster of the commitment
7103 * transaction to provide their counterparty the ability to punish them if they broadcast
7106 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7109 * The revocation key which is used to allow the broadcaster of the commitment
7110 * transaction to provide their counterparty the ability to punish them if they broadcast
7113 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7116 * Broadcaster's HTLC Key
7118 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7121 * Broadcaster's HTLC Key
7123 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7126 * Countersignatory's HTLC Key
7128 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7131 * Countersignatory's HTLC Key
7133 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7136 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
7138 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7141 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
7143 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7145 MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKPublicKey revocation_key_arg, struct LDKPublicKey broadcaster_htlc_key_arg, struct LDKPublicKey countersignatory_htlc_key_arg, struct LDKPublicKey broadcaster_delayed_payment_key_arg);
7147 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
7149 struct LDKTxCreationKeys TxCreationKeys_read(struct LDKu8slice ser);
7151 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_ptr);
7153 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
7156 * The public key which is used to sign all commitment transactions, as it appears in the
7157 * on-chain channel lock-in 2-of-2 multisig output.
7159 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7162 * The public key which is used to sign all commitment transactions, as it appears in the
7163 * on-chain channel lock-in 2-of-2 multisig output.
7165 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7168 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
7169 * revocation keys. This is combined with the per-commitment-secret generated by the
7170 * counterparty to create a secret which the counterparty can reveal to revoke previous
7173 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7176 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
7177 * revocation keys. This is combined with the per-commitment-secret generated by the
7178 * counterparty to create a secret which the counterparty can reveal to revoke previous
7181 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7184 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
7185 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
7186 * static across every commitment transaction.
7188 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7191 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
7192 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
7193 * static across every commitment transaction.
7195 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7198 * The base point which is used (with derive_public_key) to derive a per-commitment payment
7199 * public key which receives non-HTLC-encumbered funds which are only available for spending
7200 * after some delay (or can be claimed via the revocation path).
7202 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7205 * The base point which is used (with derive_public_key) to derive a per-commitment payment
7206 * public key which receives non-HTLC-encumbered funds which are only available for spending
7207 * after some delay (or can be claimed via the revocation path).
7209 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7212 * The base point which is used (with derive_public_key) to derive a per-commitment public key
7213 * which is used to encumber HTLC-in-flight outputs.
7215 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7218 * The base point which is used (with derive_public_key) to derive a per-commitment public key
7219 * which is used to encumber HTLC-in-flight outputs.
7221 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7223 MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg);
7225 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
7227 struct LDKChannelPublicKeys ChannelPublicKeys_read(struct LDKu8slice ser);
7230 * Create per-state keys from channel base points and the per-commitment point.
7231 * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
7233 MUST_USE_RES struct LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, struct LDKPublicKey broadcaster_delayed_payment_base, struct LDKPublicKey broadcaster_htlc_base, struct LDKPublicKey countersignatory_revocation_base, struct LDKPublicKey countersignatory_htlc_base);
7236 * Generate per-state keys from channel static keys.
7237 * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
7239 MUST_USE_RES struct LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys);
7242 * A script either spendable by the revocation
7243 * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
7244 * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
7246 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
7248 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_ptr);
7250 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
7253 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
7254 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
7255 * need to compare this value to whether the commitment transaction in question is that of
7256 * the counterparty or our own.
7258 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7261 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
7262 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
7263 * need to compare this value to whether the commitment transaction in question is that of
7264 * the counterparty or our own.
7266 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
7269 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
7270 * this divided by 1000.
7272 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7275 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
7276 * this divided by 1000.
7278 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
7281 * The CLTV lock-time at which this HTLC expires.
7283 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7286 * The CLTV lock-time at which this HTLC expires.
7288 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
7291 * The hash of the preimage which unlocks this HTLC.
7293 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
7296 * The hash of the preimage which unlocks this HTLC.
7298 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7300 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
7302 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(struct LDKu8slice ser);
7305 * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
7306 * does not need to have its previous_output_index filled.
7308 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
7311 * Gets the redeemscript for a funding output from the two funding public keys.
7312 * Note that the order of funding public keys does not matter.
7314 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
7317 * panics if htlc.transaction_output_index.is_none()!
7319 struct LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
7321 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_ptr);
7323 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
7326 * Holder public keys
7328 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7331 * Holder public keys
7333 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
7336 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
7338 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7341 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
7343 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
7346 * Whether the holder is the initiator of this channel.
7347 * This is an input to the commitment number obscure factor computation.
7349 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7352 * Whether the holder is the initiator of this channel.
7353 * This is an input to the commitment number obscure factor computation.
7355 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
7358 * The late-bound counterparty channel transaction parameters.
7359 * These parameters are populated at the point in the protocol where the counterparty provides them.
7361 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7364 * The late-bound counterparty channel transaction parameters.
7365 * These parameters are populated at the point in the protocol where the counterparty provides them.
7367 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
7370 * The late-bound funding outpoint
7372 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7375 * The late-bound funding outpoint
7377 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
7379 MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg);
7381 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_ptr);
7383 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
7386 * Counter-party public keys
7388 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
7391 * Counter-party public keys
7393 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
7396 * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
7398 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
7401 * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
7403 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
7405 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
7408 * Whether the late bound parameters are populated.
7410 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7413 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
7414 * given that the holder is the broadcaster.
7416 * self.is_populated() must be true before calling this function.
7418 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7421 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
7422 * given that the counterparty is the broadcaster.
7424 * self.is_populated() must be true before calling this function.
7426 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7428 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
7430 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
7432 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
7434 struct LDKChannelTransactionParameters ChannelTransactionParameters_read(struct LDKu8slice ser);
7436 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_ptr);
7439 * Get the channel pubkeys for the broadcaster
7441 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7444 * Get the channel pubkeys for the countersignatory
7446 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7449 * Get the contest delay applicable to the transactions.
7450 * Note that the contest delay was selected by the countersignatory.
7452 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7455 * Whether the channel is outbound from the broadcaster.
7457 * The boolean representing the side that initiated the channel is
7458 * an input to the commitment number obscure factor computation.
7460 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7463 * The funding outpoint
7465 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7467 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_ptr);
7469 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
7472 * Our counterparty's signature for the transaction
7474 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
7477 * Our counterparty's signature for the transaction
7479 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
7482 * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
7484 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
7486 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
7488 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(struct LDKu8slice ser);
7491 * Create a new holder transaction with the given counterparty signatures.
7492 * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
7494 MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, struct LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key);
7496 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_ptr);
7498 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
7501 * The commitment transaction
7503 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
7506 * The commitment transaction
7508 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
7511 * The txid for the commitment transaction.
7513 * This is provided as a performance optimization, instead of calling transaction.txid()
7516 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
7519 * The txid for the commitment transaction.
7521 * This is provided as a performance optimization, instead of calling transaction.txid()
7524 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7526 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
7528 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
7530 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_read(struct LDKu8slice ser);
7533 * Get the SIGHASH_ALL sighash value of the transaction.
7535 * This can be used to verify a signature.
7537 MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
7540 * Sign a transaction, either because we are counter-signing the counterparty's transaction or
7541 * because we are about to broadcast a holder transaction.
7543 MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
7545 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_ptr);
7547 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
7549 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
7551 struct LDKCommitmentTransaction CommitmentTransaction_read(struct LDKu8slice ser);
7554 * The backwards-counting commitment number
7556 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7559 * The value to be sent to the broadcaster
7561 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7564 * The value to be sent to the counterparty
7566 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7569 * The feerate paid per 1000-weight-unit in this commitment transaction.
7571 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7574 * Trust our pre-built transaction and derived transaction creation public keys.
7576 * Applies a wrapper which allows access to these fields.
7578 * This should only be used if you fully trust the builder of this object. It should not
7579 *\tbe used by an external signer - instead use the verify function.
7581 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7584 * Verify our pre-built transaction and derived transaction creation public keys.
7586 * Applies a wrapper which allows access to these fields.
7588 * An external validating signer must call this method before signing
7589 * or using the built transaction.
7591 MUST_USE_RES struct LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys);
7593 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_ptr);
7596 * The transaction ID of the built Bitcoin transaction
7598 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7601 * The pre-built Bitcoin commitment transaction
7603 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7606 * The pre-calculated transaction creation public keys.
7608 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7611 * Get a signature for each HTLC which was included in the commitment transaction (ie for
7612 * which HTLCOutputInCommitment::transaction_output_index.is_some()).
7614 * The returned Vec has one entry for each HTLC, and in the same order.
7616 MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters);
7619 * Get the transaction number obscure factor
7621 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
7623 void InitFeatures_free(struct LDKInitFeatures this_ptr);
7625 void NodeFeatures_free(struct LDKNodeFeatures this_ptr);
7627 void ChannelFeatures_free(struct LDKChannelFeatures this_ptr);
7629 void RouteHop_free(struct LDKRouteHop this_ptr);
7631 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
7634 * The node_id of the node at this hop.
7636 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7639 * The node_id of the node at this hop.
7641 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7644 * The node_announcement features of the node at this hop. For the last hop, these may be
7645 * amended to match the features present in the invoice this node generated.
7647 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7650 * The node_announcement features of the node at this hop. For the last hop, these may be
7651 * amended to match the features present in the invoice this node generated.
7653 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
7656 * The channel that should be used from the previous hop to reach this node.
7658 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7661 * The channel that should be used from the previous hop to reach this node.
7663 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
7666 * The channel_announcement features of the channel that should be used from the previous hop
7667 * to reach this node.
7669 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7672 * The channel_announcement features of the channel that should be used from the previous hop
7673 * to reach this node.
7675 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
7678 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
7680 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7683 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
7685 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
7688 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
7689 * expected at the destination, in excess of the current block height.
7691 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7694 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
7695 * expected at the destination, in excess of the current block height.
7697 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
7699 MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg);
7701 void Route_free(struct LDKRoute this_ptr);
7703 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
7706 * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
7707 * last RouteHop in each path must be the same.
7708 * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
7709 * destination. Thus, this must always be at least length one. While the maximum length of any
7710 * given path is variable, keeping the length of any path to less than 20 should currently
7711 * ensure it is viable.
7713 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
7715 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
7717 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
7719 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
7721 void RouteHint_free(struct LDKRouteHint this_ptr);
7723 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
7726 * The node_id of the non-target end of the route
7728 struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7731 * The node_id of the non-target end of the route
7733 void RouteHint_set_src_node_id(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7736 * The short_channel_id of this channel
7738 uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7741 * The short_channel_id of this channel
7743 void RouteHint_set_short_channel_id(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
7746 * The fees which must be paid to use this channel
7748 struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7751 * The fees which must be paid to use this channel
7753 void RouteHint_set_fees(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
7756 * The difference in CLTV values between this node and the next node.
7758 uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7761 * The difference in CLTV values between this node and the next node.
7763 void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val);
7766 * The minimum value, in msat, which must be relayed to the next hop.
7768 uint64_t RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7771 * The minimum value, in msat, which must be relayed to the next hop.
7773 void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
7775 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg);
7778 * Gets a route from us to the given target node.
7780 * Extra routing hops between known nodes and the target will be used if they are included in
7783 * If some channels aren't announced, it may be useful to fill in a first_hops with the
7784 * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
7785 * view of our local channels (from net_graph_msg_handler) will be ignored, and only those in first_hops
7788 * Panics if first_hops contains channels without short_channel_ids
7789 * (ChannelManager::list_usable_channels will never include such channels).
7791 * The fees on channels from us to next-hops are ignored (as they are assumed to all be
7792 * equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat
7793 * *is* checked as they may change based on the receiving node.
7795 struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey target, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
7797 void NetworkGraph_free(struct LDKNetworkGraph this_ptr);
7799 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr);
7801 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_ptr);
7804 * Creates a new tracker of the actual state of the network of channels and nodes,
7805 * assuming a fresh network graph.
7806 * Chain monitor is used to make sure announced channels exist on-chain,
7807 * channel data is correct, and that the announcement is signed with
7808 * channel owners' keys.
7810 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
7813 * Creates a new tracker of the actual state of the network of channels and nodes,
7814 * assuming an existing Network Graph.
7816 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
7819 * Take a read lock on the network_graph and return it in the C-bindings
7820 * newtype helper. This is likely only useful when called via the C
7821 * bindings as you can call `self.network_graph.read().unwrap()` in Rust
7824 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7827 * Get a reference to the NetworkGraph which this read-lock contains.
7829 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
7831 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7833 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7835 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_ptr);
7837 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
7840 * When the last update to the channel direction was issued.
7841 * Value is opaque, as set in the announcement.
7843 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7846 * When the last update to the channel direction was issued.
7847 * Value is opaque, as set in the announcement.
7849 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
7852 * Whether the channel can be currently used for payments (in this one direction).
7854 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7857 * Whether the channel can be currently used for payments (in this one direction).
7859 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
7862 * The difference in CLTV values that you must have when routing through this channel.
7864 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7867 * The difference in CLTV values that you must have when routing through this channel.
7869 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
7872 * The minimum value, which must be relayed to the next hop via the channel
7874 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7877 * The minimum value, which must be relayed to the next hop via the channel
7879 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
7882 * Fees charged when the channel is used for routing
7884 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7887 * Fees charged when the channel is used for routing
7889 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
7892 * Most recent update for the channel received from the network
7893 * Mostly redundant with the data we store in fields explicitly.
7894 * Everything else is useful only for sending out for initial routing sync.
7895 * Not stored if contains excess data to prevent DoS.
7897 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7900 * Most recent update for the channel received from the network
7901 * Mostly redundant with the data we store in fields explicitly.
7902 * Everything else is useful only for sending out for initial routing sync.
7903 * Not stored if contains excess data to prevent DoS.
7905 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
7907 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
7909 struct LDKDirectionalChannelInfo DirectionalChannelInfo_read(struct LDKu8slice ser);
7911 void ChannelInfo_free(struct LDKChannelInfo this_ptr);
7914 * Protocol features of a channel communicated during its announcement
7916 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7919 * Protocol features of a channel communicated during its announcement
7921 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
7924 * Source node of the first direction of a channel
7926 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7929 * Source node of the first direction of a channel
7931 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7934 * Details about the first direction of a channel
7936 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7939 * Details about the first direction of a channel
7941 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
7944 * Source node of the second direction of a channel
7946 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7949 * Source node of the second direction of a channel
7951 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7954 * Details about the second direction of a channel
7956 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7959 * Details about the second direction of a channel
7961 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
7964 * An initial announcement of the channel
7965 * Mostly redundant with the data we store in fields explicitly.
7966 * Everything else is useful only for sending out for initial routing sync.
7967 * Not stored if contains excess data to prevent DoS.
7969 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7972 * An initial announcement of the channel
7973 * Mostly redundant with the data we store in fields explicitly.
7974 * Everything else is useful only for sending out for initial routing sync.
7975 * Not stored if contains excess data to prevent DoS.
7977 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
7979 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
7981 struct LDKChannelInfo ChannelInfo_read(struct LDKu8slice ser);
7983 void RoutingFees_free(struct LDKRoutingFees this_ptr);
7985 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
7988 * Flat routing fee in satoshis
7990 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
7993 * Flat routing fee in satoshis
7995 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
7998 * Liquidity-based routing fee in millionths of a routed amount.
7999 * In other words, 10000 is 1%.
8001 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
8004 * Liquidity-based routing fee in millionths of a routed amount.
8005 * In other words, 10000 is 1%.
8007 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
8009 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
8011 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
8013 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
8015 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_ptr);
8017 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
8020 * Protocol features the node announced support for
8022 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
8025 * Protocol features the node announced support for
8027 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
8030 * When the last known update to the node state was issued.
8031 * Value is opaque, as set in the announcement.
8033 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
8036 * When the last known update to the node state was issued.
8037 * Value is opaque, as set in the announcement.
8039 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
8042 * Color assigned to the node
8044 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
8047 * Color assigned to the node
8049 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
8052 * Moniker assigned to the node.
8053 * May be invalid or malicious (eg control chars),
8054 * should not be exposed to the user.
8056 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
8059 * Moniker assigned to the node.
8060 * May be invalid or malicious (eg control chars),
8061 * should not be exposed to the user.
8063 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8066 * Internet-level addresses via which one can connect to the node
8068 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
8071 * An initial announcement of the node
8072 * Mostly redundant with the data we store in fields explicitly.
8073 * Everything else is useful only for sending out for initial routing sync.
8074 * Not stored if contains excess data to prevent DoS.
8076 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
8079 * An initial announcement of the node
8080 * Mostly redundant with the data we store in fields explicitly.
8081 * Everything else is useful only for sending out for initial routing sync.
8082 * Not stored if contains excess data to prevent DoS.
8084 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
8086 MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg);
8088 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
8090 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
8092 void NodeInfo_free(struct LDKNodeInfo this_ptr);
8094 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
8097 * All valid channels a node has announced
8099 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
8102 * Lowest fees enabling routing via any of the enabled, known channels to a node.
8103 * The two fields (flat and proportional fee) are independent,
8104 * meaning they don't have to refer to the same channel.
8106 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
8109 * Lowest fees enabling routing via any of the enabled, known channels to a node.
8110 * The two fields (flat and proportional fee) are independent,
8111 * meaning they don't have to refer to the same channel.
8113 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
8116 * More information about a node from node_announcement.
8117 * Optional because we store a Node entry after learning about it from
8118 * a channel announcement, but before receiving a node announcement.
8120 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
8123 * More information about a node from node_announcement.
8124 * Optional because we store a Node entry after learning about it from
8125 * a channel announcement, but before receiving a node announcement.
8127 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
8129 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
8131 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
8133 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
8135 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
8137 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
8140 * Creates a new, empty, network graph.
8142 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
8145 * For an already known node (from channel announcements), update its stored properties from a
8146 * given node announcement.
8148 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8149 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8150 * routing messages from a source using a protocol other than the lightning P2P protocol.
8152 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8155 * For an already known node (from channel announcements), update its stored properties from a
8156 * given node announcement without verifying the associated signatures. Because we aren't
8157 * given the associated signatures here we cannot relay the node announcement to any of our
8160 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
8163 * Store or update channel info from a channel announcement.
8165 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8166 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8167 * routing messages from a source using a protocol other than the lightning P2P protocol.
8169 * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
8170 * the corresponding UTXO exists on chain and is correctly-formatted.
8172 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
8175 * Store or update channel info from a channel announcement without verifying the associated
8176 * signatures. Because we aren't given the associated signatures here we cannot relay the
8177 * channel announcement to any of our peers.
8179 * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
8180 * the corresponding UTXO exists on chain and is correctly-formatted.
8182 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
8185 * Close a channel if a corresponding HTLC fail was sent.
8186 * If permanent, removes a channel from the local storage.
8187 * May cause the removal of nodes too, if this was their last channel.
8188 * If not permanent, makes channels unavailable for routing.
8190 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
8193 * For an already known (from announcement) channel, update info about one of the directions
8196 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8197 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8198 * routing messages from a source using a protocol other than the lightning P2P protocol.
8200 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8203 * For an already known (from announcement) channel, update info about one of the directions
8204 * of the channel without verifying the associated signatures. Because we aren't given the
8205 * associated signatures here we cannot relay the channel update to any of our peers.
8207 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
8209 /* Text to put at the end of the generated file */