#ifndef LDK_C_BINDINGS_H
#define LDK_C_BINDINGS_H
-/* Generated with cbindgen:0.19.0 */
+/* Generated with cbindgen:0.20.0 */
/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
* our state failed, but is expected to succeed at some point in the future).
*
* Such a failure will \"freeze\" a channel, preventing us from revoking old states or
- * submitting new commitment transactions to the counterparty. Once the update(s) which failed
- * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
- * restore the channel to an operational state.
+ * submitting new commitment transactions to the counterparty. Once the update(s) that failed
+ * have been successfully applied, a [`MonitorEvent::UpdateCompleted`] event should be returned
+ * via [`Watch::release_pending_monitor_events`] which will then restore the channel to an
+ * operational state.
*
* Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
* you return a TemporaryFailure you must ensure that it is written to disk safely before
* the channel which would invalidate previous ChannelMonitors are not made when a channel has
* been \"frozen\".
*
- * Note that even if updates made after TemporaryFailure succeed you must still call
- * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
- * operation.
+ * Note that even if updates made after TemporaryFailure succeed you must still provide a
+ * [`MonitorEvent::UpdateCompleted`] to ensure you have the latest monitor and re-enable
+ * normal channel operation. Note that this is normally generated through a call to
+ * [`ChainMonitor::channel_monitor_updated`].
*
- * Note that the update being processed here will not be replayed for you when you call
- * ChannelManager::channel_monitor_updated, so you must store the update itself along
- * with the persisted ChannelMonitor on your own local disk prior to returning a
+ * Note that the update being processed here will not be replayed for you when you return a
+ * [`MonitorEvent::UpdateCompleted`] event via [`Watch::release_pending_monitor_events`], so
+ * you must store the update itself on your own local disk prior to returning a
* TemporaryFailure. You may, of course, employ a journaling approach, storing only the
* ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
* reload-time.
* For deployments where a copy of ChannelMonitors and other local state are backed up in a
* remote location (with local copies persisted immediately), it is anticipated that all
* updates will return TemporaryFailure until the remote copies could be updated.
+ *
+ * [`ChainMonitor::channel_monitor_updated`]: chainmonitor::ChainMonitor::channel_monitor_updated
*/
LDKChannelMonitorUpdateErr_TemporaryFailure,
/**
bool result_ok;
} LDKCResult_RouteDecodeErrorZ;
+
+
+/**
+ * Parameters needed to find a [`Route`] for paying a [`Payee`].
+ *
+ * Passed to [`find_route`] and also provided in [`Event::PaymentPathFailed`] for retrying a failed
+ * payment path.
+ *
+ * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+ */
+typedef struct MUST_USE_STRUCT LDKRouteParameters {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeRouteParameters *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKRouteParameters;
+
+/**
+ * The contents of CResult_RouteParametersDecodeErrorZ
+ */
+typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKRouteParameters *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_RouteParametersDecodeErrorZPtr;
+
+/**
+ * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_RouteParametersDecodeErrorZ {
+ /**
+ * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_RouteParametersDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_RouteParametersDecodeErrorZ;
+
+
+
+/**
+ * A list of hops along a payment path terminating with a channel to the recipient.
+ */
+typedef struct MUST_USE_STRUCT LDKRouteHint {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeRouteHint *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKRouteHint;
+
+/**
+ * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_RouteHintZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKRouteHint *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_RouteHintZ;
+
/**
* An enum which can either contain a u64 or not
*/
/**
- * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
+ * The recipient of a payment.
*/
-typedef struct MUST_USE_STRUCT LDKChannelDetails {
+typedef struct MUST_USE_STRUCT LDKPayee {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeChannelDetails *inner;
+ LDKnativePayee *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKChannelDetails;
+} LDKPayee;
/**
- * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
+ * The contents of CResult_PayeeDecodeErrorZ
+ */
+typedef union LDKCResult_PayeeDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKPayee *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_PayeeDecodeErrorZPtr;
+
+/**
+ * A CResult_PayeeDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::router::Payee on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PayeeDecodeErrorZ {
+ /**
+ * The contents of this CResult_PayeeDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PayeeDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_PayeeDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PayeeDecodeErrorZ;
+
+
+
+/**
+ * A channel descriptor for a hop along a payment path.
+ */
+typedef struct MUST_USE_STRUCT LDKRouteHintHop {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeRouteHintHop *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKRouteHintHop;
+
+/**
+ * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
* This corresponds to std::vector in C++
*/
-typedef struct LDKCVec_ChannelDetailsZ {
+typedef struct LDKCVec_RouteHintHopZ {
/**
* The elements in the array.
* If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKChannelDetails *data;
+ struct LDKRouteHintHop *data;
/**
* The number of elements pointed to by `data`.
*/
uintptr_t datalen;
-} LDKCVec_ChannelDetailsZ;
+} LDKCVec_RouteHintHopZ;
+
+/**
+ * The contents of CResult_RouteHintDecodeErrorZ
+ */
+typedef union LDKCResult_RouteHintDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKRouteHint *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_RouteHintDecodeErrorZPtr;
+/**
+ * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_RouteHintDecodeErrorZ {
+ /**
+ * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_RouteHintDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_RouteHintDecodeErrorZ;
+/**
+ * The contents of CResult_RouteHintHopDecodeErrorZ
+ */
+typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKRouteHintHop *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_RouteHintHopDecodeErrorZPtr;
/**
- * A list of hops along a payment path terminating with a channel to the recipient.
+ * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct MUST_USE_STRUCT LDKRouteHint {
+typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
+ /**
+ * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_RouteHintHopDecodeErrorZ;
+
+
+
+/**
+ * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
+ */
+typedef struct MUST_USE_STRUCT LDKChannelDetails {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeRouteHint *inner;
+ LDKnativeChannelDetails *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKRouteHint;
+} LDKChannelDetails;
/**
- * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
+ * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
* This corresponds to std::vector in C++
*/
-typedef struct LDKCVec_RouteHintZ {
+typedef struct LDKCVec_ChannelDetailsZ {
/**
* The elements in the array.
* If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKRouteHint *data;
+ struct LDKChannelDetails *data;
/**
* The number of elements pointed to by `data`.
*/
uintptr_t datalen;
-} LDKCVec_RouteHintZ;
+} LDKCVec_ChannelDetailsZ;
* A monitor event that the Channel's commitment transaction was confirmed.
*/
LDKMonitorEvent_CommitmentTxConfirmed,
+ /**
+ * Indicates a [`ChannelMonitor`] update has completed. See
+ * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
+ *
+ * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
+ */
+ LDKMonitorEvent_UpdateCompleted,
+ /**
+ * Indicates a [`ChannelMonitor`] update has failed. See
+ * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
+ *
+ * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
+ */
+ LDKMonitorEvent_UpdateFailed,
/**
* Must be last for serialization purposes
*/
LDKMonitorEvent_Sentinel,
} LDKMonitorEvent_Tag;
+typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
+ /**
+ * The funding outpoint of the [`ChannelMonitor`] that was updated
+ */
+ struct LDKOutPoint funding_txo;
+ /**
+ * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
+ * [`ChannelMonitor::get_latest_update_id`].
+ *
+ * Note that this should only be set to a given update's ID if all previous updates for the
+ * same [`ChannelMonitor`] have been applied and persisted.
+ */
+ uint64_t monitor_update_id;
+} LDKMonitorEvent_LDKUpdateCompleted_Body;
+
typedef struct MUST_USE_STRUCT LDKMonitorEvent {
LDKMonitorEvent_Tag tag;
union {
struct {
struct LDKOutPoint commitment_tx_confirmed;
};
+ LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
+ struct {
+ struct LDKOutPoint update_failed;
+ };
};
} LDKMonitorEvent;
};
} LDKCOption_C2Tuple_usizeTransactionZZ;
-
-
/**
- * A channel_update message to be sent or received from a peer
+ * The reason the channel was closed. See individual variants more details.
*/
-typedef struct MUST_USE_STRUCT LDKChannelUpdate {
+typedef enum LDKClosureReason_Tag {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * Closure generated from receiving a peer error message.
+ *
+ * Our counterparty may have broadcasted their latest commitment state, and we have
+ * as well.
*/
- LDKnativeChannelUpdate *inner;
+ LDKClosureReason_CounterpartyForceClosed,
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
+ *
+ * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
*/
- bool is_owned;
-} LDKChannelUpdate;
-
-/**
- * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
- * return packet by a node along the route. See [BOLT #4] for details.
- *
- * [BOLT #4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md
- */
-typedef enum LDKNetworkUpdate_Tag {
+ LDKClosureReason_HolderForceClosed,
/**
- * An error indicating a `channel_update` messages should be applied via
- * [`NetworkGraph::update_channel`].
+ * The channel was closed after negotiating a cooperative close and we've now broadcasted
+ * the cooperative close transaction. Note the shutdown may have been initiated by us.
*/
- LDKNetworkUpdate_ChannelUpdateMessage,
+ LDKClosureReason_CooperativeClosure,
/**
- * An error indicating only that a channel has been closed, which should be applied via
- * [`NetworkGraph::close_channel_from_update`].
+ * A commitment transaction was confirmed on chain, closing the channel. Most likely this
+ * commitment transaction came from our counterparty, but it may also have come from
+ * a copy of our own `ChannelMonitor`.
*/
- LDKNetworkUpdate_ChannelClosed,
+ LDKClosureReason_CommitmentTxConfirmed,
/**
- * An error indicating only that a node has failed, which should be applied via
- * [`NetworkGraph::fail_node`].
+ * Closure generated from processing an event, likely a HTLC forward/relay/reception.
*/
- LDKNetworkUpdate_NodeFailure,
+ LDKClosureReason_ProcessingError,
/**
- * Must be last for serialization purposes
- */
- LDKNetworkUpdate_Sentinel,
-} LDKNetworkUpdate_Tag;
-
+ * The `PeerManager` informed us that we've disconnected from the peer. We close channels
+ * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the
+ * peer again in the future or if the peer disconnected before we finished negotiating
+ * the channel open. The first case may be caused by incompatible features which our
+ * counterparty, or we, require.
+ */
+ LDKClosureReason_DisconnectedPeer,
+ /**
+ * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
+ * the ChannelManager deserialized.
+ */
+ LDKClosureReason_OutdatedChannelManager,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKClosureReason_Sentinel,
+} LDKClosureReason_Tag;
+
+typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
+ /**
+ * The error which the peer sent us.
+ *
+ * The string should be sanitized before it is used (e.g emitted to logs
+ * or printed to stdout). Otherwise, a well crafted error message may exploit
+ * a security vulnerability in the terminal emulator or the logging subsystem.
+ */
+ struct LDKStr peer_msg;
+} LDKClosureReason_LDKCounterpartyForceClosed_Body;
+
+typedef struct LDKClosureReason_LDKProcessingError_Body {
+ /**
+ * A developer-readable error message which we generated.
+ */
+ struct LDKStr err;
+} LDKClosureReason_LDKProcessingError_Body;
+
+typedef struct MUST_USE_STRUCT LDKClosureReason {
+ LDKClosureReason_Tag tag;
+ union {
+ LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
+ LDKClosureReason_LDKProcessingError_Body processing_error;
+ };
+} LDKClosureReason;
+
+/**
+ * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
+ */
+typedef enum LDKCOption_ClosureReasonZ_Tag {
+ /**
+ * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
+ */
+ LDKCOption_ClosureReasonZ_Some,
+ /**
+ * When we're in this state, this COption_ClosureReasonZ contains nothing
+ */
+ LDKCOption_ClosureReasonZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_ClosureReasonZ_Sentinel,
+} LDKCOption_ClosureReasonZ_Tag;
+
+typedef struct LDKCOption_ClosureReasonZ {
+ LDKCOption_ClosureReasonZ_Tag tag;
+ union {
+ struct {
+ struct LDKClosureReason some;
+ };
+ };
+} LDKCOption_ClosureReasonZ;
+
+/**
+ * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
+ */
+typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKCOption_ClosureReasonZ *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
+
+/**
+ * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
+ /**
+ * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_COption_ClosureReasonZDecodeErrorZ;
+
+
+
+/**
+ * A channel_update message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKChannelUpdate {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeChannelUpdate *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKChannelUpdate;
+
+/**
+ * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
+ * return packet by a node along the route. See [BOLT #4] for details.
+ *
+ * [BOLT #4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md
+ */
+typedef enum LDKNetworkUpdate_Tag {
+ /**
+ * An error indicating a `channel_update` messages should be applied via
+ * [`NetworkGraph::update_channel`].
+ */
+ LDKNetworkUpdate_ChannelUpdateMessage,
+ /**
+ * An error indicating only that a channel has been closed, which should be applied via
+ * [`NetworkGraph::close_channel_from_update`].
+ */
+ LDKNetworkUpdate_ChannelClosed,
+ /**
+ * An error indicating only that a node has failed, which should be applied via
+ * [`NetworkGraph::fail_node`].
+ */
+ LDKNetworkUpdate_NodeFailure,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKNetworkUpdate_Sentinel,
+} LDKNetworkUpdate_Tag;
+
typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
/**
* The update to apply via [`NetworkGraph::update_channel`].
uintptr_t datalen;
} LDKCVec_SpendableOutputDescriptorZ;
-
-
/**
- * An accept_channel message to be sent or received from a peer
+ * Some information provided on receipt of payment depends on whether the payment received is a
+ * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
*/
-typedef struct MUST_USE_STRUCT LDKAcceptChannel {
+typedef enum LDKPaymentPurpose_Tag {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * Information for receiving a payment that we generated an invoice for.
*/
- LDKnativeAcceptChannel *inner;
+ LDKPaymentPurpose_InvoicePayment,
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Because this is a spontaneous payment, the payer generated their own preimage rather than us
+ * (the payee) providing a preimage.
*/
- bool is_owned;
-} LDKAcceptChannel;
-
-
-
-/**
- * An open_channel message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKOpenChannel {
+ LDKPaymentPurpose_SpontaneousPayment,
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * Must be last for serialization purposes
*/
- LDKnativeOpenChannel *inner;
+ LDKPaymentPurpose_Sentinel,
+} LDKPaymentPurpose_Tag;
+
+typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
+ * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
+ * [`ChannelManager::claim_funds`].
+ *
+ * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
+ * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- bool is_owned;
-} LDKOpenChannel;
-
-
-
-/**
- * A funding_created message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKFundingCreated {
+ struct LDKThirtyTwoBytes payment_preimage;
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The \"payment secret\". This authenticates the sender to the recipient, preventing a
+ * number of deanonymization attacks during the routing process.
+ * It is provided here for your reference, however its accuracy is enforced directly by
+ * [`ChannelManager`] using the values you previously provided to
+ * [`ChannelManager::create_inbound_payment`] or
+ * [`ChannelManager::create_inbound_payment_for_hash`].
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
+ * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
*/
- LDKnativeFundingCreated *inner;
+ struct LDKThirtyTwoBytes payment_secret;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * This is the `user_payment_id` which was provided to
+ * [`ChannelManager::create_inbound_payment_for_hash`] or
+ * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
+ * simply copied here. It may be used to correlate PaymentReceived events with invoice
+ * metadata stored elsewhere.
+ *
+ * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
+ * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
*/
- bool is_owned;
-} LDKFundingCreated;
-
+ uint64_t user_payment_id;
+} LDKPaymentPurpose_LDKInvoicePayment_Body;
+typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
+ LDKPaymentPurpose_Tag tag;
+ union {
+ LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
+ struct {
+ struct LDKThirtyTwoBytes spontaneous_payment;
+ };
+ };
+} LDKPaymentPurpose;
/**
- * A funding_signed message to be sent or received from a peer
+ * An Event which you should probably take some action in response to.
+ *
+ * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
+ * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
+ * written as it makes no sense to respond to it after reconnecting to peers).
*/
-typedef struct MUST_USE_STRUCT LDKFundingSigned {
+typedef enum LDKEvent_Tag {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * Used to indicate that the client should generate a funding transaction with the given
+ * parameters and then call ChannelManager::funding_transaction_generated.
+ * Generated in ChannelManager message handling.
+ * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
+ * counterparty can steal your funds!
*/
- LDKnativeFundingSigned *inner;
+ LDKEvent_FundingGenerationReady,
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
- */
- bool is_owned;
-} LDKFundingSigned;
-
-
-
-/**
- * A funding_locked message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKFundingLocked {
+ * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
+ * [`ChannelManager::claim_funds`] to get it....
+ * Note that if the preimage is not known, you should call
+ * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
+ * network congestion.
+ * If you fail to call either [`ChannelManager::claim_funds`] or
+ * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
+ * automatically failed.
+ *
+ * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
+ * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
+ */
+ LDKEvent_PaymentReceived,
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
+ * and we got back the payment preimage for it).
+ *
+ * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
+ * event. In this situation, you SHOULD treat this payment as having succeeded.
*/
- LDKnativeFundingLocked *inner;
+ LDKEvent_PaymentSent,
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Indicates an outbound payment we made failed. Probably some intermediary node dropped
+ * something. You may wish to retry with a different route.
*/
- bool is_owned;
-} LDKFundingLocked;
-
-
-
-/**
- * An announcement_signatures message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
+ LDKEvent_PaymentPathFailed,
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
+ * time in the future.
*/
- LDKnativeAnnouncementSignatures *inner;
+ LDKEvent_PendingHTLCsForwardable,
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Used to indicate that an output which you should know how to spend was confirmed on chain
+ * and is now spendable.
+ * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
+ * counterparty spending them due to some kind of timeout. Thus, you need to store them
+ * somewhere and spend them when you create on-chain transactions.
*/
- bool is_owned;
-} LDKAnnouncementSignatures;
-
-
-
-/**
- * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
- * transaction updates if they were pending.
- */
-typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
+ LDKEvent_SpendableOutputs,
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * This event is generated when a payment has been successfully forwarded through us and a
+ * forwarding fee earned.
*/
- LDKnativeCommitmentUpdate *inner;
+ LDKEvent_PaymentForwarded,
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Used to indicate that a channel with the given `channel_id` is in the process of closure.
*/
- bool is_owned;
-} LDKCommitmentUpdate;
-
-
-
-/**
- * A revoke_and_ack message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
+ LDKEvent_ChannelClosed,
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * Used to indicate to the user that they can abandon the funding transaction and recycle the
+ * inputs for another purpose.
*/
- LDKnativeRevokeAndACK *inner;
+ LDKEvent_DiscardFunding,
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Must be last for serialization purposes
*/
- bool is_owned;
-} LDKRevokeAndACK;
-
-
+ LDKEvent_Sentinel,
+} LDKEvent_Tag;
-/**
- * A closing_signed message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKClosingSigned {
+typedef struct LDKEvent_LDKFundingGenerationReady_Body {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The random channel_id we picked which you'll need to pass into
+ * ChannelManager::funding_transaction_generated.
*/
- LDKnativeClosingSigned *inner;
+ struct LDKThirtyTwoBytes temporary_channel_id;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The value, in satoshis, that the output should have.
*/
- bool is_owned;
-} LDKClosingSigned;
-
-
-
-/**
- * A shutdown message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKShutdown {
+ uint64_t channel_value_satoshis;
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The script which should be used in the transaction output.
*/
- LDKnativeShutdown *inner;
+ struct LDKCVec_u8Z output_script;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
+ * an inbound channel.
+ *
+ * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
*/
- bool is_owned;
-} LDKShutdown;
-
-
+ uint64_t user_channel_id;
+} LDKEvent_LDKFundingGenerationReady_Body;
-/**
- * A channel_reestablish message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKChannelReestablish {
- /**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeChannelReestablish *inner;
+typedef struct LDKEvent_LDKPaymentReceived_Body {
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The hash for which the preimage should be handed to the ChannelManager.
*/
- bool is_owned;
-} LDKChannelReestablish;
-
-
-
-/**
- * A channel_announcement message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
+ struct LDKThirtyTwoBytes payment_hash;
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The value, in thousandths of a satoshi, that this payment is for.
*/
- LDKnativeChannelAnnouncement *inner;
+ uint64_t amt;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Information for claiming this received payment, based on whether the purpose of the
+ * payment is to pay an invoice or to send a spontaneous payment.
*/
- bool is_owned;
-} LDKChannelAnnouncement;
-
-
+ struct LDKPaymentPurpose purpose;
+} LDKEvent_LDKPaymentReceived_Body;
-/**
- * A node_announcement message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
+typedef struct LDKEvent_LDKPaymentSent_Body {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The id returned by [`ChannelManager::send_payment`] and used with
+ * [`ChannelManager::retry_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- LDKnativeNodeAnnouncement *inner;
+ struct LDKThirtyTwoBytes payment_id;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The preimage to the hash given to ChannelManager::send_payment.
+ * Note that this serves as a payment receipt, if you wish to have such a thing, you must
+ * store it somehow!
*/
- bool is_owned;
-} LDKNodeAnnouncement;
-
-
-
-/**
- * An error message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKErrorMessage {
+ struct LDKThirtyTwoBytes payment_preimage;
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The hash which was given to [`ChannelManager::send_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
*/
- LDKnativeErrorMessage *inner;
+ struct LDKThirtyTwoBytes payment_hash;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The total fee which was spent at intermediate hops in this payment, across all paths.
+ *
+ * Note that, like [`Route::get_total_fees`] this does *not* include any potential
+ * overpayment to the recipient node.
+ *
+ * If the recipient or an intermediate node misbehaves and gives us free money, this may
+ * overstate the amount paid, though this is unlikely.
+ *
+ * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
*/
- bool is_owned;
-} LDKErrorMessage;
+ struct LDKCOption_u64Z fee_paid_msat;
+} LDKEvent_LDKPaymentSent_Body;
-/**
- * Used to put an error message in a LightningError
- */
-typedef enum LDKErrorAction_Tag {
+typedef struct LDKEvent_LDKPaymentPathFailed_Body {
/**
- * The peer took some action which made us think they were useless. Disconnect them.
+ * The id returned by [`ChannelManager::send_payment`] and used with
+ * [`ChannelManager::retry_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- LDKErrorAction_DisconnectPeer,
+ struct LDKThirtyTwoBytes payment_id;
/**
- * The peer did something harmless that we weren't able to process, just log and ignore
+ * The hash which was given to ChannelManager::send_payment.
*/
- LDKErrorAction_IgnoreError,
+ struct LDKThirtyTwoBytes payment_hash;
/**
- * The peer did something harmless that we weren't able to meaningfully process.
- * If the error is logged, log it at the given level.
- */
- LDKErrorAction_IgnoreAndLog,
+ * Indicates the payment was rejected for some reason by the recipient. This implies that
+ * the payment has failed, not just the route in question. If this is not set, you may
+ * retry the payment via a different route.
+ */
+ bool rejected_by_dest;
/**
- * The peer did something incorrect. Tell them.
+ * Any failure information conveyed via the Onion return packet by a node along the failed
+ * payment route.
+ *
+ * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
+ * account the update. [`NetGraphMsgHandler`] is capable of doing this.
+ *
+ * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
+ * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
*/
- LDKErrorAction_SendErrorMessage,
+ struct LDKCOption_NetworkUpdateZ network_update;
/**
- * Must be last for serialization purposes
+ * For both single-path and multi-path payments, this is set if all paths of the payment have
+ * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
+ * larger MPP payment were still in flight when this event was generated.
*/
- LDKErrorAction_Sentinel,
-} LDKErrorAction_Tag;
-
-typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
+ bool all_paths_failed;
/**
- * An error message which we should make an effort to send before we disconnect.
+ * The payment path that failed.
+ */
+ struct LDKCVec_RouteHopZ path;
+ /**
+ * The channel responsible for the failed payment path.
+ *
+ * If this is `Some`, then the corresponding channel should be avoided when the payment is
+ * retried. May be `None` for older [`Event`] serializations.
+ */
+ struct LDKCOption_u64Z short_channel_id;
+ /**
+ * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
+ *
+ * See [`find_route`] for details.
+ *
+ * [`Route`]: crate::routing::router::Route
+ * [`find_route`]: crate::routing::router::find_route
*
* Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- struct LDKErrorMessage msg;
-} LDKErrorAction_LDKDisconnectPeer_Body;
+ struct LDKRouteParameters retry;
+} LDKEvent_LDKPaymentPathFailed_Body;
-typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
+typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
/**
- * The message to send.
+ * The minimum amount of time that should be waited prior to calling
+ * process_pending_htlc_forwards. To increase the effort required to correlate payments,
+ * you should wait a random amount of time in roughly the range (now + time_forwardable,
+ * now + 5*time_forwardable).
*/
- struct LDKErrorMessage msg;
-} LDKErrorAction_LDKSendErrorMessage_Body;
+ uint64_t time_forwardable;
+} LDKEvent_LDKPendingHTLCsForwardable_Body;
-typedef struct MUST_USE_STRUCT LDKErrorAction {
- LDKErrorAction_Tag tag;
+typedef struct LDKEvent_LDKSpendableOutputs_Body {
+ /**
+ * The outputs which you should store as spendable by you.
+ */
+ struct LDKCVec_SpendableOutputDescriptorZ outputs;
+} LDKEvent_LDKSpendableOutputs_Body;
+
+typedef struct LDKEvent_LDKPaymentForwarded_Body {
+ /**
+ * The fee, in milli-satoshis, which was earned as a result of the payment.
+ *
+ * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
+ * was pending, the amount the next hop claimed will have been rounded down to the nearest
+ * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
+ * claimed the full value in millisatoshis from the source. In this case,
+ * `claim_from_onchain_tx` will be set.
+ *
+ * If the channel which sent us the payment has been force-closed, we will claim the funds
+ * via an on-chain transaction. In that case we do not yet know the on-chain transaction
+ * fees which we will spend and will instead set this to `None`. It is possible duplicate
+ * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
+ * `None`.
+ */
+ struct LDKCOption_u64Z fee_earned_msat;
+ /**
+ * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
+ * transaction.
+ */
+ bool claim_from_onchain_tx;
+} LDKEvent_LDKPaymentForwarded_Body;
+
+typedef struct LDKEvent_LDKChannelClosed_Body {
+ /**
+ * The channel_id of the channel which has been closed. Note that on-chain transactions
+ * resolving the channel are likely still awaiting confirmation.
+ */
+ struct LDKThirtyTwoBytes channel_id;
+ /**
+ * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
+ * an inbound channel. This will always be zero for objects serialized with LDK versions
+ * prior to 0.0.102.
+ *
+ * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
+ */
+ uint64_t user_channel_id;
+ /**
+ * The reason the channel was closed.
+ */
+ struct LDKClosureReason reason;
+} LDKEvent_LDKChannelClosed_Body;
+
+typedef struct LDKEvent_LDKDiscardFunding_Body {
+ /**
+ * The channel_id of the channel which has been closed.
+ */
+ struct LDKThirtyTwoBytes channel_id;
+ /**
+ * The full transaction received from the user
+ */
+ struct LDKTransaction transaction;
+} LDKEvent_LDKDiscardFunding_Body;
+
+typedef struct MUST_USE_STRUCT LDKEvent {
+ LDKEvent_Tag tag;
+ union {
+ LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
+ LDKEvent_LDKPaymentReceived_Body payment_received;
+ LDKEvent_LDKPaymentSent_Body payment_sent;
+ LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
+ LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
+ LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
+ LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
+ LDKEvent_LDKChannelClosed_Body channel_closed;
+ LDKEvent_LDKDiscardFunding_Body discard_funding;
+ };
+} LDKEvent;
+
+/**
+ * An enum which can either contain a crate::lightning::util::events::Event or not
+ */
+typedef enum LDKCOption_EventZ_Tag {
+ /**
+ * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
+ */
+ LDKCOption_EventZ_Some,
+ /**
+ * When we're in this state, this COption_EventZ contains nothing
+ */
+ LDKCOption_EventZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_EventZ_Sentinel,
+} LDKCOption_EventZ_Tag;
+
+typedef struct LDKCOption_EventZ {
+ LDKCOption_EventZ_Tag tag;
union {
- LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
struct {
- enum LDKLevel ignore_and_log;
+ struct LDKEvent some;
};
- LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
};
-} LDKErrorAction;
+} LDKCOption_EventZ;
+
+/**
+ * The contents of CResult_COption_EventZDecodeErrorZ
+ */
+typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKCOption_EventZ *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_COption_EventZDecodeErrorZPtr;
+
+/**
+ * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_COption_EventZDecodeErrorZ {
+ /**
+ * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_COption_EventZDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_COption_EventZDecodeErrorZ;
/**
- * A query_channel_range message is used to query a peer for channel
- * UTXOs in a range of blocks. The recipient of a query makes a best
- * effort to reply to the query using one or more reply_channel_range
- * messages.
+ * An accept_channel message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
+typedef struct MUST_USE_STRUCT LDKAcceptChannel {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeQueryChannelRange *inner;
+ LDKnativeAcceptChannel *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKQueryChannelRange;
+} LDKAcceptChannel;
/**
- * A query_short_channel_ids message is used to query a peer for
- * routing gossip messages related to one or more short_channel_ids.
- * The query recipient will reply with the latest, if available,
- * channel_announcement, channel_update and node_announcement messages
- * it maintains for the requested short_channel_ids followed by a
- * reply_short_channel_ids_end message. The short_channel_ids sent in
- * this query are encoded. We only support encoding_type=0 uncompressed
- * serialization and do not support encoding_type=1 zlib serialization.
+ * An open_channel message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
+typedef struct MUST_USE_STRUCT LDKOpenChannel {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeQueryShortChannelIds *inner;
+ LDKnativeOpenChannel *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKQueryShortChannelIds;
+} LDKOpenChannel;
/**
- * A reply_channel_range message is a reply to a query_channel_range
- * message. Multiple reply_channel_range messages can be sent in reply
- * to a single query_channel_range message. The query recipient makes a
- * best effort to respond based on their local network view which may
- * not be a perfect view of the network. The short_channel_ids in the
- * reply are encoded. We only support encoding_type=0 uncompressed
- * serialization and do not support encoding_type=1 zlib serialization.
+ * A funding_created message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
+typedef struct MUST_USE_STRUCT LDKFundingCreated {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeReplyChannelRange *inner;
+ LDKnativeFundingCreated *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKReplyChannelRange;
+} LDKFundingCreated;
+
+
/**
- * An event generated by ChannelManager which indicates a message should be sent to a peer (or
- * broadcast to most peers).
- * These events are handled by PeerManager::process_events if you are using a PeerManager.
+ * A funding_signed message to be sent or received from a peer
*/
-typedef enum LDKMessageSendEvent_Tag {
- /**
- * Used to indicate that we've accepted a channel open and should send the accept_channel
- * message provided to the given peer.
- */
- LDKMessageSendEvent_SendAcceptChannel,
- /**
- * Used to indicate that we've initiated a channel open and should send the open_channel
- * message provided to the given peer.
- */
- LDKMessageSendEvent_SendOpenChannel,
+typedef struct MUST_USE_STRUCT LDKFundingSigned {
/**
- * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKMessageSendEvent_SendFundingCreated,
+ LDKnativeFundingSigned *inner;
/**
- * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- LDKMessageSendEvent_SendFundingSigned,
+ bool is_owned;
+} LDKFundingSigned;
+
+
+
+/**
+ * A funding_locked message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKFundingLocked {
/**
- * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKMessageSendEvent_SendFundingLocked,
+ LDKnativeFundingLocked *inner;
/**
- * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- LDKMessageSendEvent_SendAnnouncementSignatures,
- /**
- * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
- * message should be sent to the peer with the given node_id.
- */
- LDKMessageSendEvent_UpdateHTLCs,
- /**
- * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
- */
- LDKMessageSendEvent_SendRevokeAndACK,
+ bool is_owned;
+} LDKFundingLocked;
+
+
+
+/**
+ * An announcement_signatures message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
/**
- * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKMessageSendEvent_SendClosingSigned,
+ LDKnativeAnnouncementSignatures *inner;
/**
- * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- LDKMessageSendEvent_SendShutdown,
+ bool is_owned;
+} LDKAnnouncementSignatures;
+
+
+
+/**
+ * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
+ * transaction updates if they were pending.
+ */
+typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
/**
- * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKMessageSendEvent_SendChannelReestablish,
+ LDKnativeCommitmentUpdate *inner;
/**
- * Used to indicate that a channel_announcement and channel_update should be broadcast to all
- * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
- *
- * Note that after doing so, you very likely (unless you did so very recently) want to call
- * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
- * This ensures that any nodes which see our channel_announcement also have a relevant
- * node_announcement, including relevant feature flags which may be important for routing
- * through or to us.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- LDKMessageSendEvent_BroadcastChannelAnnouncement,
+ bool is_owned;
+} LDKCommitmentUpdate;
+
+
+
+/**
+ * A revoke_and_ack message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
/**
- * Used to indicate that a node_announcement should be broadcast to all peers.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKMessageSendEvent_BroadcastNodeAnnouncement,
+ LDKnativeRevokeAndACK *inner;
/**
- * Used to indicate that a channel_update should be broadcast to all peers.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- LDKMessageSendEvent_BroadcastChannelUpdate,
+ bool is_owned;
+} LDKRevokeAndACK;
+
+
+
+/**
+ * A closing_signed message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKClosingSigned {
/**
- * Used to indicate that a channel_update should be sent to a single peer.
- * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
- * private channel and we shouldn't be informing all of our peers of channel parameters.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKMessageSendEvent_SendChannelUpdate,
+ LDKnativeClosingSigned *inner;
/**
- * Broadcast an error downstream to be handled
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- LDKMessageSendEvent_HandleError,
+ bool is_owned;
+} LDKClosingSigned;
+
+
+
+/**
+ * A shutdown message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKShutdown {
/**
- * Query a peer for channels with funding transaction UTXOs in a block range.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKMessageSendEvent_SendChannelRangeQuery,
+ LDKnativeShutdown *inner;
/**
- * Request routing gossip messages from a peer for a list of channels identified by
- * their short_channel_ids.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- LDKMessageSendEvent_SendShortIdsQuery,
+ bool is_owned;
+} LDKShutdown;
+
+
+
+/**
+ * A channel_reestablish message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKChannelReestablish {
/**
- * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
- * emitted during processing of the query.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKMessageSendEvent_SendReplyChannelRange,
+ LDKnativeChannelReestablish *inner;
/**
- * Must be last for serialization purposes
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- LDKMessageSendEvent_Sentinel,
-} LDKMessageSendEvent_Tag;
+ bool is_owned;
+} LDKChannelReestablish;
-typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
+
+
+/**
+ * A channel_announcement message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
/**
- * The node_id of the node which should receive this message
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKPublicKey node_id;
+ LDKnativeChannelAnnouncement *inner;
/**
- * The message which should be sent.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- struct LDKAcceptChannel msg;
-} LDKMessageSendEvent_LDKSendAcceptChannel_Body;
+ bool is_owned;
+} LDKChannelAnnouncement;
-typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
+
+
+/**
+ * A node_announcement message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
/**
- * The node_id of the node which should receive this message
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKPublicKey node_id;
+ LDKnativeNodeAnnouncement *inner;
/**
- * The message which should be sent.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- struct LDKOpenChannel msg;
-} LDKMessageSendEvent_LDKSendOpenChannel_Body;
+ bool is_owned;
+} LDKNodeAnnouncement;
-typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
+
+
+/**
+ * An error message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKErrorMessage {
/**
- * The node_id of the node which should receive this message
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKPublicKey node_id;
+ LDKnativeErrorMessage *inner;
/**
- * The message which should be sent.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- struct LDKFundingCreated msg;
-} LDKMessageSendEvent_LDKSendFundingCreated_Body;
+ bool is_owned;
+} LDKErrorMessage;
-typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
+/**
+ * Used to put an error message in a LightningError
+ */
+typedef enum LDKErrorAction_Tag {
/**
- * The node_id of the node which should receive this message
+ * The peer took some action which made us think they were useless. Disconnect them.
*/
- struct LDKPublicKey node_id;
+ LDKErrorAction_DisconnectPeer,
/**
- * The message which should be sent.
+ * The peer did something harmless that we weren't able to process, just log and ignore
*/
- struct LDKFundingSigned msg;
-} LDKMessageSendEvent_LDKSendFundingSigned_Body;
-
-typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
+ LDKErrorAction_IgnoreError,
/**
- * The node_id of the node which should receive these message(s)
+ * The peer did something harmless that we weren't able to meaningfully process.
+ * If the error is logged, log it at the given level.
*/
- struct LDKPublicKey node_id;
+ LDKErrorAction_IgnoreAndLog,
/**
- * The funding_locked message which should be sent.
+ * The peer did something incorrect. Tell them.
*/
- struct LDKFundingLocked msg;
-} LDKMessageSendEvent_LDKSendFundingLocked_Body;
-
-typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
+ LDKErrorAction_SendErrorMessage,
/**
- * The node_id of the node which should receive these message(s)
+ * Must be last for serialization purposes
*/
- struct LDKPublicKey node_id;
+ LDKErrorAction_Sentinel,
+} LDKErrorAction_Tag;
+
+typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
/**
- * The announcement_signatures message which should be sent.
+ * An error message which we should make an effort to send before we disconnect.
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- struct LDKAnnouncementSignatures msg;
-} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
+ struct LDKErrorMessage msg;
+} LDKErrorAction_LDKDisconnectPeer_Body;
-typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
+typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
/**
- * The node_id of the node which should receive these message(s)
+ * The message to send.
*/
- struct LDKPublicKey node_id;
+ struct LDKErrorMessage msg;
+} LDKErrorAction_LDKSendErrorMessage_Body;
+
+typedef struct MUST_USE_STRUCT LDKErrorAction {
+ LDKErrorAction_Tag tag;
+ union {
+ LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
+ struct {
+ enum LDKLevel ignore_and_log;
+ };
+ LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
+ };
+} LDKErrorAction;
+
+
+
+/**
+ * A query_channel_range message is used to query a peer for channel
+ * UTXOs in a range of blocks. The recipient of a query makes a best
+ * effort to reply to the query using one or more reply_channel_range
+ * messages.
+ */
+typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
/**
- * The update messages which should be sent. ALL messages in the struct should be sent!
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKCommitmentUpdate updates;
-} LDKMessageSendEvent_LDKUpdateHTLCs_Body;
+ LDKnativeQueryChannelRange *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKQueryChannelRange;
-typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
+
+
+/**
+ * A query_short_channel_ids message is used to query a peer for
+ * routing gossip messages related to one or more short_channel_ids.
+ * The query recipient will reply with the latest, if available,
+ * channel_announcement, channel_update and node_announcement messages
+ * it maintains for the requested short_channel_ids followed by a
+ * reply_short_channel_ids_end message. The short_channel_ids sent in
+ * this query are encoded. We only support encoding_type=0 uncompressed
+ * serialization and do not support encoding_type=1 zlib serialization.
+ */
+typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
/**
- * The node_id of the node which should receive this message
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKPublicKey node_id;
+ LDKnativeQueryShortChannelIds *inner;
/**
- * The message which should be sent.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- struct LDKRevokeAndACK msg;
-} LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
+ bool is_owned;
+} LDKQueryShortChannelIds;
-typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
+
+
+/**
+ * A reply_channel_range message is a reply to a query_channel_range
+ * message. Multiple reply_channel_range messages can be sent in reply
+ * to a single query_channel_range message. The query recipient makes a
+ * best effort to respond based on their local network view which may
+ * not be a perfect view of the network. The short_channel_ids in the
+ * reply are encoded. We only support encoding_type=0 uncompressed
+ * serialization and do not support encoding_type=1 zlib serialization.
+ */
+typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
/**
- * The node_id of the node which should receive this message
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKPublicKey node_id;
+ LDKnativeReplyChannelRange *inner;
/**
- * The message which should be sent.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- struct LDKClosingSigned msg;
-} LDKMessageSendEvent_LDKSendClosingSigned_Body;
+ bool is_owned;
+} LDKReplyChannelRange;
-typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
+/**
+ * An event generated by ChannelManager which indicates a message should be sent to a peer (or
+ * broadcast to most peers).
+ * These events are handled by PeerManager::process_events if you are using a PeerManager.
+ */
+typedef enum LDKMessageSendEvent_Tag {
/**
- * The node_id of the node which should receive this message
+ * Used to indicate that we've accepted a channel open and should send the accept_channel
+ * message provided to the given peer.
*/
- struct LDKPublicKey node_id;
+ LDKMessageSendEvent_SendAcceptChannel,
/**
- * The message which should be sent.
+ * Used to indicate that we've initiated a channel open and should send the open_channel
+ * message provided to the given peer.
*/
- struct LDKShutdown msg;
-} LDKMessageSendEvent_LDKSendShutdown_Body;
-
-typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
+ LDKMessageSendEvent_SendOpenChannel,
/**
- * The node_id of the node which should receive this message
+ * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
*/
- struct LDKPublicKey node_id;
+ LDKMessageSendEvent_SendFundingCreated,
/**
- * The message which should be sent.
+ * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
*/
- struct LDKChannelReestablish msg;
-} LDKMessageSendEvent_LDKSendChannelReestablish_Body;
-
-typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
+ LDKMessageSendEvent_SendFundingSigned,
/**
- * The channel_announcement which should be sent.
+ * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
*/
- struct LDKChannelAnnouncement msg;
+ LDKMessageSendEvent_SendFundingLocked,
/**
- * The followup channel_update which should be sent.
+ * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
*/
- struct LDKChannelUpdate update_msg;
-} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
-
-typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
+ LDKMessageSendEvent_SendAnnouncementSignatures,
/**
- * The node_announcement which should be sent.
+ * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
+ * message should be sent to the peer with the given node_id.
*/
- struct LDKNodeAnnouncement msg;
-} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
-
-typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
+ LDKMessageSendEvent_UpdateHTLCs,
/**
- * The channel_update which should be sent.
+ * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
*/
- struct LDKChannelUpdate msg;
-} LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
+ LDKMessageSendEvent_SendRevokeAndACK,
+ /**
+ * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
+ */
+ LDKMessageSendEvent_SendClosingSigned,
+ /**
+ * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
+ */
+ LDKMessageSendEvent_SendShutdown,
+ /**
+ * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
+ */
+ LDKMessageSendEvent_SendChannelReestablish,
+ /**
+ * Used to indicate that a channel_announcement and channel_update should be broadcast to all
+ * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
+ *
+ * Note that after doing so, you very likely (unless you did so very recently) want to call
+ * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
+ * This ensures that any nodes which see our channel_announcement also have a relevant
+ * node_announcement, including relevant feature flags which may be important for routing
+ * through or to us.
+ */
+ LDKMessageSendEvent_BroadcastChannelAnnouncement,
+ /**
+ * Used to indicate that a node_announcement should be broadcast to all peers.
+ */
+ LDKMessageSendEvent_BroadcastNodeAnnouncement,
+ /**
+ * Used to indicate that a channel_update should be broadcast to all peers.
+ */
+ LDKMessageSendEvent_BroadcastChannelUpdate,
+ /**
+ * Used to indicate that a channel_update should be sent to a single peer.
+ * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
+ * private channel and we shouldn't be informing all of our peers of channel parameters.
+ */
+ LDKMessageSendEvent_SendChannelUpdate,
+ /**
+ * Broadcast an error downstream to be handled
+ */
+ LDKMessageSendEvent_HandleError,
+ /**
+ * Query a peer for channels with funding transaction UTXOs in a block range.
+ */
+ LDKMessageSendEvent_SendChannelRangeQuery,
+ /**
+ * Request routing gossip messages from a peer for a list of channels identified by
+ * their short_channel_ids.
+ */
+ LDKMessageSendEvent_SendShortIdsQuery,
+ /**
+ * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
+ * emitted during processing of the query.
+ */
+ LDKMessageSendEvent_SendReplyChannelRange,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKMessageSendEvent_Sentinel,
+} LDKMessageSendEvent_Tag;
-typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
+typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
/**
* The node_id of the node which should receive this message
*/
struct LDKPublicKey node_id;
/**
- * The channel_update which should be sent.
+ * The message which should be sent.
*/
- struct LDKChannelUpdate msg;
-} LDKMessageSendEvent_LDKSendChannelUpdate_Body;
+ struct LDKAcceptChannel msg;
+} LDKMessageSendEvent_LDKSendAcceptChannel_Body;
-typedef struct LDKMessageSendEvent_LDKHandleError_Body {
+typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
/**
* The node_id of the node which should receive this message
*/
struct LDKPublicKey node_id;
/**
- * The action which should be taken.
+ * The message which should be sent.
*/
- struct LDKErrorAction action;
-} LDKMessageSendEvent_LDKHandleError_Body;
+ struct LDKOpenChannel msg;
+} LDKMessageSendEvent_LDKSendOpenChannel_Body;
-typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
+typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
/**
- * The node_id of this message recipient
+ * The node_id of the node which should receive this message
*/
struct LDKPublicKey node_id;
/**
- * The query_channel_range which should be sent.
+ * The message which should be sent.
*/
- struct LDKQueryChannelRange msg;
-} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
+ struct LDKFundingCreated msg;
+} LDKMessageSendEvent_LDKSendFundingCreated_Body;
-typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
+typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
/**
- * The node_id of this message recipient
+ * The node_id of the node which should receive this message
*/
struct LDKPublicKey node_id;
/**
- * The query_short_channel_ids which should be sent.
+ * The message which should be sent.
*/
- struct LDKQueryShortChannelIds msg;
-} LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
+ struct LDKFundingSigned msg;
+} LDKMessageSendEvent_LDKSendFundingSigned_Body;
-typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
+typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
/**
- * The node_id of this message recipient
+ * The node_id of the node which should receive these message(s)
*/
struct LDKPublicKey node_id;
/**
- * The reply_channel_range which should be sent.
+ * The funding_locked message which should be sent.
*/
- struct LDKReplyChannelRange msg;
-} LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
+ struct LDKFundingLocked msg;
+} LDKMessageSendEvent_LDKSendFundingLocked_Body;
-typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
- LDKMessageSendEvent_Tag tag;
- union {
- LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
- LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
- LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
- LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
- LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
- LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
- LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
- LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
- LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
- LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
- LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
- LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
- LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
- LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
- LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
- LDKMessageSendEvent_LDKHandleError_Body handle_error;
- LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
- LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
- LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
- };
-} LDKMessageSendEvent;
-
-/**
- * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_MessageSendEventZ {
+typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * The node_id of the node which should receive these message(s)
*/
- struct LDKMessageSendEvent *data;
+ struct LDKPublicKey node_id;
/**
- * The number of elements pointed to by `data`.
+ * The announcement_signatures message which should be sent.
*/
- uintptr_t datalen;
-} LDKCVec_MessageSendEventZ;
-
-
+ struct LDKAnnouncementSignatures msg;
+} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
-/**
- * Features used within an `init` message.
- */
-typedef struct MUST_USE_STRUCT LDKInitFeatures {
+typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The node_id of the node which should receive these message(s)
*/
- LDKnativeInitFeatures *inner;
+ struct LDKPublicKey node_id;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The update messages which should be sent. ALL messages in the struct should be sent!
*/
- bool is_owned;
-} LDKInitFeatures;
+ struct LDKCommitmentUpdate updates;
+} LDKMessageSendEvent_LDKUpdateHTLCs_Body;
-/**
- * The contents of CResult_InitFeaturesDecodeErrorZ
- */
-typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
+typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The node_id of the node which should receive this message
*/
- struct LDKInitFeatures *result;
+ struct LDKPublicKey node_id;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The message which should be sent.
*/
- struct LDKDecodeError *err;
-} LDKCResult_InitFeaturesDecodeErrorZPtr;
+ struct LDKRevokeAndACK msg;
+} LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
-/**
- * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
+typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
/**
- * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The node_id of the node which should receive this message
*/
- union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
+ struct LDKPublicKey node_id;
/**
- * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
+ * The message which should be sent.
*/
- bool result_ok;
-} LDKCResult_InitFeaturesDecodeErrorZ;
-
-
+ struct LDKClosingSigned msg;
+} LDKMessageSendEvent_LDKSendClosingSigned_Body;
-/**
- * Features used within a `node_announcement` message.
- */
-typedef struct MUST_USE_STRUCT LDKNodeFeatures {
+typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The node_id of the node which should receive this message
*/
- LDKnativeNodeFeatures *inner;
+ struct LDKPublicKey node_id;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The message which should be sent.
*/
- bool is_owned;
-} LDKNodeFeatures;
+ struct LDKShutdown msg;
+} LDKMessageSendEvent_LDKSendShutdown_Body;
-/**
- * The contents of CResult_NodeFeaturesDecodeErrorZ
- */
-typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
+typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The node_id of the node which should receive this message
*/
- struct LDKNodeFeatures *result;
+ struct LDKPublicKey node_id;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The message which should be sent.
*/
- struct LDKDecodeError *err;
-} LDKCResult_NodeFeaturesDecodeErrorZPtr;
+ struct LDKChannelReestablish msg;
+} LDKMessageSendEvent_LDKSendChannelReestablish_Body;
-/**
- * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
+typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
/**
- * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The channel_announcement which should be sent.
*/
- union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
+ struct LDKChannelAnnouncement msg;
/**
- * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
+ * The followup channel_update which should be sent.
*/
- bool result_ok;
-} LDKCResult_NodeFeaturesDecodeErrorZ;
+ struct LDKChannelUpdate update_msg;
+} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
+typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
+ /**
+ * The node_announcement which should be sent.
+ */
+ struct LDKNodeAnnouncement msg;
+} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
+typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
+ /**
+ * The channel_update which should be sent.
+ */
+ struct LDKChannelUpdate msg;
+} LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
-/**
- * Features used within a `channel_announcement` message.
- */
-typedef struct MUST_USE_STRUCT LDKChannelFeatures {
+typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The node_id of the node which should receive this message
*/
- LDKnativeChannelFeatures *inner;
+ struct LDKPublicKey node_id;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The channel_update which should be sent.
*/
- bool is_owned;
-} LDKChannelFeatures;
+ struct LDKChannelUpdate msg;
+} LDKMessageSendEvent_LDKSendChannelUpdate_Body;
-/**
- * The contents of CResult_ChannelFeaturesDecodeErrorZ
- */
-typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
+typedef struct LDKMessageSendEvent_LDKHandleError_Body {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The node_id of the node which should receive this message
*/
- struct LDKChannelFeatures *result;
+ struct LDKPublicKey node_id;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The action which should be taken.
*/
- struct LDKDecodeError *err;
-} LDKCResult_ChannelFeaturesDecodeErrorZPtr;
+ struct LDKErrorAction action;
+} LDKMessageSendEvent_LDKHandleError_Body;
-/**
- * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
+typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
/**
- * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The node_id of this message recipient
*/
- union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
+ struct LDKPublicKey node_id;
/**
- * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
+ * The query_channel_range which should be sent.
*/
- bool result_ok;
-} LDKCResult_ChannelFeaturesDecodeErrorZ;
-
-
+ struct LDKQueryChannelRange msg;
+} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
-/**
- * Features used within an invoice.
- */
-typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
+typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The node_id of this message recipient
*/
- LDKnativeInvoiceFeatures *inner;
+ struct LDKPublicKey node_id;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The query_short_channel_ids which should be sent.
*/
- bool is_owned;
-} LDKInvoiceFeatures;
+ struct LDKQueryShortChannelIds msg;
+} LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
-/**
- * The contents of CResult_InvoiceFeaturesDecodeErrorZ
- */
-typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
+typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The node_id of this message recipient
*/
- struct LDKInvoiceFeatures *result;
+ struct LDKPublicKey node_id;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The reply_channel_range which should be sent.
*/
- struct LDKDecodeError *err;
-} LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
-
-/**
- * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
- /**
- * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
- /**
- * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_InvoiceFeaturesDecodeErrorZ;
-
-/**
- * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
- */
-typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKDelayedPaymentOutputDescriptor *result;
- /**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
- */
- struct LDKDecodeError *err;
-} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
-
-/**
- * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
- /**
- * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
- /**
- * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
-
-/**
- * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
- */
-typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKStaticPaymentOutputDescriptor *result;
- /**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
- */
- struct LDKDecodeError *err;
-} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
-
-/**
- * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
- /**
- * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
- /**
- * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
-
-/**
- * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
- */
-typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKSpendableOutputDescriptor *result;
- /**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
- */
- struct LDKDecodeError *err;
-} LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
-
-/**
- * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
- /**
- * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
- /**
- * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
-
-/**
- * The contents of CResult_NoneNoneZ
- */
-typedef union LDKCResult_NoneNoneZPtr {
- /**
- * Note that this value is always NULL, as there are no contents in the OK variant
- */
- void *result;
- /**
- * Note that this value is always NULL, as there are no contents in the Err variant
- */
- void *err;
-} LDKCResult_NoneNoneZPtr;
-
-/**
- * A CResult_NoneNoneZ represents the result of a fallible operation,
- * containing a () on success and a () on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_NoneNoneZ {
- /**
- * The contents of this CResult_NoneNoneZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_NoneNoneZPtr contents;
- /**
- * Whether this CResult_NoneNoneZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_NoneNoneZ;
-
-/**
- * A tuple of 2 elements. See the individual fields for the types contained.
- */
-typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
- /**
- * The element at position 0
- */
- struct LDKSignature a;
- /**
- * The element at position 1
- */
- struct LDKCVec_SignatureZ b;
-} LDKC2Tuple_SignatureCVec_SignatureZZ;
-
-/**
- * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
- */
-typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
- /**
- * Note that this value is always NULL, as there are no contents in the Err variant
- */
- void *err;
-} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
-
-/**
- * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
- /**
- * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
- /**
- * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
-
-/**
- * The contents of CResult_SignatureNoneZ
- */
-typedef union LDKCResult_SignatureNoneZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKSignature *result;
- /**
- * Note that this value is always NULL, as there are no contents in the Err variant
- */
- void *err;
-} LDKCResult_SignatureNoneZPtr;
-
-/**
- * A CResult_SignatureNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::Signature on success and a () on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_SignatureNoneZ {
- /**
- * The contents of this CResult_SignatureNoneZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_SignatureNoneZPtr contents;
- /**
- * Whether this CResult_SignatureNoneZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_SignatureNoneZ;
-
+ struct LDKReplyChannelRange msg;
+} LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
+typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
+ LDKMessageSendEvent_Tag tag;
+ union {
+ LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
+ LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
+ LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
+ LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
+ LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
+ LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
+ LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
+ LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
+ LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
+ LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
+ LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
+ LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
+ LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
+ LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
+ LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
+ LDKMessageSendEvent_LDKHandleError_Body handle_error;
+ LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
+ LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
+ LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
+ };
+} LDKMessageSendEvent;
/**
- * This class tracks the per-transaction information needed to build a closing transaction and will
- * actually build it and sign.
- *
- * This class can be used inside a signer implementation to generate a signature given the relevant
- * secret key.
+ * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct MUST_USE_STRUCT LDKClosingTransaction {
+typedef struct LDKCVec_MessageSendEventZ {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- LDKnativeClosingTransaction *inner;
+ struct LDKMessageSendEvent *data;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The number of elements pointed to by `data`.
*/
- bool is_owned;
-} LDKClosingTransaction;
+ uintptr_t datalen;
+} LDKCVec_MessageSendEventZ;
/**
- * The unsigned part of a channel_announcement
+ * Features used within an `init` message.
*/
-typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
+typedef struct MUST_USE_STRUCT LDKInitFeatures {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeUnsignedChannelAnnouncement *inner;
- /**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
- */
- bool is_owned;
-} LDKUnsignedChannelAnnouncement;
-
-/**
- * A trait to sign lightning channel transactions as described in BOLT 3.
- *
- * Signing services could be implemented on a hardware wallet. In this case,
- * the current Sign would be a front-end on top of a communication
- * channel connected to your secure device and lightning key material wouldn't
- * reside on a hot server. Nevertheless, a this deployment would still need
- * to trust the ChannelManager to avoid loss of funds as this latest component
- * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
- *
- * A more secure iteration would be to use hashlock (or payment points) to pair
- * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
- * at the price of more state and computation on the hardware wallet side. In the future,
- * we are looking forward to design such interface.
- *
- * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
- * to act, as liveness and breach reply correctness are always going to be hard requirements
- * of LN security model, orthogonal of key management issues.
- */
-typedef struct LDKBaseSign {
- /**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
- */
- void *this_arg;
- /**
- * Gets the per-commitment point for a specific commitment number
- *
- * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
- */
- struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
- /**
- * Gets the commitment secret for a specific commitment number as part of the revocation process
- *
- * An external signer implementation should error here if the commitment was already signed
- * and should refuse to sign it in the future.
- *
- * May be called more than once for the same index.
- *
- * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
- */
- struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
- /**
- * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
- *
- * This is required in order for the signer to make sure that releasing a commitment
- * secret won't leave us without a broadcastable holder transaction.
- * Policy checks should be implemented in this function, including checking the amount
- * sent to us and checking the HTLCs.
- */
- struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx);
- /**
- * Gets the holder's channel public keys and basepoints
- */
- struct LDKChannelPublicKeys pubkeys;
- /**
- * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
- * Note that this takes a pointer to this object, not the this_ptr like other methods do
- * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
- */
- void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
- /**
- * Gets an arbitrary identifier describing the set of keys which are provided back to you in
- * some SpendableOutputDescriptor types. This should be sufficient to identify this
- * Sign object uniquely and lookup or re-derive its keys.
- */
- struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
- /**
- * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
- *
- * Note that if signing fails or is rejected, the channel will be force-closed.
- *
- * Policy checks should be implemented in this function, including checking the amount
- * sent to us and checking the HTLCs.
- */
- struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
- /**
- * Validate the counterparty's revocation.
- *
- * This is required in order for the signer to make sure that the state has moved
- * forward and it is safe to sign the next counterparty commitment.
- */
- struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
- /**
- * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
- * This will only ever be called with a non-revoked commitment_tx. This will be called with the
- * latest commitment_tx when we initiate a force-close.
- * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
- * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
- * the latest.
- * This may be called multiple times for the same transaction.
- *
- * An external signer implementation should check that the commitment has not been revoked.
- *
- * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case.
- */
- struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
- /**
- * Create a signature for the given input in a transaction spending an HTLC transaction output
- * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
- *
- * A justice transaction may claim multiple outputs at the same time if timelocks are
- * similar, but only a signature for the input at index `input` should be signed for here.
- * It may be called multiple times for same output(s) if a fee-bump is needed with regards
- * to an upcoming timelock expiration.
- *
- * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
- *
- * per_commitment_key is revocation secret which was provided by our counterparty when they
- * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
- * not allow the spending of any funds by itself (you need our holder revocation_secret to do
- * so).
+ LDKnativeInitFeatures *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]);
+ bool is_owned;
+} LDKInitFeatures;
+
+/**
+ * The contents of CResult_InitFeaturesDecodeErrorZ
+ */
+typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
/**
- * Create a signature for the given input in a transaction spending a commitment transaction
- * HTLC output when our counterparty broadcasts an old state.
- *
- * A justice transaction may claim multiple outputs at the same time if timelocks are
- * similar, but only a signature for the input at index `input` should be signed for here.
- * It may be called multiple times for same output(s) if a fee-bump is needed with regards
- * to an upcoming timelock expiration.
- *
- * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
- *
- * per_commitment_key is revocation secret which was provided by our counterparty when they
- * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
- * not allow the spending of any funds by itself (you need our holder revocation_secret to do
- * so).
- *
- * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
- * (which is committed to in the BIP 143 signatures).
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_htlc)(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);
+ struct LDKInitFeatures *result;
/**
- * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
- * transaction, either offered or received.
- *
- * Such a transaction may claim multiples offered outputs at same time if we know the
- * preimage for each when we create it, but only the input at index `input` should be
- * signed for here. It may be called multiple times for same output(s) if a fee-bump is
- * needed with regards to an upcoming timelock expiration.
- *
- * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
- * outputs.
- *
- * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
- *
- * Per_commitment_point is the dynamic point corresponding to the channel state
- * detected onchain. It has been generated by our counterparty and is used to derive
- * channel state keys, which are then included in the witness script and committed to in the
- * BIP 143 signature.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- 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);
+ struct LDKDecodeError *err;
+} LDKCResult_InitFeaturesDecodeErrorZPtr;
+
+/**
+ * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
/**
- * Create a signature for a (proposed) closing transaction.
- *
- * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
- * chosen to forgo their output as dust.
+ * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
+ union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
/**
- * Signs a channel announcement message with our funding key, proving it comes from one
- * of the channel participants.
- *
- * Note that if this fails or is rejected, the channel will not be publicly announced and
- * our counterparty may (though likely will not) close the channel on us for violating the
- * protocol.
+ * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
*/
- struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
+ bool result_ok;
+} LDKCResult_InitFeaturesDecodeErrorZ;
+
+
+
+/**
+ * Features used within a `node_announcement` message.
+ */
+typedef struct MUST_USE_STRUCT LDKNodeFeatures {
/**
- * Set the counterparty static channel data, including basepoints,
- * counterparty_selected/holder_selected_contest_delay and funding outpoint.
- * This is done as soon as the funding outpoint is known. Since these are static channel data,
- * they MUST NOT be allowed to change to different values once set.
- *
- * channel_parameters.is_populated() MUST be true.
- *
- * We bind holder_selected_contest_delay late here for API convenience.
- *
- * Will be called before any signatures are applied.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
+ LDKnativeNodeFeatures *inner;
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- void (*free)(void *this_arg);
-} LDKBaseSign;
+ bool is_owned;
+} LDKNodeFeatures;
/**
- * A cloneable signer.
- *
- * Although we require signers to be cloneable, it may be useful for developers to be able to use
- * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
- * which implies Sized, into this derived trait.
+ * The contents of CResult_NodeFeaturesDecodeErrorZ
*/
-typedef struct LDKSign {
+typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
/**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- void *this_arg;
+ struct LDKNodeFeatures *result;
/**
- * Implementation of BaseSign for this object.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKBaseSign BaseSign;
+ struct LDKDecodeError *err;
+} LDKCResult_NodeFeaturesDecodeErrorZPtr;
+
+/**
+ * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
/**
- * Serialize the object into a byte array
+ * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKCVec_u8Z (*write)(const void *this_arg);
+ union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
/**
- * Called, if set, after this Sign has been cloned into a duplicate object.
- * The new Sign is provided, and should be mutated as needed to perform a
- * deep copy of the object pointed to by this_arg or avoid any double-freeing.
+ * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
*/
- void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
+ bool result_ok;
+} LDKCResult_NodeFeaturesDecodeErrorZ;
+
+
+
+/**
+ * Features used within a `channel_announcement` message.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelFeatures {
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- void (*free)(void *this_arg);
-} LDKSign;
+ LDKnativeChannelFeatures *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKChannelFeatures;
/**
- * The contents of CResult_SignDecodeErrorZ
+ * The contents of CResult_ChannelFeaturesDecodeErrorZ
*/
-typedef union LDKCResult_SignDecodeErrorZPtr {
+typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKSign *result;
+ struct LDKChannelFeatures *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
struct LDKDecodeError *err;
-} LDKCResult_SignDecodeErrorZPtr;
+} LDKCResult_ChannelFeaturesDecodeErrorZPtr;
/**
- * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_SignDecodeErrorZ {
+typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
/**
- * The contents of this CResult_SignDecodeErrorZ, accessible via either
+ * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_SignDecodeErrorZPtr contents;
+ union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
/**
- * Whether this CResult_SignDecodeErrorZ represents a success state.
+ * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_SignDecodeErrorZ;
+} LDKCResult_ChannelFeaturesDecodeErrorZ;
+
+
/**
- * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
- * allows recovering the exact public key which created the signature given the message.
+ * Features used within an invoice.
*/
-typedef struct LDKRecoverableSignature {
+typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
/**
- * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
- * recovery.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- uint8_t serialized_form[68];
-} LDKRecoverableSignature;
+ LDKnativeInvoiceFeatures *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKInvoiceFeatures;
/**
- * The contents of CResult_RecoverableSignatureNoneZ
+ * The contents of CResult_InvoiceFeaturesDecodeErrorZ
*/
-typedef union LDKCResult_RecoverableSignatureNoneZPtr {
+typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKRecoverableSignature *result;
+ struct LDKInvoiceFeatures *result;
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void *err;
-} LDKCResult_RecoverableSignatureNoneZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
/**
- * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::RecoverableSignature on success and a () on failure.
+ * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_RecoverableSignatureNoneZ {
+typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
/**
- * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
+ * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_RecoverableSignatureNoneZPtr contents;
+ union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
/**
- * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
+ * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_RecoverableSignatureNoneZ;
+} LDKCResult_InvoiceFeaturesDecodeErrorZ;
+
+
/**
- * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
- * This corresponds to std::vector in C++
+ * Parameters for configuring [`Scorer`].
*/
-typedef struct LDKCVec_CVec_u8ZZ {
+typedef struct MUST_USE_STRUCT LDKScoringParameters {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKCVec_u8Z *data;
+ LDKnativeScoringParameters *inner;
/**
- * The number of elements pointed to by `data`.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- uintptr_t datalen;
-} LDKCVec_CVec_u8ZZ;
+ bool is_owned;
+} LDKScoringParameters;
/**
- * The contents of CResult_CVec_CVec_u8ZZNoneZ
+ * The contents of CResult_ScoringParametersDecodeErrorZ
*/
-typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
+typedef union LDKCResult_ScoringParametersDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKCVec_CVec_u8ZZ *result;
+ struct LDKScoringParameters *result;
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void *err;
-} LDKCResult_CVec_CVec_u8ZZNoneZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_ScoringParametersDecodeErrorZPtr;
/**
- * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
+ * A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::scorer::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
+typedef struct LDKCResult_ScoringParametersDecodeErrorZ {
/**
- * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
+ * The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
+ union LDKCResult_ScoringParametersDecodeErrorZPtr contents;
/**
- * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
+ * Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_CVec_CVec_u8ZZNoneZ;
+} LDKCResult_ScoringParametersDecodeErrorZ;
/**
- * A simple implementation of Sign that just keeps the private keys in memory.
+ * [`routing::Score`] implementation that provides reasonable default behavior.
*
- * This implementation performs no policy checks and is insufficient by itself as
- * a secure external signer.
+ * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
+ * slightly higher fees are available. Will further penalize channels that fail to relay payments.
+ *
+ * See [module-level documentation] for usage.
+ *
+ * [module-level documentation]: crate::routing::scorer
*/
-typedef struct MUST_USE_STRUCT LDKInMemorySigner {
+typedef struct MUST_USE_STRUCT LDKScorer {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeInMemorySigner *inner;
+ LDKnativeScorer *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKInMemorySigner;
+} LDKScorer;
/**
- * The contents of CResult_InMemorySignerDecodeErrorZ
+ * The contents of CResult_ScorerDecodeErrorZ
*/
-typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
+typedef union LDKCResult_ScorerDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKInMemorySigner *result;
+ struct LDKScorer *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
struct LDKDecodeError *err;
-} LDKCResult_InMemorySignerDecodeErrorZPtr;
+} LDKCResult_ScorerDecodeErrorZPtr;
/**
- * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::scorer::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
+typedef struct LDKCResult_ScorerDecodeErrorZ {
/**
- * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
+ * The contents of this CResult_ScorerDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
+ union LDKCResult_ScorerDecodeErrorZPtr contents;
/**
- * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
+ * Whether this CResult_ScorerDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_InMemorySignerDecodeErrorZ;
+} LDKCResult_ScorerDecodeErrorZ;
/**
- * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
- * This corresponds to std::vector in C++
+ * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
*/
-typedef struct LDKCVec_TxOutZ {
+typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKTxOut *data;
+ struct LDKDelayedPaymentOutputDescriptor *result;
/**
- * The number of elements pointed to by `data`.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uintptr_t datalen;
-} LDKCVec_TxOutZ;
+ struct LDKDecodeError *err;
+} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
/**
- * The contents of CResult_TransactionNoneZ
+ * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef union LDKCResult_TransactionNoneZPtr {
+typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
+ /**
+ * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
+
+/**
+ * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
+ */
+typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKTransaction *result;
+ struct LDKStaticPaymentOutputDescriptor *result;
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void *err;
-} LDKCResult_TransactionNoneZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
/**
- * A CResult_TransactionNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::Transaction on success and a () on failure.
+ * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_TransactionNoneZ {
+typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
/**
- * The contents of this CResult_TransactionNoneZ, accessible via either
+ * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_TransactionNoneZPtr contents;
+ union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
/**
- * Whether this CResult_TransactionNoneZ represents a success state.
+ * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_TransactionNoneZ;
+} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
+
+/**
+ * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
+ */
+typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKSpendableOutputDescriptor *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
+/**
+ * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
+ /**
+ * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
+/**
+ * The contents of CResult_NoneNoneZ
+ */
+typedef union LDKCResult_NoneNoneZPtr {
+ /**
+ * Note that this value is always NULL, as there are no contents in the OK variant
+ */
+ void *result;
+ /**
+ * Note that this value is always NULL, as there are no contents in the Err variant
+ */
+ void *err;
+} LDKCResult_NoneNoneZPtr;
/**
- * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
- * on-chain transactions to ensure no loss of funds occurs.
- *
- * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
- * information and are actively monitoring the chain.
- *
- * Pending Events or updated HTLCs which have not yet been read out by
- * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
- * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
- * gotten are fully handled before re-serializing the new state.
- *
- * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
- * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
- * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
- * returned block hash and the the current chain and then reconnecting blocks to get to the
- * best chain) upon deserializing the object!
+ * A CResult_NoneNoneZ represents the result of a fallible operation,
+ * containing a () on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct MUST_USE_STRUCT LDKChannelMonitor {
+typedef struct LDKCResult_NoneNoneZ {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The contents of this CResult_NoneNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKnativeChannelMonitor *inner;
+ union LDKCResult_NoneNoneZPtr contents;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Whether this CResult_NoneNoneZ represents a success state.
*/
- bool is_owned;
-} LDKChannelMonitor;
+ bool result_ok;
+} LDKCResult_NoneNoneZ;
/**
* A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
+typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
/**
* The element at position 0
*/
- struct LDKThirtyTwoBytes a;
+ struct LDKSignature a;
/**
* The element at position 1
*/
- struct LDKChannelMonitor b;
-} LDKC2Tuple_BlockHashChannelMonitorZ;
+ struct LDKCVec_SignatureZ b;
+} LDKC2Tuple_SignatureCVec_SignatureZZ;
/**
- * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
- * This corresponds to std::vector in C++
+ * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
*/
-typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
+typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
+ struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
/**
- * The number of elements pointed to by `data`.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- uintptr_t datalen;
-} LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
+ void *err;
+} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
/**
- * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
+ * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
+typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
+ /**
+ * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
+ /**
+ * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
+
+/**
+ * The contents of CResult_SignatureNoneZ
+ */
+typedef union LDKCResult_SignatureNoneZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
+ struct LDKSignature *result;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- enum LDKIOError *err;
-} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
+ void *err;
+} LDKCResult_SignatureNoneZPtr;
/**
- * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
+ * A CResult_SignatureNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::Signature on success and a () on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
+typedef struct LDKCResult_SignatureNoneZ {
/**
- * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
+ * The contents of this CResult_SignatureNoneZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
+ union LDKCResult_SignatureNoneZPtr contents;
/**
- * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
+ * Whether this CResult_SignatureNoneZ represents a success state.
*/
bool result_ok;
-} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
+} LDKCResult_SignatureNoneZ;
/**
- * A payment identifier used to uniquely identify a payment to LDK.
+ * This class tracks the per-transaction information needed to build a closing transaction and will
+ * actually build it and sign.
+ *
+ * This class can be used inside a signer implementation to generate a signature given the relevant
+ * secret key.
*/
-typedef struct MUST_USE_STRUCT LDKPaymentId {
+typedef struct MUST_USE_STRUCT LDKClosingTransaction {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativePaymentId *inner;
+ LDKnativeClosingTransaction *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKPaymentId;
+} LDKClosingTransaction;
+
+
/**
- * The contents of CResult_PaymentIdDecodeErrorZ
+ * The unsigned part of a channel_announcement
*/
-typedef union LDKCResult_PaymentIdDecodeErrorZPtr {
+typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKPaymentId *result;
+ LDKnativeUnsignedChannelAnnouncement *inner;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- struct LDKDecodeError *err;
-} LDKCResult_PaymentIdDecodeErrorZPtr;
+ bool is_owned;
+} LDKUnsignedChannelAnnouncement;
/**
- * A CResult_PaymentIdDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::channelmanager::PaymentId on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A trait to sign lightning channel transactions as described in BOLT 3.
+ *
+ * Signing services could be implemented on a hardware wallet. In this case,
+ * the current Sign would be a front-end on top of a communication
+ * channel connected to your secure device and lightning key material wouldn't
+ * reside on a hot server. Nevertheless, a this deployment would still need
+ * to trust the ChannelManager to avoid loss of funds as this latest component
+ * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
+ *
+ * A more secure iteration would be to use hashlock (or payment points) to pair
+ * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
+ * at the price of more state and computation on the hardware wallet side. In the future,
+ * we are looking forward to design such interface.
+ *
+ * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
+ * to act, as liveness and breach reply correctness are always going to be hard requirements
+ * of LN security model, orthogonal of key management issues.
*/
-typedef struct LDKCResult_PaymentIdDecodeErrorZ {
+typedef struct LDKBaseSign {
/**
- * The contents of this CResult_PaymentIdDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
*/
- union LDKCResult_PaymentIdDecodeErrorZPtr contents;
+ void *this_arg;
/**
- * Whether this CResult_PaymentIdDecodeErrorZ represents a success state.
+ * Gets the per-commitment point for a specific commitment number
+ *
+ * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
*/
- bool result_ok;
-} LDKCResult_PaymentIdDecodeErrorZ;
-
-/**
- * An enum which can either contain a u16 or not
- */
-typedef enum LDKCOption_u16Z_Tag {
+ struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
/**
- * When we're in this state, this COption_u16Z contains a u16
+ * Gets the commitment secret for a specific commitment number as part of the revocation process
+ *
+ * An external signer implementation should error here if the commitment was already signed
+ * and should refuse to sign it in the future.
+ *
+ * May be called more than once for the same index.
+ *
+ * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
*/
- LDKCOption_u16Z_Some,
+ struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
/**
- * When we're in this state, this COption_u16Z contains nothing
+ * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
+ *
+ * This is required in order for the signer to make sure that releasing a commitment
+ * secret won't leave us without a broadcastable holder transaction.
+ * Policy checks should be implemented in this function, including checking the amount
+ * sent to us and checking the HTLCs.
*/
- LDKCOption_u16Z_None,
+ struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx);
/**
- * Must be last for serialization purposes
+ * Gets the holder's channel public keys and basepoints
*/
- LDKCOption_u16Z_Sentinel,
-} LDKCOption_u16Z_Tag;
-
-typedef struct LDKCOption_u16Z {
- LDKCOption_u16Z_Tag tag;
- union {
- struct {
- uint16_t some;
- };
- };
-} LDKCOption_u16Z;
-
-/**
- * Indicates an error on the client's part (usually some variant of attempting to use too-low or
- * too-high values)
- */
-typedef enum LDKAPIError_Tag {
+ struct LDKChannelPublicKeys pubkeys;
/**
- * Indicates the API was wholly misused (see err for more). Cases where these can be returned
- * are documented, but generally indicates some precondition of a function was violated.
+ * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
+ * Note that this takes a pointer to this object, not the this_ptr like other methods do
+ * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
*/
- LDKAPIError_APIMisuseError,
+ void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
/**
- * Due to a high feerate, we were unable to complete the request.
- * For example, this may be returned if the feerate implies we cannot open a channel at the
- * requested value, but opening a larger channel would succeed.
+ * Gets an arbitrary identifier describing the set of keys which are provided back to you in
+ * some SpendableOutputDescriptor types. This should be sufficient to identify this
+ * Sign object uniquely and lookup or re-derive its keys.
*/
- LDKAPIError_FeeRateTooHigh,
+ struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
/**
- * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
- * too-many-hops, etc).
+ * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
+ *
+ * Note that if signing fails or is rejected, the channel will be force-closed.
+ *
+ * Policy checks should be implemented in this function, including checking the amount
+ * sent to us and checking the HTLCs.
*/
- LDKAPIError_RouteError,
+ struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
/**
- * We were unable to complete the request as the Channel required to do so is unable to
- * complete the request (or was not found). This can take many forms, including disconnected
- * peer, channel at capacity, channel shutting down, etc.
+ * Validate the counterparty's revocation.
+ *
+ * This is required in order for the signer to make sure that the state has moved
+ * forward and it is safe to sign the next counterparty commitment.
*/
- LDKAPIError_ChannelUnavailable,
+ struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
+ /**
+ * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
+ * This will only ever be called with a non-revoked commitment_tx. This will be called with the
+ * latest commitment_tx when we initiate a force-close.
+ * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
+ * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
+ * the latest.
+ * This may be called multiple times for the same transaction.
+ *
+ * An external signer implementation should check that the commitment has not been revoked.
+ *
+ * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case.
+ */
+ struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
+ /**
+ * Create a signature for the given input in a transaction spending an HTLC transaction output
+ * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
+ *
+ * A justice transaction may claim multiple outputs at the same time if timelocks are
+ * similar, but only a signature for the input at index `input` should be signed for here.
+ * It may be called multiple times for same output(s) if a fee-bump is needed with regards
+ * to an upcoming timelock expiration.
+ *
+ * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
+ *
+ * per_commitment_key is revocation secret which was provided by our counterparty when they
+ * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
+ * not allow the spending of any funds by itself (you need our holder revocation_secret to do
+ * so).
+ */
+ struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]);
+ /**
+ * Create a signature for the given input in a transaction spending a commitment transaction
+ * HTLC output when our counterparty broadcasts an old state.
+ *
+ * A justice transaction may claim multiple outputs at the same time if timelocks are
+ * similar, but only a signature for the input at index `input` should be signed for here.
+ * It may be called multiple times for same output(s) if a fee-bump is needed with regards
+ * to an upcoming timelock expiration.
+ *
+ * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
+ *
+ * per_commitment_key is revocation secret which was provided by our counterparty when they
+ * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
+ * not allow the spending of any funds by itself (you need our holder revocation_secret to do
+ * so).
+ *
+ * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
+ * (which is committed to in the BIP 143 signatures).
+ */
+ struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_htlc)(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);
+ /**
+ * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
+ * transaction, either offered or received.
+ *
+ * Such a transaction may claim multiples offered outputs at same time if we know the
+ * preimage for each when we create it, but only the input at index `input` should be
+ * signed for here. It may be called multiple times for same output(s) if a fee-bump is
+ * needed with regards to an upcoming timelock expiration.
+ *
+ * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
+ * outputs.
+ *
+ * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
+ *
+ * Per_commitment_point is the dynamic point corresponding to the channel state
+ * detected onchain. It has been generated by our counterparty and is used to derive
+ * channel state keys, which are then included in the witness script and committed to in the
+ * BIP 143 signature.
+ */
+ 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);
+ /**
+ * Create a signature for a (proposed) closing transaction.
+ *
+ * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
+ * chosen to forgo their output as dust.
+ */
+ struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
+ /**
+ * Signs a channel announcement message with our funding key, proving it comes from one
+ * of the channel participants.
+ *
+ * Note that if this fails or is rejected, the channel will not be publicly announced and
+ * our counterparty may (though likely will not) close the channel on us for violating the
+ * protocol.
+ */
+ struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
+ /**
+ * Set the counterparty static channel data, including basepoints,
+ * counterparty_selected/holder_selected_contest_delay and funding outpoint.
+ * This is done as soon as the funding outpoint is known. Since these are static channel data,
+ * they MUST NOT be allowed to change to different values once set.
+ *
+ * channel_parameters.is_populated() MUST be true.
+ *
+ * We bind holder_selected_contest_delay late here for API convenience.
+ *
+ * Will be called before any signatures are applied.
+ */
+ void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKBaseSign;
+
+/**
+ * A cloneable signer.
+ *
+ * Although we require signers to be cloneable, it may be useful for developers to be able to use
+ * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
+ * which implies Sized, into this derived trait.
+ */
+typedef struct LDKSign {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
/**
- * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
- * attempted action to fail.
+ * Implementation of BaseSign for this object.
*/
- LDKAPIError_MonitorUpdateFailed,
+ struct LDKBaseSign BaseSign;
/**
- * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
- * with the channel counterparty as negotiated in [`InitFeatures`].
- *
- * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
- * a channel or cooperatively close one with this peer (and will have to force-close instead).
- *
- * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
- * [`InitFeatures`]: crate::ln::features::InitFeatures
+ * Serialize the object into a byte array
*/
- LDKAPIError_IncompatibleShutdownScript,
+ struct LDKCVec_u8Z (*write)(const void *this_arg);
/**
- * Must be last for serialization purposes
+ * Called, if set, after this Sign has been cloned into a duplicate object.
+ * The new Sign is provided, and should be mutated as needed to perform a
+ * deep copy of the object pointed to by this_arg or avoid any double-freeing.
*/
- LDKAPIError_Sentinel,
-} LDKAPIError_Tag;
-
-typedef struct LDKAPIError_LDKAPIMisuseError_Body {
+ void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
/**
- * A human-readable error message
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
*/
- struct LDKStr err;
-} LDKAPIError_LDKAPIMisuseError_Body;
+ void (*free)(void *this_arg);
+} LDKSign;
-typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
+/**
+ * The contents of CResult_SignDecodeErrorZ
+ */
+typedef union LDKCResult_SignDecodeErrorZPtr {
/**
- * A human-readable error message
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKStr err;
+ struct LDKSign *result;
/**
- * The feerate which was too high.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uint32_t feerate;
-} LDKAPIError_LDKFeeRateTooHigh_Body;
+ struct LDKDecodeError *err;
+} LDKCResult_SignDecodeErrorZPtr;
-typedef struct LDKAPIError_LDKRouteError_Body {
+/**
+ * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_SignDecodeErrorZ {
/**
- * A human-readable error message
+ * The contents of this CResult_SignDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKStr err;
-} LDKAPIError_LDKRouteError_Body;
-
-typedef struct LDKAPIError_LDKChannelUnavailable_Body {
+ union LDKCResult_SignDecodeErrorZPtr contents;
/**
- * A human-readable error message
+ * Whether this CResult_SignDecodeErrorZ represents a success state.
*/
- struct LDKStr err;
-} LDKAPIError_LDKChannelUnavailable_Body;
+ bool result_ok;
+} LDKCResult_SignDecodeErrorZ;
-typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
+/**
+ * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
+ * allows recovering the exact public key which created the signature given the message.
+ */
+typedef struct LDKRecoverableSignature {
/**
- * The incompatible shutdown script.
+ * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
+ * recovery.
*/
- struct LDKShutdownScript script;
-} LDKAPIError_LDKIncompatibleShutdownScript_Body;
-
-typedef struct MUST_USE_STRUCT LDKAPIError {
- LDKAPIError_Tag tag;
- union {
- LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
- LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
- LDKAPIError_LDKRouteError_Body route_error;
- LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
- LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
- };
-} LDKAPIError;
+ uint8_t serialized_form[68];
+} LDKRecoverableSignature;
/**
- * The contents of CResult_NoneAPIErrorZ
+ * The contents of CResult_RecoverableSignatureNoneZ
*/
-typedef union LDKCResult_NoneAPIErrorZPtr {
+typedef union LDKCResult_RecoverableSignatureNoneZPtr {
/**
- * Note that this value is always NULL, as there are no contents in the OK variant
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- void *result;
+ struct LDKRecoverableSignature *result;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- struct LDKAPIError *err;
-} LDKCResult_NoneAPIErrorZPtr;
+ void *err;
+} LDKCResult_RecoverableSignatureNoneZPtr;
/**
- * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
- * containing a () on success and a crate::lightning::util::errors::APIError on failure.
+ * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::RecoverableSignature on success and a () on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_NoneAPIErrorZ {
+typedef struct LDKCResult_RecoverableSignatureNoneZ {
/**
- * The contents of this CResult_NoneAPIErrorZ, accessible via either
+ * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_NoneAPIErrorZPtr contents;
+ union LDKCResult_RecoverableSignatureNoneZPtr contents;
/**
- * Whether this CResult_NoneAPIErrorZ represents a success state.
+ * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
*/
bool result_ok;
-} LDKCResult_NoneAPIErrorZ;
+} LDKCResult_RecoverableSignatureNoneZ;
/**
- * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
+ * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
* This corresponds to std::vector in C++
*/
-typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
+typedef struct LDKCVec_CVec_u8ZZ {
/**
* The elements in the array.
* If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKCResult_NoneAPIErrorZ *data;
+ struct LDKCVec_u8Z *data;
/**
* The number of elements pointed to by `data`.
*/
uintptr_t datalen;
-} LDKCVec_CResult_NoneAPIErrorZZ;
+} LDKCVec_CVec_u8ZZ;
/**
- * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
- * This corresponds to std::vector in C++
+ * The contents of CResult_CVec_CVec_u8ZZNoneZ
*/
-typedef struct LDKCVec_APIErrorZ {
+typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKAPIError *data;
+ struct LDKCVec_CVec_u8ZZ *result;
/**
- * The number of elements pointed to by `data`.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- uintptr_t datalen;
-} LDKCVec_APIErrorZ;
+ void *err;
+} LDKCResult_CVec_CVec_u8ZZNoneZPtr;
/**
- * The contents of CResult__u832APIErrorZ
+ * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef union LDKCResult__u832APIErrorZPtr {
+typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
+ /**
+ * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
+ /**
+ * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_CVec_CVec_u8ZZNoneZ;
+
+
+
+/**
+ * A simple implementation of Sign that just keeps the private keys in memory.
+ *
+ * This implementation performs no policy checks and is insufficient by itself as
+ * a secure external signer.
+ */
+typedef struct MUST_USE_STRUCT LDKInMemorySigner {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeInMemorySigner *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKInMemorySigner;
+
+/**
+ * The contents of CResult_InMemorySignerDecodeErrorZ
+ */
+typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKThirtyTwoBytes *result;
+ struct LDKInMemorySigner *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKAPIError *err;
-} LDKCResult__u832APIErrorZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_InMemorySignerDecodeErrorZPtr;
/**
- * A CResult__u832APIErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
+ * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult__u832APIErrorZ {
+typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
/**
- * The contents of this CResult__u832APIErrorZ, accessible via either
+ * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult__u832APIErrorZPtr contents;
+ union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
/**
- * Whether this CResult__u832APIErrorZ represents a success state.
+ * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult__u832APIErrorZ;
+} LDKCResult_InMemorySignerDecodeErrorZ;
/**
- * If a payment fails to send, it can be in one of several states. This enum is returned as the
- * Err() type describing which state the payment is in, see the description of individual enum
- * states for more.
+ * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef enum LDKPaymentSendFailure_Tag {
- /**
- * A parameter which was passed to send_payment was invalid, preventing us from attempting to
- * send the payment at all. No channel state has been changed or messages sent to peers, and
- * once you've changed the parameter at error, you can freely retry the payment in full.
- */
- LDKPaymentSendFailure_ParameterError,
- /**
- * A parameter in a single path which was passed to send_payment was invalid, preventing us
- * from attempting to send the payment at all. No channel state has been changed or messages
- * sent to peers, and once you've changed the parameter at error, you can freely retry the
- * payment in full.
- *
- * The results here are ordered the same as the paths in the route object which was passed to
- * send_payment.
- */
- LDKPaymentSendFailure_PathParameterError,
- /**
- * All paths which were attempted failed to send, with no channel state change taking place.
- * You can freely retry the payment in full (though you probably want to do so over different
- * paths than the ones selected).
- */
- LDKPaymentSendFailure_AllFailedRetrySafe,
+typedef struct LDKCVec_TxOutZ {
/**
- * Some paths which were attempted failed to send, though possibly not all. At least some
- * paths have irrevocably committed to the HTLC and retrying the payment in full would result
- * in over-/re-payment.
- *
- * The results here are ordered the same as the paths in the route object which was passed to
- * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
- * retried (though there is currently no API with which to do so).
- *
- * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
- * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
- * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
- * with the latest update_id.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- LDKPaymentSendFailure_PartialFailure,
+ struct LDKTxOut *data;
/**
- * Must be last for serialization purposes
+ * The number of elements pointed to by `data`.
*/
- LDKPaymentSendFailure_Sentinel,
-} LDKPaymentSendFailure_Tag;
-
-typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
- LDKPaymentSendFailure_Tag tag;
- union {
- struct {
- struct LDKAPIError parameter_error;
- };
- struct {
- struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
- };
- struct {
- struct LDKCVec_APIErrorZ all_failed_retry_safe;
- };
- struct {
- struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
- };
- };
-} LDKPaymentSendFailure;
+ uintptr_t datalen;
+} LDKCVec_TxOutZ;
/**
- * The contents of CResult_PaymentIdPaymentSendFailureZ
+ * The contents of CResult_TransactionNoneZ
*/
-typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
+typedef union LDKCResult_TransactionNoneZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKPaymentId *result;
+ struct LDKTransaction *result;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- struct LDKPaymentSendFailure *err;
-} LDKCResult_PaymentIdPaymentSendFailureZPtr;
+ void *err;
+} LDKCResult_TransactionNoneZPtr;
/**
- * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::channelmanager::PaymentId on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+ * A CResult_TransactionNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::Transaction on success and a () on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
+typedef struct LDKCResult_TransactionNoneZ {
/**
- * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
+ * The contents of this CResult_TransactionNoneZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
+ union LDKCResult_TransactionNoneZPtr contents;
/**
- * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
+ * Whether this CResult_TransactionNoneZ represents a success state.
*/
bool result_ok;
-} LDKCResult_PaymentIdPaymentSendFailureZ;
+} LDKCResult_TransactionNoneZ;
+
+
/**
- * The contents of CResult_NonePaymentSendFailureZ
+ * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
+ * on-chain transactions to ensure no loss of funds occurs.
+ *
+ * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
+ * information and are actively monitoring the chain.
+ *
+ * Pending Events or updated HTLCs which have not yet been read out by
+ * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
+ * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
+ * gotten are fully handled before re-serializing the new state.
+ *
+ * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
+ * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
+ * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
+ * returned block hash and the the current chain and then reconnecting blocks to get to the
+ * best chain) upon deserializing the object!
*/
-typedef union LDKCResult_NonePaymentSendFailureZPtr {
+typedef struct MUST_USE_STRUCT LDKChannelMonitor {
/**
- * Note that this value is always NULL, as there are no contents in the OK variant
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- void *result;
+ LDKnativeChannelMonitor *inner;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- struct LDKPaymentSendFailure *err;
-} LDKCResult_NonePaymentSendFailureZPtr;
+ bool is_owned;
+} LDKChannelMonitor;
/**
- * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
- * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef struct LDKCResult_NonePaymentSendFailureZ {
+typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
/**
- * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The element at position 0
*/
- union LDKCResult_NonePaymentSendFailureZPtr contents;
+ struct LDKThirtyTwoBytes a;
/**
- * Whether this CResult_NonePaymentSendFailureZ represents a success state.
+ * The element at position 1
*/
- bool result_ok;
-} LDKCResult_NonePaymentSendFailureZ;
+ struct LDKChannelMonitor b;
+} LDKC2Tuple_BlockHashChannelMonitorZ;
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
+typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
/**
- * The element at position 0
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKThirtyTwoBytes a;
+ struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
/**
- * The element at position 1
+ * The number of elements pointed to by `data`.
*/
- struct LDKPaymentId b;
-} LDKC2Tuple_PaymentHashPaymentIdZ;
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
/**
- * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
+ * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
*/
-typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
+typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
+ struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKPaymentSendFailure *err;
-} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
+ enum LDKIOError *err;
+} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
/**
- * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+ * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
+typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
/**
- * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
+ * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
+ union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
/**
- * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
+ * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
+} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
/**
- * A 4-byte byte array.
+ * An enum which can either contain a u16 or not
*/
-typedef struct LDKFourBytes {
+typedef enum LDKCOption_u16Z_Tag {
/**
- * The four bytes
+ * When we're in this state, this COption_u16Z contains a u16
*/
- uint8_t data[4];
-} LDKFourBytes;
-
-/**
- * A 16-byte byte array.
- */
-typedef struct LDKSixteenBytes {
+ LDKCOption_u16Z_Some,
/**
- * The sixteen bytes
+ * When we're in this state, this COption_u16Z contains nothing
*/
- uint8_t data[16];
-} LDKSixteenBytes;
-
-/**
- * A 10-byte byte array.
- */
-typedef struct LDKTenBytes {
+ LDKCOption_u16Z_None,
/**
- * The ten bytes
+ * Must be last for serialization purposes
*/
- uint8_t data[10];
-} LDKTenBytes;
+ LDKCOption_u16Z_Sentinel,
+} LDKCOption_u16Z_Tag;
+
+typedef struct LDKCOption_u16Z {
+ LDKCOption_u16Z_Tag tag;
+ union {
+ struct {
+ uint16_t some;
+ };
+ };
+} LDKCOption_u16Z;
/**
- * An address which can be used to connect to a remote peer
+ * Indicates an error on the client's part (usually some variant of attempting to use too-low or
+ * too-high values)
*/
-typedef enum LDKNetAddress_Tag {
+typedef enum LDKAPIError_Tag {
/**
- * An IPv4 address/port on which the peer is listening.
+ * Indicates the API was wholly misused (see err for more). Cases where these can be returned
+ * are documented, but generally indicates some precondition of a function was violated.
*/
- LDKNetAddress_IPv4,
+ LDKAPIError_APIMisuseError,
/**
- * An IPv6 address/port on which the peer is listening.
+ * Due to a high feerate, we were unable to complete the request.
+ * For example, this may be returned if the feerate implies we cannot open a channel at the
+ * requested value, but opening a larger channel would succeed.
*/
- LDKNetAddress_IPv6,
+ LDKAPIError_FeeRateTooHigh,
/**
- * An old-style Tor onion address/port on which the peer is listening.
+ * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
+ * too-many-hops, etc).
*/
- LDKNetAddress_OnionV2,
+ LDKAPIError_RouteError,
/**
- * A new-style Tor onion address/port on which the peer is listening.
- * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
- * wrap as base32 and append \".onion\".
+ * We were unable to complete the request as the Channel required to do so is unable to
+ * complete the request (or was not found). This can take many forms, including disconnected
+ * peer, channel at capacity, channel shutting down, etc.
*/
- LDKNetAddress_OnionV3,
+ LDKAPIError_ChannelUnavailable,
+ /**
+ * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
+ * attempted action to fail.
+ */
+ LDKAPIError_MonitorUpdateFailed,
+ /**
+ * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
+ * with the channel counterparty as negotiated in [`InitFeatures`].
+ *
+ * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
+ * a channel or cooperatively close one with this peer (and will have to force-close instead).
+ *
+ * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
+ * [`InitFeatures`]: crate::ln::features::InitFeatures
+ */
+ LDKAPIError_IncompatibleShutdownScript,
/**
* Must be last for serialization purposes
*/
- LDKNetAddress_Sentinel,
-} LDKNetAddress_Tag;
+ LDKAPIError_Sentinel,
+} LDKAPIError_Tag;
-typedef struct LDKNetAddress_LDKIPv4_Body {
+typedef struct LDKAPIError_LDKAPIMisuseError_Body {
/**
- * The 4-byte IPv4 address
+ * A human-readable error message
*/
- struct LDKFourBytes addr;
+ struct LDKStr err;
+} LDKAPIError_LDKAPIMisuseError_Body;
+
+typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
/**
- * The port on which the node is listening
+ * A human-readable error message
*/
- uint16_t port;
-} LDKNetAddress_LDKIPv4_Body;
-
-typedef struct LDKNetAddress_LDKIPv6_Body {
+ struct LDKStr err;
/**
- * The 16-byte IPv6 address
+ * The feerate which was too high.
*/
- struct LDKSixteenBytes addr;
+ uint32_t feerate;
+} LDKAPIError_LDKFeeRateTooHigh_Body;
+
+typedef struct LDKAPIError_LDKRouteError_Body {
/**
- * The port on which the node is listening
+ * A human-readable error message
*/
- uint16_t port;
-} LDKNetAddress_LDKIPv6_Body;
+ struct LDKStr err;
+} LDKAPIError_LDKRouteError_Body;
-typedef struct LDKNetAddress_LDKOnionV2_Body {
+typedef struct LDKAPIError_LDKChannelUnavailable_Body {
/**
- * The bytes (usually encoded in base32 with \".onion\" appended)
+ * A human-readable error message
*/
- struct LDKTenBytes addr;
+ struct LDKStr err;
+} LDKAPIError_LDKChannelUnavailable_Body;
+
+typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
/**
- * The port on which the node is listening
+ * The incompatible shutdown script.
*/
- uint16_t port;
-} LDKNetAddress_LDKOnionV2_Body;
+ struct LDKShutdownScript script;
+} LDKAPIError_LDKIncompatibleShutdownScript_Body;
-typedef struct LDKNetAddress_LDKOnionV3_Body {
+typedef struct MUST_USE_STRUCT LDKAPIError {
+ LDKAPIError_Tag tag;
+ union {
+ LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
+ LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
+ LDKAPIError_LDKRouteError_Body route_error;
+ LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
+ LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
+ };
+} LDKAPIError;
+
+/**
+ * The contents of CResult_NoneAPIErrorZ
+ */
+typedef union LDKCResult_NoneAPIErrorZPtr {
/**
- * The ed25519 long-term public key of the peer
+ * Note that this value is always NULL, as there are no contents in the OK variant
*/
- struct LDKThirtyTwoBytes ed25519_pubkey;
+ void *result;
/**
- * The checksum of the pubkey and version, as included in the onion address
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uint16_t checksum;
+ struct LDKAPIError *err;
+} LDKCResult_NoneAPIErrorZPtr;
+
+/**
+ * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning::util::errors::APIError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NoneAPIErrorZ {
/**
- * The version byte, as defined by the Tor Onion v3 spec.
+ * The contents of this CResult_NoneAPIErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- uint8_t version;
+ union LDKCResult_NoneAPIErrorZPtr contents;
/**
- * The port on which the node is listening
+ * Whether this CResult_NoneAPIErrorZ represents a success state.
*/
- uint16_t port;
-} LDKNetAddress_LDKOnionV3_Body;
-
-typedef struct MUST_USE_STRUCT LDKNetAddress {
- LDKNetAddress_Tag tag;
- union {
- LDKNetAddress_LDKIPv4_Body i_pv4;
- LDKNetAddress_LDKIPv6_Body i_pv6;
- LDKNetAddress_LDKOnionV2_Body onion_v2;
- LDKNetAddress_LDKOnionV3_Body onion_v3;
- };
-} LDKNetAddress;
+ bool result_ok;
+} LDKCResult_NoneAPIErrorZ;
/**
- * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
+ * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
* This corresponds to std::vector in C++
*/
-typedef struct LDKCVec_NetAddressZ {
+typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
/**
* The elements in the array.
* If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKNetAddress *data;
+ struct LDKCResult_NoneAPIErrorZ *data;
/**
* The number of elements pointed to by `data`.
*/
uintptr_t datalen;
-} LDKCVec_NetAddressZ;
+} LDKCVec_CResult_NoneAPIErrorZZ;
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
+typedef struct LDKCVec_APIErrorZ {
/**
- * The element at position 0
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKThirtyTwoBytes a;
+ struct LDKAPIError *data;
/**
- * The element at position 1
+ * The number of elements pointed to by `data`.
*/
- struct LDKThirtyTwoBytes b;
-} LDKC2Tuple_PaymentHashPaymentSecretZ;
+ uintptr_t datalen;
+} LDKCVec_APIErrorZ;
/**
- * The contents of CResult_PaymentSecretAPIErrorZ
+ * The contents of CResult__u832APIErrorZ
*/
-typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
+typedef union LDKCResult__u832APIErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
* Reading from this pointer when `result_ok` is set is undefined.
*/
struct LDKAPIError *err;
-} LDKCResult_PaymentSecretAPIErrorZPtr;
+} LDKCResult__u832APIErrorZPtr;
/**
- * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
+ * A CResult__u832APIErrorZ represents the result of a fallible operation,
* containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_PaymentSecretAPIErrorZ {
+typedef struct LDKCResult__u832APIErrorZ {
/**
- * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
+ * The contents of this CResult__u832APIErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_PaymentSecretAPIErrorZPtr contents;
+ union LDKCResult__u832APIErrorZPtr contents;
/**
- * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
+ * Whether this CResult__u832APIErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_PaymentSecretAPIErrorZ;
+} LDKCResult__u832APIErrorZ;
/**
- * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
- * This corresponds to std::vector in C++
+ * If a payment fails to send, it can be in one of several states. This enum is returned as the
+ * Err() type describing which state the payment is in, see the description of individual enum
+ * states for more.
*/
-typedef struct LDKCVec_ChannelMonitorZ {
+typedef enum LDKPaymentSendFailure_Tag {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A parameter which was passed to send_payment was invalid, preventing us from attempting to
+ * send the payment at all. No channel state has been changed or messages sent to peers, and
+ * once you've changed the parameter at error, you can freely retry the payment in full.
*/
- struct LDKChannelMonitor *data;
+ LDKPaymentSendFailure_ParameterError,
/**
- * The number of elements pointed to by `data`.
+ * A parameter in a single path which was passed to send_payment was invalid, preventing us
+ * from attempting to send the payment at all. No channel state has been changed or messages
+ * sent to peers, and once you've changed the parameter at error, you can freely retry the
+ * payment in full.
+ *
+ * The results here are ordered the same as the paths in the route object which was passed to
+ * send_payment.
*/
- uintptr_t datalen;
-} LDKCVec_ChannelMonitorZ;
-
-
-
-/**
- * An update generated by the underlying Channel itself which contains some new information the
- * ChannelMonitor should be made aware of.
- */
-typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
+ LDKPaymentSendFailure_PathParameterError,
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * All paths which were attempted failed to send, with no channel state change taking place.
+ * You can freely retry the payment in full (though you probably want to do so over different
+ * paths than the ones selected).
*/
- LDKnativeChannelMonitorUpdate *inner;
+ LDKPaymentSendFailure_AllFailedRetrySafe,
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Some paths which were attempted failed to send, though possibly not all. At least some
+ * paths have irrevocably committed to the HTLC and retrying the payment in full would result
+ * in over-/re-payment.
+ *
+ * The results here are ordered the same as the paths in the route object which was passed to
+ * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
+ * retried (though there is currently no API with which to do so).
+ *
+ * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
+ * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
+ * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
+ * with the latest update_id.
*/
- bool is_owned;
-} LDKChannelMonitorUpdate;
+ LDKPaymentSendFailure_PartialFailure,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKPaymentSendFailure_Sentinel,
+} LDKPaymentSendFailure_Tag;
-/**
- * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
- * blocks are connected and disconnected.
- *
- * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
- * responsible for maintaining a set of monitors such that they can be updated accordingly as
- * channel state changes and HTLCs are resolved. See method documentation for specific
- * requirements.
- *
- * Implementations **must** ensure that updates are successfully applied and persisted upon method
- * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
- * without taking any further action such as persisting the current state.
- *
- * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
- * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
- * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
- * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
- * multiple instances.
- *
- * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
- */
-typedef struct LDKWatch {
+typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
/**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
+ * The errors themselves, in the same order as the route hops.
*/
- void *this_arg;
+ struct LDKCVec_CResult_NoneAPIErrorZZ results;
/**
- * Watches a channel identified by `funding_txo` using `monitor`.
- *
- * Implementations are responsible for watching the chain for the funding transaction along
- * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
- * calling [`block_connected`] and [`block_disconnected`] on the monitor.
- *
- * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
- * the given `funding_txo` has previously been registered via `watch_channel`.
+ * If some paths failed without irrevocably committing to the new HTLC(s), this will
+ * contain a [`RouteParameters`] object which can be used to calculate a new route that
+ * will pay all remaining unpaid balance.
*
- * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
- * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
- * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
+ struct LDKRouteParameters failed_paths_retry;
/**
- * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
- *
- * Implementations must call [`update_monitor`] with the given update. See
- * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
- *
- * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
+ * The payment id for the payment, which is now at least partially pending.
*/
- struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
+ struct LDKThirtyTwoBytes payment_id;
+} LDKPaymentSendFailure_LDKPartialFailure_Body;
+
+typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
+ LDKPaymentSendFailure_Tag tag;
+ union {
+ struct {
+ struct LDKAPIError parameter_error;
+ };
+ struct {
+ struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
+ };
+ struct {
+ struct LDKCVec_APIErrorZ all_failed_retry_safe;
+ };
+ LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
+ };
+} LDKPaymentSendFailure;
+
+/**
+ * The contents of CResult_PaymentIdPaymentSendFailureZ
+ */
+typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
/**
- * Returns any monitor events since the last call. Subsequent calls must only return new
- * events.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
+ struct LDKThirtyTwoBytes *result;
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void (*free)(void *this_arg);
-} LDKWatch;
+ struct LDKPaymentSendFailure *err;
+} LDKCResult_PaymentIdPaymentSendFailureZPtr;
/**
- * An interface to send a transaction to the Bitcoin network.
+ * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKBroadcasterInterface {
- /**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
- */
- void *this_arg;
+typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
/**
- * Sends a transaction out to (hopefully) be mined.
+ * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
+ union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
*/
- void (*free)(void *this_arg);
-} LDKBroadcasterInterface;
+ bool result_ok;
+} LDKCResult_PaymentIdPaymentSendFailureZ;
/**
- * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
- * own the memory pointed to by data.
+ * The contents of CResult_NonePaymentSendFailureZ
*/
-typedef struct LDKu8slice {
+typedef union LDKCResult_NonePaymentSendFailureZPtr {
/**
- * A pointer to the byte buffer
+ * Note that this value is always NULL, as there are no contents in the OK variant
*/
- const uint8_t *data;
+ void *result;
/**
- * The number of bytes pointed to by `data`.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uintptr_t datalen;
-} LDKu8slice;
+ struct LDKPaymentSendFailure *err;
+} LDKCResult_NonePaymentSendFailureZPtr;
/**
- * A trait to describe an object which can get user secrets and key material.
+ * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKKeysInterface {
- /**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
- */
- void *this_arg;
+typedef struct LDKCResult_NonePaymentSendFailureZ {
/**
- * Get node secret key (aka node_id or network_key).
- *
- * This method must return the same value each time it is called.
+ * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKSecretKey (*get_node_secret)(const void *this_arg);
+ union LDKCResult_NonePaymentSendFailureZPtr contents;
/**
- * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
- *
- * This method should return a different value each time it is called, to avoid linking
- * on-chain funds across channels as controlled to the same user.
+ * Whether this CResult_NonePaymentSendFailureZ represents a success state.
*/
- struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
+ bool result_ok;
+} LDKCResult_NonePaymentSendFailureZ;
+
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
/**
- * Get a script pubkey which we will send funds to when closing a channel.
- *
- * This method should return a different value each time it is called, to avoid linking
- * on-chain funds across channels as controlled to the same user.
+ * The element at position 0
*/
- struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
+ struct LDKThirtyTwoBytes a;
/**
- * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
- * restarted with some stale data!
- *
- * This method must return a different value each time it is called.
+ * The element at position 1
*/
- struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
+ struct LDKThirtyTwoBytes b;
+} LDKC2Tuple_PaymentHashPaymentIdZ;
+
+/**
+ * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
+ */
+typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
/**
- * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
- * onion packets and for temporary channel IDs. There is no requirement that these be
- * persisted anywhere, though they must be unique across restarts.
- *
- * This method must return a different value each time it is called.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
+ struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
/**
- * Reads a `Signer` for this `KeysInterface` from the given input stream.
- * This is only called during deserialization of other objects which contain
- * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
- * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
- * contain no versioning scheme. You may wish to include your own version prefix and ensure
- * you've read all of the provided bytes to ensure no corruption occurred.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
+ struct LDKPaymentSendFailure *err;
+} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
+
+/**
+ * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
/**
- * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
- * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
- * this trait to parse the invoice and make sure they're signing what they expect, rather than
- * blindly signing the hash.
+ * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
+ union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
*/
- void (*free)(void *this_arg);
-} LDKKeysInterface;
+ bool result_ok;
+} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
/**
- * A trait which should be implemented to provide feerate information on a number of time
- * horizons.
- *
- * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
- * called from inside the library in response to chain events, P2P events, or timer events).
+ * A 4-byte byte array.
*/
-typedef struct LDKFeeEstimator {
+typedef struct LDKFourBytes {
/**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
+ * The four bytes
*/
- void *this_arg;
+ uint8_t data[4];
+} LDKFourBytes;
+
+/**
+ * A 16-byte byte array.
+ */
+typedef struct LDKSixteenBytes {
/**
- * Gets estimated satoshis of fee required per 1000 Weight-Units.
- *
- * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
- * don't put us below 1 satoshi-per-byte).
- *
- * This translates to:
- * * satoshis-per-byte * 250
- * * ceil(satoshis-per-kbyte / 4)
+ * The sixteen bytes
*/
- uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
+ uint8_t data[16];
+} LDKSixteenBytes;
+
+/**
+ * A 10-byte byte array.
+ */
+typedef struct LDKTenBytes {
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * The ten bytes
*/
- void (*free)(void *this_arg);
-} LDKFeeEstimator;
+ uint8_t data[10];
+} LDKTenBytes;
/**
- * A trait encapsulating the operations required of a logger
+ * An address which can be used to connect to a remote peer
*/
-typedef struct LDKLogger {
+typedef enum LDKNetAddress_Tag {
/**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
+ * An IPv4 address/port on which the peer is listening.
*/
- void *this_arg;
+ LDKNetAddress_IPv4,
/**
- * Logs the `Record`
+ * An IPv6 address/port on which the peer is listening.
*/
- void (*log)(const void *this_arg, const char *record);
+ LDKNetAddress_IPv6,
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * An old-style Tor onion address/port on which the peer is listening.
*/
- void (*free)(void *this_arg);
-} LDKLogger;
-
-
+ LDKNetAddress_OnionV2,
+ /**
+ * A new-style Tor onion address/port on which the peer is listening.
+ * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
+ * wrap as base32 and append \".onion\".
+ */
+ LDKNetAddress_OnionV3,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKNetAddress_Sentinel,
+} LDKNetAddress_Tag;
-/**
- * Manager which keeps track of a number of channels and sends messages to the appropriate
- * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
- *
- * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
- * to individual Channels.
- *
- * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
- * all peers during write/read (though does not modify this instance, only the instance being
- * serialized). This will result in any channels which have not yet exchanged funding_created (ie
- * called funding_transaction_generated for outbound channels).
- *
- * Note that you can be a bit lazier about writing out ChannelManager than you can be with
- * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
- * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
- * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
- * the serialization process). If the deserialized version is out-of-date compared to the
- * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
- * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
- *
- * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
- * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
- * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
- * block_connected() to step towards your best block) upon deserialization before using the
- * object!
- *
- * Note that ChannelManager is responsible for tracking liveness of its channels and generating
- * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
- * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
- * offline for a full minute. In order to track this, you must call
- * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
- *
- * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
- * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
- * essentially you should default to using a SimpleRefChannelManager, and use a
- * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
- * you're using lightning-net-tokio.
- */
-typedef struct MUST_USE_STRUCT LDKChannelManager {
+typedef struct LDKNetAddress_LDKIPv4_Body {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The 4-byte IPv4 address
*/
- LDKnativeChannelManager *inner;
+ struct LDKFourBytes addr;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The port on which the node is listening
*/
- bool is_owned;
-} LDKChannelManager;
+ uint16_t port;
+} LDKNetAddress_LDKIPv4_Body;
-/**
- * A tuple of 2 elements. See the individual fields for the types contained.
- */
-typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
+typedef struct LDKNetAddress_LDKIPv6_Body {
/**
- * The element at position 0
+ * The 16-byte IPv6 address
*/
- struct LDKThirtyTwoBytes a;
+ struct LDKSixteenBytes addr;
/**
- * The element at position 1
+ * The port on which the node is listening
*/
- struct LDKChannelManager b;
-} LDKC2Tuple_BlockHashChannelManagerZ;
+ uint16_t port;
+} LDKNetAddress_LDKIPv6_Body;
-/**
- * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
- */
-typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
+typedef struct LDKNetAddress_LDKOnionV2_Body {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The bytes (usually encoded in base32 with \".onion\" appended)
*/
- struct LDKC2Tuple_BlockHashChannelManagerZ *result;
+ struct LDKTenBytes addr;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The port on which the node is listening
*/
- struct LDKDecodeError *err;
-} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
+ uint16_t port;
+} LDKNetAddress_LDKOnionV2_Body;
-/**
- * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
+typedef struct LDKNetAddress_LDKOnionV3_Body {
/**
- * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The ed25519 long-term public key of the peer
*/
- union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
+ struct LDKThirtyTwoBytes ed25519_pubkey;
/**
- * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
+ * The checksum of the pubkey and version, as included in the onion address
*/
- bool result_ok;
-} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
-
-
-
-/**
- * Options which apply on a per-channel basis and may change at runtime or based on negotiation
- * with our counterparty.
- */
-typedef struct MUST_USE_STRUCT LDKChannelConfig {
+ uint16_t checksum;
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The version byte, as defined by the Tor Onion v3 spec.
*/
- LDKnativeChannelConfig *inner;
+ uint8_t version;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The port on which the node is listening
*/
- bool is_owned;
-} LDKChannelConfig;
+ uint16_t port;
+} LDKNetAddress_LDKOnionV3_Body;
+
+typedef struct MUST_USE_STRUCT LDKNetAddress {
+ LDKNetAddress_Tag tag;
+ union {
+ LDKNetAddress_LDKIPv4_Body i_pv4;
+ LDKNetAddress_LDKIPv6_Body i_pv6;
+ LDKNetAddress_LDKOnionV2_Body onion_v2;
+ LDKNetAddress_LDKOnionV3_Body onion_v3;
+ };
+} LDKNetAddress;
/**
- * The contents of CResult_ChannelConfigDecodeErrorZ
+ * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
+typedef struct LDKCVec_NetAddressZ {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKChannelConfig *result;
+ struct LDKNetAddress *data;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The number of elements pointed to by `data`.
*/
- struct LDKDecodeError *err;
-} LDKCResult_ChannelConfigDecodeErrorZPtr;
+ uintptr_t datalen;
+} LDKCVec_NetAddressZ;
/**
- * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
+typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
/**
- * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The element at position 0
*/
- union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
+ struct LDKThirtyTwoBytes a;
/**
- * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
+ * The element at position 1
*/
- bool result_ok;
-} LDKCResult_ChannelConfigDecodeErrorZ;
+ struct LDKThirtyTwoBytes b;
+} LDKC2Tuple_PaymentHashPaymentSecretZ;
/**
- * The contents of CResult_OutPointDecodeErrorZ
+ * The contents of CResult_PaymentSecretAPIErrorZ
*/
-typedef union LDKCResult_OutPointDecodeErrorZPtr {
+typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKOutPoint *result;
+ struct LDKThirtyTwoBytes *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKDecodeError *err;
-} LDKCResult_OutPointDecodeErrorZPtr;
+ struct LDKAPIError *err;
+} LDKCResult_PaymentSecretAPIErrorZPtr;
/**
- * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_OutPointDecodeErrorZ {
+typedef struct LDKCResult_PaymentSecretAPIErrorZ {
/**
- * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
+ * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_OutPointDecodeErrorZPtr contents;
+ union LDKCResult_PaymentSecretAPIErrorZPtr contents;
/**
- * Whether this CResult_OutPointDecodeErrorZ represents a success state.
+ * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_OutPointDecodeErrorZ;
+} LDKCResult_PaymentSecretAPIErrorZ;
/**
- * Defines a type identifier for sending messages over the wire.
- *
- * Messages implementing this trait specify a type and must be [`Writeable`].
+ * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct LDKType {
- /**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
- */
- void *this_arg;
+typedef struct LDKCVec_ChannelMonitorZ {
/**
- * Returns the type identifying the message payload.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- uint16_t (*type_id)(const void *this_arg);
+ struct LDKChannelMonitor *data;
/**
- * Return a human-readable "debug" string describing this object
+ * The number of elements pointed to by `data`.
*/
- struct LDKStr (*debug_str)(const void *this_arg);
+ uintptr_t datalen;
+} LDKCVec_ChannelMonitorZ;
+
+
+
+/**
+ * An update generated by the underlying Channel itself which contains some new information the
+ * ChannelMonitor should be made aware of.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
/**
- * Serialize the object into a byte array
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKCVec_u8Z (*write)(const void *this_arg);
+ LDKnativeChannelMonitorUpdate *inner;
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- void (*free)(void *this_arg);
-} LDKType;
+ bool is_owned;
+} LDKChannelMonitorUpdate;
/**
- * An enum which can either contain a crate::lightning::ln::wire::Type or not
+ * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
+ * blocks are connected and disconnected.
+ *
+ * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
+ * responsible for maintaining a set of monitors such that they can be updated accordingly as
+ * channel state changes and HTLCs are resolved. See method documentation for specific
+ * requirements.
+ *
+ * Implementations **must** ensure that updates are successfully applied and persisted upon method
+ * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
+ * without taking any further action such as persisting the current state.
+ *
+ * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
+ * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
+ * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
+ * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
+ * multiple instances.
+ *
+ * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
*/
-typedef enum LDKCOption_TypeZ_Tag {
+typedef struct LDKWatch {
/**
- * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
*/
- LDKCOption_TypeZ_Some,
+ void *this_arg;
/**
- * When we're in this state, this COption_TypeZ contains nothing
+ * Watches a channel identified by `funding_txo` using `monitor`.
+ *
+ * Implementations are responsible for watching the chain for the funding transaction along
+ * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
+ * calling [`block_connected`] and [`block_disconnected`] on the monitor.
+ *
+ * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
+ * the given `funding_txo` has previously been registered via `watch_channel`.
+ *
+ * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
+ * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
+ * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
*/
- LDKCOption_TypeZ_None,
+ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
/**
- * Must be last for serialization purposes
+ * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
+ *
+ * Implementations must call [`update_monitor`] with the given update. See
+ * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
+ *
+ * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
*/
- LDKCOption_TypeZ_Sentinel,
-} LDKCOption_TypeZ_Tag;
-
-typedef struct LDKCOption_TypeZ {
- LDKCOption_TypeZ_Tag tag;
- union {
- struct {
- struct LDKType some;
- };
- };
-} LDKCOption_TypeZ;
-
-/**
- * The contents of CResult_COption_TypeZDecodeErrorZ
- */
-typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
+ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * Returns any monitor events since the last call. Subsequent calls must only return new
+ * events.
+ *
+ * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
+ * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
+ * to disk.
+ *
+ * For details on asynchronous [`ChannelMonitor`] updating and returning
+ * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
*/
- struct LDKCOption_TypeZ *result;
+ struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
*/
- struct LDKDecodeError *err;
-} LDKCResult_COption_TypeZDecodeErrorZPtr;
+ void (*free)(void *this_arg);
+} LDKWatch;
/**
- * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * An interface to send a transaction to the Bitcoin network.
*/
-typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
+typedef struct LDKBroadcasterInterface {
/**
- * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
*/
- union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
+ void *this_arg;
/**
- * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
+ * Sends a transaction out to (hopefully) be mined.
*/
- bool result_ok;
-} LDKCResult_COption_TypeZDecodeErrorZ;
+ void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKBroadcasterInterface;
/**
- * The contents of CResult_SiPrefixNoneZ
+ * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
+ * own the memory pointed to by data.
*/
-typedef union LDKCResult_SiPrefixNoneZPtr {
+typedef struct LDKu8slice {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * A pointer to the byte buffer
*/
- enum LDKSiPrefix *result;
+ const uint8_t *data;
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * The number of bytes pointed to by `data`.
*/
- void *err;
-} LDKCResult_SiPrefixNoneZPtr;
+ uintptr_t datalen;
+} LDKu8slice;
/**
- * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A trait to describe an object which can get user secrets and key material.
*/
-typedef struct LDKCResult_SiPrefixNoneZ {
+typedef struct LDKKeysInterface {
/**
- * The contents of this CResult_SiPrefixNoneZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
*/
- union LDKCResult_SiPrefixNoneZPtr contents;
+ void *this_arg;
/**
- * Whether this CResult_SiPrefixNoneZ represents a success state.
+ * Get node secret key (aka node_id or network_key).
+ *
+ * This method must return the same value each time it is called.
*/
- bool result_ok;
-} LDKCResult_SiPrefixNoneZ;
-
-
-
-/**
- * Represents a syntactically and semantically correct lightning BOLT11 invoice.
- *
- * There are three ways to construct an `Invoice`:
- * 1. using `InvoiceBuilder`
- * 2. using `Invoice::from_signed(SignedRawInvoice)`
- * 3. using `str::parse::<Invoice>(&str)`
- */
-typedef struct MUST_USE_STRUCT LDKInvoice {
+ struct LDKSecretKey (*get_node_secret)(const void *this_arg);
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
+ *
+ * This method should return a different value each time it is called, to avoid linking
+ * on-chain funds across channels as controlled to the same user.
*/
- LDKnativeInvoice *inner;
+ struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Get a script pubkey which we will send funds to when closing a channel.
+ *
+ * This method should return a different value each time it is called, to avoid linking
+ * on-chain funds across channels as controlled to the same user.
*/
- bool is_owned;
-} LDKInvoice;
-
-/**
- * The contents of CResult_InvoiceNoneZ
- */
-typedef union LDKCResult_InvoiceNoneZPtr {
+ struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
+ * restarted with some stale data!
+ *
+ * This method must return a different value each time it is called.
*/
- struct LDKInvoice *result;
+ struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
+ * onion packets and for temporary channel IDs. There is no requirement that these be
+ * persisted anywhere, though they must be unique across restarts.
+ *
+ * This method must return a different value each time it is called.
*/
- void *err;
-} LDKCResult_InvoiceNoneZPtr;
+ struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
+ /**
+ * Reads a `Signer` for this `KeysInterface` from the given input stream.
+ * This is only called during deserialization of other objects which contain
+ * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
+ * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
+ * contain no versioning scheme. You may wish to include your own version prefix and ensure
+ * you've read all of the provided bytes to ensure no corruption occurred.
+ */
+ struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
+ /**
+ * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
+ * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
+ * this trait to parse the invoice and make sure they're signing what they expect, rather than
+ * blindly signing the hash.
+ */
+ struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKKeysInterface;
/**
- * A CResult_InvoiceNoneZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::Invoice on success and a () on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A trait which should be implemented to provide feerate information on a number of time
+ * horizons.
+ *
+ * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
+ * called from inside the library in response to chain events, P2P events, or timer events).
*/
-typedef struct LDKCResult_InvoiceNoneZ {
+typedef struct LDKFeeEstimator {
/**
- * The contents of this CResult_InvoiceNoneZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
*/
- union LDKCResult_InvoiceNoneZPtr contents;
+ void *this_arg;
/**
- * Whether this CResult_InvoiceNoneZ represents a success state.
+ * Gets estimated satoshis of fee required per 1000 Weight-Units.
+ *
+ * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
+ * don't put us below 1 satoshi-per-byte).
+ *
+ * This translates to:
+ * * satoshis-per-byte * 250
+ * * ceil(satoshis-per-kbyte / 4)
*/
- bool result_ok;
-} LDKCResult_InvoiceNoneZ;
+ uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKFeeEstimator;
/**
- * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
- * invalid.
- *
- * # Invariants
- * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
+ * A Record, unit of logging output with Metadata to enable filtering
+ * Module_path, file, line to inform on log's source
*/
-typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
+typedef struct MUST_USE_STRUCT LDKRecord {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeSignedRawInvoice *inner;
+ LDKnativeRecord *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKSignedRawInvoice;
+} LDKRecord;
/**
- * The contents of CResult_SignedRawInvoiceNoneZ
+ * A trait encapsulating the operations required of a logger
*/
-typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKSignedRawInvoice *result;
+typedef struct LDKLogger {
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
*/
- void *err;
-} LDKCResult_SignedRawInvoiceNoneZPtr;
-
-/**
- * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_SignedRawInvoiceNoneZ {
+ void *this_arg;
/**
- * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * Logs the `Record`
*/
- union LDKCResult_SignedRawInvoiceNoneZPtr contents;
+ void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
/**
- * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
*/
- bool result_ok;
-} LDKCResult_SignedRawInvoiceNoneZ;
+ void (*free)(void *this_arg);
+} LDKLogger;
/**
- * Represents an syntactically correct Invoice for a payment on the lightning network,
- * but without the signature information.
- * De- and encoding should not lead to information loss but may lead to different hashes.
+ * Manager which keeps track of a number of channels and sends messages to the appropriate
+ * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
+ *
+ * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
+ * to individual Channels.
+ *
+ * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
+ * all peers during write/read (though does not modify this instance, only the instance being
+ * serialized). This will result in any channels which have not yet exchanged funding_created (ie
+ * called funding_transaction_generated for outbound channels).
+ *
+ * Note that you can be a bit lazier about writing out ChannelManager than you can be with
+ * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
+ * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
+ * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
+ * the serialization process). If the deserialized version is out-of-date compared to the
+ * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
+ * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
+ *
+ * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
+ * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
+ * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
+ * block_connected() to step towards your best block) upon deserialization before using the
+ * object!
+ *
+ * Note that ChannelManager is responsible for tracking liveness of its channels and generating
+ * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
+ * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
+ * offline for a full minute. In order to track this, you must call
+ * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
*
- * For methods without docs see the corresponding methods in `Invoice`.
+ * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
+ * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
+ * essentially you should default to using a SimpleRefChannelManager, and use a
+ * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
+ * you're using lightning-net-tokio.
*/
-typedef struct MUST_USE_STRUCT LDKRawInvoice {
+typedef struct MUST_USE_STRUCT LDKChannelManager {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeRawInvoice *inner;
+ LDKnativeChannelManager *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKRawInvoice;
-
-
+} LDKChannelManager;
/**
- * Recoverable signature
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
+typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * The element at position 0
*/
- LDKnativeInvoiceSignature *inner;
+ struct LDKThirtyTwoBytes a;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * The element at position 1
*/
- bool is_owned;
-} LDKInvoiceSignature;
+ struct LDKChannelManager b;
+} LDKC2Tuple_BlockHashChannelManagerZ;
/**
- * A tuple of 3 elements. See the individual fields for the types contained.
+ * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
*/
-typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
+typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
/**
- * The element at position 0
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKRawInvoice a;
+ struct LDKC2Tuple_BlockHashChannelManagerZ *result;
/**
- * The element at position 1
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKThirtyTwoBytes b;
+ struct LDKDecodeError *err;
+} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
+
+/**
+ * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
/**
- * The element at position 2
+ * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKInvoiceSignature c;
-} LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
+ union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
/**
- * Payee public key
+ * Options which apply on a per-channel basis and may change at runtime or based on negotiation
+ * with our counterparty.
*/
-typedef struct MUST_USE_STRUCT LDKPayeePubKey {
+typedef struct MUST_USE_STRUCT LDKChannelConfig {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativePayeePubKey *inner;
+ LDKnativeChannelConfig *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKPayeePubKey;
+} LDKChannelConfig;
/**
- * The contents of CResult_PayeePubKeyErrorZ
+ * The contents of CResult_ChannelConfigDecodeErrorZ
*/
-typedef union LDKCResult_PayeePubKeyErrorZPtr {
+typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKPayeePubKey *result;
+ struct LDKChannelConfig *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- enum LDKSecp256k1Error *err;
-} LDKCResult_PayeePubKeyErrorZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelConfigDecodeErrorZPtr;
/**
- * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
+ * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_PayeePubKeyErrorZ {
+typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
/**
- * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
+ * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_PayeePubKeyErrorZPtr contents;
+ union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
/**
- * Whether this CResult_PayeePubKeyErrorZ represents a success state.
+ * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_PayeePubKeyErrorZ;
-
-
+} LDKCResult_ChannelConfigDecodeErrorZ;
/**
- * Private routing information
- *
- * # Invariants
- * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
- *
+ * The contents of CResult_OutPointDecodeErrorZ
*/
-typedef struct MUST_USE_STRUCT LDKPrivateRoute {
+typedef union LDKCResult_OutPointDecodeErrorZPtr {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- LDKnativePrivateRoute *inner;
+ struct LDKOutPoint *result;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- bool is_owned;
-} LDKPrivateRoute;
+ struct LDKDecodeError *err;
+} LDKCResult_OutPointDecodeErrorZPtr;
/**
- * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
- * This corresponds to std::vector in C++
+ * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCVec_PrivateRouteZ {
+typedef struct LDKCResult_OutPointDecodeErrorZ {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKPrivateRoute *data;
+ union LDKCResult_OutPointDecodeErrorZPtr contents;
/**
- * The number of elements pointed to by `data`.
+ * Whether this CResult_OutPointDecodeErrorZ represents a success state.
*/
- uintptr_t datalen;
-} LDKCVec_PrivateRouteZ;
-
-
+ bool result_ok;
+} LDKCResult_OutPointDecodeErrorZ;
/**
- * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
- * timestamp is positive.
+ * Defines a type identifier for sending messages over the wire.
*
- * # Invariants
- * The UNIX timestamp representing the stored time has to be positive and small enough so that
- * a `EpiryTime` can be added to it without an overflow.
+ * Messages implementing this trait specify a type and must be [`Writeable`].
*/
-typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
+typedef struct LDKType {
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
*/
- LDKnativePositiveTimestamp *inner;
+ void *this_arg;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Returns the type identifying the message payload.
*/
- bool is_owned;
-} LDKPositiveTimestamp;
+ uint16_t (*type_id)(const void *this_arg);
+ /**
+ * Return a human-readable "debug" string describing this object
+ */
+ struct LDKStr (*debug_str)(const void *this_arg);
+ /**
+ * Serialize the object into a byte array
+ */
+ struct LDKCVec_u8Z (*write)(const void *this_arg);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKType;
/**
- * The contents of CResult_PositiveTimestampCreationErrorZ
+ * An enum which can either contain a crate::lightning::ln::wire::Type or not
*/
-typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
+typedef enum LDKCOption_TypeZ_Tag {
+ /**
+ * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
+ */
+ LDKCOption_TypeZ_Some,
+ /**
+ * When we're in this state, this COption_TypeZ contains nothing
+ */
+ LDKCOption_TypeZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_TypeZ_Sentinel,
+} LDKCOption_TypeZ_Tag;
+
+typedef struct LDKCOption_TypeZ {
+ LDKCOption_TypeZ_Tag tag;
+ union {
+ struct {
+ struct LDKType some;
+ };
+ };
+} LDKCOption_TypeZ;
+
+/**
+ * The contents of CResult_COption_TypeZDecodeErrorZ
+ */
+typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKPositiveTimestamp *result;
+ struct LDKCOption_TypeZ *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- enum LDKCreationError *err;
-} LDKCResult_PositiveTimestampCreationErrorZPtr;
+ struct LDKDecodeError *err;
+} LDKCResult_COption_TypeZDecodeErrorZPtr;
/**
- * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
+ * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
+typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
/**
- * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
+ * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
+ union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
/**
- * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
+ * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_PositiveTimestampCreationErrorZ;
+} LDKCResult_COption_TypeZDecodeErrorZ;
/**
- * The contents of CResult_NoneSemanticErrorZ
+ * An error that may occur when making a payment.
+ */
+typedef enum LDKPaymentError_Tag {
+ /**
+ * An error resulting from the provided [`Invoice`] or payment hash.
+ */
+ LDKPaymentError_Invoice,
+ /**
+ * An error occurring when finding a route.
+ */
+ LDKPaymentError_Routing,
+ /**
+ * An error occurring when sending a payment.
+ */
+ LDKPaymentError_Sending,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKPaymentError_Sentinel,
+} LDKPaymentError_Tag;
+
+typedef struct MUST_USE_STRUCT LDKPaymentError {
+ LDKPaymentError_Tag tag;
+ union {
+ struct {
+ struct LDKStr invoice;
+ };
+ struct {
+ struct LDKLightningError routing;
+ };
+ struct {
+ struct LDKPaymentSendFailure sending;
+ };
+ };
+} LDKPaymentError;
+
+/**
+ * The contents of CResult_PaymentIdPaymentErrorZ
*/
-typedef union LDKCResult_NoneSemanticErrorZPtr {
+typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
/**
- * Note that this value is always NULL, as there are no contents in the OK variant
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- void *result;
+ struct LDKThirtyTwoBytes *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- enum LDKSemanticError *err;
-} LDKCResult_NoneSemanticErrorZPtr;
+ struct LDKPaymentError *err;
+} LDKCResult_PaymentIdPaymentErrorZPtr;
/**
- * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
- * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
+ * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_NoneSemanticErrorZ {
+typedef struct LDKCResult_PaymentIdPaymentErrorZ {
/**
- * The contents of this CResult_NoneSemanticErrorZ, accessible via either
+ * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_NoneSemanticErrorZPtr contents;
+ union LDKCResult_PaymentIdPaymentErrorZPtr contents;
/**
- * Whether this CResult_NoneSemanticErrorZ represents a success state.
+ * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_NoneSemanticErrorZ;
+} LDKCResult_PaymentIdPaymentErrorZ;
/**
- * The contents of CResult_InvoiceSemanticErrorZ
+ * The contents of CResult_SiPrefixNoneZ
*/
-typedef union LDKCResult_InvoiceSemanticErrorZPtr {
+typedef union LDKCResult_SiPrefixNoneZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKInvoice *result;
+ enum LDKSiPrefix *result;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- enum LDKSemanticError *err;
-} LDKCResult_InvoiceSemanticErrorZPtr;
+ void *err;
+} LDKCResult_SiPrefixNoneZPtr;
/**
- * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
+ * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_InvoiceSemanticErrorZ {
+typedef struct LDKCResult_SiPrefixNoneZ {
/**
- * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
+ * The contents of this CResult_SiPrefixNoneZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_InvoiceSemanticErrorZPtr contents;
+ union LDKCResult_SiPrefixNoneZPtr contents;
/**
- * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
+ * Whether this CResult_SiPrefixNoneZ represents a success state.
*/
bool result_ok;
-} LDKCResult_InvoiceSemanticErrorZ;
+} LDKCResult_SiPrefixNoneZ;
/**
- * Description string
+ * Represents a syntactically and semantically correct lightning BOLT11 invoice.
*
- * # Invariants
- * The description can be at most 639 __bytes__ long
+ * There are three ways to construct an `Invoice`:
+ * 1. using `InvoiceBuilder`
+ * 2. using `Invoice::from_signed(SignedRawInvoice)`
+ * 3. using `str::parse::<Invoice>(&str)`
*/
-typedef struct MUST_USE_STRUCT LDKDescription {
+typedef struct MUST_USE_STRUCT LDKInvoice {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeDescription *inner;
+ LDKnativeInvoice *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKDescription;
+} LDKInvoice;
/**
- * The contents of CResult_DescriptionCreationErrorZ
+ * The contents of CResult_InvoiceNoneZ
*/
-typedef union LDKCResult_DescriptionCreationErrorZPtr {
+typedef union LDKCResult_InvoiceNoneZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKDescription *result;
+ struct LDKInvoice *result;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- enum LDKCreationError *err;
-} LDKCResult_DescriptionCreationErrorZPtr;
+ void *err;
+} LDKCResult_InvoiceNoneZPtr;
/**
- * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
+ * A CResult_InvoiceNoneZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::Invoice on success and a () on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_DescriptionCreationErrorZ {
+typedef struct LDKCResult_InvoiceNoneZ {
/**
- * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
+ * The contents of this CResult_InvoiceNoneZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_DescriptionCreationErrorZPtr contents;
+ union LDKCResult_InvoiceNoneZPtr contents;
/**
- * Whether this CResult_DescriptionCreationErrorZ represents a success state.
+ * Whether this CResult_InvoiceNoneZ represents a success state.
*/
bool result_ok;
-} LDKCResult_DescriptionCreationErrorZ;
+} LDKCResult_InvoiceNoneZ;
/**
- * Positive duration that defines when (relatively to the timestamp) in the future the invoice
- * expires
+ * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
+ * invalid.
*
* # Invariants
- * The number of seconds this expiry time represents has to be in the range
- * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
- * timestamp
+ * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
*/
-typedef struct MUST_USE_STRUCT LDKExpiryTime {
+typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeExpiryTime *inner;
+ LDKnativeSignedRawInvoice *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKExpiryTime;
+} LDKSignedRawInvoice;
/**
- * The contents of CResult_ExpiryTimeCreationErrorZ
+ * The contents of CResult_SignedRawInvoiceNoneZ
*/
-typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
+typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKExpiryTime *result;
+ struct LDKSignedRawInvoice *result;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- enum LDKCreationError *err;
-} LDKCResult_ExpiryTimeCreationErrorZPtr;
+ void *err;
+} LDKCResult_SignedRawInvoiceNoneZPtr;
/**
- * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
+ * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
+typedef struct LDKCResult_SignedRawInvoiceNoneZ {
/**
- * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
+ * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
+ union LDKCResult_SignedRawInvoiceNoneZPtr contents;
/**
- * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
+ * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
*/
bool result_ok;
-} LDKCResult_ExpiryTimeCreationErrorZ;
+} LDKCResult_SignedRawInvoiceNoneZ;
+
+
/**
- * The contents of CResult_PrivateRouteCreationErrorZ
+ * Represents an syntactically correct Invoice for a payment on the lightning network,
+ * but without the signature information.
+ * De- and encoding should not lead to information loss but may lead to different hashes.
+ *
+ * For methods without docs see the corresponding methods in `Invoice`.
*/
-typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
+typedef struct MUST_USE_STRUCT LDKRawInvoice {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKPrivateRoute *result;
+ LDKnativeRawInvoice *inner;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- enum LDKCreationError *err;
-} LDKCResult_PrivateRouteCreationErrorZPtr;
+ bool is_owned;
+} LDKRawInvoice;
+
+
/**
- * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * Recoverable signature
*/
-typedef struct LDKCResult_PrivateRouteCreationErrorZ {
+typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
/**
- * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- union LDKCResult_PrivateRouteCreationErrorZPtr contents;
+ LDKnativeInvoiceSignature *inner;
/**
- * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- bool result_ok;
-} LDKCResult_PrivateRouteCreationErrorZ;
+ bool is_owned;
+} LDKInvoiceSignature;
/**
- * The contents of CResult_StringErrorZ
+ * A tuple of 3 elements. See the individual fields for the types contained.
*/
-typedef union LDKCResult_StringErrorZPtr {
+typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The element at position 0
*/
- struct LDKStr *result;
+ struct LDKRawInvoice a;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The element at position 1
*/
- enum LDKSecp256k1Error *err;
-} LDKCResult_StringErrorZPtr;
+ struct LDKThirtyTwoBytes b;
+ /**
+ * The element at position 2
+ */
+ struct LDKInvoiceSignature c;
+} LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
+
+
/**
- * A CResult_StringErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * Payee public key
*/
-typedef struct LDKCResult_StringErrorZ {
+typedef struct MUST_USE_STRUCT LDKPayeePubKey {
/**
- * The contents of this CResult_StringErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- union LDKCResult_StringErrorZPtr contents;
+ LDKnativePayeePubKey *inner;
/**
- * Whether this CResult_StringErrorZ represents a success state.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- bool result_ok;
-} LDKCResult_StringErrorZ;
+ bool is_owned;
+} LDKPayeePubKey;
/**
- * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
+ * The contents of CResult_PayeePubKeyErrorZ
*/
-typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
+typedef union LDKCResult_PayeePubKeyErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKChannelMonitorUpdate *result;
+ struct LDKPayeePubKey *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKDecodeError *err;
-} LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
+ enum LDKSecp256k1Error *err;
+} LDKCResult_PayeePubKeyErrorZPtr;
/**
- * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
+typedef struct LDKCResult_PayeePubKeyErrorZ {
/**
- * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
+ * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
+ union LDKCResult_PayeePubKeyErrorZPtr contents;
/**
- * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
+ * Whether this CResult_PayeePubKeyErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
+} LDKCResult_PayeePubKeyErrorZ;
+
+
/**
- * The contents of CResult_HTLCUpdateDecodeErrorZ
+ * Private routing information
+ *
+ * # Invariants
+ * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
+ *
*/
-typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
+typedef struct MUST_USE_STRUCT LDKPrivateRoute {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKHTLCUpdate *result;
+ LDKnativePrivateRoute *inner;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- struct LDKDecodeError *err;
-} LDKCResult_HTLCUpdateDecodeErrorZPtr;
+ bool is_owned;
+} LDKPrivateRoute;
/**
- * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
+typedef struct LDKCVec_PrivateRouteZ {
/**
- * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
+ struct LDKPrivateRoute *data;
/**
- * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
+ * The number of elements pointed to by `data`.
*/
- bool result_ok;
-} LDKCResult_HTLCUpdateDecodeErrorZ;
+ uintptr_t datalen;
+} LDKCVec_PrivateRouteZ;
/**
- * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
- * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
- * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
- * corrupted.
- * Contains a developer-readable error message.
+ * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
+ * timestamp is positive.
+ *
+ * # Invariants
+ * The UNIX timestamp representing the stored time has to be positive and small enough so that
+ * a `EpiryTime` can be added to it without an overflow.
*/
-typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
+typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeMonitorUpdateError *inner;
+ LDKnativePositiveTimestamp *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKMonitorUpdateError;
+} LDKPositiveTimestamp;
/**
- * The contents of CResult_NoneMonitorUpdateErrorZ
+ * The contents of CResult_PositiveTimestampCreationErrorZ
*/
-typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
+typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
/**
- * Note that this value is always NULL, as there are no contents in the OK variant
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- void *result;
+ struct LDKPositiveTimestamp *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKMonitorUpdateError *err;
-} LDKCResult_NoneMonitorUpdateErrorZPtr;
+ enum LDKCreationError *err;
+} LDKCResult_PositiveTimestampCreationErrorZPtr;
/**
- * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
- * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
+ * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
+typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
/**
- * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
+ * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
+ union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
/**
- * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
+ * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_NoneMonitorUpdateErrorZ;
+} LDKCResult_PositiveTimestampCreationErrorZ;
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * The contents of CResult_NoneSemanticErrorZ
*/
-typedef struct LDKC2Tuple_OutPointScriptZ {
+typedef union LDKCResult_NoneSemanticErrorZPtr {
/**
- * The element at position 0
+ * Note that this value is always NULL, as there are no contents in the OK variant
*/
- struct LDKOutPoint a;
+ void *result;
/**
- * The element at position 1
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKCVec_u8Z b;
-} LDKC2Tuple_OutPointScriptZ;
+ enum LDKSemanticError *err;
+} LDKCResult_NoneSemanticErrorZPtr;
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKC2Tuple_u32ScriptZ {
+typedef struct LDKCResult_NoneSemanticErrorZ {
/**
- * The element at position 0
+ * The contents of this CResult_NoneSemanticErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- uint32_t a;
+ union LDKCResult_NoneSemanticErrorZPtr contents;
/**
- * The element at position 1
+ * Whether this CResult_NoneSemanticErrorZ represents a success state.
*/
- struct LDKCVec_u8Z b;
-} LDKC2Tuple_u32ScriptZ;
+ bool result_ok;
+} LDKCResult_NoneSemanticErrorZ;
/**
- * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
- * This corresponds to std::vector in C++
+ * The contents of CResult_InvoiceSemanticErrorZ
*/
-typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
+typedef union LDKCResult_InvoiceSemanticErrorZPtr {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKC2Tuple_u32ScriptZ *data;
+ struct LDKInvoice *result;
/**
- * The number of elements pointed to by `data`.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uintptr_t datalen;
-} LDKCVec_C2Tuple_u32ScriptZZ;
+ enum LDKSemanticError *err;
+} LDKCResult_InvoiceSemanticErrorZPtr;
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
+typedef struct LDKCResult_InvoiceSemanticErrorZ {
/**
- * The element at position 0
+ * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKThirtyTwoBytes a;
+ union LDKCResult_InvoiceSemanticErrorZPtr contents;
/**
- * The element at position 1
+ * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
*/
- struct LDKCVec_C2Tuple_u32ScriptZZ b;
-} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
+ bool result_ok;
+} LDKCResult_InvoiceSemanticErrorZ;
+
+
/**
- * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
- * This corresponds to std::vector in C++
+ * Description string
+ *
+ * # Invariants
+ * The description can be at most 639 __bytes__ long
*/
-typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
+typedef struct MUST_USE_STRUCT LDKDescription {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
+ LDKnativeDescription *inner;
/**
- * The number of elements pointed to by `data`.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- uintptr_t datalen;
-} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
+ bool is_owned;
+} LDKDescription;
/**
- * Some information provided on receipt of payment depends on whether the payment received is a
- * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
+ * The contents of CResult_DescriptionCreationErrorZ
*/
-typedef enum LDKPaymentPurpose_Tag {
- /**
- * Information for receiving a payment that we generated an invoice for.
- */
- LDKPaymentPurpose_InvoicePayment,
+typedef union LDKCResult_DescriptionCreationErrorZPtr {
/**
- * Because this is a spontaneous payment, the payer generated their own preimage rather than us
- * (the payee) providing a preimage.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- LDKPaymentPurpose_SpontaneousPayment,
+ struct LDKDescription *result;
/**
- * Must be last for serialization purposes
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- LDKPaymentPurpose_Sentinel,
-} LDKPaymentPurpose_Tag;
+ enum LDKCreationError *err;
+} LDKCResult_DescriptionCreationErrorZPtr;
-typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
- /**
- * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
- * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
- * [`ChannelManager::claim_funds`].
- *
- * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
- * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
- *
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
- */
- struct LDKThirtyTwoBytes payment_preimage;
+/**
+ * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_DescriptionCreationErrorZ {
/**
- * The \"payment secret\". This authenticates the sender to the recipient, preventing a
- * number of deanonymization attacks during the routing process.
- * It is provided here for your reference, however its accuracy is enforced directly by
- * [`ChannelManager`] using the values you previously provided to
- * [`ChannelManager::create_inbound_payment`] or
- * [`ChannelManager::create_inbound_payment_for_hash`].
- *
- * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
- * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
- * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
+ * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKThirtyTwoBytes payment_secret;
+ union LDKCResult_DescriptionCreationErrorZPtr contents;
/**
- * This is the `user_payment_id` which was provided to
- * [`ChannelManager::create_inbound_payment_for_hash`] or
- * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
- * simply copied here. It may be used to correlate PaymentReceived events with invoice
- * metadata stored elsewhere.
- *
- * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
- * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
+ * Whether this CResult_DescriptionCreationErrorZ represents a success state.
*/
- uint64_t user_payment_id;
-} LDKPaymentPurpose_LDKInvoicePayment_Body;
+ bool result_ok;
+} LDKCResult_DescriptionCreationErrorZ;
-typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
- LDKPaymentPurpose_Tag tag;
- union {
- LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
- struct {
- struct LDKThirtyTwoBytes spontaneous_payment;
- };
- };
-} LDKPaymentPurpose;
+
+
+/**
+ * Positive duration that defines when (relatively to the timestamp) in the future the invoice
+ * expires
+ *
+ * # Invariants
+ * The number of seconds this expiry time represents has to be in the range
+ * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
+ * timestamp
+ */
+typedef struct MUST_USE_STRUCT LDKExpiryTime {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeExpiryTime *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKExpiryTime;
/**
- * The reason the channel was closed. See individual variants more details.
+ * The contents of CResult_ExpiryTimeCreationErrorZ
*/
-typedef enum LDKClosureReason_Tag {
+typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
/**
- * Closure generated from receiving a peer error message.
- *
- * Our counterparty may have broadcasted their latest commitment state, and we have
- * as well.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- LDKClosureReason_CounterpartyForceClosed,
+ struct LDKExpiryTime *result;
/**
- * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
- *
- * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- LDKClosureReason_HolderForceClosed,
+ enum LDKCreationError *err;
+} LDKCResult_ExpiryTimeCreationErrorZPtr;
+
+/**
+ * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
/**
- * The channel was closed after negotiating a cooperative close and we've now broadcasted
- * the cooperative close transaction. Note the shutdown may have been initiated by us.
+ * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKClosureReason_CooperativeClosure,
+ union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
/**
- * A commitment transaction was confirmed on chain, closing the channel. Most likely this
- * commitment transaction came from our counterparty, but it may also have come from
- * a copy of our own `ChannelMonitor`.
+ * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
*/
- LDKClosureReason_CommitmentTxConfirmed,
+ bool result_ok;
+} LDKCResult_ExpiryTimeCreationErrorZ;
+
+/**
+ * The contents of CResult_PrivateRouteCreationErrorZ
+ */
+typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
/**
- * Closure generated from processing an event, likely a HTLC forward/relay/reception.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- LDKClosureReason_ProcessingError,
+ struct LDKPrivateRoute *result;
/**
- * The `PeerManager` informed us that we've disconnected from the peer. We close channels
- * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the
- * peer again in the future or if the peer disconnected before we finished negotiating
- * the channel open. The first case may be caused by incompatible features which our
- * counterparty, or we, require.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- LDKClosureReason_DisconnectedPeer,
+ enum LDKCreationError *err;
+} LDKCResult_PrivateRouteCreationErrorZPtr;
+
+/**
+ * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PrivateRouteCreationErrorZ {
/**
- * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
- * the ChannelManager deserialized.
+ * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKClosureReason_OutdatedChannelManager,
+ union LDKCResult_PrivateRouteCreationErrorZPtr contents;
/**
- * Must be last for serialization purposes
+ * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
*/
- LDKClosureReason_Sentinel,
-} LDKClosureReason_Tag;
+ bool result_ok;
+} LDKCResult_PrivateRouteCreationErrorZ;
-typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
+/**
+ * The contents of CResult_StringErrorZ
+ */
+typedef union LDKCResult_StringErrorZPtr {
/**
- * The error which the peer sent us.
- *
- * The string should be sanitized before it is used (e.g emitted to logs
- * or printed to stdout). Otherwise, a well crafted error message may exploit
- * a security vulnerability in the terminal emulator or the logging subsystem.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKStr peer_msg;
-} LDKClosureReason_LDKCounterpartyForceClosed_Body;
-
-typedef struct LDKClosureReason_LDKProcessingError_Body {
+ struct LDKStr *result;
/**
- * A developer-readable error message which we generated.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKStr err;
-} LDKClosureReason_LDKProcessingError_Body;
-
-typedef struct MUST_USE_STRUCT LDKClosureReason {
- LDKClosureReason_Tag tag;
- union {
- LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
- LDKClosureReason_LDKProcessingError_Body processing_error;
- };
-} LDKClosureReason;
+ enum LDKSecp256k1Error *err;
+} LDKCResult_StringErrorZPtr;
/**
- * An Event which you should probably take some action in response to.
- *
- * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
- * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
- * written as it makes no sense to respond to it after reconnecting to peers).
+ * A CResult_StringErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef enum LDKEvent_Tag {
- /**
- * Used to indicate that the client should generate a funding transaction with the given
- * parameters and then call ChannelManager::funding_transaction_generated.
- * Generated in ChannelManager message handling.
- * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
- * counterparty can steal your funds!
- */
- LDKEvent_FundingGenerationReady,
+typedef struct LDKCResult_StringErrorZ {
/**
- * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
- * [`ChannelManager::claim_funds`] to get it....
- * Note that if the preimage is not known, you should call
- * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
- * network congestion.
- * If you fail to call either [`ChannelManager::claim_funds`] or
- * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
- * automatically failed.
- *
- * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
- * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
+ * The contents of this CResult_StringErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKEvent_PaymentReceived,
+ union LDKCResult_StringErrorZPtr contents;
/**
- * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
- * and we got back the payment preimage for it).
- *
- * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
- * event. In this situation, you SHOULD treat this payment as having succeeded.
+ * Whether this CResult_StringErrorZ represents a success state.
*/
- LDKEvent_PaymentSent,
+ bool result_ok;
+} LDKCResult_StringErrorZ;
+
+/**
+ * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
/**
- * Indicates an outbound payment we made failed. Probably some intermediary node dropped
- * something. You may wish to retry with a different route.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- LDKEvent_PaymentPathFailed,
+ struct LDKChannelMonitorUpdate *result;
/**
- * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
- * time in the future.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- LDKEvent_PendingHTLCsForwardable,
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
/**
- * Used to indicate that an output which you should know how to spend was confirmed on chain
- * and is now spendable.
- * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
- * counterparty spending them due to some kind of timeout. Thus, you need to store them
- * somewhere and spend them when you create on-chain transactions.
+ * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKEvent_SpendableOutputs,
+ union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
/**
- * This event is generated when a payment has been successfully forwarded through us and a
- * forwarding fee earned.
+ * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
*/
- LDKEvent_PaymentForwarded,
+ bool result_ok;
+} LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
+
+/**
+ * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
+ */
+typedef enum LDKCOption_MonitorEventZ_Tag {
/**
- * Used to indicate that a channel with the given `channel_id` is in the process of closure.
+ * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
*/
- LDKEvent_ChannelClosed,
+ LDKCOption_MonitorEventZ_Some,
/**
- * Used to indicate to the user that they can abandon the funding transaction and recycle the
- * inputs for another purpose.
+ * When we're in this state, this COption_MonitorEventZ contains nothing
*/
- LDKEvent_DiscardFunding,
+ LDKCOption_MonitorEventZ_None,
/**
* Must be last for serialization purposes
*/
- LDKEvent_Sentinel,
-} LDKEvent_Tag;
+ LDKCOption_MonitorEventZ_Sentinel,
+} LDKCOption_MonitorEventZ_Tag;
-typedef struct LDKEvent_LDKFundingGenerationReady_Body {
+typedef struct LDKCOption_MonitorEventZ {
+ LDKCOption_MonitorEventZ_Tag tag;
+ union {
+ struct {
+ struct LDKMonitorEvent some;
+ };
+ };
+} LDKCOption_MonitorEventZ;
+
+/**
+ * The contents of CResult_COption_MonitorEventZDecodeErrorZ
+ */
+typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
/**
- * The random channel_id we picked which you'll need to pass into
- * ChannelManager::funding_transaction_generated.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKThirtyTwoBytes temporary_channel_id;
+ struct LDKCOption_MonitorEventZ *result;
/**
- * The value, in satoshis, that the output should have.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uint64_t channel_value_satoshis;
+ struct LDKDecodeError *err;
+} LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
+
+/**
+ * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
/**
- * The script which should be used in the transaction output.
+ * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKCVec_u8Z output_script;
+ union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
/**
- * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
- * an inbound channel.
- *
- * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
+ * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
*/
- uint64_t user_channel_id;
-} LDKEvent_LDKFundingGenerationReady_Body;
+ bool result_ok;
+} LDKCResult_COption_MonitorEventZDecodeErrorZ;
-typedef struct LDKEvent_LDKPaymentReceived_Body {
- /**
- * The hash for which the preimage should be handed to the ChannelManager.
- */
- struct LDKThirtyTwoBytes payment_hash;
+/**
+ * The contents of CResult_HTLCUpdateDecodeErrorZ
+ */
+typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
/**
- * The value, in thousandths of a satoshi, that this payment is for.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- uint64_t amt;
+ struct LDKHTLCUpdate *result;
/**
- * Information for claiming this received payment, based on whether the purpose of the
- * payment is to pay an invoice or to send a spontaneous payment.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKPaymentPurpose purpose;
-} LDKEvent_LDKPaymentReceived_Body;
+ struct LDKDecodeError *err;
+} LDKCResult_HTLCUpdateDecodeErrorZPtr;
-typedef struct LDKEvent_LDKPaymentSent_Body {
+/**
+ * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
/**
- * The preimage to the hash given to ChannelManager::send_payment.
- * Note that this serves as a payment receipt, if you wish to have such a thing, you must
- * store it somehow!
+ * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKThirtyTwoBytes payment_preimage;
+ union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
/**
- * The hash which was given to [`ChannelManager::send_payment`].
- *
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
*/
- struct LDKThirtyTwoBytes payment_hash;
-} LDKEvent_LDKPaymentSent_Body;
+ bool result_ok;
+} LDKCResult_HTLCUpdateDecodeErrorZ;
-typedef struct LDKEvent_LDKPaymentPathFailed_Body {
+
+
+/**
+ * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
+ * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
+ * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
+ * corrupted.
+ * Contains a developer-readable error message.
+ */
+typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
/**
- * The hash which was given to ChannelManager::send_payment.
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- struct LDKThirtyTwoBytes payment_hash;
+ LDKnativeMonitorUpdateError *inner;
/**
- * Indicates the payment was rejected for some reason by the recipient. This implies that
- * the payment has failed, not just the route in question. If this is not set, you may
- * retry the payment via a different route.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- bool rejected_by_dest;
+ bool is_owned;
+} LDKMonitorUpdateError;
+
+/**
+ * The contents of CResult_NoneMonitorUpdateErrorZ
+ */
+typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
/**
- * Any failure information conveyed via the Onion return packet by a node along the failed
- * payment route.
- *
- * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
- * account the update. [`NetGraphMsgHandler`] is capable of doing this.
- *
- * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
- * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
+ * Note that this value is always NULL, as there are no contents in the OK variant
*/
- struct LDKCOption_NetworkUpdateZ network_update;
+ void *result;
/**
- * For both single-path and multi-path payments, this is set if all paths of the payment have
- * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
- * larger MPP payment were still in flight when this event was generated.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- bool all_paths_failed;
+ struct LDKMonitorUpdateError *err;
+} LDKCResult_NoneMonitorUpdateErrorZPtr;
+
+/**
+ * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
/**
- * The payment path that failed.
+ * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKCVec_RouteHopZ path;
+ union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
/**
- * The channel responsible for the failed payment path.
- *
- * If this is `Some`, then the corresponding channel should be avoided when the payment is
- * retried. May be `None` for older [`Event`] serializations.
+ * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
*/
- struct LDKCOption_u64Z short_channel_id;
-} LDKEvent_LDKPaymentPathFailed_Body;
+ bool result_ok;
+} LDKCResult_NoneMonitorUpdateErrorZ;
-typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_OutPointScriptZ {
/**
- * The minimum amount of time that should be waited prior to calling
- * process_pending_htlc_forwards. To increase the effort required to correlate payments,
- * you should wait a random amount of time in roughly the range (now + time_forwardable,
- * now + 5*time_forwardable).
+ * The element at position 0
*/
- uint64_t time_forwardable;
-} LDKEvent_LDKPendingHTLCsForwardable_Body;
-
-typedef struct LDKEvent_LDKSpendableOutputs_Body {
+ struct LDKOutPoint a;
/**
- * The outputs which you should store as spendable by you.
+ * The element at position 1
*/
- struct LDKCVec_SpendableOutputDescriptorZ outputs;
-} LDKEvent_LDKSpendableOutputs_Body;
+ struct LDKCVec_u8Z b;
+} LDKC2Tuple_OutPointScriptZ;
-typedef struct LDKEvent_LDKPaymentForwarded_Body {
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_u32ScriptZ {
/**
- * The fee, in milli-satoshis, which was earned as a result of the payment.
- *
- * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
- * was pending, the amount the next hop claimed will have been rounded down to the nearest
- * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
- * claimed the full value in millisatoshis from the source. In this case,
- * `claim_from_onchain_tx` will be set.
- *
- * If the channel which sent us the payment has been force-closed, we will claim the funds
- * via an on-chain transaction. In that case we do not yet know the on-chain transaction
- * fees which we will spend and will instead set this to `None`. It is possible duplicate
- * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
- * `None`.
+ * The element at position 0
*/
- struct LDKCOption_u64Z fee_earned_msat;
+ uint32_t a;
/**
- * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
- * transaction.
+ * The element at position 1
*/
- bool claim_from_onchain_tx;
-} LDKEvent_LDKPaymentForwarded_Body;
+ struct LDKCVec_u8Z b;
+} LDKC2Tuple_u32ScriptZ;
-typedef struct LDKEvent_LDKChannelClosed_Body {
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
/**
- * The channel_id of the channel which has been closed. Note that on-chain transactions
- * resolving the channel are likely still awaiting confirmation.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKThirtyTwoBytes channel_id;
+ struct LDKC2Tuple_u32ScriptZ *data;
/**
- * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
- * an inbound channel. This will always be zero for objects serialized with LDK versions
- * prior to 0.0.102.
- *
- * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
+ * The number of elements pointed to by `data`.
*/
- uint64_t user_channel_id;
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_u32ScriptZZ;
+
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
/**
- * The reason the channel was closed.
+ * The element at position 0
*/
- struct LDKClosureReason reason;
-} LDKEvent_LDKChannelClosed_Body;
+ struct LDKThirtyTwoBytes a;
+ /**
+ * The element at position 1
+ */
+ struct LDKCVec_C2Tuple_u32ScriptZZ b;
+} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
-typedef struct LDKEvent_LDKDiscardFunding_Body {
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
/**
- * The channel_id of the channel which has been closed.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKThirtyTwoBytes channel_id;
+ struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
/**
- * The full transaction received from the user
+ * The number of elements pointed to by `data`.
*/
- struct LDKTransaction transaction;
-} LDKEvent_LDKDiscardFunding_Body;
-
-typedef struct MUST_USE_STRUCT LDKEvent {
- LDKEvent_Tag tag;
- union {
- LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
- LDKEvent_LDKPaymentReceived_Body payment_received;
- LDKEvent_LDKPaymentSent_Body payment_sent;
- LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
- LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
- LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
- LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
- LDKEvent_LDKChannelClosed_Body channel_closed;
- LDKEvent_LDKDiscardFunding_Body discard_funding;
- };
-} LDKEvent;
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
/**
* A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
*/
LDKnativeNodeId *inner;
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKNodeId;
+
+/**
+ * The contents of CResult_NodeIdDecodeErrorZ
+ */
+typedef union LDKCResult_NodeIdDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKNodeId *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_NodeIdDecodeErrorZPtr;
+
+/**
+ * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NodeIdDecodeErrorZ {
+ /**
+ * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NodeIdDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
*/
- bool is_owned;
-} LDKNodeId;
+ bool result_ok;
+} LDKCResult_NodeIdDecodeErrorZ;
/**
- * The contents of CResult_NodeIdDecodeErrorZ
+ * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
*/
-typedef union LDKCResult_NodeIdDecodeErrorZPtr {
+typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKNodeId *result;
+ struct LDKCOption_NetworkUpdateZ *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
struct LDKDecodeError *err;
-} LDKCResult_NodeIdDecodeErrorZPtr;
+} LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
/**
- * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_NodeIdDecodeErrorZ {
+typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
/**
- * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
+ * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_NodeIdDecodeErrorZPtr contents;
+ union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
/**
- * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
+ * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_NodeIdDecodeErrorZ;
+} LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
/**
* The `Access` trait defines behavior for accessing chain data and state, such as blocks and
};
} LDKCOption_CVec_NetAddressZZ;
-/**
- * The contents of CResult_NetAddressu8Z
- */
-typedef union LDKCResult_NetAddressu8ZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKNetAddress *result;
- /**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
- */
- uint8_t *err;
-} LDKCResult_NetAddressu8ZPtr;
-
-/**
- * A CResult_NetAddressu8Z represents the result of a fallible operation,
- * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_NetAddressu8Z {
- /**
- * The contents of this CResult_NetAddressu8Z, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_NetAddressu8ZPtr contents;
- /**
- * Whether this CResult_NetAddressu8Z represents a success state.
- */
- bool result_ok;
-} LDKCResult_NetAddressu8Z;
-
-/**
- * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
- */
-typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKCResult_NetAddressu8Z *result;
- /**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
- */
- struct LDKDecodeError *err;
-} LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
-
-/**
- * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
- /**
- * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
- /**
- * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
-
/**
* The contents of CResult_NetAddressDecodeErrorZ
*/
void (*free)(void *this_arg);
} LDKConfirm;
+
+
+/**
+ * An opaque identifier describing a specific [`Persist`] method call.
+ */
+typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeMonitorUpdateId *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKMonitorUpdateId;
+
/**
* `Persist` defines behavior for persisting channel monitors: this could mean
* writing once to disk, and/or uploading to one or more backup services.
*
- * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
- * to disk/backups. And, on every update, you **must** persist either the
- * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
- * of situations such as revoking a transaction, then crashing before this
- * revocation can be persisted, then unintentionally broadcasting a revoked
- * transaction and losing money. This is a risk because previous channel states
- * are toxic, so it's important that whatever channel state is persisted is
- * kept up-to-date.
+ * Each method can return three possible values:
+ * * If persistence (including any relevant `fsync()` calls) happens immediately, the
+ * implementation should return `Ok(())`, indicating normal channel operation should continue.
+ * * If persistence happens asynchronously, implementations should first ensure the
+ * [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
+ * `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
+ * background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
+ * called with the corresponding [`MonitorUpdateId`].
+ *
+ * Note that unlike the direct [`chain::Watch`] interface,
+ * [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
+ *
+ * * If persistence fails for some reason, implementations should return
+ * `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
+ * closed without broadcasting the latest state. See
+ * [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
*/
typedef struct LDKPersist {
/**
*/
void *this_arg;
/**
- * Persist a new channel's data. The data can be stored any way you want, but
- * the identifier provided by Rust-Lightning is the channel's outpoint (and
- * it is up to you to maintain a correct mapping between the outpoint and the
- * stored channel data). Note that you **must** persist every new monitor to
- * disk. See the `Persist` trait documentation for more details.
+ * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
+ * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
+ *
+ * The data can be stored any way you want, but the identifier provided by LDK is the
+ * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
+ * and the stored channel data). Note that you **must** persist every new monitor to disk.
+ *
+ * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
+ * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
*
* See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
* and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
*
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
* [`Writeable::write`]: crate::util::ser::Writeable::write
*/
- struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
+ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
/**
- * Update one channel's data. The provided `ChannelMonitor` has already
- * applied the given update.
+ * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
+ * update.
*
- * Note that on every update, you **must** persist either the
- * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
- * the `Persist` trait documentation for more details.
+ * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
+ * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
+ * details.
+ *
+ * During blockchain synchronization operations, this may be called with no
+ * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
+ * Note that after the full [`ChannelMonitor`] is persisted any previous
+ * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
+ * applied to the persisted [`ChannelMonitor`] as they were already applied.
*
* If an implementer chooses to persist the updates only, they need to make
* sure that all the updates are applied to the `ChannelMonitors` *before*
* them in batches. The size of each monitor grows `O(number of state updates)`
* whereas updates are small and `O(1)`.
*
+ * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
+ * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
+ *
* See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
* [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
* [`ChannelMonitorUpdateErr`] for requirements when returning errors.
*
* [`Writeable::write`]: crate::util::ser::Writeable::write
+ *
+ * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- 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);
+ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
/**
* Frees any resources associated with this object given its this_arg pointer.
* Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
*
* At a high-level, the process for deserializing a ChannelManager and resuming normal operation
* is:
- * 1) Deserialize all stored ChannelMonitors.
- * 2) Deserialize the ChannelManager by filling in this struct and calling:
- * <(BlockHash, ChannelManager)>::read(reader, args)
- * This may result in closing some Channels if the ChannelMonitor is newer than the stored
- * ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
- * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
- * way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
- * ChannelMonitor::get_funding_txo().
- * 4) Reconnect blocks on your ChannelMonitors.
- * 5) Disconnect/connect blocks on the ChannelManager.
- * 6) Move the ChannelMonitors into your local chain::Watch.
- *
- * Note that the ordering of #4-6 is not of importance, however all three must occur before you
- * call any other methods on the newly-deserialized ChannelManager.
+ * 1) Deserialize all stored [`ChannelMonitor`]s.
+ * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
+ * `<(BlockHash, ChannelManager)>::read(reader, args)`
+ * This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
+ * [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
+ * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
+ * same way you would handle a [`chain::Filter`] call using
+ * [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
+ * 4) Reconnect blocks on your [`ChannelMonitor`]s.
+ * 5) Disconnect/connect blocks on the [`ChannelManager`].
+ * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
+ * Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
+ * will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
+ * the next step.
+ * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
+ * [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
+ *
+ * Note that the ordering of #4-7 is not of importance, however all four must occur before you
+ * call any other methods on the newly-deserialized [`ChannelManager`].
*
* Note that because some channels may be closed during deserialization, it is critical that you
* always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
* broadcast), and then later deserialize a newer version of the same ChannelManager (which will
* not force-close the same channels but consider them live), you may end up revoking a state for
* which you've already broadcasted the transaction.
+ *
+ * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
*/
typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
/**
*/
void *this_arg;
/**
- * Returns the fee in msats willing to be paid to avoid routing through the given channel.
+ * Returns the fee in msats willing to be paid to avoid routing through the given channel
+ * in the direction from `source` to `target`.
*/
- uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id);
+ uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target);
/**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ * Handles updating channel penalties after failing to route through a channel.
*/
- void (*free)(void *this_arg);
-} LDKScore;
-
-
-
-/**
- * A read-only view of [`NetworkGraph`].
- */
-typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
+ void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
/**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * Serialize the object into a byte array
*/
- LDKnativeReadOnlyNetworkGraph *inner;
+ struct LDKCVec_u8Z (*write)(const void *this_arg);
/**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
*/
- bool is_owned;
-} LDKReadOnlyNetworkGraph;
+ void (*free)(void *this_arg);
+} LDKScore;
/**
- * Receives and validates network updates from peers,
- * stores authentic and relevant data as a network graph.
- * This network graph is then used for routing payments.
- * Provides interface to help with initial routing sync by
- * serving historical announcements.
+ * A scorer that is accessed under a lock.
*
- * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
- * [`NetworkGraph`].
+ * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
+ * having shared ownership of a scorer but without requiring internal locking in [`Score`]
+ * implementations. Internal locking would be detrimental to route finding performance and could
+ * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
+ *
+ * [`find_route`]: crate::routing::router::find_route
*/
-typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
+typedef struct MUST_USE_STRUCT LDKLockableScore {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeNetGraphMsgHandler *inner;
+ LDKnativeLockableScore *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKNetGraphMsgHandler;
+} LDKLockableScore;
/**
- * A channel descriptor for a hop along a payment path.
+ * A read-only view of [`NetworkGraph`].
*/
-typedef struct MUST_USE_STRUCT LDKRouteHintHop {
+typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeRouteHintHop *inner;
+ LDKnativeReadOnlyNetworkGraph *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKRouteHintHop;
+} LDKReadOnlyNetworkGraph;
/**
- * [`routing::Score`] implementation that provides reasonable default behavior.
- *
- * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
- * slightly higher fees are available.
- *
- * See [module-level documentation] for usage.
+ * Receives and validates network updates from peers,
+ * stores authentic and relevant data as a network graph.
+ * This network graph is then used for routing payments.
+ * Provides interface to help with initial routing sync by
+ * serving historical announcements.
*
- * [module-level documentation]: crate::routing::scorer
+ * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
+ * [`NetworkGraph`].
*/
-typedef struct MUST_USE_STRUCT LDKScorer {
+typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeScorer *inner;
+ LDKnativeNetGraphMsgHandler *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKScorer;
+} LDKNetGraphMsgHandler;
LDKFallback_PubKeyHash,
LDKFallback_ScriptHash,
/**
- * Must be last for serialization purposes
+ * Must be last for serialization purposes
+ */
+ LDKFallback_Sentinel,
+} LDKFallback_Tag;
+
+typedef struct LDKFallback_LDKSegWitProgram_Body {
+ struct LDKu5 version;
+ struct LDKCVec_u8Z program;
+} LDKFallback_LDKSegWitProgram_Body;
+
+typedef struct MUST_USE_STRUCT LDKFallback {
+ LDKFallback_Tag tag;
+ union {
+ LDKFallback_LDKSegWitProgram_Body seg_wit_program;
+ struct {
+ struct LDKTwentyBytes pub_key_hash;
+ };
+ struct {
+ struct LDKTwentyBytes script_hash;
+ };
+ };
+} LDKFallback;
+
+/**
+ * A trait defining behavior of an [`Invoice`] payer.
+ */
+typedef struct LDKPayer {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Returns the payer's node id.
+ */
+ struct LDKPublicKey (*node_id)(const void *this_arg);
+ /**
+ * Returns the payer's channels.
+ */
+ struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
+ /**
+ * Sends a payment over the Lightning Network using the given [`Route`].
+ *
+ * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
+ /**
+ * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
+ */
+ struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKPayer;
+
+/**
+ * A trait defining behavior for routing an [`Invoice`] payment.
+ */
+typedef struct LDKRouter {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
+ *
+ * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKRouter;
+
+
+
+/**
+ * A utility for paying [`Invoice]`s.
+ */
+typedef struct MUST_USE_STRUCT LDKInvoicePayer {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeInvoicePayer *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKInvoicePayer;
+
+
+
+/**
+ * Number of attempts to retry payment path failures for an [`Invoice`].
+ *
+ * Note that this is the number of *path* failures, not full payment retries. For multi-path
+ * payments, if this is less than the total number of paths, we will never even retry all of the
+ * payment's paths.
+ */
+typedef struct MUST_USE_STRUCT LDKRetryAttempts {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeRetryAttempts *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKRetryAttempts;
+
+
+
+/**
+ * A [`Router`] implemented using [`find_route`].
+ */
+typedef struct MUST_USE_STRUCT LDKDefaultRouter {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeDefaultRouter *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
*/
- LDKFallback_Sentinel,
-} LDKFallback_Tag;
-
-typedef struct LDKFallback_LDKSegWitProgram_Body {
- struct LDKu5 version;
- struct LDKCVec_u8Z program;
-} LDKFallback_LDKSegWitProgram_Body;
-
-typedef struct MUST_USE_STRUCT LDKFallback {
- LDKFallback_Tag tag;
- union {
- LDKFallback_LDKSegWitProgram_Body seg_wit_program;
- struct {
- struct LDKTwentyBytes pub_key_hash;
- };
- struct {
- struct LDKTwentyBytes script_hash;
- };
- };
-} LDKFallback;
+ bool is_owned;
+} LDKDefaultRouter;
extern const uintptr_t MAX_BUF_SIZE;
*/
void Str_free(struct LDKStr _res);
+#if defined(LDK_DEBUG_BUILD)
+/**
+ * This function exists for memory safety testing purposes. It should never be used in production
+ * code
+ */
+const void *__unmangle_inner_ptr(const void *ptr);
+#endif
+
/**
* Creates a new CResult_SecretKeyErrorZ in the success state.
*/
*/
struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_SecretKeyErrorZ.
*/
*/
struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_PublicKeyErrorZ.
*/
*/
struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
*/
*/
struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
*/
*/
struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_TxCreationKeysErrorZ.
*/
*/
struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
*/
*/
struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
*/
*/
struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
*/
*/
struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
*/
*/
struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
*/
*/
struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
*/
*/
struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
*/
*/
struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
*/
*/
struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_CVec_SignatureZNoneZ.
*/
*/
struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
*/
*/
struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
*/
*/
struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NoneErrorZ.
*/
*/
struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_RouteHopDecodeErrorZ.
*/
*/
struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_RouteDecodeErrorZ.
*/
*/
struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
+/**
+ * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
+ */
+struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
+
+/**
+ * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
+ */
+struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
+ */
+void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
+
/**
* Constructs a new COption_u64Z containing a u64
*/
*/
struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
+/**
+ * Creates a new CResult_PayeeDecodeErrorZ in the success state.
+ */
+struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_ok(struct LDKPayee o);
+
+/**
+ * Creates a new CResult_PayeeDecodeErrorZ in the error state.
+ */
+struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PayeeDecodeErrorZ_is_ok(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PayeeDecodeErrorZ.
+ */
+void CResult_PayeeDecodeErrorZ_free(struct LDKCResult_PayeeDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_clone(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR orig);
+
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
+void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
+
+/**
+ * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
+ */
+struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
+
+/**
+ * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
+ */
+struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
+ */
+void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
+ */
+struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
+
+/**
+ * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
+ */
+struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
+ */
+void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
+void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
/**
* Creates a new CResult_RouteLightningErrorZ in the success state.
*/
struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_RouteLightningErrorZ.
*/
struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
/**
- * Frees any resources used by the CResult_TxOutAccessErrorZ.
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_TxOutAccessErrorZ.
+ */
+void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
+
+/**
+ * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
+ */
+struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
+
+/**
+ * Frees any resources used by the C2Tuple_usizeTransactionZ.
+ */
+void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
+
+/**
+ * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
+ */
+struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
+
+/**
+ * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
+ */
+struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
+ */
+void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
+
+/**
+ * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
+
+/**
+ * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
+ */
+struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
+
+/**
+ * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
+ */
+struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
+ */
+void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
+
+/**
+ * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
+ */
+struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
+
+/**
+ * Constructs a new COption_ClosureReasonZ containing nothing
+ */
+struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
*/
-void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
+void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
/**
- * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
+ * Creates a new COption_ClosureReasonZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
+struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
/**
- * Creates a new tuple which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
*/
-struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
+struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
/**
- * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
+ * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
*/
-struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
+struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Frees any resources used by the C2Tuple_usizeTransactionZ.
+ * Checks if the given object is currently in the success state
*/
-void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
+bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
*/
-void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
+void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
+struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
+ * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
*/
-struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
+struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
/**
- * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
+ * Constructs a new COption_NetworkUpdateZ containing nothing
*/
-struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
+struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
/**
- * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
+ * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
*/
-void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
+void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
/**
- * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
+ * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
+struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
+void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
/**
- * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
+ * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
*/
-struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
+struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
/**
- * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
+ * Constructs a new COption_EventZ containing nothing
*/
-struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
+struct LDKCOption_EventZ COption_EventZ_none(void);
/**
- * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
+ * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
*/
-void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
+void COption_EventZ_free(struct LDKCOption_EventZ _res);
/**
- * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
+ * Creates a new COption_EventZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
+struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
/**
- * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
+ * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
*/
-struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
+struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
/**
- * Constructs a new COption_NetworkUpdateZ containing nothing
+ * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
*/
-struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
+struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
+ * Checks if the given object is currently in the success state
*/
-void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
+bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
/**
- * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
*/
-struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
+void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
+struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
*/
*/
struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
*/
*/
struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
*/
*/
struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
*/
void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
+/**
+ * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o);
+
+/**
+ * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
+ */
+void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ScorerDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o);
+
+/**
+ * Creates a new CResult_ScorerDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ScorerDecodeErrorZ.
+ */
+void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res);
+
/**
* Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
*/
*/
struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
*/
*/
struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
*/
*/
struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
*/
*/
struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NoneNoneZ.
*/
*/
struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
*/
*/
struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_SignatureNoneZ.
*/
*/
struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_SignDecodeErrorZ.
*/
*/
struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_RecoverableSignatureNoneZ.
*/
*/
struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
*/
*/
struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
*/
*/
struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_TransactionNoneZ.
*/
struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
/**
- * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
- */
-void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
-
-/**
- * Creates a new CResult_PaymentIdDecodeErrorZ in the success state.
+ * Checks if the given object is currently in the success state
*/
-struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_ok(struct LDKPaymentId o);
+bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
/**
- * Creates a new CResult_PaymentIdDecodeErrorZ in the error state.
- */
-struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_err(struct LDKDecodeError e);
-
-/**
- * Frees any resources used by the CResult_PaymentIdDecodeErrorZ.
- */
-void CResult_PaymentIdDecodeErrorZ_free(struct LDKCResult_PaymentIdDecodeErrorZ _res);
-
-/**
- * Creates a new CResult_PaymentIdDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
*/
-struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_clone(const struct LDKCResult_PaymentIdDecodeErrorZ *NONNULL_PTR orig);
+void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
/**
* Constructs a new COption_u16Z containing a u16
*/
struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NoneAPIErrorZ.
*/
*/
struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult__u832APIErrorZ.
*/
/**
* Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
*/
-struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKPaymentId o);
+struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
/**
* Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
*/
struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
*/
*/
struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NonePaymentSendFailureZ.
*/
/**
* Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
*/
-struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKPaymentId b);
+struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
/**
* Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
*/
struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
*/
*/
struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
*/
*/
struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
*/
*/
struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
*/
*/
struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_OutPointDecodeErrorZ.
*/
*/
struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
*/
void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
+/**
+ * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
+ */
+struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
+
+/**
+ * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
+ */
+struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
+ */
+void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
+
+/**
+ * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_SiPrefixNoneZ in the success state.
*/
*/
struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_SiPrefixNoneZ_is_ok(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_SiPrefixNoneZ.
*/
*/
struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_InvoiceNoneZ_is_ok(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_InvoiceNoneZ.
*/
*/
struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_SignedRawInvoiceNoneZ_is_ok(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
*/
*/
struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_PayeePubKeyErrorZ.
*/
*/
struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
*/
*/
struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NoneSemanticErrorZ.
*/
*/
struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_InvoiceSemanticErrorZ.
*/
*/
struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_DescriptionCreationErrorZ.
*/
*/
struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ExpiryTimeCreationErrorZ_is_ok(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
*/
*/
struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
*/
*/
struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_StringErrorZ.
*/
void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
/**
- * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
+ * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
+
+/**
+ * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
+ */
+void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
+ */
+struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
+
+/**
+ * Constructs a new COption_MonitorEventZ containing nothing
+ */
+struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
+ */
+void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
+
+/**
+ * Creates a new COption_MonitorEventZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
+ */
+struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
+
+/**
+ * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
*/
-struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
+struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
+ * Checks if the given object is currently in the success state
*/
-struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
+bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
+ * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
*/
-void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
+void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
/**
- * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
/**
* Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
*/
struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
*/
*/
struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NoneMonitorUpdateErrorZ_is_ok(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
*/
*/
struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
*/
*/
struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NoneLightningErrorZ.
*/
*/
struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_boolLightningErrorZ.
*/
*/
struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
*/
*/
struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NonePeerHandleErrorZ.
*/
*/
struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_boolPeerHandleErrorZ.
*/
*/
struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NodeIdDecodeErrorZ.
*/
*/
struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
+/**
+ * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
+ */
+struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
+
+/**
+ * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
+ */
+struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
+ */
+void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
+
/**
* Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
*/
*/
struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
*/
*/
struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
*/
*/
struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
*/
*/
struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
*/
*/
struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
*/
*/
struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
*/
*/
struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
-/**
- * Creates a new CResult_NetAddressu8Z in the success state.
- */
-struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
-
-/**
- * Creates a new CResult_NetAddressu8Z in the error state.
- */
-struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
-
-/**
- * Frees any resources used by the CResult_NetAddressu8Z.
- */
-void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
-
-/**
- * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
-
-/**
- * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
- */
-struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
-
-/**
- * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
- */
-struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
-
-/**
- * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
- */
-void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
-
-/**
- * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
-
/**
* Creates a new CResult_NetAddressDecodeErrorZ in the success state.
*/
*/
struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NetAddressDecodeErrorZ.
*/
*/
struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
*/
*/
struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
*/
*/
struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
*/
*/
struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
*/
*/
struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
*/
*/
struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
*/
*/
struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
*/
*/
struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
*/
*/
struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_FundingLockedDecodeErrorZ_is_ok(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
*/
*/
struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_InitDecodeErrorZ.
*/
*/
struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
*/
*/
struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
*/
*/
struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ShutdownDecodeErrorZ.
*/
*/
struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
*/
*/
struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
*/
*/
struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
*/
*/
struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
*/
*/
struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
*/
*/
struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_PingDecodeErrorZ.
*/
*/
struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_PongDecodeErrorZ.
*/
*/
struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
*/
*/
struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
*/
*/
struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
*/
*/
struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
*/
*/
struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
*/
*/
struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
*/
*/
struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
*/
*/
struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
*/
*/
struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
*/
*/
struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
*/
*/
struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
*/
*/
struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
*/
*/
struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
*/
*/
struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
+
/**
* Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
*/
*/
struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
+/**
+ * Read a ClosureReason from a byte array, created by ClosureReason_write
+ */
+struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
+
/**
* Frees any resources used by the Event
*/
/**
* Utility method to constructs a new PaymentSent-variant Event
*/
-struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash);
+struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
/**
* Utility method to constructs a new PaymentPathFailed-variant Event
*/
-struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id);
+struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry);
/**
* Utility method to constructs a new PendingHTLCsForwardable-variant Event
*/
struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
+/**
+ * Read a Event from a byte array, created by Event_write
+ */
+struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
+
/**
* Frees any resources used by the MessageSendEvent
*/
*/
MUST_USE_RES enum LDKLevel Level_max(void);
+/**
+ * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
+ */
+void Record_free(struct LDKRecord this_obj);
+
+/**
+ * The verbosity level of the message.
+ */
+enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
+
+/**
+ * The verbosity level of the message.
+ */
+void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
+
+/**
+ * The message body.
+ */
+struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
+
+/**
+ * The message body.
+ */
+void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
+
+/**
+ * The module path of the message.
+ */
+struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
+
+/**
+ * The module path of the message.
+ */
+void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
+
+/**
+ * The source file containing the message.
+ */
+struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
+
+/**
+ * The source file containing the message.
+ */
+void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
+
+/**
+ * The line containing the message.
+ */
+uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
+
+/**
+ * The line containing the message.
+ */
+void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
+
+/**
+ * Creates a copy of the Record
+ */
+struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
+
/**
* Calls the free function if one is set
*/
* Checks if two ConfirmationTargets contain equal inner contents.
* This ignores pointers and is_owned flags and looks at the values in fields.
*/
-bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
+bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
+
+/**
+ * Calls the free function if one is set
+ */
+void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
+
+/**
+ * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
+ */
+void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
+
+/**
+ * Creates a copy of the MonitorUpdateId
+ */
+struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
+
+/**
+ * Checks if two MonitorUpdateIds contain equal inner contents.
+ */
+uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
/**
- * Calls the free function if one is set
+ * Checks if two MonitorUpdateIds contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
*/
-void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
+bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
/**
* Calls the free function if one is set
*/
MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
+/**
+ * Indicates the persistence of a [`ChannelMonitor`] has completed after
+ * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
+ *
+ * Thus, the anticipated use is, at a high level:
+ * 1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
+ * update to disk and begins updating any remote (e.g. watchtower/backup) copies,
+ * returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
+ * 2) once all remote copies are updated, you call this function with the
+ * `completed_update_id` that completed, and once all pending updates have completed the
+ * channel will be re-enabled.
+ *
+ * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
+ * registered [`ChannelMonitor`]s.
+ */
+MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChainMonitor_channel_monitor_updated(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, struct LDKMonitorUpdateId completed_update_id);
+
/**
* Constructs a new Listen which calls the relevant methods on this_arg.
* This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
*/
void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
+struct LDKStr MonitorUpdateError_get_a(const struct LDKMonitorUpdateError *NONNULL_PTR this_ptr);
+
+void MonitorUpdateError_set_a(struct LDKMonitorUpdateError *NONNULL_PTR this_ptr, struct LDKStr val);
+
+/**
+ * Constructs a new MonitorUpdateError given each field
+ */
+MUST_USE_RES struct LDKMonitorUpdateError MonitorUpdateError_new(struct LDKStr a_arg);
+
/**
* Creates a copy of the MonitorUpdateError
*/
*/
struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
+/**
+ * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
+ */
+struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
+
+/**
+ * Utility method to constructs a new UpdateFailed-variant MonitorEvent
+ */
+struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
+
+/**
+ * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
+ */
+struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
+
+/**
+ * Read a MonitorEvent from a byte array, created by MonitorEvent_write
+ */
+struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
+
/**
* Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
*/
*/
struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
-/**
- * Frees any resources used by the PaymentId, if is_owned is set and inner is non-NULL.
- */
-void PaymentId_free(struct LDKPaymentId this_obj);
-
-/**
- * Checks if two PaymentIds contain equal inner contents.
- */
-uint64_t PaymentId_hash(const struct LDKPaymentId *NONNULL_PTR o);
-
-/**
- * Creates a copy of the PaymentId
- */
-struct LDKPaymentId PaymentId_clone(const struct LDKPaymentId *NONNULL_PTR orig);
-
-/**
- * Checks if two PaymentIds contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
- * Two objects with NULL inner values will be considered "equal" here.
- */
-bool PaymentId_eq(const struct LDKPaymentId *NONNULL_PTR a, const struct LDKPaymentId *NONNULL_PTR b);
-
-/**
- * Serialize the PaymentId object into a byte array which can be read by PaymentId_read
- */
-struct LDKCVec_u8Z PaymentId_write(const struct LDKPaymentId *NONNULL_PTR obj);
-
-/**
- * Read a PaymentId from a byte array, created by PaymentId_write
- */
-struct LDKCResult_PaymentIdDecodeErrorZ PaymentId_read(struct LDKu8slice ser);
-
/**
* Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
*/
/**
* Utility method to constructs a new PartialFailure-variant PaymentSendFailure
*/
-struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ a);
+struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
/**
* Constructs a new ChannelManager to hold several channels and route between them.
*
* [`send_payment`]: [`ChannelManager::send_payment`]
*/
-MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKPaymentId payment_id);
+MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
/**
* Send a spontaneous payment, which is a payment that does not require the recipient to have
*/
MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
-/**
- * Restores a single, given channel to normal operation after a
- * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
- * operation.
- *
- * All ChannelMonitor updates up to and including highest_applied_update_id must have been
- * fully committed in every copy of the given channels' ChannelMonitors.
- *
- * Note that there is no effect to calling with a highest_applied_update_id other than the
- * current latest ChannelMonitorUpdate and one call to this function after multiple
- * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
- * exists largely only to prevent races between this and concurrent update_monitor calls.
- *
- * Thus, the anticipated use is, at a high level:
- * 1) You register a chain::Watch with this ChannelManager,
- * 2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
- * said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
- * any time it cannot do so instantly,
- * 3) update(s) are applied to each remote copy of a ChannelMonitor,
- * 4) once all remote copies are updated, you call this function with the update_id that
- * completed, and once it is the latest the Channel will be re-enabled.
- */
-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);
-
/**
* Gets a payment secret and payment hash for use in an invoice given to a third party wishing
* to pay us.
*/
struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
-/**
- * Read a Result from a byte array, created by Result_write
- */
-struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
-
/**
* Read a NetAddress from a byte array, created by NetAddress_write
*/
*/
void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
+/**
+ * Disconnects all currently-connected peers. This is useful on platforms where there may be
+ * an indication that TCP sockets have stalled even if we weren't around to time them out
+ * using regular ping/pongs.
+ */
+void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
+
/**
* Send pings to each peer and disconnect those which did not respond to the last round of
* pings.
*/
void Score_free(struct LDKScore this_ptr);
+/**
+ * Frees any resources used by the LockableScore, if is_owned is set and inner is non-NULL.
+ */
+void LockableScore_free(struct LDKLockableScore this_obj);
+
+/**
+ * Constructs a new LockableScore from a Score
+ */
+MUST_USE_RES struct LDKLockableScore LockableScore_new(struct LDKScore score);
+
+/**
+ * Serialize the LockableScore object into a byte array which can be read by LockableScore_read
+ */
+struct LDKCVec_u8Z LockableScore_write(const struct LDKLockableScore *NONNULL_PTR obj);
+
/**
* Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
*/
*/
struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
+/**
+ * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
+ */
+struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
+
/**
* Constructs a new EventHandler which calls the relevant methods on this_arg.
* This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
*/
void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
-/**
- * Representation of the payment channel network
- */
-struct LDKNetworkGraph NetGraphMsgHandler_get_network_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr);
-
-/**
- * Representation of the payment channel network
- */
-void NetGraphMsgHandler_set_network_graph(struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr, struct LDKNetworkGraph val);
-
/**
* Creates a new tracker of the actual state of the network of channels and nodes,
* assuming an existing Network Graph.
* channel data is correct, and that the announcement is signed with
* channel owners' keys.
*/
-MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKNetworkGraph network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
+MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
/**
* Adds a provider used to check new announcements. Does not affect
void RouteHop_free(struct LDKRouteHop this_obj);
/**
- * The node_id of the node at this hop.
+ * The node_id of the node at this hop.
+ */
+struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
+
+/**
+ * The node_id of the node at this hop.
+ */
+void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
+
+/**
+ * The node_announcement features of the node at this hop. For the last hop, these may be
+ * amended to match the features present in the invoice this node generated.
+ */
+struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
+
+/**
+ * The node_announcement features of the node at this hop. For the last hop, these may be
+ * amended to match the features present in the invoice this node generated.
+ */
+void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
+
+/**
+ * The channel that should be used from the previous hop to reach this node.
+ */
+uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
+
+/**
+ * The channel that should be used from the previous hop to reach this node.
+ */
+void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * The channel_announcement features of the channel that should be used from the previous hop
+ * to reach this node.
+ */
+struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
+
+/**
+ * The channel_announcement features of the channel that should be used from the previous hop
+ * to reach this node.
+ */
+void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
+
+/**
+ * The fee taken on this hop (for paying for the use of the *next* channel in the path).
+ * For the last hop, this should be the full value of the payment (might be more than
+ * requested if we had to match htlc_minimum_msat).
+ */
+uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
+
+/**
+ * The fee taken on this hop (for paying for the use of the *next* channel in the path).
+ * For the last hop, this should be the full value of the payment (might be more than
+ * requested if we had to match htlc_minimum_msat).
+ */
+void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
+ * expected at the destination, in excess of the current block height.
+ */
+uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
+
+/**
+ * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
+ * expected at the destination, in excess of the current block height.
+ */
+void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
+
+/**
+ * Constructs a new RouteHop given each field
+ */
+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);
+
+/**
+ * Creates a copy of the RouteHop
+ */
+struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
+
+/**
+ * Checks if two RouteHops contain equal inner contents.
+ */
+uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
+
+/**
+ * Checks if two RouteHops contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
+
+/**
+ * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
+ */
+struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
+
+/**
+ * Read a RouteHop from a byte array, created by RouteHop_write
+ */
+struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
+
+/**
+ * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
+ */
+void Route_free(struct LDKRoute this_obj);
+
+/**
+ * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
+ * last RouteHop in each path must be the same.
+ * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
+ * destination. Thus, this must always be at least length one. While the maximum length of any
+ * given path is variable, keeping the length of any path to less than 20 should currently
+ * ensure it is viable.
+ */
+struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
+
+/**
+ * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
+ * last RouteHop in each path must be the same.
+ * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
+ * destination. Thus, this must always be at least length one. While the maximum length of any
+ * given path is variable, keeping the length of any path to less than 20 should currently
+ * ensure it is viable.
+ */
+void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
+
+/**
+ * The `payee` parameter passed to [`find_route`].
+ * This is used by `ChannelManager` to track information which may be required for retries,
+ * provided back to you via [`Event::PaymentPathFailed`].
+ *
+ * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+struct LDKPayee Route_get_payee(const struct LDKRoute *NONNULL_PTR this_ptr);
+
+/**
+ * The `payee` parameter passed to [`find_route`].
+ * This is used by `ChannelManager` to track information which may be required for retries,
+ * provided back to you via [`Event::PaymentPathFailed`].
+ *
+ * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+ *
+ * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+void Route_set_payee(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPayee val);
+
+/**
+ * Constructs a new Route given each field
+ */
+MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPayee payee_arg);
+
+/**
+ * Creates a copy of the Route
+ */
+struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
+
+/**
+ * Checks if two Routes contain equal inner contents.
+ */
+uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
+
+/**
+ * Checks if two Routes contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
+
+/**
+ * Returns the total amount of fees paid on this [`Route`].
+ *
+ * This doesn't include any extra payment made to the recipient, which can happen in excess of
+ * the amount passed to [`find_route`]'s `params.final_value_msat`.
+ */
+MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
+
+/**
+ * Returns the total amount paid on this [`Route`], excluding the fees.
+ */
+MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
+
+/**
+ * Serialize the Route object into a byte array which can be read by Route_read
+ */
+struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
+
+/**
+ * Read a Route from a byte array, created by Route_write
*/
-struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
+struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
/**
- * The node_id of the node at this hop.
+ * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
*/
-void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
+void RouteParameters_free(struct LDKRouteParameters this_obj);
/**
- * The node_announcement features of the node at this hop. For the last hop, these may be
- * amended to match the features present in the invoice this node generated.
+ * The recipient of the failed payment path.
*/
-struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
+struct LDKPayee RouteParameters_get_payee(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
/**
- * The node_announcement features of the node at this hop. For the last hop, these may be
- * amended to match the features present in the invoice this node generated.
+ * The recipient of the failed payment path.
*/
-void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
+void RouteParameters_set_payee(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPayee val);
/**
- * The channel that should be used from the previous hop to reach this node.
+ * The amount in msats sent on the failed payment path.
*/
-uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
+uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
/**
- * The channel that should be used from the previous hop to reach this node.
+ * The amount in msats sent on the failed payment path.
*/
-void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
+void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
/**
- * The channel_announcement features of the channel that should be used from the previous hop
- * to reach this node.
+ * The CLTV on the final hop of the failed payment path.
*/
-struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
+uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
/**
- * The channel_announcement features of the channel that should be used from the previous hop
- * to reach this node.
+ * The CLTV on the final hop of the failed payment path.
*/
-void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
+void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
/**
- * The fee taken on this hop (for paying for the use of the *next* channel in the path).
- * For the last hop, this should be the full value of the payment (might be more than
- * requested if we had to match htlc_minimum_msat).
+ * Constructs a new RouteParameters given each field
*/
-uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
+MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPayee payee_arg, uint64_t final_value_msat_arg, uint32_t final_cltv_expiry_delta_arg);
/**
- * The fee taken on this hop (for paying for the use of the *next* channel in the path).
- * For the last hop, this should be the full value of the payment (might be more than
- * requested if we had to match htlc_minimum_msat).
+ * Creates a copy of the RouteParameters
*/
-void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
+struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
/**
- * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
- * expected at the destination, in excess of the current block height.
+ * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
*/
-uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
+struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
/**
- * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
- * expected at the destination, in excess of the current block height.
+ * Read a RouteParameters from a byte array, created by RouteParameters_write
*/
-void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
+struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
/**
- * Constructs a new RouteHop given each field
+ * Frees any resources used by the Payee, if is_owned is set and inner is non-NULL.
*/
-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);
+void Payee_free(struct LDKPayee this_obj);
/**
- * Creates a copy of the RouteHop
+ * The node id of the payee.
*/
-struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
+struct LDKPublicKey Payee_get_pubkey(const struct LDKPayee *NONNULL_PTR this_ptr);
/**
- * Checks if two RouteHops contain equal inner contents.
+ * The node id of the payee.
*/
-uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
+void Payee_set_pubkey(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKPublicKey val);
/**
- * Checks if two RouteHops contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
- * Two objects with NULL inner values will be considered "equal" here.
+ * Features supported by the payee.
+ *
+ * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
+ * does not contain any features.
+ *
+ * [`for_keysend`]: Self::for_keysend
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
+struct LDKInvoiceFeatures Payee_get_features(const struct LDKPayee *NONNULL_PTR this_ptr);
/**
- * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
+ * Features supported by the payee.
+ *
+ * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
+ * does not contain any features.
+ *
+ * [`for_keysend`]: Self::for_keysend
+ *
+ * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
+void Payee_set_features(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
/**
- * Read a RouteHop from a byte array, created by RouteHop_write
+ * Hints for routing to the payee, containing channels connecting the payee to public nodes.
*/
-struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
+struct LDKCVec_RouteHintZ Payee_get_route_hints(const struct LDKPayee *NONNULL_PTR this_ptr);
/**
- * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
+ * Hints for routing to the payee, containing channels connecting the payee to public nodes.
*/
-void Route_free(struct LDKRoute this_obj);
+void Payee_set_route_hints(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
/**
- * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
- * last RouteHop in each path must be the same.
- * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
- * destination. Thus, this must always be at least length one. While the maximum length of any
- * given path is variable, keeping the length of any path to less than 20 should currently
- * ensure it is viable.
+ * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
*/
-struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
+struct LDKCOption_u64Z Payee_get_expiry_time(const struct LDKPayee *NONNULL_PTR this_ptr);
/**
- * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
- * last RouteHop in each path must be the same.
- * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
- * destination. Thus, this must always be at least length one. While the maximum length of any
- * given path is variable, keeping the length of any path to less than 20 should currently
- * ensure it is viable.
+ * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
*/
-void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
+void Payee_set_expiry_time(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
/**
- * Constructs a new Route given each field
+ * Constructs a new Payee given each field
*/
-MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
+MUST_USE_RES struct LDKPayee Payee_new(struct LDKPublicKey pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_arg, struct LDKCOption_u64Z expiry_time_arg);
/**
- * Creates a copy of the Route
+ * Creates a copy of the Payee
*/
-struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
+struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig);
/**
- * Checks if two Routes contain equal inner contents.
+ * Checks if two Payees contain equal inner contents.
*/
-uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
+uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o);
/**
- * Checks if two Routes contain equal inner contents.
+ * Checks if two Payees contain equal inner contents.
* This ignores pointers and is_owned flags and looks at the values in fields.
* Two objects with NULL inner values will be considered "equal" here.
*/
-bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
+bool Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b);
/**
- * Returns the total amount of fees paid on this [`Route`].
- *
- * This doesn't include any extra payment made to the recipient, which can happen in excess of
- * the amount passed to [`get_route`]'s `final_value_msat`.
+ * Serialize the Payee object into a byte array which can be read by Payee_read
*/
-MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
+struct LDKCVec_u8Z Payee_write(const struct LDKPayee *NONNULL_PTR obj);
/**
- * Returns the total amount paid on this [`Route`], excluding the fees.
+ * Read a Payee from a byte array, created by Payee_write
*/
-MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
+struct LDKCResult_PayeeDecodeErrorZ Payee_read(struct LDKu8slice ser);
/**
- * Serialize the Route object into a byte array which can be read by Route_read
+ * Creates a payee with the node id of the given `pubkey`.
*/
-struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
+MUST_USE_RES struct LDKPayee Payee_from_node_id(struct LDKPublicKey pubkey);
/**
- * Read a Route from a byte array, created by Route_write
+ * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
*/
-struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
+MUST_USE_RES struct LDKPayee Payee_for_keysend(struct LDKPublicKey pubkey);
/**
* Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
*/
void RouteHint_free(struct LDKRouteHint this_obj);
+struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
+
+void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
+
+/**
+ * Constructs a new RouteHint given each field
+ */
+MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
+
/**
* Creates a copy of the RouteHint
*/
*/
bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
+/**
+ * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
+ */
+struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
+
+/**
+ * Read a RouteHint from a byte array, created by RouteHint_write
+ */
+struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
+
/**
* Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
*/
bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
/**
- * Gets a keysend route from us (payer) to the given target node (payee). This is needed because
- * keysend payments do not have an invoice from which to pull the payee's supported features, which
- * makes it tricky to otherwise supply the `payee_features` parameter of `get_route`.
- *
- * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
+ */
+struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
+
+/**
+ * Read a RouteHintHop from a byte array, created by RouteHintHop_write
*/
-struct LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_pubkey, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer);
+struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
/**
- * Gets a route from us (payer) to the given target node (payee).
+ * Finds a route from us (payer) to the given target node (payee).
*
- * If the payee provided features in their invoice, they should be provided via payee_features.
+ * If the payee provided features in their invoice, they should be provided via `params.payee`.
* Without this, MPP will only be used if the payee's features are available in the network graph.
*
- * Private routing paths between a public node and the target may be included in `last_hops`.
- * Currently, only the last hop in each path is considered.
+ * Private routing paths between a public node and the target may be included in `params.payee`.
+ *
+ * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
+ * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local
+ * channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used.
+ *
+ * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
+ * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
+ * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
+ *
+ * # Note
+ *
+ * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
+ * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
+ * function.
*
- * If some channels aren't announced, it may be useful to fill in a first_hops with the
- * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
- * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
- * in first_hops will be used.
+ * # Panics
*
- * Panics if first_hops contains channels without short_channel_ids
- * (ChannelManager::list_usable_channels will never include such channels).
+ * Panics if first_hops contains channels without short_channel_ids;
+ * [`ChannelManager::list_usable_channels`] will never include such channels.
*
- * The fees on channels from us to next-hops are ignored (as they are assumed to all be
- * equal), however the enabled/disabled bit on such channels as well as the
- * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
+ * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
+ * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
*
- * Note that payee_features (or a relevant inner pointer) may be NULL or all-0s to represent None
* Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_pubkey, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer);
+struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer);
/**
* Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
void Scorer_free(struct LDKScorer this_obj);
/**
- * Creates a new scorer using `base_penalty_msat` as the channel penalty.
+ * Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
+ */
+void ScoringParameters_free(struct LDKScoringParameters this_obj);
+
+/**
+ * A fixed penalty in msats to apply to each channel.
+ */
+uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
+
+/**
+ * A fixed penalty in msats to apply to each channel.
+ */
+void ScoringParameters_set_base_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * A penalty in msats to apply to a channel upon failing to relay a payment.
+ *
+ * This accumulates for each failure but may be reduced over time based on
+ * [`failure_penalty_half_life`].
+ *
+ * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
+ */
+uint64_t ScoringParameters_get_failure_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
+
+/**
+ * A penalty in msats to apply to a channel upon failing to relay a payment.
+ *
+ * This accumulates for each failure but may be reduced over time based on
+ * [`failure_penalty_half_life`].
+ *
+ * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
+ */
+void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
+ * cut in half.
+ *
+ * # Note
+ *
+ * When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never
+ * elapse. Therefore, this penalty will never decay.
+ *
+ * [`failure_penalty_msat`]: Self::failure_penalty_msat
+ */
+uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
+
+/**
+ * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
+ * cut in half.
+ *
+ * # Note
+ *
+ * When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never
+ * elapse. Therefore, this penalty will never decay.
+ *
+ * [`failure_penalty_msat`]: Self::failure_penalty_msat
*/
-MUST_USE_RES struct LDKScorer Scorer_new(uint64_t base_penalty_msat);
+void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * Constructs a new ScoringParameters given each field
+ */
+MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint64_t failure_penalty_half_life_arg);
+
+/**
+ * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
+ */
+struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj);
+
+/**
+ * Read a ScoringParameters from a byte array, created by ScoringParameters_write
+ */
+struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser);
+
+/**
+ * Creates a new scorer using the given scoring parameters.
+ */
+MUST_USE_RES struct LDKScorer Scorer_new(struct LDKScoringParameters params);
/**
* Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
*/
MUST_USE_RES struct LDKScorer Scorer_default(void);
+/**
+ * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
+ */
+MUST_USE_RES struct LDKScoringParameters ScoringParameters_default(void);
+
/**
* Constructs a new Score which calls the relevant methods on this_arg.
* This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
*/
struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg);
+/**
+ * Serialize the Scorer object into a byte array which can be read by Scorer_read
+ */
+struct LDKCVec_u8Z Scorer_write(const struct LDKScorer *NONNULL_PTR obj);
+
+/**
+ * Read a Scorer from a byte array, created by Scorer_write
+ */
+struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser);
+
/**
* Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
*/
*/
void PayeePubKey_free(struct LDKPayeePubKey this_obj);
+struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
+
+void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
+
+/**
+ * Constructs a new PayeePubKey given each field
+ */
+MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
+
/**
* Creates a copy of the PayeePubKey
*/
*/
void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
+uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
+
+void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * Constructs a new MinFinalCltvExpiry given each field
+ */
+MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
+
/**
* Creates a copy of the MinFinalCltvExpiry
*/
/**
* Get the payment secret if one was included in the invoice
*/
-MUST_USE_RES struct LDKThirtyTwoBytes Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg);
+MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
/**
* Get the invoice features if they were included in the invoice
*/
MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
+/**
+ * Returns whether the invoice has expired.
+ */
+MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
+
/**
* Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
* [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
/**
- * Returns the amount if specified in the invoice as pico <currency>.
+ * Returns the amount if specified in the invoice as millisatoshis.
*/
-MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
/**
* Creates a new `Description` if `description` is at most 1023 __bytes__ long,
*/
struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
+/**
+ * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
+ */
+void InvoicePayer_free(struct LDKInvoicePayer this_obj);
+
+/**
+ * Calls the free function if one is set
+ */
+void Payer_free(struct LDKPayer this_ptr);
+
+/**
+ * Calls the free function if one is set
+ */
+void Router_free(struct LDKRouter this_ptr);
+
+/**
+ * Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL.
+ */
+void RetryAttempts_free(struct LDKRetryAttempts this_obj);
+
+uintptr_t RetryAttempts_get_a(const struct LDKRetryAttempts *NONNULL_PTR this_ptr);
+
+void RetryAttempts_set_a(struct LDKRetryAttempts *NONNULL_PTR this_ptr, uintptr_t val);
+
+/**
+ * Constructs a new RetryAttempts given each field
+ */
+MUST_USE_RES struct LDKRetryAttempts RetryAttempts_new(uintptr_t a_arg);
+
+/**
+ * Creates a copy of the RetryAttempts
+ */
+struct LDKRetryAttempts RetryAttempts_clone(const struct LDKRetryAttempts *NONNULL_PTR orig);
+
+/**
+ * Checks if two RetryAttemptss contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool RetryAttempts_eq(const struct LDKRetryAttempts *NONNULL_PTR a, const struct LDKRetryAttempts *NONNULL_PTR b);
+
+/**
+ * Checks if two RetryAttemptss contain equal inner contents.
+ */
+uint64_t RetryAttempts_hash(const struct LDKRetryAttempts *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the PaymentError
+ */
+void PaymentError_free(struct LDKPaymentError this_ptr);
+
+/**
+ * Creates a copy of the PaymentError
+ */
+struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new Invoice-variant PaymentError
+ */
+struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
+
+/**
+ * Utility method to constructs a new Routing-variant PaymentError
+ */
+struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
+
+/**
+ * Utility method to constructs a new Sending-variant PaymentError
+ */
+struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
+
+/**
+ * Creates an invoice payer that retries failed payment paths.
+ *
+ * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
+ * `retry_attempts` has been exceeded for a given [`Invoice`].
+ */
+MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, const struct LDKLockableScore *NONNULL_PTR scorer, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetryAttempts retry_attempts);
+
+/**
+ * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
+ *
+ * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
+ * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
+ * for you.
+ */
+MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
+
+/**
+ * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
+ * case a retry is needed.
+ *
+ * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
+ * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
+ * for you.
+ */
+MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_zero_value_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats);
+
+/**
+ * Removes the payment cached by the given payment hash.
+ *
+ * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
+ * [`EventHandler`]. Otherwise, calling this method is unnecessary.
+ */
+void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
+
+/**
+ * Constructs a new EventHandler which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
+ */
+struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
+
/**
* Utility to construct an invoice. Generally, unless you want to do something like a custom
* cltv_expiry, this is what you should be using to create an invoice. The reason being, this
*/
struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description);
+/**
+ * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
+ */
+void DefaultRouter_free(struct LDKDefaultRouter this_obj);
+
+/**
+ * Creates a new router using the given [`NetworkGraph`] and [`Logger`].
+ */
+MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
+
+/**
+ * Constructs a new Router which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
+ */
+struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
+
+/**
+ * Constructs a new Payer which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
+ */
+struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
+
/**
* Read a SiPrefix object from a string
*/