typedef struct nativeBestBlockOpaque LDKnativeBestBlock;
struct nativeWatchedOutputOpaque;
typedef struct nativeWatchedOutputOpaque LDKnativeWatchedOutput;
-struct nativeLockableScoreOpaque;
-typedef struct nativeLockableScoreOpaque LDKnativeLockableScore;
+struct nativeMultiThreadedLockableScoreOpaque;
+typedef struct nativeMultiThreadedLockableScoreOpaque LDKnativeMultiThreadedLockableScore;
+struct nativeScorerOpaque;
+typedef struct nativeScorerOpaque LDKnativeScorer;
+struct nativeScoringParametersOpaque;
+typedef struct nativeScoringParametersOpaque LDKnativeScoringParameters;
struct nativeInitFeaturesOpaque;
typedef struct nativeInitFeaturesOpaque LDKnativeInitFeatures;
struct nativeNodeFeaturesOpaque;
typedef struct nativeChannelFeaturesOpaque LDKnativeChannelFeatures;
struct nativeInvoiceFeaturesOpaque;
typedef struct nativeInvoiceFeaturesOpaque LDKnativeInvoiceFeatures;
-struct nativeScorerOpaque;
-typedef struct nativeScorerOpaque LDKnativeScorer;
-struct nativeScoringParametersOpaque;
-typedef struct nativeScoringParametersOpaque LDKnativeScoringParameters;
+struct nativeChannelTypeFeaturesOpaque;
+typedef struct nativeChannelTypeFeaturesOpaque LDKnativeChannelTypeFeatures;
struct nativeDelayedPaymentOutputDescriptorOpaque;
typedef struct nativeDelayedPaymentOutputDescriptorOpaque LDKnativeDelayedPaymentOutputDescriptor;
struct nativeStaticPaymentOutputDescriptorOpaque;
typedef struct nativePrivateRouteOpaque LDKnativePrivateRoute;
struct nativeChannelMonitorUpdateOpaque;
typedef struct nativeChannelMonitorUpdateOpaque LDKnativeChannelMonitorUpdate;
-struct nativeMonitorUpdateErrorOpaque;
-typedef struct nativeMonitorUpdateErrorOpaque LDKnativeMonitorUpdateError;
struct nativeHTLCUpdateOpaque;
typedef struct nativeHTLCUpdateOpaque LDKnativeHTLCUpdate;
struct nativeChannelMonitorOpaque;
LDKAccessError_Sentinel,
} LDKAccessError;
+/**
+ * An enum which can either contain a or not
+ */
+typedef enum LDKCOption_NoneZ {
+ /**
+ * When we're in this state, this COption_NoneZ contains a
+ */
+ LDKCOption_NoneZ_Some,
+ /**
+ * When we're in this state, this COption_NoneZ contains nothing
+ */
+ LDKCOption_NoneZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_NoneZ_Sentinel,
+} LDKCOption_NoneZ;
+
/**
* An error enum representing a failure to persist a channel monitor update.
*/
* The supplied expiry time could cause an overflow if added to a `PositiveTimestamp`
*/
LDKCreationError_ExpiryTimeOutOfBounds,
+ /**
+ * The supplied millisatoshi amount was greater than the total bitcoin supply.
+ */
+ LDKCreationError_InvalidAmount,
/**
* Must be last for serialization purposes
*/
* An enum representing the available verbosity levels of the logger.
*/
typedef enum LDKLevel {
+ /**
+ * Designates extremely verbose information, including gossip-induced messages
+ */
+ LDKLevel_Gossip,
/**
* Designates very low priority, often extremely verbose, information
*/
* a copy of our own `ChannelMonitor`.
*/
LDKClosureReason_CommitmentTxConfirmed,
+ /**
+ * The funding transaction failed to confirm in a timely manner on an inbound channel.
+ */
+ LDKClosureReason_FundingTimedOut,
/**
* Closure generated from processing an event, likely a HTLC forward/relay/reception.
*/
* [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
*/
struct LDKThirtyTwoBytes payment_secret;
- /**
- * 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
- */
- uint64_t user_payment_id;
} LDKPaymentPurpose_LDKInvoicePayment_Body;
typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
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.
+ * 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!
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
*/
LDKEvent_FundingGenerationReady,
/**
* [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
* automatically failed.
*
+ * # Note
+ * LDK will not stop an inbound payment from being paid multiple times, so multiple
+ * `PaymentReceived` events may be generated for the same payment.
+ *
* [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
* [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
*/
*/
LDKEvent_PaymentSent,
/**
- * Indicates an outbound payment we made failed. Probably some intermediary node dropped
+ * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
* something. You may wish to retry with a different route.
+ *
+ * Note that this does *not* indicate that all paths for an MPP payment have failed, see
+ * [`Event::PaymentFailed`] and [`all_paths_failed`].
+ *
+ * [`all_paths_failed`]: Self::all_paths_failed
*/
LDKEvent_PaymentPathFailed,
/**
- * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
- * time in the future.
+ * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
+ * provide failure information for each MPP part in the payment.
+ *
+ * This event is provided once there are no further pending HTLCs for the payment and the
+ * payment is no longer retryable, either due to a several-block timeout or because
+ * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
+ *
+ * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+ */
+ LDKEvent_PaymentFailed,
+ /**
+ * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
+ * a time in the future.
+ *
+ * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
*/
LDKEvent_PendingHTLCsForwardable,
/**
* inputs for another purpose.
*/
LDKEvent_DiscardFunding,
+ /**
+ * Indicates that a path for an outbound payment was successful.
+ *
+ * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
+ * [`Event::PaymentSent`] for obtaining the payment preimage.
+ */
+ LDKEvent_PaymentPathSuccessful,
/**
* Must be last for serialization purposes
*/
typedef struct LDKEvent_LDKPaymentReceived_Body {
/**
- * The hash for which the preimage should be handed to the ChannelManager.
+ * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
+ * not stop you from registering duplicate payment hashes for inbound payments.
*/
struct LDKThirtyTwoBytes payment_hash;
/**
*/
struct LDKThirtyTwoBytes payment_preimage;
/**
- * The hash which was given to [`ChannelManager::send_payment`].
+ * The hash that was given to [`ChannelManager::send_payment`].
*
* [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
*/
typedef struct LDKEvent_LDKPaymentPathFailed_Body {
/**
* The id returned by [`ChannelManager::send_payment`] and used with
- * [`ChannelManager::retry_payment`].
+ * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
*
* [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
* [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+ * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
*
* Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
struct LDKThirtyTwoBytes payment_id;
/**
- * The hash which was given to ChannelManager::send_payment.
+ * The hash that was given to [`ChannelManager::send_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
*/
struct LDKThirtyTwoBytes payment_hash;
/**
* 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.
+ *
+ * Note that if you are retrying individual MPP parts, using this value to determine if a
+ * payment has fully failed is race-y. Because multiple failures can happen prior to events
+ * being processed, you may retry in response to a first failure, with a second failure
+ * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
+ * you will see `all_paths_failed` set even though the retry of the first failure still
+ * has an associated in-flight HTLC. See (1) for an example of such a failure.
+ *
+ * If you wish to retry individual MPP parts and learn when a payment has failed, you must
+ * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
+ *
+ * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
+ *
+ * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
*/
bool all_paths_failed;
/**
struct LDKRouteParameters retry;
} LDKEvent_LDKPaymentPathFailed_Body;
+typedef struct LDKEvent_LDKPaymentFailed_Body {
+ /**
+ * The id returned by [`ChannelManager::send_payment`] and used with
+ * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+ * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+ */
+ struct LDKThirtyTwoBytes payment_id;
+ /**
+ * The hash that was given to [`ChannelManager::send_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ */
+ struct LDKThirtyTwoBytes payment_hash;
+} LDKEvent_LDKPaymentFailed_Body;
+
typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
/**
* The minimum amount of time that should be waited prior to calling
struct LDKTransaction transaction;
} LDKEvent_LDKDiscardFunding_Body;
+typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
+ /**
+ * 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
+ */
+ struct LDKThirtyTwoBytes payment_id;
+ /**
+ * The hash that was given to [`ChannelManager::send_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKThirtyTwoBytes payment_hash;
+ /**
+ * The payment path that was successful.
+ *
+ * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
+ */
+ struct LDKCVec_RouteHopZ path;
+} LDKEvent_LDKPaymentPathSuccessful_Body;
+
typedef struct MUST_USE_STRUCT LDKEvent {
LDKEvent_Tag tag;
union {
LDKEvent_LDKPaymentReceived_Body payment_received;
LDKEvent_LDKPaymentSent_Body payment_sent;
LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
+ LDKEvent_LDKPaymentFailed_Body payment_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_LDKPaymentPathSuccessful_Body payment_path_successful;
};
} LDKEvent;
* If the error is logged, log it at the given level.
*/
LDKErrorAction_IgnoreAndLog,
+ /**
+ * The peer provided us with a gossip message which we'd already seen. In most cases this
+ * should be ignored, but it may result in the message being forwarded if it is a duplicate of
+ * our own channel announcements.
+ */
+ LDKErrorAction_IgnoreDuplicateGossip,
/**
* The peer did something incorrect. Tell them.
*/
/**
- * Features used within an `init` message.
+ * Parameters for configuring [`Scorer`].
*/
-typedef struct MUST_USE_STRUCT LDKInitFeatures {
+typedef struct MUST_USE_STRUCT LDKScoringParameters {
/**
* 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.
*/
- LDKnativeInitFeatures *inner;
+ LDKnativeScoringParameters *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;
-} LDKInitFeatures;
+} LDKScoringParameters;
/**
- * The contents of CResult_InitFeaturesDecodeErrorZ
+ * The contents of CResult_ScoringParametersDecodeErrorZ
*/
-typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
+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 LDKInitFeatures *result;
+ struct LDKScoringParameters *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_InitFeaturesDecodeErrorZPtr;
+} LDKCResult_ScoringParametersDecodeErrorZPtr;
/**
- * 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.
+ * A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::scoring::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_InitFeaturesDecodeErrorZ {
+typedef struct LDKCResult_ScoringParametersDecodeErrorZ {
/**
- * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
+ * The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
+ union LDKCResult_ScoringParametersDecodeErrorZPtr contents;
/**
- * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
+ * Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_InitFeaturesDecodeErrorZ;
+} LDKCResult_ScoringParametersDecodeErrorZ;
/**
- * Features used within a `node_announcement` message.
+ * [`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. Will further penalize channels that fail to relay payments.
+ *
+ * See [module-level documentation] for usage.
+ *
+ * [module-level documentation]: crate::routing::scoring
*/
-typedef struct MUST_USE_STRUCT LDKNodeFeatures {
+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.
*/
- LDKnativeNodeFeatures *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;
-} LDKNodeFeatures;
+} LDKScorer;
/**
- * The contents of CResult_NodeFeaturesDecodeErrorZ
+ * The contents of CResult_ScorerDecodeErrorZ
*/
-typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
+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 LDKNodeFeatures *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_NodeFeaturesDecodeErrorZPtr;
+} LDKCResult_ScorerDecodeErrorZPtr;
/**
- * 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.
+ * A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::scoring::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_NodeFeaturesDecodeErrorZ {
+typedef struct LDKCResult_ScorerDecodeErrorZ {
/**
- * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
+ * The contents of this CResult_ScorerDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
+ union LDKCResult_ScorerDecodeErrorZPtr contents;
/**
- * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
+ * Whether this CResult_ScorerDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_NodeFeaturesDecodeErrorZ;
+} LDKCResult_ScorerDecodeErrorZ;
/**
- * Features used within a `channel_announcement` message.
+ * Features used within an `init` message.
*/
-typedef struct MUST_USE_STRUCT LDKChannelFeatures {
+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.
*/
- LDKnativeChannelFeatures *inner;
+ 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.
*/
bool is_owned;
-} LDKChannelFeatures;
+} LDKInitFeatures;
/**
- * The contents of CResult_ChannelFeaturesDecodeErrorZ
+ * The contents of CResult_InitFeaturesDecodeErrorZ
*/
-typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
+typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKChannelFeatures *result;
+ struct LDKInitFeatures *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_ChannelFeaturesDecodeErrorZPtr;
+} LDKCResult_InitFeaturesDecodeErrorZPtr;
/**
- * 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.
+ * 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_ChannelFeaturesDecodeErrorZ {
+typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
/**
- * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
+ * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
+ union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
/**
- * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
+ * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_ChannelFeaturesDecodeErrorZ;
+} LDKCResult_InitFeaturesDecodeErrorZ;
/**
- * Features used within an invoice.
+ * Features used within a `channel_announcement` message.
*/
-typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
+typedef struct MUST_USE_STRUCT LDKChannelFeatures {
/**
* 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.
*/
- LDKnativeInvoiceFeatures *inner;
+ 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;
-} LDKInvoiceFeatures;
+} LDKChannelFeatures;
/**
- * The contents of CResult_InvoiceFeaturesDecodeErrorZ
+ * The contents of CResult_ChannelFeaturesDecodeErrorZ
*/
-typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
+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 LDKInvoiceFeatures *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_InvoiceFeaturesDecodeErrorZPtr;
+} LDKCResult_ChannelFeaturesDecodeErrorZPtr;
/**
- * 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.
+ * 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_InvoiceFeaturesDecodeErrorZ {
+typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
/**
- * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
+ * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
+ union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
/**
- * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
+ * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_InvoiceFeaturesDecodeErrorZ;
+} LDKCResult_ChannelFeaturesDecodeErrorZ;
/**
- * Parameters for configuring [`Scorer`].
+ * Features used within a `node_announcement` message.
*/
-typedef struct MUST_USE_STRUCT LDKScoringParameters {
+typedef struct MUST_USE_STRUCT LDKNodeFeatures {
/**
* 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.
*/
- LDKnativeScoringParameters *inner;
+ LDKnativeNodeFeatures *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;
-} LDKScoringParameters;
+} LDKNodeFeatures;
/**
- * The contents of CResult_ScoringParametersDecodeErrorZ
+ * The contents of CResult_NodeFeaturesDecodeErrorZ
*/
-typedef union LDKCResult_ScoringParametersDecodeErrorZPtr {
+typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKScoringParameters *result;
+ struct LDKNodeFeatures *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_ScoringParametersDecodeErrorZPtr;
+} LDKCResult_NodeFeaturesDecodeErrorZPtr;
/**
- * 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.
+ * 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_ScoringParametersDecodeErrorZ {
+typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
/**
- * The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
+ * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_ScoringParametersDecodeErrorZPtr contents;
+ union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
/**
- * Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
+ * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_ScoringParametersDecodeErrorZ;
+} LDKCResult_NodeFeaturesDecodeErrorZ;
/**
- * [`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. Will further penalize channels that fail to relay payments.
- *
- * See [module-level documentation] for usage.
- *
- * [module-level documentation]: crate::routing::scorer
+ * Features used within an invoice.
*/
-typedef struct MUST_USE_STRUCT LDKScorer {
+typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
/**
* 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;
+ 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;
-} LDKScorer;
+} LDKInvoiceFeatures;
/**
- * The contents of CResult_ScorerDecodeErrorZ
+ * The contents of CResult_InvoiceFeaturesDecodeErrorZ
*/
-typedef union LDKCResult_ScorerDecodeErrorZPtr {
+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 LDKScorer *result;
+ struct LDKInvoiceFeatures *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_ScorerDecodeErrorZPtr;
+} LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
/**
- * 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.
+ * 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_ScorerDecodeErrorZ {
+typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
/**
- * The contents of this CResult_ScorerDecodeErrorZ, accessible via either
+ * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_ScorerDecodeErrorZPtr contents;
+ union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
/**
- * Whether this CResult_ScorerDecodeErrorZ represents a success state.
+ * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_ScorerDecodeErrorZ;
+} LDKCResult_InvoiceFeaturesDecodeErrorZ;
+
+
+
+/**
+ * Features used within the channel_type field in an OpenChannel message.
+ *
+ * A channel is always of some known \"type\", describing the transaction formats used and the exact
+ * semantics of our interaction with our peer.
+ *
+ * Note that because a channel is a specific type which is proposed by the opener and accepted by
+ * the counterparty, only required features are allowed here.
+ *
+ * This is serialized differently from other feature types - it is not prefixed by a length, and
+ * thus must only appear inside a TLV where its length is known in advance.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
+ /**
+ * 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.
+ */
+ LDKnativeChannelTypeFeatures *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;
+} LDKChannelTypeFeatures;
+
+/**
+ * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKChannelTypeFeatures *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_ChannelTypeFeaturesDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::features::ChannelTypeFeatures 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_ChannelTypeFeaturesDecodeErrorZ {
+ /**
+ * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
/**
* The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
} LDKSixteenBytes;
/**
- * A 10-byte byte array.
+ * A 12-byte byte array.
*/
-typedef struct LDKTenBytes {
+typedef struct LDKTwelveBytes {
/**
- * The ten bytes
+ * The twelve bytes
*/
- uint8_t data[10];
-} LDKTenBytes;
+ uint8_t data[12];
+} LDKTwelveBytes;
/**
* An address which can be used to connect to a remote peer
LDKNetAddress_IPv6,
/**
* An old-style Tor onion address/port on which the peer is listening.
+ *
+ * This field is deprecated and the Tor network generally no longer supports V2 Onion
+ * addresses. Thus, the details are not parsed here.
*/
LDKNetAddress_OnionV2,
/**
uint16_t port;
} LDKNetAddress_LDKIPv6_Body;
-typedef struct LDKNetAddress_LDKOnionV2_Body {
- /**
- * The bytes (usually encoded in base32 with \".onion\" appended)
- */
- struct LDKTenBytes addr;
- /**
- * The port on which the node is listening
- */
- uint16_t port;
-} LDKNetAddress_LDKOnionV2_Body;
-
typedef struct LDKNetAddress_LDKOnionV3_Body {
/**
* The ed25519 long-term public key of the peer
union {
LDKNetAddress_LDKIPv4_Body i_pv4;
LDKNetAddress_LDKIPv6_Body i_pv6;
- LDKNetAddress_LDKOnionV2_Body onion_v2;
+ struct {
+ struct LDKTwelveBytes onion_v2;
+ };
LDKNetAddress_LDKOnionV3_Body onion_v3;
};
} LDKNetAddress;
struct LDKThirtyTwoBytes b;
} LDKC2Tuple_PaymentHashPaymentSecretZ;
+/**
+ * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
+ */
+typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
+ /**
+ * Note that this value is always NULL, as there are no contents in the Err variant
+ */
+ void *err;
+} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
+
+/**
+ * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ /**
+ * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
+ /**
+ * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
+
+/**
+ * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
+ */
+typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKC2Tuple_PaymentHashPaymentSecretZ *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_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
+
+/**
+ * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ 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_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ /**
+ * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
+ /**
+ * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
+
+/**
+ * The contents of CResult_PaymentSecretNoneZ
+ */
+typedef union LDKCResult_PaymentSecretNoneZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKThirtyTwoBytes *result;
+ /**
+ * Note that this value is always NULL, as there are no contents in the Err variant
+ */
+ void *err;
+} LDKCResult_PaymentSecretNoneZPtr;
+
+/**
+ * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PaymentSecretNoneZ {
+ /**
+ * The contents of this CResult_PaymentSecretNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PaymentSecretNoneZPtr contents;
+ /**
+ * Whether this CResult_PaymentSecretNoneZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PaymentSecretNoneZ;
+
/**
* The contents of CResult_PaymentSecretAPIErrorZ
*/
bool result_ok;
} LDKCResult_PaymentSecretAPIErrorZ;
+/**
+ * The contents of CResult_PaymentPreimageAPIErrorZ
+ */
+typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKThirtyTwoBytes *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_PaymentPreimageAPIErrorZPtr;
+
+/**
+ * A CResult_PaymentPreimageAPIErrorZ 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_PaymentPreimageAPIErrorZ {
+ /**
+ * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
+ /**
+ * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PaymentPreimageAPIErrorZ;
+
/**
* A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
* This corresponds to std::vector in C++
* blindly signing the hash.
*/
struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
+ /**
+ * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
+ *
+ * This method must return the same value each time it is called.
+ */
+ struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(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.
/**
* 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).
+ * Must return a value 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)
+ * This method can be implemented with the following unit conversions:
+ * * max(satoshis-per-byte * 250, 253)
+ * * max(satoshis-per-kbyte / 4, 253)
*/
uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
/**
bool result_ok;
} LDKCResult_HTLCUpdateDecodeErrorZ;
-
-
-/**
- * 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 {
- /**
- * 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;
- /**
- * 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;
-
-/**
- * The contents of CResult_NoneMonitorUpdateErrorZ
- */
-typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
- /**
- * Note that this value is always NULL, as there are no contents in the OK variant
- */
- void *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;
-
-/**
- * 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 contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
- /**
- * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_NoneMonitorUpdateErrorZ;
-
/**
* A tuple of 2 elements. See the individual fields for the types contained.
*/
bool is_owned;
} LDKDirectedChannelTransactionParameters;
+
+
+/**
+ * A read-only view of [`NetworkGraph`].
+ */
+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.
+ */
+ 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;
+} LDKReadOnlyNetworkGraph;
+
+
+
+/**
+ * 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.
+ *
+ * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
+ * [`NetworkGraph`].
+ */
+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.
+ */
+ 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;
+} LDKNetGraphMsgHandler;
+
/**
* An interface used to score payment channels for path finding.
*
*/
void *this_arg;
/**
- * Returns the fee in msats willing to be paid to avoid routing through the given channel
- * in the direction from `source` to `target`.
+ * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
+ * given channel in the direction from `source` to `target`.
+ *
+ * The channel's capacity (less any other MPP parts which are also being considered for use in
+ * the same payment) is given by `channel_capacity_msat`. It may be guessed from various
+ * sources or assumed from no data at all.
+ *
+ * For hints provided in the invoice, we assume the channel has sufficient capacity to accept
+ * the invoice's full amount, and provide a `channel_capacity_msat` of `None`. In all other
+ * cases it is set to `Some`, even if we're guessing at the channel value.
+ *
+ * Your code should be overflow-safe through a `channel_capacity_msat` of 21 million BTC.
*/
- 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);
+ uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, struct LDKCOption_u64Z channel_capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target);
/**
* Handles updating channel penalties after failing to route through a channel.
*/
void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
+ /**
+ * Handles updating channel penalties after successfully routing along a path.
+ */
+ void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
/**
* Serialize the object into a byte array
*/
void (*free)(void *this_arg);
} LDKScore;
-
-
/**
* A scorer that is accessed under a lock.
*
*
* [`find_route`]: crate::routing::router::find_route
*/
-typedef struct MUST_USE_STRUCT LDKLockableScore {
+typedef 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.
- */
- 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.
+ * 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.
*/
- bool is_owned;
-} LDKLockableScore;
-
-
-
-/**
- * A read-only view of [`NetworkGraph`].
- */
-typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
+ 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.
+ * Returns the locked scorer.
*/
- LDKnativeReadOnlyNetworkGraph *inner;
+ struct LDKScore (*lock)(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);
+} LDKLockableScore;
/**
- * 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.
- *
- * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
- * [`NetworkGraph`].
+ * A concrete implementation of [`LockableScore`] which supports multi-threading.
*/
-typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
+typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
/**
* 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;
+ LDKnativeMultiThreadedLockableScore *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;
+} LDKMultiThreadedLockableScore;
* [`ChannelManager`] persistence should be done in the background.
* * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
* at the appropriate intervals.
+ * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`NetGraphMsgHandler`] is provided to
+ * [`BackgroundProcessor::start`]).
*
* It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
* upon as doing so may result in high latency.
* 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);
+ /**
+ * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
+ */
+ struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
/**
* 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);
+ /**
+ * Signals that no further retries for the given payment will occur.
+ */
+ void (*abandon_payment)(const void *this_arg, 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.
*
* 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);
+ struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, const uint8_t (*payment_hash)[32], 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.
/**
- * A utility for paying [`Invoice]`s.
+ * A utility for paying [`Invoice`]s and sending spontaneous payments.
+ *
+ * See [module-level documentation] for details.
+ *
+ * [module-level documentation]: crate::payment
*/
typedef struct MUST_USE_STRUCT LDKInvoicePayer {
/**
*/
struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
+/**
+ * Constructs a new COption_NoneZ containing a
+ */
+enum LDKCOption_NoneZ COption_NoneZ_some(void);
+
+/**
+ * Constructs a new COption_NoneZ containing nothing
+ */
+enum LDKCOption_NoneZ COption_NoneZ_none(void);
+
+/**
+ * Frees any resources associated with the , if we are in the Some state
+ */
+void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
+
/**
* Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
*/
*/
void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
+/**
+ * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_NoneErrorZ in the success state.
*/
void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
/**
- * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
+ * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
*/
-struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
+struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o);
/**
- * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
+ * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
*/
-struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_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);
+bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
+ * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
*/
-void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
+void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res);
/**
- * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
+ * Creates a new CResult_ScorerDecodeErrorZ in the success state.
*/
-struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
+struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o);
/**
- * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
+ * Creates a new CResult_ScorerDecodeErrorZ in the error state.
*/
-struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_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);
+bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
+ * Frees any resources used by the CResult_ScorerDecodeErrorZ.
*/
-void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
+void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
+ */
+struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
+
+/**
+ * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
+ */
+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.
+ */
+void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
/**
* Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
/**
- * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
+ * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
*/
-struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
+struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
/**
- * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
+ * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
*/
-struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_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);
+bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
+ * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
*/
-void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
+void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
/**
- * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
+ * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
*/
-struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o);
+struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
/**
- * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
+ * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
*/
-struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_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);
+bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
+ * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
*/
-void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res);
+void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
/**
- * Creates a new CResult_ScorerDecodeErrorZ in the success state.
+ * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
*/
-struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o);
+struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
/**
- * Creates a new CResult_ScorerDecodeErrorZ in the error state.
+ * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
*/
-struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_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);
+bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_ScorerDecodeErrorZ.
+ * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
*/
-void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res);
+void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
/**
* Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
*/
void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
+ */
+void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
+ */
+void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_PaymentSecretNoneZ in the success state.
+ */
+struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
+
+/**
+ * Creates a new CResult_PaymentSecretNoneZ in the error state.
+ */
+struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PaymentSecretNoneZ.
+ */
+void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
+
+/**
+ * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
*/
*/
struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
+/**
+ * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
+ */
+struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
+
+/**
+ * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
+ */
+struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
+ */
+void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
+
+/**
+ * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
+
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
*/
struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
-/**
- * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
- */
-struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
-
-/**
- * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
- */
-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.
- */
-void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
-
-/**
- * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
-
/**
* Creates a new tuple which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
/**
* Utility method to constructs a new InvoicePayment-variant PaymentPurpose
*/
-struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t user_payment_id);
+struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
/**
* Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
*/
struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
+/**
+ * Utility method to constructs a new FundingTimedOut-variant ClosureReason
+ */
+struct LDKClosureReason ClosureReason_funding_timed_out(void);
+
/**
* Utility method to constructs a new ProcessingError-variant ClosureReason
*/
*/
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 PaymentFailed-variant Event
+ */
+struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
+
/**
* Utility method to constructs a new PendingHTLCsForwardable-variant Event
*/
*/
struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
+/**
+ * Utility method to constructs a new PaymentPathSuccessful-variant Event
+ */
+struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
+
/**
* Serialize the Event object into a byte array which can be read by Event_read
*/
*/
enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
+/**
+ * Utility method to constructs a new Gossip-variant Level
+ */
+enum LDKLevel Level_gossip(void);
+
/**
* Utility method to constructs a new Trace-variant Level
*/
*/
void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
+/**
+ * If this is set to false, we do not accept inbound requests to open a new channel.
+ * Default value: true.
+ */
+bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
+
+/**
+ * If this is set to false, we do not accept inbound requests to open a new channel.
+ * Default value: true.
+ */
+void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
+
/**
* Constructs a new UserConfig given each field
*/
-MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg);
+MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg);
/**
* Creates a copy of the UserConfig
*/
struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
-/**
- * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
- */
-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 LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
-
/**
* Frees any resources used by the MonitorEvent
*/
*
* panics if the given update is not the next update by update_id.
*/
-MUST_USE_RES struct LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
+MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
/**
* Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
*/
MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
+/**
+ * Whether anchors should be used.
+ * Will panic if ready_channel wasn't called.
+ */
+MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
+
/**
* Sign the single input of spend_tx at index `input_idx` which spends the output
* described by descriptor, returning the witness stack for the input.
*/
void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
+/**
+ * Our total balance. This is the amount we would get if we close the channel.
+ * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
+ * amount is not likely to be recoverable on close.
+ *
+ * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
+ * balance is not available for inclusion in new outbound HTLCs). This further does not include
+ * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
+ * This does not consider any on-chain fees.
+ *
+ * See also [`ChannelDetails::outbound_capacity_msat`]
+ */
+uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
+
+/**
+ * Our total balance. This is the amount we would get if we close the channel.
+ * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
+ * amount is not likely to be recoverable on close.
+ *
+ * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
+ * balance is not available for inclusion in new outbound HTLCs). This further does not include
+ * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
+ * This does not consider any on-chain fees.
+ *
+ * See also [`ChannelDetails::outbound_capacity_msat`]
+ */
+void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
+
/**
* The available outbound capacity for sending HTLCs to the remote peer. This does not include
- * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
+ * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
* available for inclusion in new outbound HTLCs). This further does not include any pending
* outgoing HTLCs which are awaiting some other resolution to be sent.
*
+ * See also [`ChannelDetails::balance_msat`]
+ *
* This value is not exact. Due to various in-flight changes, feerate changes, and our
* conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
* should be able to spend nearly this amount.
/**
* The available outbound capacity for sending HTLCs to the remote peer. This does not include
- * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
+ * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
* available for inclusion in new outbound HTLCs). This further does not include any pending
* outgoing HTLCs which are awaiting some other resolution to be sent.
*
+ * See also [`ChannelDetails::balance_msat`]
+ *
* This value is not exact. Due to various in-flight changes, feerate changes, and our
* conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
* should be able to spend nearly this amount.
/**
* The available inbound capacity for the remote peer to send HTLCs to us. This does not
- * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
+ * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
* available for inclusion in new inbound HTLCs).
* Note that there are some corner cases not fully handled here, so the actual available
* inbound capacity may be slightly higher than this.
/**
* The available inbound capacity for the remote peer to send HTLCs to us. This does not
- * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
+ * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
* available for inclusion in new inbound HTLCs).
* Note that there are some corner cases not fully handled here, so the actual available
* inbound capacity may be slightly higher than this.
/**
* Constructs a new ChannelDetails given each field
*/
-MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg);
+MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg);
/**
* Creates a copy of the ChannelDetails
*
* Errors returned are a superset of those returned from [`send_payment`], so see
* [`send_payment`] documentation for more details on errors. This method will also error if the
- * retry amount puts the payment more than 10% over the payment's total amount, or if the payment
- * for the given `payment_id` cannot be found (likely due to timeout or success).
+ * retry amount puts the payment more than 10% over the payment's total amount, if the payment
+ * for the given `payment_id` cannot be found (likely due to timeout or success), or if
+ * further retries have been disabled with [`abandon_payment`].
*
* [`send_payment`]: [`ChannelManager::send_payment`]
+ * [`abandon_payment`]: [`ChannelManager::abandon_payment`]
*/
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);
+/**
+ * Signals that no further retries for the given payment will occur.
+ *
+ * After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
+ * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
+ * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
+ * pending HTLCs for this payment.
+ *
+ * Note that calling this method does *not* prevent a payment from succeeding. You must still
+ * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
+ * determine the ultimate status of a payment.
+ *
+ * [`retry_payment`]: Self::retry_payment
+ * [`Event::PaymentFailed`]: events::Event::PaymentFailed
+ * [`Event::PaymentSent`]: events::Event::PaymentSent
+ */
+void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
+
/**
* Send a spontaneous payment, which is a payment that does not require the recipient to have
* generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
* Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
* or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
*
- * Panics if a funding transaction has already been provided for this channel.
+ * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
+ * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
*
* May panic if the output found in the funding transaction is duplicative with some other
* channel (note that this should be trivially prevented by using unique funding transaction
* create a new channel with a conflicting funding transaction.
*
* [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
+ * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
*/
MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKTransaction funding_transaction);
MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
/**
- * Provides a payment preimage in response to a PaymentReceived event, returning true and
- * generating message events for the net layer to claim the payment, if possible. Thus, you
- * should probably kick the net layer to go send messages if this returns true!
+ * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
+ * [`MessageSendEvent`]s needed to claim the payment.
*
* Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
* [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
* event matches your expectation. If you fail to do so and call this method, you may provide
* the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
*
- * May panic if called except in response to a PaymentReceived event.
+ * Returns whether any HTLCs were claimed, and thus if any new [`MessageSendEvent`]s are now
+ * pending for processing via [`get_and_clear_pending_msg_events`].
*
+ * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
* [`create_inbound_payment`]: Self::create_inbound_payment
* [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
+ * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
*/
MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
* to pay us.
*
* This differs from [`create_inbound_payment_for_hash`] only in that it generates the
- * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
+ * [`PaymentHash`] and [`PaymentPreimage`] for you.
*
* The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
* will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
*
* See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
*
+ * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
+ * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
+ *
+ * # Note
+ *
+ * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
+ * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
+ *
+ * Errors if `min_value_msat` is greater than total bitcoin supply.
+ *
* [`claim_funds`]: Self::claim_funds
* [`PaymentReceived`]: events::Event::PaymentReceived
* [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
* [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
*/
-MUST_USE_RES struct LDKC2Tuple_PaymentHashPaymentSecretZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, uint64_t user_payment_id);
+MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs);
+
+/**
+ * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
+ * serialized state with LDK node(s) running 0.0.103 and earlier.
+ *
+ * # Note
+ * This method is deprecated and will be removed soon.
+ *
+ * [`create_inbound_payment`]: Self::create_inbound_payment
+ */
+MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ChannelManager_create_inbound_payment_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs);
/**
* Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
* payment secret fetched via this method or [`create_inbound_payment`], and which is at least
* the `min_value_msat` provided here, if one is provided.
*
- * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
- * method may return an Err if another payment with the same payment_hash is still pending.
- *
- * `user_payment_id` will be provided back in [`PaymentPurpose::InvoicePayment::user_payment_id`] events to
- * allow tracking of which events correspond with which calls to this and
- * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
- * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
- * with invoice metadata stored elsewhere.
+ * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
+ * note that LDK will not stop you from registering duplicate payment hashes for inbound
+ * payments.
*
* `min_value_msat` should be set if the invoice being generated contains a value. Any payment
* received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
* If you need exact expiry semantics, you should enforce them upon receipt of
* [`PaymentReceived`].
*
- * Pending inbound payments are stored in memory and in serialized versions of this
- * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
- * space is limited, you may wish to rate-limit inbound payment creation.
- *
* May panic if `invoice_expiry_delta_secs` is greater than one year.
*
* Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
* set to at least [`MIN_FINAL_CLTV_EXPIRY`].
*
+ * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
+ * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
+ *
+ * # Note
+ *
+ * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
+ * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
+ *
+ * Errors if `min_value_msat` is greater than total bitcoin supply.
+ *
* [`create_inbound_payment`]: Self::create_inbound_payment
* [`PaymentReceived`]: events::Event::PaymentReceived
- * [`PaymentPurpose::InvoicePayment::user_payment_id`]: events::PaymentPurpose::InvoicePayment::user_payment_id
*/
-MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, uint64_t user_payment_id);
+MUST_USE_RES struct LDKCResult_PaymentSecretNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs);
+
+/**
+ * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
+ * serialized state with LDK node(s) running 0.0.103 and earlier.
+ *
+ * # Note
+ * This method is deprecated and will be removed soon.
+ *
+ * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
+ */
+MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs);
+
+/**
+ * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
+ * previously returned from [`create_inbound_payment`].
+ *
+ * [`create_inbound_payment`]: Self::create_inbound_payment
+ */
+MUST_USE_RES struct LDKCResult_PaymentPreimageAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
/**
* Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
* indicating whether persistence is necessary. Only one listener on
* `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
* up.
- * Note that the feature `allow_wallclock_use` must be enabled to use this function.
+ *
+ * Note that this method is not available with the `no-std` feature.
*/
MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
*/
void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
+/**
+ * The channel type that this channel will represent. If none is set, we derive the channel
+ * type from the intersection of our feature bits with our counterparty's feature bits from
+ * the Init message.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
+
+/**
+ * The channel type that this channel will represent. If none is set, we derive the channel
+ * type from the intersection of our feature bits with our counterparty's feature bits from
+ * the Init message.
+ *
+ * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
+
/**
* Creates a copy of the OpenChannel
*/
/**
* Utility method to constructs a new OnionV2-variant NetAddress
*/
-struct LDKNetAddress NetAddress_onion_v2(struct LDKTenBytes addr, uint16_t port);
+struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
/**
* Utility method to constructs a new OnionV3-variant NetAddress
*/
struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
+/**
+ * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
+ */
+struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
+
/**
* Utility method to constructs a new SendErrorMessage-variant ErrorAction
*/
*/
void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
+/**
+ * Gets the weight for an HTLC-Success transaction.
+ */
+uint64_t htlc_success_tx_weight(bool opt_anchors);
+
+/**
+ * Gets the weight for an HTLC-Timeout transaction.
+ */
+uint64_t htlc_timeout_tx_weight(bool opt_anchors);
+
/**
* Build the commitment secret from the seed and the commitment number
*/
* Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
* does not need to have its previous_output_index filled.
*/
-struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
+struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
/**
* Gets the redeemscript for a funding output from the two funding public keys.
* Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
* commitment transaction).
*/
-struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
+struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
+
+/**
+ * Gets the witnessScript for an anchor output from the funding public key.
+ * The witness in the spending input must be:
+ * <BIP 143 funding_signature>
+ * After 16 blocks of confirmation, an alternative satisfying witness could be:
+ * <>
+ * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
+ */
+struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
/**
* Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
*/
void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
+/**
+ * Are anchors used for this channel. Boolean is serialization backwards-compatible
+ */
+enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
+
+/**
+ * Are anchors used for this channel. Boolean is serialization backwards-compatible
+ */
+void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
+
/**
* Constructs a new ChannelTransactionParameters given each field
*/
-MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg);
+MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg, enum LDKCOption_NoneZ opt_anchors_arg);
/**
* Creates a copy of the ChannelTransactionParameters
*/
MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
+/**
+ * Whether to use anchors for this channel
+ */
+MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
+
/**
* Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
*/
*/
void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
+/**
+ * Creates a copy of the ClosingTransaction
+ */
+struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
+
+/**
+ * Checks if two ClosingTransactions contain equal inner contents.
+ */
+uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
+
/**
* Construct an object of the class
*/
*/
MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
+/**
+ * Should anchors be used.
+ */
+MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
+
/**
* Get a signature for each HTLC which was included in the commitment transaction (ie for
* which HTLCOutputInCommitment::transaction_output_index.is_some()).
*/
bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
+/**
+ * Checks if two ChannelTypeFeaturess 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 ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
+
/**
* Creates a copy of the InitFeatures
*/
*/
struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
+/**
+ * Creates a copy of the ChannelTypeFeatures
+ */
+struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
+
/**
* Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
*/
*/
void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
+/**
+ * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
+ */
+void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
+
/**
* Create a blank Features with no features set
*/
MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
/**
- * Returns whether the `payment_secret` feature is supported.
+ * Create a blank Features with no features set
*/
-MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
/**
- * Returns whether the `payment_secret` feature is supported.
+ * Creates a Features with the bits set which are known by the implementation
*/
-MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void);
/**
- * Returns whether the `payment_secret` feature is supported.
+ * Returns true if this `Features` object contains unknown feature flags which are set as
+ * \"required\".
*/
-MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
/**
* Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
/**
- * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
+ * Read a InitFeatures from a byte array, created by InitFeatures_write
*/
-struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
+struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
/**
* Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
/**
- * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
+ * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
*/
-struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
+struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
/**
- * Read a InitFeatures from a byte array, created by InitFeatures_write
+ * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
*/
-struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
+struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
/**
* Read a NodeFeatures from a byte array, created by NodeFeatures_write
struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
/**
- * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
+ * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
*/
-struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
+struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
/**
* Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
*/
struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
+/**
+ * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
+ */
+struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
+
+/**
+ * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
+ */
+struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
+
/**
* Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
*/
*/
MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
+/**
+ * Creates a copy of the InvalidShutdownScript
+ */
+struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
+
/**
* Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
*/
*/
void Type_free(struct LDKType this_ptr);
-/**
- * Calls the free function if one is set
- */
-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.
*/
*/
void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
-/**
- * Constructs a new ChannelInfo given each field
- */
-MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKNodeId node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKNodeId node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg);
-
/**
* Creates a copy of the ChannelInfo
*/
*/
void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
+/**
+ * Removes information about channels that we haven't heard any updates about in some time.
+ * This can be used regularly to prune the network graph of channels that likely no longer
+ * exist.
+ *
+ * While there is no formal requirement that nodes regularly re-broadcast their channel
+ * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
+ * pruning occur for updates which are at least two weeks old, which we implement here.
+ *
+ * This function takes the current unix time as an argument. For users with the `std` feature
+ * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
+ */
+void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
+
/**
* For an already known (from announcement) channel, update info about one of the directions
* of the channel.
* You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
* RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
* routing messages from a source using a protocol other than the lightning P2P protocol.
+ *
+ * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
+ * materially in the future will be rejected.
*/
MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
* For an already known (from announcement) channel, update info about one of the directions
* of the channel without verifying the associated signatures. Because we aren't given the
* associated signatures here we cannot relay the channel update to any of our peers.
+ *
+ * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
+ * materially in the future will be rejected.
*/
MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
*/
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);
+/**
+ * Calls the free function if one is set
+ */
+void Score_free(struct LDKScore this_ptr);
+
+/**
+ * Calls the free function if one is set
+ */
+void LockableScore_free(struct LDKLockableScore this_ptr);
+
+/**
+ * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
+ */
+void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
+
+/**
+ * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
+ */
+MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
+
/**
* Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
*/
/**
* A fixed penalty in msats to apply to each channel.
+ *
+ * Default value: 500 msat
*/
uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
/**
* A fixed penalty in msats to apply to each channel.
+ *
+ * Default value: 500 msat
*/
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`] or when successfully routing through a channel.
+ *
+ * Default value: 1,024,000 msat
*
* [`failure_penalty_half_life`]: Self::failure_penalty_half_life
*/
* 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`] or when successfully routing through a channel.
+ *
+ * Default value: 1,024,000 msat
*
* [`failure_penalty_half_life`]: Self::failure_penalty_half_life
*/
void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+/**
+ * When the amount being sent over a channel is this many 1024ths of the total channel
+ * capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
+ *
+ * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
+ *
+ * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
+ */
+uint16_t ScoringParameters_get_overuse_penalty_start_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
+
+/**
+ * When the amount being sent over a channel is this many 1024ths of the total channel
+ * capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
+ *
+ * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
+ *
+ * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
+ */
+void ScoringParameters_set_overuse_penalty_start_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint16_t val);
+
+/**
+ * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
+ * over the channel exceeds [`overuse_penalty_start_1024th`] by.
+ *
+ * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
+ * to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
+ *
+ * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
+ */
+uint64_t ScoringParameters_get_overuse_penalty_msat_per_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
+
+/**
+ * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
+ * over the channel exceeds [`overuse_penalty_start_1024th`] by.
+ *
+ * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
+ * to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
+ *
+ * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
+ */
+void ScoringParameters_set_overuse_penalty_msat_per_1024th(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.
*
+ * Successfully routing through a channel will immediately cut the penalty in half as well.
+ *
* # Note
*
- * When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never
- * elapse. Therefore, this penalty will never decay.
+ * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
+ * never decay.
*
* [`failure_penalty_msat`]: Self::failure_penalty_msat
*/
* The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
* cut in half.
*
+ * Successfully routing through a channel will immediately cut the penalty in half as well.
+ *
* # Note
*
- * When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never
- * elapse. Therefore, this penalty will never decay.
+ * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
+ * never decay.
*
* [`failure_penalty_msat`]: Self::failure_penalty_msat
*/
/**
* 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);
+MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint16_t overuse_penalty_start_1024th_arg, uint64_t overuse_penalty_msat_per_1024th_arg, uint64_t failure_penalty_half_life_arg);
/**
* Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
* functionality implemented by other handlers.
* * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
*
- * [top-level documentation]: Self
+ * [top-level documentation]: BackgroundProcessor
* [`join`]: Self::join
* [`stop`]: Self::stop
* [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
*/
enum LDKCreationError CreationError_expiry_time_out_of_bounds(void);
+/**
+ * Utility method to constructs a new InvalidAmount-variant CreationError
+ */
+enum LDKCreationError CreationError_invalid_amount(void);
+
/**
* Checks if two CreationErrors contain equal inner contents.
* This ignores pointers and is_owned flags and looks at the values in fields.
* 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);
+MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, const struct LDKMultiThreadedLockableScore *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.
*/
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);
+/**
+ * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in
+ * case a retry is needed.
+ *
+ * You should ensure that `payment_preimage` is unique and that its `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_pubkey(const struct LDKInvoicePayer *NONNULL_PTR this_arg, struct LDKPublicKey pubkey, struct LDKThirtyTwoBytes payment_preimage, uint64_t amount_msats, uint32_t final_cltv_expiry_delta);
+
/**
* Removes the payment cached by the given payment hash.
*
class EventHandler;
class Score;
class LockableScore;
+class MultiThreadedLockableScore;
+class Scorer;
+class ScoringParameters;
class InitFeatures;
class NodeFeatures;
class ChannelFeatures;
class InvoiceFeatures;
-class Scorer;
-class ScoringParameters;
+class ChannelTypeFeatures;
class DelayedPaymentOutputDescriptor;
class StaticPaymentOutputDescriptor;
class SpendableOutputDescriptor;
class SemanticError;
class SignOrCreationError;
class ChannelMonitorUpdate;
-class MonitorUpdateError;
class MonitorEvent;
class HTLCUpdate;
class Balance;
class COption_u64Z;
class CResult_TxOutAccessErrorZ;
class CResult_TrustedClosingTransactionNoneZ;
+class CResult_PaymentPreimageAPIErrorZ;
class CResult_ChannelMonitorUpdateDecodeErrorZ;
-class C2Tuple_PublicKeyTypeZ;
class CResult_RouteHintDecodeErrorZ;
+class C2Tuple_PublicKeyTypeZ;
class CResult_NetAddressDecodeErrorZ;
class CResult_ChannelReestablishDecodeErrorZ;
-class CResult_UnsignedNodeAnnouncementDecodeErrorZ;
class CResult_CommitmentSignedDecodeErrorZ;
class CVec_UpdateAddHTLCZ;
-class CResult_ReplyChannelRangeDecodeErrorZ;
+class CResult_UnsignedNodeAnnouncementDecodeErrorZ;
+class CResult_StaticPaymentOutputDescriptorDecodeErrorZ;
class COption_u32Z;
class CResult_InitFeaturesDecodeErrorZ;
-class CResult_StaticPaymentOutputDescriptorDecodeErrorZ;
class CResult_PaymentIdPaymentSendFailureZ;
-class CResult_GossipTimestampFilterDecodeErrorZ;
+class CResult_ReplyChannelRangeDecodeErrorZ;
class CResult_CommitmentTransactionDecodeErrorZ;
class COption_C2Tuple_usizeTransactionZZ;
class CResult_TransactionNoneZ;
class CResult_ExpiryTimeCreationErrorZ;
class CResult_ClosingSignedFeeRangeDecodeErrorZ;
class CResult_PingDecodeErrorZ;
-class CResult_InvoiceSignOrCreationErrorZ;
+class CResult_GossipTimestampFilterDecodeErrorZ;
class CVec_TransactionOutputsZ;
class CResult_ErrorMessageDecodeErrorZ;
class CResult_OpenChannelDecodeErrorZ;
class CVec_CVec_u8ZZ;
-class COption_FilterZ;
+class CResult_InvoiceSignOrCreationErrorZ;
class CResult_SecretKeyErrorZ;
class CResult_ShutdownScriptDecodeErrorZ;
class CResult_InvoiceNoneZ;
class C3Tuple_RawInvoice_u832InvoiceSignatureZ;
class CVec_UpdateFailMalformedHTLCZ;
class CResult_FundingSignedDecodeErrorZ;
+class COption_FilterZ;
class CResult_NetworkGraphDecodeErrorZ;
class CVec_RouteHopZ;
class CVec_C2Tuple_BlockHashChannelMonitorZZ;
class CVec_CResult_NoneAPIErrorZZ;
class CResult_SignatureNoneZ;
class CVec_RouteHintHopZ;
+class CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
class C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
class CResult_InitDecodeErrorZ;
class CResult_OutPointDecodeErrorZ;
class CVec_NodeAnnouncementZ;
class CResult_UnsignedChannelAnnouncementDecodeErrorZ;
class CVec_TxidZ;
-class CResult_NoneMonitorUpdateErrorZ;
+class COption_AccessZ;
class CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
class CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
class CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
class CResult_CVec_CVec_u8ZZNoneZ;
class C2Tuple_PaymentHashPaymentSecretZ;
-class COption_AccessZ;
+class CResult_AcceptChannelDecodeErrorZ;
class C2Tuple_BlockHashChannelManagerZ;
class CResult_ChannelTransactionParametersDecodeErrorZ;
-class CResult_AcceptChannelDecodeErrorZ;
+class CResult_PongDecodeErrorZ;
class CVec_SignatureZ;
class CVec_u64Z;
class CResult_ScorerDecodeErrorZ;
class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
class C2Tuple_PaymentHashPaymentIdZ;
-class CResult_StringErrorZ;
+class CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
class CResult_NoneErrorZ;
+class CResult_StringErrorZ;
class C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
-class CResult_PongDecodeErrorZ;
class CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
class COption_EventZ;
+class CResult_ChannelTypeFeaturesDecodeErrorZ;
class CVec_RouteHintZ;
class COption_u16Z;
class CVec_CVec_RouteHopZZ;
class CResult_DirectionalChannelInfoDecodeErrorZ;
class C2Tuple_u32TxOutZ;
class CResult_UpdateFailHTLCDecodeErrorZ;
+class CResult_PaymentSecretNoneZ;
class CResult_ChannelConfigDecodeErrorZ;
class CVec_PrivateRouteZ;
class CResult_SpendableOutputDescriptorDecodeErrorZ;
class CResult_SiPrefixNoneZ;
class CResult_PublicKeyErrorZ;
class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
-class CResult_NoneNoneZ;
class CResult_RouteParametersDecodeErrorZ;
class COption_ClosureReasonZ;
+class CResult_NoneNoneZ;
class CVec_APIErrorZ;
class CResult_PrivateRouteCreationErrorZ;
class CResult_boolPeerHandleErrorZ;
class CResult_ReplyShortChannelIdsEndDecodeErrorZ;
class CResult_RouteDecodeErrorZ;
class CResult_BuiltCommitmentTransactionDecodeErrorZ;
-class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
+class COption_NoneZ;
class CVec_TxOutZ;
+class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
class CVec_UpdateFailHTLCZ;
class CResult_FundingLockedDecodeErrorZ;
/**
* 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).
+ * Must return a value 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)
+ * This method can be implemented with the following unit conversions:
+ * * max(satoshis-per-byte * 250, 253)
+ * * max(satoshis-per-kbyte / 4, 253)
*/
inline uint32_t get_est_sat_per_1000_weight(enum LDKConfirmationTarget confirmation_target);
};
const LDKScore* operator &() const { return &self; }
const LDKScore* operator ->() const { return &self; }
/**
- * Returns the fee in msats willing to be paid to avoid routing through the given channel
- * in the direction from `source` to `target`.
+ * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
+ * given channel in the direction from `source` to `target`.
+ *
+ * The channel's capacity (less any other MPP parts which are also being considered for use in
+ * the same payment) is given by `channel_capacity_msat`. It may be guessed from various
+ * sources or assumed from no data at all.
+ *
+ * For hints provided in the invoice, we assume the channel has sufficient capacity to accept
+ * the invoice's full amount, and provide a `channel_capacity_msat` of `None`. In all other
+ * cases it is set to `Some`, even if we're guessing at the channel value.
+ *
+ * Your code should be overflow-safe through a `channel_capacity_msat` of 21 million BTC.
*/
- inline uint64_t channel_penalty_msat(uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target);
+ inline uint64_t channel_penalty_msat(uint64_t short_channel_id, uint64_t send_amt_msat, struct LDKCOption_u64Z channel_capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target);
/**
* Handles updating channel penalties after failing to route through a channel.
*/
inline void payment_path_failed(struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
+ /**
+ * Handles updating channel penalties after successfully routing along a path.
+ */
+ inline void payment_path_successful(struct LDKCVec_RouteHopZ path);
};
class LockableScore {
private:
LDKLockableScore* operator ->() { return &self; }
const LDKLockableScore* operator &() const { return &self; }
const LDKLockableScore* operator ->() const { return &self; }
+ /**
+ * Returns the locked scorer.
+ */
+ inline LDK::Score lock();
+};
+class MultiThreadedLockableScore {
+private:
+ LDKMultiThreadedLockableScore self;
+public:
+ MultiThreadedLockableScore(const MultiThreadedLockableScore&) = delete;
+ MultiThreadedLockableScore(MultiThreadedLockableScore&& o) : self(o.self) { memset(&o, 0, sizeof(MultiThreadedLockableScore)); }
+ MultiThreadedLockableScore(LDKMultiThreadedLockableScore&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMultiThreadedLockableScore)); }
+ operator LDKMultiThreadedLockableScore() && { LDKMultiThreadedLockableScore res = self; memset(&self, 0, sizeof(LDKMultiThreadedLockableScore)); return res; }
+ ~MultiThreadedLockableScore() { MultiThreadedLockableScore_free(self); }
+ MultiThreadedLockableScore& operator=(MultiThreadedLockableScore&& o) { MultiThreadedLockableScore_free(self); self = o.self; memset(&o, 0, sizeof(MultiThreadedLockableScore)); return *this; }
+ LDKMultiThreadedLockableScore* operator &() { return &self; }
+ LDKMultiThreadedLockableScore* operator ->() { return &self; }
+ const LDKMultiThreadedLockableScore* operator &() const { return &self; }
+ const LDKMultiThreadedLockableScore* operator ->() const { return &self; }
+};
+class Scorer {
+private:
+ LDKScorer self;
+public:
+ Scorer(const Scorer&) = delete;
+ Scorer(Scorer&& o) : self(o.self) { memset(&o, 0, sizeof(Scorer)); }
+ Scorer(LDKScorer&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKScorer)); }
+ operator LDKScorer() && { LDKScorer res = self; memset(&self, 0, sizeof(LDKScorer)); return res; }
+ ~Scorer() { Scorer_free(self); }
+ Scorer& operator=(Scorer&& o) { Scorer_free(self); self = o.self; memset(&o, 0, sizeof(Scorer)); return *this; }
+ LDKScorer* operator &() { return &self; }
+ LDKScorer* operator ->() { return &self; }
+ const LDKScorer* operator &() const { return &self; }
+ const LDKScorer* operator ->() const { return &self; }
+};
+class ScoringParameters {
+private:
+ LDKScoringParameters self;
+public:
+ ScoringParameters(const ScoringParameters&) = delete;
+ ScoringParameters(ScoringParameters&& o) : self(o.self) { memset(&o, 0, sizeof(ScoringParameters)); }
+ ScoringParameters(LDKScoringParameters&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKScoringParameters)); }
+ operator LDKScoringParameters() && { LDKScoringParameters res = self; memset(&self, 0, sizeof(LDKScoringParameters)); return res; }
+ ~ScoringParameters() { ScoringParameters_free(self); }
+ ScoringParameters& operator=(ScoringParameters&& o) { ScoringParameters_free(self); self = o.self; memset(&o, 0, sizeof(ScoringParameters)); return *this; }
+ LDKScoringParameters* operator &() { return &self; }
+ LDKScoringParameters* operator ->() { return &self; }
+ const LDKScoringParameters* operator &() const { return &self; }
+ const LDKScoringParameters* operator ->() const { return &self; }
};
class InitFeatures {
private:
const LDKInvoiceFeatures* operator &() const { return &self; }
const LDKInvoiceFeatures* operator ->() const { return &self; }
};
-class Scorer {
+class ChannelTypeFeatures {
private:
- LDKScorer self;
+ LDKChannelTypeFeatures self;
public:
- Scorer(const Scorer&) = delete;
- Scorer(Scorer&& o) : self(o.self) { memset(&o, 0, sizeof(Scorer)); }
- Scorer(LDKScorer&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKScorer)); }
- operator LDKScorer() && { LDKScorer res = self; memset(&self, 0, sizeof(LDKScorer)); return res; }
- ~Scorer() { Scorer_free(self); }
- Scorer& operator=(Scorer&& o) { Scorer_free(self); self = o.self; memset(&o, 0, sizeof(Scorer)); return *this; }
- LDKScorer* operator &() { return &self; }
- LDKScorer* operator ->() { return &self; }
- const LDKScorer* operator &() const { return &self; }
- const LDKScorer* operator ->() const { return &self; }
-};
-class ScoringParameters {
-private:
- LDKScoringParameters self;
-public:
- ScoringParameters(const ScoringParameters&) = delete;
- ScoringParameters(ScoringParameters&& o) : self(o.self) { memset(&o, 0, sizeof(ScoringParameters)); }
- ScoringParameters(LDKScoringParameters&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKScoringParameters)); }
- operator LDKScoringParameters() && { LDKScoringParameters res = self; memset(&self, 0, sizeof(LDKScoringParameters)); return res; }
- ~ScoringParameters() { ScoringParameters_free(self); }
- ScoringParameters& operator=(ScoringParameters&& o) { ScoringParameters_free(self); self = o.self; memset(&o, 0, sizeof(ScoringParameters)); return *this; }
- LDKScoringParameters* operator &() { return &self; }
- LDKScoringParameters* operator ->() { return &self; }
- const LDKScoringParameters* operator &() const { return &self; }
- const LDKScoringParameters* operator ->() const { return &self; }
+ ChannelTypeFeatures(const ChannelTypeFeatures&) = delete;
+ ChannelTypeFeatures(ChannelTypeFeatures&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelTypeFeatures)); }
+ ChannelTypeFeatures(LDKChannelTypeFeatures&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelTypeFeatures)); }
+ operator LDKChannelTypeFeatures() && { LDKChannelTypeFeatures res = self; memset(&self, 0, sizeof(LDKChannelTypeFeatures)); return res; }
+ ~ChannelTypeFeatures() { ChannelTypeFeatures_free(self); }
+ ChannelTypeFeatures& operator=(ChannelTypeFeatures&& o) { ChannelTypeFeatures_free(self); self = o.self; memset(&o, 0, sizeof(ChannelTypeFeatures)); return *this; }
+ LDKChannelTypeFeatures* operator &() { return &self; }
+ LDKChannelTypeFeatures* operator ->() { return &self; }
+ const LDKChannelTypeFeatures* operator &() const { return &self; }
+ const LDKChannelTypeFeatures* operator ->() const { return &self; }
};
class DelayedPaymentOutputDescriptor {
private:
* blindly signing the hash.
*/
inline LDK::CResult_RecoverableSignatureNoneZ sign_invoice(struct LDKCVec_u8Z invoice_preimage);
+ /**
+ * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
+ *
+ * This method must return the same value each time it is called.
+ */
+ inline LDKThirtyTwoBytes get_inbound_payment_key_material();
};
class InMemorySigner {
private:
* Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
inline LDK::CResult_PaymentIdPaymentSendFailureZ send_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
+ /**
+ * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
+ */
+ inline LDK::CResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
/**
* Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
*/
inline LDK::CResult_NonePaymentSendFailureZ retry_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
+ /**
+ * Signals that no further retries for the given payment will occur.
+ */
+ inline void abandon_payment(struct LDKThirtyTwoBytes payment_id);
};
class Router {
private:
*
* Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- inline LDK::CResult_RouteLightningErrorZ find_route(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer);
+ inline LDK::CResult_RouteLightningErrorZ find_route(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer);
};
class RetryAttempts {
private:
const LDKChannelMonitorUpdate* operator &() const { return &self; }
const LDKChannelMonitorUpdate* operator ->() const { return &self; }
};
-class MonitorUpdateError {
-private:
- LDKMonitorUpdateError self;
-public:
- MonitorUpdateError(const MonitorUpdateError&) = delete;
- MonitorUpdateError(MonitorUpdateError&& o) : self(o.self) { memset(&o, 0, sizeof(MonitorUpdateError)); }
- MonitorUpdateError(LDKMonitorUpdateError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMonitorUpdateError)); }
- operator LDKMonitorUpdateError() && { LDKMonitorUpdateError res = self; memset(&self, 0, sizeof(LDKMonitorUpdateError)); return res; }
- ~MonitorUpdateError() { MonitorUpdateError_free(self); }
- MonitorUpdateError& operator=(MonitorUpdateError&& o) { MonitorUpdateError_free(self); self = o.self; memset(&o, 0, sizeof(MonitorUpdateError)); return *this; }
- LDKMonitorUpdateError* operator &() { return &self; }
- LDKMonitorUpdateError* operator ->() { return &self; }
- const LDKMonitorUpdateError* operator &() const { return &self; }
- const LDKMonitorUpdateError* operator ->() const { return &self; }
-};
class MonitorEvent {
private:
LDKMonitorEvent self;
const LDKCResult_TrustedClosingTransactionNoneZ* operator &() const { return &self; }
const LDKCResult_TrustedClosingTransactionNoneZ* operator ->() const { return &self; }
};
+class CResult_PaymentPreimageAPIErrorZ {
+private:
+ LDKCResult_PaymentPreimageAPIErrorZ self;
+public:
+ CResult_PaymentPreimageAPIErrorZ(const CResult_PaymentPreimageAPIErrorZ&) = delete;
+ CResult_PaymentPreimageAPIErrorZ(CResult_PaymentPreimageAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentPreimageAPIErrorZ)); }
+ CResult_PaymentPreimageAPIErrorZ(LDKCResult_PaymentPreimageAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentPreimageAPIErrorZ)); }
+ operator LDKCResult_PaymentPreimageAPIErrorZ() && { LDKCResult_PaymentPreimageAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentPreimageAPIErrorZ)); return res; }
+ ~CResult_PaymentPreimageAPIErrorZ() { CResult_PaymentPreimageAPIErrorZ_free(self); }
+ CResult_PaymentPreimageAPIErrorZ& operator=(CResult_PaymentPreimageAPIErrorZ&& o) { CResult_PaymentPreimageAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentPreimageAPIErrorZ)); return *this; }
+ LDKCResult_PaymentPreimageAPIErrorZ* operator &() { return &self; }
+ LDKCResult_PaymentPreimageAPIErrorZ* operator ->() { return &self; }
+ const LDKCResult_PaymentPreimageAPIErrorZ* operator &() const { return &self; }
+ const LDKCResult_PaymentPreimageAPIErrorZ* operator ->() const { return &self; }
+};
class CResult_ChannelMonitorUpdateDecodeErrorZ {
private:
LDKCResult_ChannelMonitorUpdateDecodeErrorZ self;
const LDKCResult_ChannelMonitorUpdateDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_ChannelMonitorUpdateDecodeErrorZ* operator ->() const { return &self; }
};
-class C2Tuple_PublicKeyTypeZ {
-private:
- LDKC2Tuple_PublicKeyTypeZ self;
-public:
- C2Tuple_PublicKeyTypeZ(const C2Tuple_PublicKeyTypeZ&) = delete;
- C2Tuple_PublicKeyTypeZ(C2Tuple_PublicKeyTypeZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PublicKeyTypeZ)); }
- C2Tuple_PublicKeyTypeZ(LDKC2Tuple_PublicKeyTypeZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PublicKeyTypeZ)); }
- operator LDKC2Tuple_PublicKeyTypeZ() && { LDKC2Tuple_PublicKeyTypeZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PublicKeyTypeZ)); return res; }
- ~C2Tuple_PublicKeyTypeZ() { C2Tuple_PublicKeyTypeZ_free(self); }
- C2Tuple_PublicKeyTypeZ& operator=(C2Tuple_PublicKeyTypeZ&& o) { C2Tuple_PublicKeyTypeZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PublicKeyTypeZ)); return *this; }
- LDKC2Tuple_PublicKeyTypeZ* operator &() { return &self; }
- LDKC2Tuple_PublicKeyTypeZ* operator ->() { return &self; }
- const LDKC2Tuple_PublicKeyTypeZ* operator &() const { return &self; }
- const LDKC2Tuple_PublicKeyTypeZ* operator ->() const { return &self; }
-};
class CResult_RouteHintDecodeErrorZ {
private:
LDKCResult_RouteHintDecodeErrorZ self;
const LDKCResult_RouteHintDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_RouteHintDecodeErrorZ* operator ->() const { return &self; }
};
+class C2Tuple_PublicKeyTypeZ {
+private:
+ LDKC2Tuple_PublicKeyTypeZ self;
+public:
+ C2Tuple_PublicKeyTypeZ(const C2Tuple_PublicKeyTypeZ&) = delete;
+ C2Tuple_PublicKeyTypeZ(C2Tuple_PublicKeyTypeZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PublicKeyTypeZ)); }
+ C2Tuple_PublicKeyTypeZ(LDKC2Tuple_PublicKeyTypeZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PublicKeyTypeZ)); }
+ operator LDKC2Tuple_PublicKeyTypeZ() && { LDKC2Tuple_PublicKeyTypeZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PublicKeyTypeZ)); return res; }
+ ~C2Tuple_PublicKeyTypeZ() { C2Tuple_PublicKeyTypeZ_free(self); }
+ C2Tuple_PublicKeyTypeZ& operator=(C2Tuple_PublicKeyTypeZ&& o) { C2Tuple_PublicKeyTypeZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PublicKeyTypeZ)); return *this; }
+ LDKC2Tuple_PublicKeyTypeZ* operator &() { return &self; }
+ LDKC2Tuple_PublicKeyTypeZ* operator ->() { return &self; }
+ const LDKC2Tuple_PublicKeyTypeZ* operator &() const { return &self; }
+ const LDKC2Tuple_PublicKeyTypeZ* operator ->() const { return &self; }
+};
class CResult_NetAddressDecodeErrorZ {
private:
LDKCResult_NetAddressDecodeErrorZ self;
const LDKCResult_ChannelReestablishDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_ChannelReestablishDecodeErrorZ* operator ->() const { return &self; }
};
-class CResult_UnsignedNodeAnnouncementDecodeErrorZ {
-private:
- LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ self;
-public:
- CResult_UnsignedNodeAnnouncementDecodeErrorZ(const CResult_UnsignedNodeAnnouncementDecodeErrorZ&) = delete;
- CResult_UnsignedNodeAnnouncementDecodeErrorZ(CResult_UnsignedNodeAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedNodeAnnouncementDecodeErrorZ)); }
- CResult_UnsignedNodeAnnouncementDecodeErrorZ(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ)); }
- operator LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ() && { LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ)); return res; }
- ~CResult_UnsignedNodeAnnouncementDecodeErrorZ() { CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(self); }
- CResult_UnsignedNodeAnnouncementDecodeErrorZ& operator=(CResult_UnsignedNodeAnnouncementDecodeErrorZ&& o) { CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedNodeAnnouncementDecodeErrorZ)); return *this; }
- LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator &() { return &self; }
- LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator ->() const { return &self; }
-};
class CResult_CommitmentSignedDecodeErrorZ {
private:
LDKCResult_CommitmentSignedDecodeErrorZ self;
const LDKCVec_UpdateAddHTLCZ* operator &() const { return &self; }
const LDKCVec_UpdateAddHTLCZ* operator ->() const { return &self; }
};
-class CResult_ReplyChannelRangeDecodeErrorZ {
+class CResult_UnsignedNodeAnnouncementDecodeErrorZ {
private:
- LDKCResult_ReplyChannelRangeDecodeErrorZ self;
+ LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ self;
public:
- CResult_ReplyChannelRangeDecodeErrorZ(const CResult_ReplyChannelRangeDecodeErrorZ&) = delete;
- CResult_ReplyChannelRangeDecodeErrorZ(CResult_ReplyChannelRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ReplyChannelRangeDecodeErrorZ)); }
- CResult_ReplyChannelRangeDecodeErrorZ(LDKCResult_ReplyChannelRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ)); }
- operator LDKCResult_ReplyChannelRangeDecodeErrorZ() && { LDKCResult_ReplyChannelRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ)); return res; }
- ~CResult_ReplyChannelRangeDecodeErrorZ() { CResult_ReplyChannelRangeDecodeErrorZ_free(self); }
- CResult_ReplyChannelRangeDecodeErrorZ& operator=(CResult_ReplyChannelRangeDecodeErrorZ&& o) { CResult_ReplyChannelRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ReplyChannelRangeDecodeErrorZ)); return *this; }
- LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() { return &self; }
- LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() const { return &self; }
+ CResult_UnsignedNodeAnnouncementDecodeErrorZ(const CResult_UnsignedNodeAnnouncementDecodeErrorZ&) = delete;
+ CResult_UnsignedNodeAnnouncementDecodeErrorZ(CResult_UnsignedNodeAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedNodeAnnouncementDecodeErrorZ)); }
+ CResult_UnsignedNodeAnnouncementDecodeErrorZ(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ)); }
+ operator LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ() && { LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ)); return res; }
+ ~CResult_UnsignedNodeAnnouncementDecodeErrorZ() { CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(self); }
+ CResult_UnsignedNodeAnnouncementDecodeErrorZ& operator=(CResult_UnsignedNodeAnnouncementDecodeErrorZ&& o) { CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedNodeAnnouncementDecodeErrorZ)); return *this; }
+ LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator ->() const { return &self; }
+};
+class CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
+private:
+ LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ self;
+public:
+ CResult_StaticPaymentOutputDescriptorDecodeErrorZ(const CResult_StaticPaymentOutputDescriptorDecodeErrorZ&) = delete;
+ CResult_StaticPaymentOutputDescriptorDecodeErrorZ(CResult_StaticPaymentOutputDescriptorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StaticPaymentOutputDescriptorDecodeErrorZ)); }
+ CResult_StaticPaymentOutputDescriptorDecodeErrorZ(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ)); }
+ operator LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ() && { LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ)); return res; }
+ ~CResult_StaticPaymentOutputDescriptorDecodeErrorZ() { CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(self); }
+ CResult_StaticPaymentOutputDescriptorDecodeErrorZ& operator=(CResult_StaticPaymentOutputDescriptorDecodeErrorZ&& o) { CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StaticPaymentOutputDescriptorDecodeErrorZ)); return *this; }
+ LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator ->() const { return &self; }
};
class COption_u32Z {
private:
const LDKCResult_InitFeaturesDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_InitFeaturesDecodeErrorZ* operator ->() const { return &self; }
};
-class CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
-private:
- LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ self;
-public:
- CResult_StaticPaymentOutputDescriptorDecodeErrorZ(const CResult_StaticPaymentOutputDescriptorDecodeErrorZ&) = delete;
- CResult_StaticPaymentOutputDescriptorDecodeErrorZ(CResult_StaticPaymentOutputDescriptorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StaticPaymentOutputDescriptorDecodeErrorZ)); }
- CResult_StaticPaymentOutputDescriptorDecodeErrorZ(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ)); }
- operator LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ() && { LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ)); return res; }
- ~CResult_StaticPaymentOutputDescriptorDecodeErrorZ() { CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(self); }
- CResult_StaticPaymentOutputDescriptorDecodeErrorZ& operator=(CResult_StaticPaymentOutputDescriptorDecodeErrorZ&& o) { CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StaticPaymentOutputDescriptorDecodeErrorZ)); return *this; }
- LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator &() { return &self; }
- LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator ->() const { return &self; }
-};
class CResult_PaymentIdPaymentSendFailureZ {
private:
LDKCResult_PaymentIdPaymentSendFailureZ self;
const LDKCResult_PaymentIdPaymentSendFailureZ* operator &() const { return &self; }
const LDKCResult_PaymentIdPaymentSendFailureZ* operator ->() const { return &self; }
};
-class CResult_GossipTimestampFilterDecodeErrorZ {
+class CResult_ReplyChannelRangeDecodeErrorZ {
private:
- LDKCResult_GossipTimestampFilterDecodeErrorZ self;
+ LDKCResult_ReplyChannelRangeDecodeErrorZ self;
public:
- CResult_GossipTimestampFilterDecodeErrorZ(const CResult_GossipTimestampFilterDecodeErrorZ&) = delete;
- CResult_GossipTimestampFilterDecodeErrorZ(CResult_GossipTimestampFilterDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_GossipTimestampFilterDecodeErrorZ)); }
- CResult_GossipTimestampFilterDecodeErrorZ(LDKCResult_GossipTimestampFilterDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ)); }
- operator LDKCResult_GossipTimestampFilterDecodeErrorZ() && { LDKCResult_GossipTimestampFilterDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ)); return res; }
- ~CResult_GossipTimestampFilterDecodeErrorZ() { CResult_GossipTimestampFilterDecodeErrorZ_free(self); }
- CResult_GossipTimestampFilterDecodeErrorZ& operator=(CResult_GossipTimestampFilterDecodeErrorZ&& o) { CResult_GossipTimestampFilterDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_GossipTimestampFilterDecodeErrorZ)); return *this; }
- LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() { return &self; }
- LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() const { return &self; }
+ CResult_ReplyChannelRangeDecodeErrorZ(const CResult_ReplyChannelRangeDecodeErrorZ&) = delete;
+ CResult_ReplyChannelRangeDecodeErrorZ(CResult_ReplyChannelRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ReplyChannelRangeDecodeErrorZ)); }
+ CResult_ReplyChannelRangeDecodeErrorZ(LDKCResult_ReplyChannelRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ)); }
+ operator LDKCResult_ReplyChannelRangeDecodeErrorZ() && { LDKCResult_ReplyChannelRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ)); return res; }
+ ~CResult_ReplyChannelRangeDecodeErrorZ() { CResult_ReplyChannelRangeDecodeErrorZ_free(self); }
+ CResult_ReplyChannelRangeDecodeErrorZ& operator=(CResult_ReplyChannelRangeDecodeErrorZ&& o) { CResult_ReplyChannelRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ReplyChannelRangeDecodeErrorZ)); return *this; }
+ LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() const { return &self; }
};
class CResult_CommitmentTransactionDecodeErrorZ {
private:
const LDKCResult_PingDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_PingDecodeErrorZ* operator ->() const { return &self; }
};
-class CResult_InvoiceSignOrCreationErrorZ {
+class CResult_GossipTimestampFilterDecodeErrorZ {
private:
- LDKCResult_InvoiceSignOrCreationErrorZ self;
+ LDKCResult_GossipTimestampFilterDecodeErrorZ self;
public:
- CResult_InvoiceSignOrCreationErrorZ(const CResult_InvoiceSignOrCreationErrorZ&) = delete;
- CResult_InvoiceSignOrCreationErrorZ(CResult_InvoiceSignOrCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceSignOrCreationErrorZ)); }
- CResult_InvoiceSignOrCreationErrorZ(LDKCResult_InvoiceSignOrCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceSignOrCreationErrorZ)); }
- operator LDKCResult_InvoiceSignOrCreationErrorZ() && { LDKCResult_InvoiceSignOrCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceSignOrCreationErrorZ)); return res; }
- ~CResult_InvoiceSignOrCreationErrorZ() { CResult_InvoiceSignOrCreationErrorZ_free(self); }
- CResult_InvoiceSignOrCreationErrorZ& operator=(CResult_InvoiceSignOrCreationErrorZ&& o) { CResult_InvoiceSignOrCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceSignOrCreationErrorZ)); return *this; }
- LDKCResult_InvoiceSignOrCreationErrorZ* operator &() { return &self; }
- LDKCResult_InvoiceSignOrCreationErrorZ* operator ->() { return &self; }
- const LDKCResult_InvoiceSignOrCreationErrorZ* operator &() const { return &self; }
- const LDKCResult_InvoiceSignOrCreationErrorZ* operator ->() const { return &self; }
+ CResult_GossipTimestampFilterDecodeErrorZ(const CResult_GossipTimestampFilterDecodeErrorZ&) = delete;
+ CResult_GossipTimestampFilterDecodeErrorZ(CResult_GossipTimestampFilterDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_GossipTimestampFilterDecodeErrorZ)); }
+ CResult_GossipTimestampFilterDecodeErrorZ(LDKCResult_GossipTimestampFilterDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ)); }
+ operator LDKCResult_GossipTimestampFilterDecodeErrorZ() && { LDKCResult_GossipTimestampFilterDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ)); return res; }
+ ~CResult_GossipTimestampFilterDecodeErrorZ() { CResult_GossipTimestampFilterDecodeErrorZ_free(self); }
+ CResult_GossipTimestampFilterDecodeErrorZ& operator=(CResult_GossipTimestampFilterDecodeErrorZ&& o) { CResult_GossipTimestampFilterDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_GossipTimestampFilterDecodeErrorZ)); return *this; }
+ LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() const { return &self; }
};
class CVec_TransactionOutputsZ {
private:
const LDKCVec_CVec_u8ZZ* operator &() const { return &self; }
const LDKCVec_CVec_u8ZZ* operator ->() const { return &self; }
};
-class COption_FilterZ {
+class CResult_InvoiceSignOrCreationErrorZ {
private:
- LDKCOption_FilterZ self;
+ LDKCResult_InvoiceSignOrCreationErrorZ self;
public:
- COption_FilterZ(const COption_FilterZ&) = delete;
- COption_FilterZ(COption_FilterZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_FilterZ)); }
- COption_FilterZ(LDKCOption_FilterZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_FilterZ)); }
- operator LDKCOption_FilterZ() && { LDKCOption_FilterZ res = self; memset(&self, 0, sizeof(LDKCOption_FilterZ)); return res; }
- ~COption_FilterZ() { COption_FilterZ_free(self); }
- COption_FilterZ& operator=(COption_FilterZ&& o) { COption_FilterZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_FilterZ)); return *this; }
- LDKCOption_FilterZ* operator &() { return &self; }
- LDKCOption_FilterZ* operator ->() { return &self; }
- const LDKCOption_FilterZ* operator &() const { return &self; }
- const LDKCOption_FilterZ* operator ->() const { return &self; }
+ CResult_InvoiceSignOrCreationErrorZ(const CResult_InvoiceSignOrCreationErrorZ&) = delete;
+ CResult_InvoiceSignOrCreationErrorZ(CResult_InvoiceSignOrCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceSignOrCreationErrorZ)); }
+ CResult_InvoiceSignOrCreationErrorZ(LDKCResult_InvoiceSignOrCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceSignOrCreationErrorZ)); }
+ operator LDKCResult_InvoiceSignOrCreationErrorZ() && { LDKCResult_InvoiceSignOrCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceSignOrCreationErrorZ)); return res; }
+ ~CResult_InvoiceSignOrCreationErrorZ() { CResult_InvoiceSignOrCreationErrorZ_free(self); }
+ CResult_InvoiceSignOrCreationErrorZ& operator=(CResult_InvoiceSignOrCreationErrorZ&& o) { CResult_InvoiceSignOrCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceSignOrCreationErrorZ)); return *this; }
+ LDKCResult_InvoiceSignOrCreationErrorZ* operator &() { return &self; }
+ LDKCResult_InvoiceSignOrCreationErrorZ* operator ->() { return &self; }
+ const LDKCResult_InvoiceSignOrCreationErrorZ* operator &() const { return &self; }
+ const LDKCResult_InvoiceSignOrCreationErrorZ* operator ->() const { return &self; }
};
class CResult_SecretKeyErrorZ {
private:
const LDKCResult_FundingSignedDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_FundingSignedDecodeErrorZ* operator ->() const { return &self; }
};
+class COption_FilterZ {
+private:
+ LDKCOption_FilterZ self;
+public:
+ COption_FilterZ(const COption_FilterZ&) = delete;
+ COption_FilterZ(COption_FilterZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_FilterZ)); }
+ COption_FilterZ(LDKCOption_FilterZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_FilterZ)); }
+ operator LDKCOption_FilterZ() && { LDKCOption_FilterZ res = self; memset(&self, 0, sizeof(LDKCOption_FilterZ)); return res; }
+ ~COption_FilterZ() { COption_FilterZ_free(self); }
+ COption_FilterZ& operator=(COption_FilterZ&& o) { COption_FilterZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_FilterZ)); return *this; }
+ LDKCOption_FilterZ* operator &() { return &self; }
+ LDKCOption_FilterZ* operator ->() { return &self; }
+ const LDKCOption_FilterZ* operator &() const { return &self; }
+ const LDKCOption_FilterZ* operator ->() const { return &self; }
+};
class CResult_NetworkGraphDecodeErrorZ {
private:
LDKCResult_NetworkGraphDecodeErrorZ self;
const LDKCVec_RouteHintHopZ* operator &() const { return &self; }
const LDKCVec_RouteHintHopZ* operator ->() const { return &self; }
};
+class CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+private:
+ LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ self;
+public:
+ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ(const CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&) = delete;
+ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); }
+ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); }
+ operator LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ() && { LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); return res; }
+ ~CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ() { CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(self); }
+ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ& operator=(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&& o) { CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); return *this; }
+ LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator &() { return &self; }
+ LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator ->() { return &self; }
+ const LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator &() const { return &self; }
+ const LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator ->() const { return &self; }
+};
class C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
private:
LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ self;
const LDKCVec_TxidZ* operator &() const { return &self; }
const LDKCVec_TxidZ* operator ->() const { return &self; }
};
-class CResult_NoneMonitorUpdateErrorZ {
+class COption_AccessZ {
private:
- LDKCResult_NoneMonitorUpdateErrorZ self;
+ LDKCOption_AccessZ self;
public:
- CResult_NoneMonitorUpdateErrorZ(const CResult_NoneMonitorUpdateErrorZ&) = delete;
- CResult_NoneMonitorUpdateErrorZ(CResult_NoneMonitorUpdateErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneMonitorUpdateErrorZ)); }
- CResult_NoneMonitorUpdateErrorZ(LDKCResult_NoneMonitorUpdateErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneMonitorUpdateErrorZ)); }
- operator LDKCResult_NoneMonitorUpdateErrorZ() && { LDKCResult_NoneMonitorUpdateErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneMonitorUpdateErrorZ)); return res; }
- ~CResult_NoneMonitorUpdateErrorZ() { CResult_NoneMonitorUpdateErrorZ_free(self); }
- CResult_NoneMonitorUpdateErrorZ& operator=(CResult_NoneMonitorUpdateErrorZ&& o) { CResult_NoneMonitorUpdateErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneMonitorUpdateErrorZ)); return *this; }
- LDKCResult_NoneMonitorUpdateErrorZ* operator &() { return &self; }
- LDKCResult_NoneMonitorUpdateErrorZ* operator ->() { return &self; }
- const LDKCResult_NoneMonitorUpdateErrorZ* operator &() const { return &self; }
- const LDKCResult_NoneMonitorUpdateErrorZ* operator ->() const { return &self; }
+ COption_AccessZ(const COption_AccessZ&) = delete;
+ COption_AccessZ(COption_AccessZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_AccessZ)); }
+ COption_AccessZ(LDKCOption_AccessZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_AccessZ)); }
+ operator LDKCOption_AccessZ() && { LDKCOption_AccessZ res = self; memset(&self, 0, sizeof(LDKCOption_AccessZ)); return res; }
+ ~COption_AccessZ() { COption_AccessZ_free(self); }
+ COption_AccessZ& operator=(COption_AccessZ&& o) { COption_AccessZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_AccessZ)); return *this; }
+ LDKCOption_AccessZ* operator &() { return &self; }
+ LDKCOption_AccessZ* operator ->() { return &self; }
+ const LDKCOption_AccessZ* operator &() const { return &self; }
+ const LDKCOption_AccessZ* operator ->() const { return &self; }
};
class CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
private:
const LDKC2Tuple_PaymentHashPaymentSecretZ* operator &() const { return &self; }
const LDKC2Tuple_PaymentHashPaymentSecretZ* operator ->() const { return &self; }
};
-class COption_AccessZ {
+class CResult_AcceptChannelDecodeErrorZ {
private:
- LDKCOption_AccessZ self;
+ LDKCResult_AcceptChannelDecodeErrorZ self;
public:
- COption_AccessZ(const COption_AccessZ&) = delete;
- COption_AccessZ(COption_AccessZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_AccessZ)); }
- COption_AccessZ(LDKCOption_AccessZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_AccessZ)); }
- operator LDKCOption_AccessZ() && { LDKCOption_AccessZ res = self; memset(&self, 0, sizeof(LDKCOption_AccessZ)); return res; }
- ~COption_AccessZ() { COption_AccessZ_free(self); }
- COption_AccessZ& operator=(COption_AccessZ&& o) { COption_AccessZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_AccessZ)); return *this; }
- LDKCOption_AccessZ* operator &() { return &self; }
- LDKCOption_AccessZ* operator ->() { return &self; }
- const LDKCOption_AccessZ* operator &() const { return &self; }
- const LDKCOption_AccessZ* operator ->() const { return &self; }
+ CResult_AcceptChannelDecodeErrorZ(const CResult_AcceptChannelDecodeErrorZ&) = delete;
+ CResult_AcceptChannelDecodeErrorZ(CResult_AcceptChannelDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AcceptChannelDecodeErrorZ)); }
+ CResult_AcceptChannelDecodeErrorZ(LDKCResult_AcceptChannelDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AcceptChannelDecodeErrorZ)); }
+ operator LDKCResult_AcceptChannelDecodeErrorZ() && { LDKCResult_AcceptChannelDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AcceptChannelDecodeErrorZ)); return res; }
+ ~CResult_AcceptChannelDecodeErrorZ() { CResult_AcceptChannelDecodeErrorZ_free(self); }
+ CResult_AcceptChannelDecodeErrorZ& operator=(CResult_AcceptChannelDecodeErrorZ&& o) { CResult_AcceptChannelDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AcceptChannelDecodeErrorZ)); return *this; }
+ LDKCResult_AcceptChannelDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_AcceptChannelDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_AcceptChannelDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_AcceptChannelDecodeErrorZ* operator ->() const { return &self; }
};
class C2Tuple_BlockHashChannelManagerZ {
private:
const LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator ->() const { return &self; }
};
-class CResult_AcceptChannelDecodeErrorZ {
+class CResult_PongDecodeErrorZ {
private:
- LDKCResult_AcceptChannelDecodeErrorZ self;
+ LDKCResult_PongDecodeErrorZ self;
public:
- CResult_AcceptChannelDecodeErrorZ(const CResult_AcceptChannelDecodeErrorZ&) = delete;
- CResult_AcceptChannelDecodeErrorZ(CResult_AcceptChannelDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AcceptChannelDecodeErrorZ)); }
- CResult_AcceptChannelDecodeErrorZ(LDKCResult_AcceptChannelDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AcceptChannelDecodeErrorZ)); }
- operator LDKCResult_AcceptChannelDecodeErrorZ() && { LDKCResult_AcceptChannelDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AcceptChannelDecodeErrorZ)); return res; }
- ~CResult_AcceptChannelDecodeErrorZ() { CResult_AcceptChannelDecodeErrorZ_free(self); }
- CResult_AcceptChannelDecodeErrorZ& operator=(CResult_AcceptChannelDecodeErrorZ&& o) { CResult_AcceptChannelDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AcceptChannelDecodeErrorZ)); return *this; }
- LDKCResult_AcceptChannelDecodeErrorZ* operator &() { return &self; }
- LDKCResult_AcceptChannelDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_AcceptChannelDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_AcceptChannelDecodeErrorZ* operator ->() const { return &self; }
+ CResult_PongDecodeErrorZ(const CResult_PongDecodeErrorZ&) = delete;
+ CResult_PongDecodeErrorZ(CResult_PongDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); }
+ CResult_PongDecodeErrorZ(LDKCResult_PongDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); }
+ operator LDKCResult_PongDecodeErrorZ() && { LDKCResult_PongDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); return res; }
+ ~CResult_PongDecodeErrorZ() { CResult_PongDecodeErrorZ_free(self); }
+ CResult_PongDecodeErrorZ& operator=(CResult_PongDecodeErrorZ&& o) { CResult_PongDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); return *this; }
+ LDKCResult_PongDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_PongDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_PongDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_PongDecodeErrorZ* operator ->() const { return &self; }
};
class CVec_SignatureZ {
private:
const LDKC2Tuple_PaymentHashPaymentIdZ* operator &() const { return &self; }
const LDKC2Tuple_PaymentHashPaymentIdZ* operator ->() const { return &self; }
};
-class CResult_StringErrorZ {
+class CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
private:
- LDKCResult_StringErrorZ self;
+ LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ self;
public:
- CResult_StringErrorZ(const CResult_StringErrorZ&) = delete;
- CResult_StringErrorZ(CResult_StringErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StringErrorZ)); }
- CResult_StringErrorZ(LDKCResult_StringErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StringErrorZ)); }
- operator LDKCResult_StringErrorZ() && { LDKCResult_StringErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_StringErrorZ)); return res; }
- ~CResult_StringErrorZ() { CResult_StringErrorZ_free(self); }
- CResult_StringErrorZ& operator=(CResult_StringErrorZ&& o) { CResult_StringErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StringErrorZ)); return *this; }
- LDKCResult_StringErrorZ* operator &() { return &self; }
- LDKCResult_StringErrorZ* operator ->() { return &self; }
- const LDKCResult_StringErrorZ* operator &() const { return &self; }
- const LDKCResult_StringErrorZ* operator ->() const { return &self; }
+ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ(const CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ&) = delete;
+ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ(CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ)); }
+ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ)); }
+ operator LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ() && { LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ)); return res; }
+ ~CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ() { CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(self); }
+ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ& operator=(CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ&& o) { CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ)); return *this; }
+ LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* operator &() { return &self; }
+ LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* operator ->() { return &self; }
+ const LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* operator &() const { return &self; }
+ const LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* operator ->() const { return &self; }
};
class CResult_NoneErrorZ {
private:
const LDKCResult_NoneErrorZ* operator &() const { return &self; }
const LDKCResult_NoneErrorZ* operator ->() const { return &self; }
};
+class CResult_StringErrorZ {
+private:
+ LDKCResult_StringErrorZ self;
+public:
+ CResult_StringErrorZ(const CResult_StringErrorZ&) = delete;
+ CResult_StringErrorZ(CResult_StringErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StringErrorZ)); }
+ CResult_StringErrorZ(LDKCResult_StringErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StringErrorZ)); }
+ operator LDKCResult_StringErrorZ() && { LDKCResult_StringErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_StringErrorZ)); return res; }
+ ~CResult_StringErrorZ() { CResult_StringErrorZ_free(self); }
+ CResult_StringErrorZ& operator=(CResult_StringErrorZ&& o) { CResult_StringErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StringErrorZ)); return *this; }
+ LDKCResult_StringErrorZ* operator &() { return &self; }
+ LDKCResult_StringErrorZ* operator ->() { return &self; }
+ const LDKCResult_StringErrorZ* operator &() const { return &self; }
+ const LDKCResult_StringErrorZ* operator ->() const { return &self; }
+};
class C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
private:
LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ self;
const LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator &() const { return &self; }
const LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator ->() const { return &self; }
};
-class CResult_PongDecodeErrorZ {
-private:
- LDKCResult_PongDecodeErrorZ self;
-public:
- CResult_PongDecodeErrorZ(const CResult_PongDecodeErrorZ&) = delete;
- CResult_PongDecodeErrorZ(CResult_PongDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); }
- CResult_PongDecodeErrorZ(LDKCResult_PongDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); }
- operator LDKCResult_PongDecodeErrorZ() && { LDKCResult_PongDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); return res; }
- ~CResult_PongDecodeErrorZ() { CResult_PongDecodeErrorZ_free(self); }
- CResult_PongDecodeErrorZ& operator=(CResult_PongDecodeErrorZ&& o) { CResult_PongDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); return *this; }
- LDKCResult_PongDecodeErrorZ* operator &() { return &self; }
- LDKCResult_PongDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_PongDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_PongDecodeErrorZ* operator ->() const { return &self; }
-};
class CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
private:
LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ self;
const LDKCOption_EventZ* operator &() const { return &self; }
const LDKCOption_EventZ* operator ->() const { return &self; }
};
+class CResult_ChannelTypeFeaturesDecodeErrorZ {
+private:
+ LDKCResult_ChannelTypeFeaturesDecodeErrorZ self;
+public:
+ CResult_ChannelTypeFeaturesDecodeErrorZ(const CResult_ChannelTypeFeaturesDecodeErrorZ&) = delete;
+ CResult_ChannelTypeFeaturesDecodeErrorZ(CResult_ChannelTypeFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelTypeFeaturesDecodeErrorZ)); }
+ CResult_ChannelTypeFeaturesDecodeErrorZ(LDKCResult_ChannelTypeFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ)); }
+ operator LDKCResult_ChannelTypeFeaturesDecodeErrorZ() && { LDKCResult_ChannelTypeFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ)); return res; }
+ ~CResult_ChannelTypeFeaturesDecodeErrorZ() { CResult_ChannelTypeFeaturesDecodeErrorZ_free(self); }
+ CResult_ChannelTypeFeaturesDecodeErrorZ& operator=(CResult_ChannelTypeFeaturesDecodeErrorZ&& o) { CResult_ChannelTypeFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelTypeFeaturesDecodeErrorZ)); return *this; }
+ LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator ->() const { return &self; }
+};
class CVec_RouteHintZ {
private:
LDKCVec_RouteHintZ self;
const LDKCResult_UpdateFailHTLCDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_UpdateFailHTLCDecodeErrorZ* operator ->() const { return &self; }
};
+class CResult_PaymentSecretNoneZ {
+private:
+ LDKCResult_PaymentSecretNoneZ self;
+public:
+ CResult_PaymentSecretNoneZ(const CResult_PaymentSecretNoneZ&) = delete;
+ CResult_PaymentSecretNoneZ(CResult_PaymentSecretNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentSecretNoneZ)); }
+ CResult_PaymentSecretNoneZ(LDKCResult_PaymentSecretNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentSecretNoneZ)); }
+ operator LDKCResult_PaymentSecretNoneZ() && { LDKCResult_PaymentSecretNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentSecretNoneZ)); return res; }
+ ~CResult_PaymentSecretNoneZ() { CResult_PaymentSecretNoneZ_free(self); }
+ CResult_PaymentSecretNoneZ& operator=(CResult_PaymentSecretNoneZ&& o) { CResult_PaymentSecretNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentSecretNoneZ)); return *this; }
+ LDKCResult_PaymentSecretNoneZ* operator &() { return &self; }
+ LDKCResult_PaymentSecretNoneZ* operator ->() { return &self; }
+ const LDKCResult_PaymentSecretNoneZ* operator &() const { return &self; }
+ const LDKCResult_PaymentSecretNoneZ* operator ->() const { return &self; }
+};
class CResult_ChannelConfigDecodeErrorZ {
private:
LDKCResult_ChannelConfigDecodeErrorZ self;
const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() const { return &self; }
const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() const { return &self; }
};
-class CResult_NoneNoneZ {
-private:
- LDKCResult_NoneNoneZ self;
-public:
- CResult_NoneNoneZ(const CResult_NoneNoneZ&) = delete;
- CResult_NoneNoneZ(CResult_NoneNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneNoneZ)); }
- CResult_NoneNoneZ(LDKCResult_NoneNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneNoneZ)); }
- operator LDKCResult_NoneNoneZ() && { LDKCResult_NoneNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneNoneZ)); return res; }
- ~CResult_NoneNoneZ() { CResult_NoneNoneZ_free(self); }
- CResult_NoneNoneZ& operator=(CResult_NoneNoneZ&& o) { CResult_NoneNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneNoneZ)); return *this; }
- LDKCResult_NoneNoneZ* operator &() { return &self; }
- LDKCResult_NoneNoneZ* operator ->() { return &self; }
- const LDKCResult_NoneNoneZ* operator &() const { return &self; }
- const LDKCResult_NoneNoneZ* operator ->() const { return &self; }
-};
class CResult_RouteParametersDecodeErrorZ {
private:
LDKCResult_RouteParametersDecodeErrorZ self;
const LDKCOption_ClosureReasonZ* operator &() const { return &self; }
const LDKCOption_ClosureReasonZ* operator ->() const { return &self; }
};
+class CResult_NoneNoneZ {
+private:
+ LDKCResult_NoneNoneZ self;
+public:
+ CResult_NoneNoneZ(const CResult_NoneNoneZ&) = delete;
+ CResult_NoneNoneZ(CResult_NoneNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneNoneZ)); }
+ CResult_NoneNoneZ(LDKCResult_NoneNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneNoneZ)); }
+ operator LDKCResult_NoneNoneZ() && { LDKCResult_NoneNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneNoneZ)); return res; }
+ ~CResult_NoneNoneZ() { CResult_NoneNoneZ_free(self); }
+ CResult_NoneNoneZ& operator=(CResult_NoneNoneZ&& o) { CResult_NoneNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneNoneZ)); return *this; }
+ LDKCResult_NoneNoneZ* operator &() { return &self; }
+ LDKCResult_NoneNoneZ* operator ->() { return &self; }
+ const LDKCResult_NoneNoneZ* operator &() const { return &self; }
+ const LDKCResult_NoneNoneZ* operator ->() const { return &self; }
+};
class CVec_APIErrorZ {
private:
LDKCVec_APIErrorZ self;
const LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator ->() const { return &self; }
};
-class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
+class COption_NoneZ {
private:
- LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ self;
+ LDKCOption_NoneZ self;
public:
- CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&) = delete;
- CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); }
- CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); }
- operator LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return res; }
- ~CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); }
- CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return *this; }
- LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() { return &self; }
- LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() const { return &self; }
+ COption_NoneZ(const COption_NoneZ&) = delete;
+ COption_NoneZ(COption_NoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_NoneZ)); }
+ COption_NoneZ(LDKCOption_NoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_NoneZ)); }
+ operator LDKCOption_NoneZ() && { LDKCOption_NoneZ res = self; memset(&self, 0, sizeof(LDKCOption_NoneZ)); return res; }
+ ~COption_NoneZ() { COption_NoneZ_free(self); }
+ COption_NoneZ& operator=(COption_NoneZ&& o) { COption_NoneZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_NoneZ)); return *this; }
+ LDKCOption_NoneZ* operator &() { return &self; }
+ LDKCOption_NoneZ* operator ->() { return &self; }
+ const LDKCOption_NoneZ* operator &() const { return &self; }
+ const LDKCOption_NoneZ* operator ->() const { return &self; }
};
class CVec_TxOutZ {
private:
const LDKCVec_TxOutZ* operator &() const { return &self; }
const LDKCVec_TxOutZ* operator ->() const { return &self; }
};
+class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
+private:
+ LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ self;
+public:
+ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&) = delete;
+ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); }
+ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); }
+ operator LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return res; }
+ ~CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); }
+ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return *this; }
+ LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() const { return &self; }
+};
class CVec_UpdateFailHTLCZ {
private:
LDKCVec_UpdateFailHTLCZ self;
inline void EventHandler::handle_event(const struct LDKEvent *NONNULL_PTR event) {
(self.handle_event)(self.this_arg, event);
}
-inline uint64_t Score::channel_penalty_msat(uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target) {
- uint64_t ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id, source, target);
+inline uint64_t Score::channel_penalty_msat(uint64_t short_channel_id, uint64_t send_amt_msat, struct LDKCOption_u64Z channel_capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target) {
+ uint64_t ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id, send_amt_msat, channel_capacity_msat, source, target);
return ret;
}
inline void Score::payment_path_failed(struct LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
(self.payment_path_failed)(self.this_arg, path, short_channel_id);
}
+inline void Score::payment_path_successful(struct LDKCVec_RouteHopZ path) {
+ (self.payment_path_successful)(self.this_arg, path);
+}
+inline LDK::Score LockableScore::lock() {
+ LDK::Score ret = (self.lock)(self.this_arg);
+ return ret;
+}
inline LDKPublicKey BaseSign::get_per_commitment_point(uint64_t idx) {
LDKPublicKey ret = (self.get_per_commitment_point)(self.this_arg, idx);
return ret;
LDK::CResult_RecoverableSignatureNoneZ ret = (self.sign_invoice)(self.this_arg, invoice_preimage);
return ret;
}
+inline LDKThirtyTwoBytes KeysInterface::get_inbound_payment_key_material() {
+ LDKThirtyTwoBytes ret = (self.get_inbound_payment_key_material)(self.this_arg);
+ return ret;
+}
inline LDK::CResult_COption_TypeZDecodeErrorZ CustomMessageReader::read(uint16_t message_type, struct LDKu8slice buffer) {
LDK::CResult_COption_TypeZDecodeErrorZ ret = (self.read)(self.this_arg, message_type, buffer);
return ret;
LDK::CResult_PaymentIdPaymentSendFailureZ ret = (self.send_payment)(self.this_arg, route, payment_hash, payment_secret);
return ret;
}
+inline LDK::CResult_PaymentIdPaymentSendFailureZ Payer::send_spontaneous_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage) {
+ LDK::CResult_PaymentIdPaymentSendFailureZ ret = (self.send_spontaneous_payment)(self.this_arg, route, payment_preimage);
+ return ret;
+}
inline LDK::CResult_NonePaymentSendFailureZ Payer::retry_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id) {
LDK::CResult_NonePaymentSendFailureZ ret = (self.retry_payment)(self.this_arg, route, payment_id);
return ret;
}
-inline LDK::CResult_RouteLightningErrorZ Router::find_route(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer) {
- LDK::CResult_RouteLightningErrorZ ret = (self.find_route)(self.this_arg, payer, params, first_hops, scorer);
+inline void Payer::abandon_payment(struct LDKThirtyTwoBytes payment_id) {
+ (self.abandon_payment)(self.this_arg, payment_id);
+}
+inline LDK::CResult_RouteLightningErrorZ Router::find_route(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer) {
+ LDK::CResult_RouteLightningErrorZ ret = (self.find_route)(self.this_arg, payer, params, payment_hash, first_hops, scorer);
return ret;
}
inline LDK::CResult_NoneLightningErrorZ CustomMessageHandler::handle_custom_message(struct LDKType msg, struct LDKPublicKey sender_node_id) {
}
impl COption_u32Z {
#[allow(unused)] pub(crate) fn is_some(&self) -> bool {
- if let Self::Some(_) = self { true } else { false }
+ if let Self::None = self { false } else { true }
}
#[allow(unused)] pub(crate) fn is_none(&self) -> bool {
!self.is_some()
/// but with all dynamically-allocated buffers duplicated in new buffers.
pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
+/// An enum which can either contain a or not
+pub enum COption_NoneZ {
+ /// When we're in this state, this COption_NoneZ contains a
+ Some,
+ /// When we're in this state, this COption_NoneZ contains nothing
+ None
+}
+impl COption_NoneZ {
+ #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
+ if let Self::None = self { false } else { true }
+ }
+ #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
+ !self.is_some()
+ }
+}
+#[no_mangle]
+/// Constructs a new COption_NoneZ containing a
+pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
+ COption_NoneZ::Some
+}
+#[no_mangle]
+/// Constructs a new COption_NoneZ containing nothing
+pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
+ COption_NoneZ::None
+}
+#[no_mangle]
+/// Frees any resources associated with the , if we are in the Some state
+pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
+#[repr(C)]
/// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
/// A pointer to the contents in the success state.
}
}
}
+impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
#[repr(C)]
/// The contents of CResult_NoneErrorZ
pub union CResult_NoneErrorZPtr {
}
impl COption_u64Z {
#[allow(unused)] pub(crate) fn is_some(&self) -> bool {
- if let Self::Some(_) = self { true } else { false }
+ if let Self::None = self { false } else { true }
}
#[allow(unused)] pub(crate) fn is_none(&self) -> bool {
!self.is_some()
}
impl COption_C2Tuple_usizeTransactionZZ {
#[allow(unused)] pub(crate) fn is_some(&self) -> bool {
- if let Self::Some(_) = self { true } else { false }
+ if let Self::None = self { false } else { true }
}
#[allow(unused)] pub(crate) fn is_none(&self) -> bool {
!self.is_some()
}
impl COption_ClosureReasonZ {
#[allow(unused)] pub(crate) fn is_some(&self) -> bool {
- if let Self::Some(_) = self { true } else { false }
+ if let Self::None = self { false } else { true }
}
#[allow(unused)] pub(crate) fn is_none(&self) -> bool {
!self.is_some()
}
impl COption_NetworkUpdateZ {
#[allow(unused)] pub(crate) fn is_some(&self) -> bool {
- if let Self::Some(_) = self { true } else { false }
+ if let Self::None = self { false } else { true }
}
#[allow(unused)] pub(crate) fn is_none(&self) -> bool {
!self.is_some()
}
impl COption_EventZ {
#[allow(unused)] pub(crate) fn is_some(&self) -> bool {
- if let Self::Some(_) = self { true } else { false }
+ if let Self::None = self { false } else { true }
}
#[allow(unused)] pub(crate) fn is_none(&self) -> bool {
!self.is_some()
}
}
#[repr(C)]
-/// The contents of CResult_InitFeaturesDecodeErrorZ
-pub union CResult_InitFeaturesDecodeErrorZPtr {
+/// The contents of CResult_ScoringParametersDecodeErrorZ
+pub union CResult_ScoringParametersDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::ln::features::InitFeatures,
+ pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// 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.
+/// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::scoring::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`.
-pub struct CResult_InitFeaturesDecodeErrorZ {
- /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
+pub struct CResult_ScoringParametersDecodeErrorZ {
+ /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_InitFeaturesDecodeErrorZPtr,
- /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
+ pub contents: CResult_ScoringParametersDecodeErrorZPtr,
+ /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
-pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
- CResult_InitFeaturesDecodeErrorZ {
- contents: CResult_InitFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
+ CResult_ScoringParametersDecodeErrorZ {
+ contents: CResult_ScoringParametersDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
-pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
- CResult_InitFeaturesDecodeErrorZ {
- contents: CResult_InitFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
+ CResult_ScoringParametersDecodeErrorZ {
+ contents: CResult_ScoringParametersDecodeErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
-pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
-impl Drop for CResult_InitFeaturesDecodeErrorZ {
+/// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
+pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
+impl Drop for CResult_ScoringParametersDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = std::ptr::null_mut() };
- CResult_InitFeaturesDecodeErrorZPtr { result }
+ CResult_ScoringParametersDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = std::ptr::null_mut(); }
- CResult_InitFeaturesDecodeErrorZPtr { err }
+ CResult_ScoringParametersDecodeErrorZPtr { err }
};
Self {
contents,
}
}
#[repr(C)]
-/// The contents of CResult_NodeFeaturesDecodeErrorZ
-pub union CResult_NodeFeaturesDecodeErrorZPtr {
+/// The contents of CResult_ScorerDecodeErrorZ
+pub union CResult_ScorerDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::ln::features::NodeFeatures,
+ pub result: *mut crate::lightning::routing::scoring::Scorer,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// 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.
+/// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::routing::scoring::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`.
-pub struct CResult_NodeFeaturesDecodeErrorZ {
- /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
+pub struct CResult_ScorerDecodeErrorZ {
+ /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
- /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
+ pub contents: CResult_ScorerDecodeErrorZPtr,
+ /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
-pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
- CResult_NodeFeaturesDecodeErrorZ {
- contents: CResult_NodeFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_ScorerDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
+ CResult_ScorerDecodeErrorZ {
+ contents: CResult_ScorerDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
-pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
- CResult_NodeFeaturesDecodeErrorZ {
- contents: CResult_NodeFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_ScorerDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
+ CResult_ScorerDecodeErrorZ {
+ contents: CResult_ScorerDecodeErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
-pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
-impl Drop for CResult_NodeFeaturesDecodeErrorZ {
+/// Frees any resources used by the CResult_ScorerDecodeErrorZ.
+pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
+impl Drop for CResult_ScorerDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = std::ptr::null_mut() };
- CResult_NodeFeaturesDecodeErrorZPtr { result }
+ CResult_ScorerDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = std::ptr::null_mut(); }
- CResult_NodeFeaturesDecodeErrorZPtr { err }
+ CResult_ScorerDecodeErrorZPtr { err }
};
Self {
contents,
}
}
#[repr(C)]
-/// The contents of CResult_ChannelFeaturesDecodeErrorZ
-pub union CResult_ChannelFeaturesDecodeErrorZPtr {
+/// The contents of CResult_InitFeaturesDecodeErrorZ
+pub union CResult_InitFeaturesDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::ln::features::ChannelFeatures,
+ pub result: *mut crate::lightning::ln::features::InitFeatures,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// 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.
+/// 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`.
-pub struct CResult_ChannelFeaturesDecodeErrorZ {
- /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
+pub struct CResult_InitFeaturesDecodeErrorZ {
+ /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
- /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
+ pub contents: CResult_InitFeaturesDecodeErrorZPtr,
+ /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
- CResult_ChannelFeaturesDecodeErrorZ {
- contents: CResult_ChannelFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
+pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
+ CResult_InitFeaturesDecodeErrorZ {
+ contents: CResult_InitFeaturesDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
- CResult_ChannelFeaturesDecodeErrorZ {
- contents: CResult_ChannelFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
+pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
+ CResult_InitFeaturesDecodeErrorZ {
+ contents: CResult_InitFeaturesDecodeErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
-pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
-impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
+/// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
+pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
+impl Drop for CResult_InitFeaturesDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = std::ptr::null_mut() };
- CResult_ChannelFeaturesDecodeErrorZPtr { result }
+ CResult_InitFeaturesDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = std::ptr::null_mut(); }
- CResult_ChannelFeaturesDecodeErrorZPtr { err }
+ CResult_InitFeaturesDecodeErrorZPtr { err }
};
Self {
contents,
}
}
#[repr(C)]
-/// The contents of CResult_InvoiceFeaturesDecodeErrorZ
-pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
+/// The contents of CResult_ChannelFeaturesDecodeErrorZ
+pub union CResult_ChannelFeaturesDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
+ pub result: *mut crate::lightning::ln::features::ChannelFeatures,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// 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.
+/// 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`.
-pub struct CResult_InvoiceFeaturesDecodeErrorZ {
- /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
+pub struct CResult_ChannelFeaturesDecodeErrorZ {
+ /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
- /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
+ pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
+ /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
-pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
- CResult_InvoiceFeaturesDecodeErrorZ {
- contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
+ CResult_ChannelFeaturesDecodeErrorZ {
+ contents: CResult_ChannelFeaturesDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
-pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
- CResult_InvoiceFeaturesDecodeErrorZ {
- contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
+/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
+ CResult_ChannelFeaturesDecodeErrorZ {
+ contents: CResult_ChannelFeaturesDecodeErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
-pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
-impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
+/// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
+pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
+impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = std::ptr::null_mut() };
- CResult_InvoiceFeaturesDecodeErrorZPtr { result }
+ CResult_ChannelFeaturesDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = std::ptr::null_mut(); }
- CResult_InvoiceFeaturesDecodeErrorZPtr { err }
+ CResult_ChannelFeaturesDecodeErrorZPtr { err }
};
Self {
contents,
}
}
#[repr(C)]
-/// The contents of CResult_ScoringParametersDecodeErrorZ
-pub union CResult_ScoringParametersDecodeErrorZPtr {
+/// The contents of CResult_NodeFeaturesDecodeErrorZ
+pub union CResult_NodeFeaturesDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::routing::scorer::ScoringParameters,
+ pub result: *mut crate::lightning::ln::features::NodeFeatures,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// 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.
+/// 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`.
-pub struct CResult_ScoringParametersDecodeErrorZ {
- /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
+pub struct CResult_NodeFeaturesDecodeErrorZ {
+ /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ScoringParametersDecodeErrorZPtr,
- /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
+ pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
+ /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scorer::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
- CResult_ScoringParametersDecodeErrorZ {
- contents: CResult_ScoringParametersDecodeErrorZPtr {
+/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
+pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
+ CResult_NodeFeaturesDecodeErrorZ {
+ contents: CResult_NodeFeaturesDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
- CResult_ScoringParametersDecodeErrorZ {
- contents: CResult_ScoringParametersDecodeErrorZPtr {
+/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
+pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
+ CResult_NodeFeaturesDecodeErrorZ {
+ contents: CResult_NodeFeaturesDecodeErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
-pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
-impl Drop for CResult_ScoringParametersDecodeErrorZ {
+/// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
+pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
+impl Drop for CResult_NodeFeaturesDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::routing::scorer::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scorer::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = std::ptr::null_mut() };
- CResult_ScoringParametersDecodeErrorZPtr { result }
+ CResult_NodeFeaturesDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = std::ptr::null_mut(); }
- CResult_ScoringParametersDecodeErrorZPtr { err }
+ CResult_NodeFeaturesDecodeErrorZPtr { err }
};
Self {
contents,
}
}
#[repr(C)]
-/// The contents of CResult_ScorerDecodeErrorZ
-pub union CResult_ScorerDecodeErrorZPtr {
+/// The contents of CResult_InvoiceFeaturesDecodeErrorZ
+pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning::routing::scorer::Scorer,
+ pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
pub err: *mut crate::lightning::ln::msgs::DecodeError,
}
#[repr(C)]
-/// 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.
+/// 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`.
-pub struct CResult_ScorerDecodeErrorZ {
- /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
+pub struct CResult_InvoiceFeaturesDecodeErrorZ {
+ /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ScorerDecodeErrorZPtr,
- /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
+ pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
+ /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_ScorerDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scorer::Scorer) -> CResult_ScorerDecodeErrorZ {
- CResult_ScorerDecodeErrorZ {
- contents: CResult_ScorerDecodeErrorZPtr {
+/// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
+pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
+ CResult_InvoiceFeaturesDecodeErrorZ {
+ contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_ScorerDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
- CResult_ScorerDecodeErrorZ {
- contents: CResult_ScorerDecodeErrorZPtr {
+/// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
+pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
+ CResult_InvoiceFeaturesDecodeErrorZ {
+ contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
/// Checks if the given object is currently in the success state
#[no_mangle]
-pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_ScorerDecodeErrorZ.
-pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
-impl Drop for CResult_ScorerDecodeErrorZ {
+/// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
+pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
+impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning::routing::scorer::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scorer::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = std::ptr::null_mut() };
- CResult_ScorerDecodeErrorZPtr { result }
+ CResult_InvoiceFeaturesDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = std::ptr::null_mut(); }
- CResult_ScorerDecodeErrorZPtr { err }
+ CResult_InvoiceFeaturesDecodeErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
+ }
+}
+#[repr(C)]
+/// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
+pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
+ /// A pointer to the contents in the success state.
+ /// Reading from this pointer when `result_ok` is not set is undefined.
+ pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
+ /// A pointer to the contents in the error state.
+ /// Reading from this pointer when `result_ok` is set is undefined.
+ pub err: *mut crate::lightning::ln::msgs::DecodeError,
+}
+#[repr(C)]
+/// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
+ /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
+ /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
+ pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
+ CResult_ChannelTypeFeaturesDecodeErrorZ {
+ contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
+ CResult_ChannelTypeFeaturesDecodeErrorZ {
+ contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
+ },
+ result_ok: false,
+ }
+}
+/// Checks if the given object is currently in the success state
+#[no_mangle]
+pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
+ o.result_ok
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
+pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
+impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
+ fn drop(&mut self) {
+ if self.result_ok {
+ if unsafe { !(self.contents.result as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.result) };
+ }
+ } else {
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.err) };
+ }
+ }
+ }
+}
+impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = std::ptr::null_mut() };
+ CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = std::ptr::null_mut(); }
+ CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
};
Self {
contents,
}
impl COption_u16Z {
#[allow(unused)] pub(crate) fn is_some(&self) -> bool {
- if let Self::Some(_) = self { true } else { false }
+ if let Self::None = self { false } else { true }
}
#[allow(unused)] pub(crate) fn is_none(&self) -> bool {
!self.is_some()
/// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
#[repr(C)]
+/// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
+pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+ /// A pointer to the contents in the success state.
+ /// Reading from this pointer when `result_ok` is not set is undefined.
+ pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
+ /// Note that this value is always NULL, as there are no contents in the Err variant
+ pub err: *mut std::ffi::c_void,
+}
+#[repr(C)]
+/// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
+ /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
+ pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+ err: std::ptr::null_mut(),
+ },
+ result_ok: false,
+ }
+}
+/// Checks if the given object is currently in the success state
+#[no_mangle]
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
+ o.result_ok
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
+impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ fn drop(&mut self) {
+ if self.result_ok {
+ if unsafe { !(self.contents.result as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.result) };
+ }
+ } else {
+ }
+ }
+}
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = std::ptr::null_mut() };
+ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
+ } else {
+ let _ = unsafe { Box::from_raw(o.contents.err) };
+ o.contents.err = std::ptr::null_mut();
+ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: std::ptr::null_mut() }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
+ }
+}
+impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+ err: std::ptr::null_mut()
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
+#[repr(C)]
+/// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
+pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
+ /// A pointer to the contents in the success state.
+ /// Reading from this pointer when `result_ok` is not set is undefined.
+ pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
+ /// A pointer to the contents in the error state.
+ /// Reading from this pointer when `result_ok` is set is undefined.
+ pub err: *mut crate::lightning::util::errors::APIError,
+}
+#[repr(C)]
+/// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
+ /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
+ pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
+ },
+ result_ok: false,
+ }
+}
+/// Checks if the given object is currently in the success state
+#[no_mangle]
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
+ o.result_ok
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
+impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ fn drop(&mut self) {
+ if self.result_ok {
+ if unsafe { !(self.contents.result as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.result) };
+ }
+ } else {
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.err) };
+ }
+ }
+ }
+}
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = std::ptr::null_mut() };
+ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = std::ptr::null_mut(); }
+ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
+ }
+}
+impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
+#[repr(C)]
+/// The contents of CResult_PaymentSecretNoneZ
+pub union CResult_PaymentSecretNoneZPtr {
+ /// A pointer to the contents in the success state.
+ /// Reading from this pointer when `result_ok` is not set is undefined.
+ pub result: *mut crate::c_types::ThirtyTwoBytes,
+ /// Note that this value is always NULL, as there are no contents in the Err variant
+ pub err: *mut std::ffi::c_void,
+}
+#[repr(C)]
+/// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
+/// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_PaymentSecretNoneZ {
+ /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_PaymentSecretNoneZPtr,
+ /// Whether this CResult_PaymentSecretNoneZ represents a success state.
+ pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_PaymentSecretNoneZ in the success state.
+pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
+ CResult_PaymentSecretNoneZ {
+ contents: CResult_PaymentSecretNoneZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_PaymentSecretNoneZ in the error state.
+pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
+ CResult_PaymentSecretNoneZ {
+ contents: CResult_PaymentSecretNoneZPtr {
+ err: std::ptr::null_mut(),
+ },
+ result_ok: false,
+ }
+}
+/// Checks if the given object is currently in the success state
+#[no_mangle]
+pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
+ o.result_ok
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_PaymentSecretNoneZ.
+pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
+impl Drop for CResult_PaymentSecretNoneZ {
+ fn drop(&mut self) {
+ if self.result_ok {
+ if unsafe { !(self.contents.result as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.result) };
+ }
+ } else {
+ }
+ }
+}
+impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = std::ptr::null_mut() };
+ CResult_PaymentSecretNoneZPtr { result }
+ } else {
+ let _ = unsafe { Box::from_raw(o.contents.err) };
+ o.contents.err = std::ptr::null_mut();
+ CResult_PaymentSecretNoneZPtr { err: std::ptr::null_mut() }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
+ }
+}
+impl Clone for CResult_PaymentSecretNoneZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
+ err: std::ptr::null_mut()
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
+#[repr(C)]
/// The contents of CResult_PaymentSecretAPIErrorZ
pub union CResult_PaymentSecretAPIErrorZPtr {
/// A pointer to the contents in the success state.
/// but with all dynamically-allocated buffers duplicated in new buffers.
pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
#[repr(C)]
+/// The contents of CResult_PaymentPreimageAPIErrorZ
+pub union CResult_PaymentPreimageAPIErrorZPtr {
+ /// A pointer to the contents in the success state.
+ /// Reading from this pointer when `result_ok` is not set is undefined.
+ pub result: *mut crate::c_types::ThirtyTwoBytes,
+ /// A pointer to the contents in the error state.
+ /// Reading from this pointer when `result_ok` is set is undefined.
+ pub err: *mut crate::lightning::util::errors::APIError,
+}
+#[repr(C)]
+/// A CResult_PaymentPreimageAPIErrorZ 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`.
+pub struct CResult_PaymentPreimageAPIErrorZ {
+ /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_PaymentPreimageAPIErrorZPtr,
+ /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
+ pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
+pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
+ CResult_PaymentPreimageAPIErrorZ {
+ contents: CResult_PaymentPreimageAPIErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
+pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
+ CResult_PaymentPreimageAPIErrorZ {
+ contents: CResult_PaymentPreimageAPIErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
+ },
+ result_ok: false,
+ }
+}
+/// Checks if the given object is currently in the success state
+#[no_mangle]
+pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
+ o.result_ok
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
+pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
+impl Drop for CResult_PaymentPreimageAPIErrorZ {
+ fn drop(&mut self) {
+ if self.result_ok {
+ if unsafe { !(self.contents.result as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.result) };
+ }
+ } else {
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.err) };
+ }
+ }
+ }
+}
+impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = std::ptr::null_mut() };
+ CResult_PaymentPreimageAPIErrorZPtr { result }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = std::ptr::null_mut(); }
+ CResult_PaymentPreimageAPIErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
+ }
+}
+impl Clone for CResult_PaymentPreimageAPIErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
+#[repr(C)]
/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
/// This corresponds to std::vector in C++
pub struct CVec_ChannelMonitorZ {
}
impl COption_TypeZ {
#[allow(unused)] pub(crate) fn is_some(&self) -> bool {
- if let Self::Some(_) = self { true } else { false }
+ if let Self::None = self { false } else { true }
}
#[allow(unused)] pub(crate) fn is_none(&self) -> bool {
!self.is_some()
}
impl COption_MonitorEventZ {
#[allow(unused)] pub(crate) fn is_some(&self) -> bool {
- if let Self::Some(_) = self { true } else { false }
+ if let Self::None = self { false } else { true }
}
#[allow(unused)] pub(crate) fn is_none(&self) -> bool {
!self.is_some()
/// but with all dynamically-allocated buffers duplicated in new buffers.
pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_NoneMonitorUpdateErrorZ
-pub union CResult_NoneMonitorUpdateErrorZPtr {
- /// Note that this value is always NULL, as there are no contents in the OK variant
- pub result: *mut std::ffi::c_void,
- /// A pointer to the contents in the error state.
- /// Reading from this pointer when `result_ok` is set is undefined.
- pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
-}
-#[repr(C)]
-/// 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`.
-pub struct CResult_NoneMonitorUpdateErrorZ {
- /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
- /// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_NoneMonitorUpdateErrorZPtr,
- /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
- pub result_ok: bool,
-}
-#[no_mangle]
-/// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
-pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
- CResult_NoneMonitorUpdateErrorZ {
- contents: CResult_NoneMonitorUpdateErrorZPtr {
- result: std::ptr::null_mut(),
- },
- result_ok: true,
- }
-}
-#[no_mangle]
-/// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
-pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
- CResult_NoneMonitorUpdateErrorZ {
- contents: CResult_NoneMonitorUpdateErrorZPtr {
- err: Box::into_raw(Box::new(e)),
- },
- result_ok: false,
- }
-}
-/// Checks if the given object is currently in the success state
-#[no_mangle]
-pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_is_ok(o: &CResult_NoneMonitorUpdateErrorZ) -> bool {
- o.result_ok
-}
-#[no_mangle]
-/// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
-pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
-impl Drop for CResult_NoneMonitorUpdateErrorZ {
- fn drop(&mut self) {
- if self.result_ok {
- } else {
- if unsafe { !(self.contents.err as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.err) };
- }
- }
- }
-}
-impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
- let contents = if o.result_ok {
- let _ = unsafe { Box::from_raw(o.contents.result) };
- o.contents.result = std::ptr::null_mut();
- CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
- } else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = std::ptr::null_mut(); }
- CResult_NoneMonitorUpdateErrorZPtr { err }
- };
- Self {
- contents,
- result_ok: o.result_ok,
- }
- }
-}
-impl Clone for CResult_NoneMonitorUpdateErrorZ {
- fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
- result: std::ptr::null_mut()
- } }
- } else {
- Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
- } }
- }
- }
-}
-#[no_mangle]
-/// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { Clone::clone(&orig) }
-#[repr(C)]
/// A tuple of 2 elements. See the individual fields for the types contained.
pub struct C2Tuple_OutPointScriptZ {
/// The element at position 0
}
impl COption_AccessZ {
#[allow(unused)] pub(crate) fn is_some(&self) -> bool {
- if let Self::Some(_) = self { true } else { false }
+ if let Self::None = self { false } else { true }
}
#[allow(unused)] pub(crate) fn is_none(&self) -> bool {
!self.is_some()
}
impl COption_CVec_NetAddressZZ {
#[allow(unused)] pub(crate) fn is_some(&self) -> bool {
- if let Self::Some(_) = self { true } else { false }
+ if let Self::None = self { false } else { true }
}
#[allow(unused)] pub(crate) fn is_none(&self) -> bool {
!self.is_some()
}
impl COption_FilterZ {
#[allow(unused)] pub(crate) fn is_some(&self) -> bool {
- if let Self::Some(_) = self { true } else { false }
+ if let Self::None = self { false } else { true }
}
#[allow(unused)] pub(crate) fn is_none(&self) -> bool {
!self.is_some()
pub this_arg: *mut c_void,
/// 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).
+ /// Must return a value 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)
+ /// This method can be implemented with the following unit conversions:
+ /// * max(satoshis-per-byte * 250, 253)
+ /// * max(satoshis-per-kbyte / 4, 253)
#[must_use]
pub get_est_sat_per_1000_weight: extern "C" fn (this_arg: *const c_void, confirmation_target: crate::lightning::chain::chaininterface::ConfirmationTarget) -> u32,
/// Frees any resources associated with this object given its this_arg pointer.
let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::channelmonitor::ChannelMonitorUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
local_res
}
-
-use lightning::chain::channelmonitor::MonitorUpdateError as nativeMonitorUpdateErrorImport;
-pub(crate) type nativeMonitorUpdateError = nativeMonitorUpdateErrorImport;
-
-/// 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.
-#[must_use]
-#[repr(C)]
-pub struct MonitorUpdateError {
- /// 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.
- pub inner: *mut nativeMonitorUpdateError,
- /// 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.
- pub is_owned: bool,
-}
-
-impl Drop for MonitorUpdateError {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeMonitorUpdateError>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn MonitorUpdateError_free(this_obj: MonitorUpdateError) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn MonitorUpdateError_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMonitorUpdateError); }
-}
-#[allow(unused)]
-impl MonitorUpdateError {
- pub(crate) fn get_native_ref(&self) -> &'static nativeMonitorUpdateError {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeMonitorUpdateError {
- unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
- }
- /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
- pub(crate) fn take_inner(mut self) -> *mut nativeMonitorUpdateError {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = std::ptr::null_mut();
- ret
- }
-}
-#[no_mangle]
-pub extern "C" fn MonitorUpdateError_get_a(this_ptr: &MonitorUpdateError) -> crate::c_types::Str {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().0;
- inner_val.into()
-}
-#[no_mangle]
-pub extern "C" fn MonitorUpdateError_set_a(this_ptr: &mut MonitorUpdateError, mut val: crate::c_types::Str) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = val.into_str();
-}
-/// Constructs a new MonitorUpdateError given each field
-#[must_use]
-#[no_mangle]
-pub extern "C" fn MonitorUpdateError_new(mut a_arg: crate::c_types::Str) -> MonitorUpdateError {
- MonitorUpdateError { inner: ObjOps::heap_alloc(lightning::chain::channelmonitor::MonitorUpdateError (
- a_arg.into_str(),
- )), is_owned: true }
-}
-impl Clone for MonitorUpdateError {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeMonitorUpdateError>::is_null(self.inner) { std::ptr::null_mut() } else {
- ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
- is_owned: true,
- }
- }
-}
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn MonitorUpdateError_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeMonitorUpdateError)).clone() })) as *mut c_void
-}
-#[no_mangle]
-/// Creates a copy of the MonitorUpdateError
-pub extern "C" fn MonitorUpdateError_clone(orig: &MonitorUpdateError) -> MonitorUpdateError {
- orig.clone()
-}
/// An event to be processed by the ChannelManager.
#[must_use]
#[derive(Clone)]
/// panics if the given update is not the next update by update_id.
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelMonitor_update_monitor(this_arg: &ChannelMonitor, updates: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, broadcaster: &crate::lightning::chain::chaininterface::BroadcasterInterface, fee_estimator: &crate::lightning::chain::chaininterface::FeeEstimator, logger: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_NoneMonitorUpdateErrorZ {
+pub extern "C" fn ChannelMonitor_update_monitor(this_arg: &ChannelMonitor, updates: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, broadcaster: &crate::lightning::chain::chaininterface::BroadcasterInterface, fee_estimator: &crate::lightning::chain::chaininterface::FeeEstimator, logger: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_NoneNoneZ {
let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_monitor(updates.get_native_ref(), broadcaster, fee_estimator, logger);
- let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::chain::channelmonitor::MonitorUpdateError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
/// blindly signing the hash.
#[must_use]
pub sign_invoice: extern "C" fn (this_arg: *const c_void, invoice_preimage: crate::c_types::derived::CVec_u8Z) -> crate::c_types::derived::CResult_RecoverableSignatureNoneZ,
+ /// Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
+ ///
+ /// This method must return the same value each time it is called.
+ #[must_use]
+ pub get_inbound_payment_key_material: extern "C" fn (this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes,
/// 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.
pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
get_secure_random_bytes: Clone::clone(&orig.get_secure_random_bytes),
read_chan_signer: Clone::clone(&orig.read_chan_signer),
sign_invoice: Clone::clone(&orig.sign_invoice),
+ get_inbound_payment_key_material: Clone::clone(&orig.get_inbound_payment_key_material),
free: Clone::clone(&orig.free),
}
}
let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
local_ret
}
+ fn get_inbound_payment_key_material(&self) -> lightning::chain::keysinterface::KeyMaterial {
+ let mut ret = (self.get_inbound_payment_key_material)(self.this_arg);
+ ::lightning::chain::keysinterface::KeyMaterial(ret.data)
+ }
}
// We're essentially a pointer already, or at least a set of pointers, so allow us to be used
crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }
}
+/// Whether anchors should be used.
+/// Will panic if ready_channel wasn't called.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn InMemorySigner_opt_anchors(this_arg: &InMemorySigner) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.opt_anchors();
+ ret
+}
+
/// Sign the single input of spend_tx at index `input_idx` which spends the output
/// described by descriptor, returning the witness stack for the input.
///
get_secure_random_bytes: KeysManager_KeysInterface_get_secure_random_bytes,
read_chan_signer: KeysManager_KeysInterface_read_chan_signer,
sign_invoice: KeysManager_KeysInterface_sign_invoice,
+ get_inbound_payment_key_material: KeysManager_KeysInterface_get_inbound_payment_key_material,
}
}
crate::c_types::SecretKey::from_rust(ret)
}
#[must_use]
+extern "C" fn KeysManager_KeysInterface_get_inbound_payment_key_material(this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes {
+ let mut ret = <nativeKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_inbound_payment_key_material(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, );
+ crate::c_types::ThirtyTwoBytes { data: ret.0 }
+}
+#[must_use]
extern "C" fn KeysManager_KeysInterface_get_destination_script(this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z {
let mut ret = <nativeKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_destination_script(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, );
ret.into_bytes().into()
use bitcoin::hashes::Hash;
use crate::c_types::*;
+/// Gets the weight for an HTLC-Success transaction.
+#[no_mangle]
+pub extern "C" fn htlc_success_tx_weight(mut opt_anchors: bool) -> u64 {
+ let mut ret = lightning::ln::chan_utils::htlc_success_tx_weight(opt_anchors);
+ ret
+}
+
+/// Gets the weight for an HTLC-Timeout transaction.
+#[no_mangle]
+pub extern "C" fn htlc_timeout_tx_weight(mut opt_anchors: bool) -> u64 {
+ let mut ret = lightning::ln::chan_utils::htlc_timeout_tx_weight(opt_anchors);
+ ret
+}
+
/// Build the commitment secret from the seed and the commitment number
#[no_mangle]
pub extern "C" fn build_commitment_secret(commitment_seed: *const [u8; 32], mut idx: u64) -> crate::c_types::ThirtyTwoBytes {
/// Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
/// does not need to have its previous_output_index filled.
#[no_mangle]
-pub extern "C" fn get_htlc_redeemscript(htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment, keys: &crate::lightning::ln::chan_utils::TxCreationKeys) -> crate::c_types::derived::CVec_u8Z {
- let mut ret = lightning::ln::chan_utils::get_htlc_redeemscript(htlc.get_native_ref(), keys.get_native_ref());
+pub extern "C" fn get_htlc_redeemscript(htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment, mut opt_anchors: bool, keys: &crate::lightning::ln::chan_utils::TxCreationKeys) -> crate::c_types::derived::CVec_u8Z {
+ let mut ret = lightning::ln::chan_utils::get_htlc_redeemscript(htlc.get_native_ref(), opt_anchors, keys.get_native_ref());
ret.into_bytes().into()
}
/// Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
/// commitment transaction).
#[no_mangle]
-pub extern "C" fn build_htlc_transaction(commitment_txid: *const [u8; 32], mut feerate_per_kw: u32, mut contest_delay: u16, htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment, mut broadcaster_delayed_payment_key: crate::c_types::PublicKey, mut revocation_key: crate::c_types::PublicKey) -> crate::c_types::Transaction {
- let mut ret = lightning::ln::chan_utils::build_htlc_transaction(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*commitment_txid }[..]).unwrap(), feerate_per_kw, contest_delay, htlc.get_native_ref(), &broadcaster_delayed_payment_key.into_rust(), &revocation_key.into_rust());
+pub extern "C" fn build_htlc_transaction(commitment_txid: *const [u8; 32], mut feerate_per_kw: u32, mut contest_delay: u16, htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment, mut opt_anchors: bool, mut broadcaster_delayed_payment_key: crate::c_types::PublicKey, mut revocation_key: crate::c_types::PublicKey) -> crate::c_types::Transaction {
+ let mut ret = lightning::ln::chan_utils::build_htlc_transaction(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*commitment_txid }[..]).unwrap(), feerate_per_kw, contest_delay, htlc.get_native_ref(), opt_anchors, &broadcaster_delayed_payment_key.into_rust(), &revocation_key.into_rust());
crate::c_types::Transaction::from_bitcoin(&ret)
}
+/// Gets the witnessScript for an anchor output from the funding public key.
+/// The witness in the spending input must be:
+/// <BIP 143 funding_signature>
+/// After 16 blocks of confirmation, an alternative satisfying witness could be:
+/// <>
+/// (empty vector required to satisfy compliance with MINIMALIF-standard rule)
+#[no_mangle]
+pub extern "C" fn get_anchor_redeemscript(mut funding_pubkey: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z {
+ let mut ret = lightning::ln::chan_utils::get_anchor_redeemscript(&funding_pubkey.into_rust());
+ ret.into_bytes().into()
+}
+
use lightning::ln::chan_utils::ChannelTransactionParameters as nativeChannelTransactionParametersImport;
pub(crate) type nativeChannelTransactionParameters = nativeChannelTransactionParametersImport;
let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_outpoint = local_val;
}
+/// Are anchors used for this channel. Boolean is serialization backwards-compatible
+#[no_mangle]
+pub extern "C" fn ChannelTransactionParameters_get_opt_anchors(this_ptr: &ChannelTransactionParameters) -> crate::c_types::derived::COption_NoneZ {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().opt_anchors;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_NoneZ::None } else { crate::c_types::derived::COption_NoneZ::Some /* { () /**/ } */};
+ local_inner_val
+}
+/// Are anchors used for this channel. Boolean is serialization backwards-compatible
+#[no_mangle]
+pub extern "C" fn ChannelTransactionParameters_set_opt_anchors(this_ptr: &mut ChannelTransactionParameters, mut val: crate::c_types::derived::COption_NoneZ) {
+ let mut local_val = if val.is_some() { Some( { () /*val.take()*/ }) } else { None };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.opt_anchors = local_val;
+}
/// Constructs a new ChannelTransactionParameters given each field
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelTransactionParameters_new(mut holder_pubkeys_arg: crate::lightning::ln::chan_utils::ChannelPublicKeys, mut holder_selected_contest_delay_arg: u16, mut is_outbound_from_holder_arg: bool, mut counterparty_parameters_arg: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, mut funding_outpoint_arg: crate::lightning::chain::transaction::OutPoint) -> ChannelTransactionParameters {
+pub extern "C" fn ChannelTransactionParameters_new(mut holder_pubkeys_arg: crate::lightning::ln::chan_utils::ChannelPublicKeys, mut holder_selected_contest_delay_arg: u16, mut is_outbound_from_holder_arg: bool, mut counterparty_parameters_arg: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, mut funding_outpoint_arg: crate::lightning::chain::transaction::OutPoint, mut opt_anchors_arg: crate::c_types::derived::COption_NoneZ) -> ChannelTransactionParameters {
let mut local_counterparty_parameters_arg = if counterparty_parameters_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(counterparty_parameters_arg.take_inner()) } }) };
let mut local_funding_outpoint_arg = if funding_outpoint_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(funding_outpoint_arg.take_inner()) } }) };
+ let mut local_opt_anchors_arg = if opt_anchors_arg.is_some() { Some( { () /*opt_anchors_arg.take()*/ }) } else { None };
ChannelTransactionParameters { inner: ObjOps::heap_alloc(nativeChannelTransactionParameters {
holder_pubkeys: *unsafe { Box::from_raw(holder_pubkeys_arg.take_inner()) },
holder_selected_contest_delay: holder_selected_contest_delay_arg,
is_outbound_from_holder: is_outbound_from_holder_arg,
counterparty_parameters: local_counterparty_parameters_arg,
funding_outpoint: local_funding_outpoint_arg,
+ opt_anchors: local_opt_anchors_arg,
}), is_owned: true }
}
impl Clone for ChannelTransactionParameters {
crate::c_types::bitcoin_to_C_outpoint(ret)
}
+/// Whether to use anchors for this channel
+#[must_use]
+#[no_mangle]
+pub extern "C" fn DirectedChannelTransactionParameters_opt_anchors(this_arg: &DirectedChannelTransactionParameters) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.opt_anchors();
+ ret
+}
+
use lightning::ln::chan_utils::HolderCommitmentTransaction as nativeHolderCommitmentTransactionImport;
pub(crate) type nativeHolderCommitmentTransaction = nativeHolderCommitmentTransactionImport;
ret
}
}
+impl Clone for ClosingTransaction {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeClosingTransaction>::is_null(self.inner) { std::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ClosingTransaction_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeClosingTransaction)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the ClosingTransaction
+pub extern "C" fn ClosingTransaction_clone(orig: &ClosingTransaction) -> ClosingTransaction {
+ orig.clone()
+}
+/// Checks if two ClosingTransactions contain equal inner contents.
+#[no_mangle]
+pub extern "C" fn ClosingTransaction_hash(o: &ClosingTransaction) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use std::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ std::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ std::hash::Hasher::finish(&hasher)
+}
/// Construct an object of the class
#[must_use]
#[no_mangle]
crate::lightning::ln::chan_utils::TxCreationKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::TxCreationKeys<>) as *mut _) }, is_owned: false }
}
+/// Should anchors be used.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn TrustedCommitmentTransaction_opt_anchors(this_arg: &TrustedCommitmentTransaction) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.opt_anchors();
+ ret
+}
+
/// Get a signature for each HTLC which was included in the commitment transaction (ie for
/// which HTLCOutputInCommitment::transaction_output_index.is_some()).
///
use bitcoin::hashes::Hash;
use crate::c_types::*;
+mod inbound_payment {
+
+use std::str::FromStr;
+use std::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+
+}
use lightning::ln::channelmanager::ChannelManager as nativeChannelManagerImport;
pub(crate) type nativeChannelManager = nativeChannelManagerImport<crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>;
pub extern "C" fn ChannelDetails_set_user_channel_id(this_ptr: &mut ChannelDetails, mut val: u64) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.user_channel_id = val;
}
+/// Our total balance. This is the amount we would get if we close the channel.
+/// This value is not exact. Due to various in-flight changes and feerate changes, exactly this
+/// amount is not likely to be recoverable on close.
+///
+/// This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
+/// balance is not available for inclusion in new outbound HTLCs). This further does not include
+/// any pending outgoing HTLCs which are awaiting some other resolution to be sent.
+/// This does not consider any on-chain fees.
+///
+/// See also [`ChannelDetails::outbound_capacity_msat`]
+#[no_mangle]
+pub extern "C" fn ChannelDetails_get_balance_msat(this_ptr: &ChannelDetails) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().balance_msat;
+ *inner_val
+}
+/// Our total balance. This is the amount we would get if we close the channel.
+/// This value is not exact. Due to various in-flight changes and feerate changes, exactly this
+/// amount is not likely to be recoverable on close.
+///
+/// This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
+/// balance is not available for inclusion in new outbound HTLCs). This further does not include
+/// any pending outgoing HTLCs which are awaiting some other resolution to be sent.
+/// This does not consider any on-chain fees.
+///
+/// See also [`ChannelDetails::outbound_capacity_msat`]
+#[no_mangle]
+pub extern "C" fn ChannelDetails_set_balance_msat(this_ptr: &mut ChannelDetails, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.balance_msat = val;
+}
/// The available outbound capacity for sending HTLCs to the remote peer. This does not include
-/// any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
+/// any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
/// available for inclusion in new outbound HTLCs). This further does not include any pending
/// outgoing HTLCs which are awaiting some other resolution to be sent.
///
+/// See also [`ChannelDetails::balance_msat`]
+///
/// This value is not exact. Due to various in-flight changes, feerate changes, and our
/// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
/// should be able to spend nearly this amount.
*inner_val
}
/// The available outbound capacity for sending HTLCs to the remote peer. This does not include
-/// any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
+/// any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
/// available for inclusion in new outbound HTLCs). This further does not include any pending
/// outgoing HTLCs which are awaiting some other resolution to be sent.
///
+/// See also [`ChannelDetails::balance_msat`]
+///
/// This value is not exact. Due to various in-flight changes, feerate changes, and our
/// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
/// should be able to spend nearly this amount.
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outbound_capacity_msat = val;
}
/// The available inbound capacity for the remote peer to send HTLCs to us. This does not
-/// include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
+/// include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
/// available for inclusion in new inbound HTLCs).
/// Note that there are some corner cases not fully handled here, so the actual available
/// inbound capacity may be slightly higher than this.
*inner_val
}
/// The available inbound capacity for the remote peer to send HTLCs to us. This does not
-/// include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
+/// include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
/// available for inclusion in new inbound HTLCs).
/// Note that there are some corner cases not fully handled here, so the actual available
/// inbound capacity may be slightly higher than this.
/// Constructs a new ChannelDetails given each field
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut counterparty_arg: crate::lightning::ln::channelmanager::ChannelCounterparty, mut funding_txo_arg: crate::lightning::chain::transaction::OutPoint, mut short_channel_id_arg: crate::c_types::derived::COption_u64Z, mut channel_value_satoshis_arg: u64, mut unspendable_punishment_reserve_arg: crate::c_types::derived::COption_u64Z, mut user_channel_id_arg: u64, mut outbound_capacity_msat_arg: u64, mut inbound_capacity_msat_arg: u64, mut confirmations_required_arg: crate::c_types::derived::COption_u32Z, mut force_close_spend_delay_arg: crate::c_types::derived::COption_u16Z, mut is_outbound_arg: bool, mut is_funding_locked_arg: bool, mut is_usable_arg: bool, mut is_public_arg: bool) -> ChannelDetails {
+pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut counterparty_arg: crate::lightning::ln::channelmanager::ChannelCounterparty, mut funding_txo_arg: crate::lightning::chain::transaction::OutPoint, mut short_channel_id_arg: crate::c_types::derived::COption_u64Z, mut channel_value_satoshis_arg: u64, mut unspendable_punishment_reserve_arg: crate::c_types::derived::COption_u64Z, mut user_channel_id_arg: u64, mut balance_msat_arg: u64, mut outbound_capacity_msat_arg: u64, mut inbound_capacity_msat_arg: u64, mut confirmations_required_arg: crate::c_types::derived::COption_u32Z, mut force_close_spend_delay_arg: crate::c_types::derived::COption_u16Z, mut is_outbound_arg: bool, mut is_funding_locked_arg: bool, mut is_usable_arg: bool, mut is_public_arg: bool) -> ChannelDetails {
let mut local_funding_txo_arg = if funding_txo_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(funding_txo_arg.take_inner()) } }) };
let mut local_short_channel_id_arg = if short_channel_id_arg.is_some() { Some( { short_channel_id_arg.take() }) } else { None };
let mut local_unspendable_punishment_reserve_arg = if unspendable_punishment_reserve_arg.is_some() { Some( { unspendable_punishment_reserve_arg.take() }) } else { None };
channel_value_satoshis: channel_value_satoshis_arg,
unspendable_punishment_reserve: local_unspendable_punishment_reserve_arg,
user_channel_id: user_channel_id_arg,
+ balance_msat: balance_msat_arg,
outbound_capacity_msat: outbound_capacity_msat_arg,
inbound_capacity_msat: inbound_capacity_msat_arg,
confirmations_required: local_confirmations_required_arg,
///
/// Errors returned are a superset of those returned from [`send_payment`], so see
/// [`send_payment`] documentation for more details on errors. This method will also error if the
-/// retry amount puts the payment more than 10% over the payment's total amount, or if the payment
-/// for the given `payment_id` cannot be found (likely due to timeout or success).
+/// retry amount puts the payment more than 10% over the payment's total amount, if the payment
+/// for the given `payment_id` cannot be found (likely due to timeout or success), or if
+/// further retries have been disabled with [`abandon_payment`].
///
/// [`send_payment`]: [`ChannelManager::send_payment`]
+/// [`abandon_payment`]: [`ChannelManager::abandon_payment`]
#[must_use]
#[no_mangle]
pub extern "C" fn ChannelManager_retry_payment(this_arg: &ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ {
local_ret
}
+/// Signals that no further retries for the given payment will occur.
+///
+/// After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
+/// will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
+/// an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
+/// pending HTLCs for this payment.
+///
+/// Note that calling this method does *not* prevent a payment from succeeding. You must still
+/// wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
+/// determine the ultimate status of a payment.
+///
+/// [`retry_payment`]: Self::retry_payment
+/// [`Event::PaymentFailed`]: events::Event::PaymentFailed
+/// [`Event::PaymentSent`]: events::Event::PaymentSent
+#[no_mangle]
+pub extern "C" fn ChannelManager_abandon_payment(this_arg: &ChannelManager, mut payment_id: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.abandon_payment(::lightning::ln::channelmanager::PaymentId(payment_id.data))
+}
+
/// Send a spontaneous payment, which is a payment that does not require the recipient to have
/// generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
/// the preimage, it must be a cryptographically secure random value that no intermediate node
/// Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
/// or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
///
-/// Panics if a funding transaction has already been provided for this channel.
+/// Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
+/// for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
///
/// May panic if the output found in the funding transaction is duplicative with some other
/// channel (note that this should be trivially prevented by using unique funding transaction
/// create a new channel with a conflicting funding transaction.
///
/// [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
+/// [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
#[must_use]
#[no_mangle]
pub extern "C" fn ChannelManager_funding_transaction_generated(this_arg: &ChannelManager, temporary_channel_id: *const [u8; 32], mut funding_transaction: crate::c_types::Transaction) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
ret
}
-/// Provides a payment preimage in response to a PaymentReceived event, returning true and
-/// generating message events for the net layer to claim the payment, if possible. Thus, you
-/// should probably kick the net layer to go send messages if this returns true!
+/// Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
+/// [`MessageSendEvent`]s needed to claim the payment.
///
/// Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
/// [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
/// event matches your expectation. If you fail to do so and call this method, you may provide
/// the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
///
-/// May panic if called except in response to a PaymentReceived event.
+/// Returns whether any HTLCs were claimed, and thus if any new [`MessageSendEvent`]s are now
+/// pending for processing via [`get_and_clear_pending_msg_events`].
///
+/// [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
/// [`create_inbound_payment`]: Self::create_inbound_payment
/// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
+/// [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
#[must_use]
#[no_mangle]
pub extern "C" fn ChannelManager_claim_funds(this_arg: &ChannelManager, mut payment_preimage: crate::c_types::ThirtyTwoBytes) -> bool {
/// to pay us.
///
/// This differs from [`create_inbound_payment_for_hash`] only in that it generates the
-/// [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
+/// [`PaymentHash`] and [`PaymentPreimage`] for you.
///
/// The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
/// will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
///
/// See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
///
+/// Note that a malicious eavesdropper can intuit whether an inbound payment was created by
+/// `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
+///
+/// # Note
+///
+/// If you register an inbound payment with this method, then serialize the `ChannelManager`, then
+/// deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
+///
+/// Errors if `min_value_msat` is greater than total bitcoin supply.
+///
/// [`claim_funds`]: Self::claim_funds
/// [`PaymentReceived`]: events::Event::PaymentReceived
/// [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
/// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelManager_create_inbound_payment(this_arg: &ChannelManager, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32, mut user_payment_id: u64) -> crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ {
+pub extern "C" fn ChannelManager_create_inbound_payment(this_arg: &ChannelManager, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None };
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment(local_min_value_msat, invoice_expiry_delta_secs, user_payment_id);
- let (mut orig_ret_0, mut orig_ret_1) = ret; let mut local_ret = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_1.0 }).into();
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment(local_min_value_msat, invoice_expiry_delta_secs);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.0 }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+ local_ret
+}
+
+/// Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
+/// serialized state with LDK node(s) running 0.0.103 and earlier.
+///
+/// # Note
+/// This method is deprecated and will be removed soon.
+///
+/// [`create_inbound_payment`]: Self::create_inbound_payment
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_create_inbound_payment_legacy(this_arg: &ChannelManager, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None };
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment_legacy(local_min_value_msat, invoice_expiry_delta_secs);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.0 }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
local_ret
}
/// payment secret fetched via this method or [`create_inbound_payment`], and which is at least
/// the `min_value_msat` provided here, if one is provided.
///
-/// The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
-/// method may return an Err if another payment with the same payment_hash is still pending.
-///
-/// `user_payment_id` will be provided back in [`PaymentPurpose::InvoicePayment::user_payment_id`] events to
-/// allow tracking of which events correspond with which calls to this and
-/// [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
-/// copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
-/// with invoice metadata stored elsewhere.
+/// The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
+/// note that LDK will not stop you from registering duplicate payment hashes for inbound
+/// payments.
///
/// `min_value_msat` should be set if the invoice being generated contains a value. Any payment
/// received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
/// If you need exact expiry semantics, you should enforce them upon receipt of
/// [`PaymentReceived`].
///
-/// Pending inbound payments are stored in memory and in serialized versions of this
-/// [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
-/// space is limited, you may wish to rate-limit inbound payment creation.
-///
/// May panic if `invoice_expiry_delta_secs` is greater than one year.
///
/// Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
/// set to at least [`MIN_FINAL_CLTV_EXPIRY`].
///
+/// Note that a malicious eavesdropper can intuit whether an inbound payment was created by
+/// `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
+///
+/// # Note
+///
+/// If you register an inbound payment with this method, then serialize the `ChannelManager`, then
+/// deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
+///
+/// Errors if `min_value_msat` is greater than total bitcoin supply.
+///
/// [`create_inbound_payment`]: Self::create_inbound_payment
/// [`PaymentReceived`]: events::Event::PaymentReceived
-/// [`PaymentPurpose::InvoicePayment::user_payment_id`]: events::PaymentPurpose::InvoicePayment::user_payment_id
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelManager_create_inbound_payment_for_hash(this_arg: &ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32, mut user_payment_id: u64) -> crate::c_types::derived::CResult_PaymentSecretAPIErrorZ {
+pub extern "C" fn ChannelManager_create_inbound_payment_for_hash(this_arg: &ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_PaymentSecretNoneZ {
let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None };
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment_for_hash(::lightning::ln::PaymentHash(payment_hash.data), local_min_value_msat, invoice_expiry_delta_secs, user_payment_id);
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment_for_hash(::lightning::ln::PaymentHash(payment_hash.data), local_min_value_msat, invoice_expiry_delta_secs);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+ local_ret
+}
+
+/// Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
+/// serialized state with LDK node(s) running 0.0.103 and earlier.
+///
+/// # Note
+/// This method is deprecated and will be removed soon.
+///
+/// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_create_inbound_payment_for_hash_legacy(this_arg: &ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_PaymentSecretAPIErrorZ {
+ let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None };
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment_for_hash_legacy(::lightning::ln::PaymentHash(payment_hash.data), local_min_value_msat, invoice_expiry_delta_secs);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
+ local_ret
+}
+
+/// Gets an LDK-generated payment preimage from a payment hash and payment secret that were
+/// previously returned from [`create_inbound_payment`].
+///
+/// [`create_inbound_payment`]: Self::create_inbound_payment
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_get_payment_preimage(this_arg: &ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentPreimageAPIErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_payment_preimage(::lightning::ln::PaymentHash(payment_hash.data), ::lightning::ln::PaymentSecret(payment_secret.data));
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
local_ret
}
/// indicating whether persistence is necessary. Only one listener on
/// `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
/// up.
-/// Note that the feature `allow_wallclock_use` must be enabled to use this function.
+///
+/// Note that this method is not available with the `no-std` feature.
#[must_use]
#[no_mangle]
pub extern "C" fn ChannelManager_await_persistable_update_timeout(this_arg: &ChannelManager, mut max_wait: u64) -> bool {
if a.inner.is_null() || b.inner.is_null() { return false; }
if a.get_native_ref() == b.get_native_ref() { true } else { false }
}
+/// Checks if two ChannelTypeFeaturess 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.
+#[no_mangle]
+pub extern "C" fn ChannelTypeFeatures_eq(a: &ChannelTypeFeatures, b: &ChannelTypeFeatures) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
impl Clone for InitFeatures {
fn clone(&self) -> Self {
Self {
pub extern "C" fn InvoiceFeatures_clone(orig: &InvoiceFeatures) -> InvoiceFeatures {
orig.clone()
}
+impl Clone for ChannelTypeFeatures {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeChannelTypeFeatures>::is_null(self.inner) { std::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelTypeFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelTypeFeatures)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the ChannelTypeFeatures
+pub extern "C" fn ChannelTypeFeatures_clone(orig: &ChannelTypeFeatures) -> ChannelTypeFeatures {
+ orig.clone()
+}
use lightning::ln::features::InitFeatures as nativeInitFeaturesImport;
pub(crate) type nativeInitFeatures = nativeInitFeaturesImport;
ret
}
}
+
+use lightning::ln::features::ChannelTypeFeatures as nativeChannelTypeFeaturesImport;
+pub(crate) type nativeChannelTypeFeatures = nativeChannelTypeFeaturesImport;
+
+/// Features used within the channel_type field in an OpenChannel message.
+///
+/// A channel is always of some known \"type\", describing the transaction formats used and the exact
+/// semantics of our interaction with our peer.
+///
+/// Note that because a channel is a specific type which is proposed by the opener and accepted by
+/// the counterparty, only required features are allowed here.
+///
+/// This is serialized differently from other feature types - it is not prefixed by a length, and
+/// thus must only appear inside a TLV where its length is known in advance.
+#[must_use]
+#[repr(C)]
+pub struct ChannelTypeFeatures {
+ /// 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.
+ pub inner: *mut nativeChannelTypeFeatures,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for ChannelTypeFeatures {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeChannelTypeFeatures>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn ChannelTypeFeatures_free(this_obj: ChannelTypeFeatures) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelTypeFeatures_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelTypeFeatures); }
+}
+#[allow(unused)]
+impl ChannelTypeFeatures {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeChannelTypeFeatures {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelTypeFeatures {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeChannelTypeFeatures {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = std::ptr::null_mut();
+ ret
+ }
+}
/// Create a blank Features with no features set
#[must_use]
#[no_mangle]
ret
}
-/// Returns whether the `payment_secret` feature is supported.
+/// Create a blank Features with no features set
#[must_use]
#[no_mangle]
-pub extern "C" fn InitFeatures_supports_payment_secret(this_arg: &InitFeatures) -> bool {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret();
- ret
+pub extern "C" fn ChannelTypeFeatures_empty() -> ChannelTypeFeatures {
+ let mut ret = lightning::ln::features::ChannelTypeFeatures::empty();
+ ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
-/// Returns whether the `payment_secret` feature is supported.
+/// Creates a Features with the bits set which are known by the implementation
#[must_use]
#[no_mangle]
-pub extern "C" fn NodeFeatures_supports_payment_secret(this_arg: &NodeFeatures) -> bool {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret();
- ret
+pub extern "C" fn ChannelTypeFeatures_known() -> ChannelTypeFeatures {
+ let mut ret = lightning::ln::features::ChannelTypeFeatures::known();
+ ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
-/// Returns whether the `payment_secret` feature is supported.
+/// Returns true if this `Features` object contains unknown feature flags which are set as
+/// \"required\".
#[must_use]
#[no_mangle]
-pub extern "C" fn InvoiceFeatures_supports_payment_secret(this_arg: &InvoiceFeatures) -> bool {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret();
+pub extern "C" fn ChannelTypeFeatures_requires_unknown_bits(this_arg: &ChannelTypeFeatures) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
ret
}
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInitFeatures) })
}
#[no_mangle]
-/// Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
-pub extern "C" fn NodeFeatures_write(obj: &NodeFeatures) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-pub(crate) extern "C" fn NodeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeFeatures) })
+/// Read a InitFeatures from a byte array, created by InitFeatures_write
+pub extern "C" fn InitFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitFeaturesDecodeErrorZ {
+ let res: Result<lightning::ln::features::InitFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_res
}
#[no_mangle]
/// Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelFeatures) })
}
#[no_mangle]
-/// Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
-pub extern "C" fn InvoiceFeatures_write(obj: &InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+/// Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
+pub extern "C" fn ChannelFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelFeaturesDecodeErrorZ {
+ let res: Result<lightning::ln::features::ChannelFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_res
}
#[no_mangle]
-pub(crate) extern "C" fn InvoiceFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInvoiceFeatures) })
+/// Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
+pub extern "C" fn NodeFeatures_write(obj: &NodeFeatures) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
#[no_mangle]
-/// Read a InitFeatures from a byte array, created by InitFeatures_write
-pub extern "C" fn InitFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitFeaturesDecodeErrorZ {
- let res: Result<lightning::ln::features::InitFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
- local_res
+pub(crate) extern "C" fn NodeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeFeatures) })
}
#[no_mangle]
/// Read a NodeFeatures from a byte array, created by NodeFeatures_write
local_res
}
#[no_mangle]
-/// Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
-pub extern "C" fn ChannelFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelFeaturesDecodeErrorZ {
- let res: Result<lightning::ln::features::ChannelFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
- local_res
+/// Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
+pub extern "C" fn InvoiceFeatures_write(obj: &InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+}
+#[no_mangle]
+pub(crate) extern "C" fn InvoiceFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInvoiceFeatures) })
}
#[no_mangle]
/// Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
local_res
}
+#[no_mangle]
+/// Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
+pub extern "C" fn ChannelTypeFeatures_write(obj: &ChannelTypeFeatures) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+}
+#[no_mangle]
+pub(crate) extern "C" fn ChannelTypeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelTypeFeatures) })
+}
+#[no_mangle]
+/// Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
+pub extern "C" fn ChannelTypeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelTypeFeaturesDecodeErrorZ {
+ let res: Result<lightning::ln::features::ChannelTypeFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_res
+}
pub extern "C" fn OpenChannel_set_channel_flags(this_ptr: &mut OpenChannel, mut val: u8) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_flags = val;
}
+/// The channel type that this channel will represent. If none is set, we derive the channel
+/// type from the intersection of our feature bits with our counterparty's feature bits from
+/// the Init message.
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn OpenChannel_get_channel_type(this_ptr: &OpenChannel) -> crate::lightning::ln::features::ChannelTypeFeatures {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_type;
+ let mut local_inner_val = crate::lightning::ln::features::ChannelTypeFeatures { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::features::ChannelTypeFeatures<>) as *mut _ }, is_owned: false };
+ local_inner_val
+}
+/// The channel type that this channel will represent. If none is set, we derive the channel
+/// type from the intersection of our feature bits with our counterparty's feature bits from
+/// the Init message.
+///
+/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[no_mangle]
+pub extern "C" fn OpenChannel_set_channel_type(this_ptr: &mut OpenChannel, mut val: crate::lightning::ln::features::ChannelTypeFeatures) {
+ let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_type = local_val;
+}
impl Clone for OpenChannel {
fn clone(&self) -> Self {
Self {
port: u16,
},
/// An old-style Tor onion address/port on which the peer is listening.
- OnionV2 {
- /// The bytes (usually encoded in base32 with \".onion\" appended)
- addr: crate::c_types::TenBytes,
- /// The port on which the node is listening
- port: u16,
- },
+ ///
+ /// This field is deprecated and the Tor network generally no longer supports V2 Onion
+ /// addresses. Thus, the details are not parsed here.
+ OnionV2(crate::c_types::TwelveBytes),
/// 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\".
port: port_nonref,
}
},
- NetAddress::OnionV2 {ref addr, ref port, } => {
- let mut addr_nonref = (*addr).clone();
- let mut port_nonref = (*port).clone();
- nativeNetAddress::OnionV2 {
- addr: addr_nonref.data,
- port: port_nonref,
- }
+ NetAddress::OnionV2 (ref a, ) => {
+ let mut a_nonref = (*a).clone();
+ nativeNetAddress::OnionV2 (
+ a_nonref.data,
+ )
},
NetAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => {
let mut ed25519_pubkey_nonref = (*ed25519_pubkey).clone();
port: port,
}
},
- NetAddress::OnionV2 {mut addr, mut port, } => {
- nativeNetAddress::OnionV2 {
- addr: addr.data,
- port: port,
- }
+ NetAddress::OnionV2 (mut a, ) => {
+ nativeNetAddress::OnionV2 (
+ a.data,
+ )
},
NetAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => {
nativeNetAddress::OnionV3 {
port: port_nonref,
}
},
- nativeNetAddress::OnionV2 {ref addr, ref port, } => {
- let mut addr_nonref = (*addr).clone();
- let mut port_nonref = (*port).clone();
- NetAddress::OnionV2 {
- addr: crate::c_types::TenBytes { data: addr_nonref },
- port: port_nonref,
- }
+ nativeNetAddress::OnionV2 (ref a, ) => {
+ let mut a_nonref = (*a).clone();
+ NetAddress::OnionV2 (
+ crate::c_types::TwelveBytes { data: a_nonref },
+ )
},
nativeNetAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => {
let mut ed25519_pubkey_nonref = (*ed25519_pubkey).clone();
port: port,
}
},
- nativeNetAddress::OnionV2 {mut addr, mut port, } => {
- NetAddress::OnionV2 {
- addr: crate::c_types::TenBytes { data: addr },
- port: port,
- }
+ nativeNetAddress::OnionV2 (mut a, ) => {
+ NetAddress::OnionV2 (
+ crate::c_types::TwelveBytes { data: a },
+ )
},
nativeNetAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => {
NetAddress::OnionV3 {
}
#[no_mangle]
/// Utility method to constructs a new OnionV2-variant NetAddress
-pub extern "C" fn NetAddress_onion_v2(addr: crate::c_types::TenBytes, port: u16) -> NetAddress {
- NetAddress::OnionV2 {
- addr,
- port,
- }
+pub extern "C" fn NetAddress_onion_v2(a: crate::c_types::TwelveBytes) -> NetAddress {
+ NetAddress::OnionV2(a, )
}
#[no_mangle]
/// Utility method to constructs a new OnionV3-variant NetAddress
/// The peer did something harmless that we weren't able to meaningfully process.
/// If the error is logged, log it at the given level.
IgnoreAndLog(crate::lightning::util::logger::Level),
+ /// The peer provided us with a gossip message which we'd already seen. In most cases this
+ /// should be ignored, but it may result in the message being forwarded if it is a duplicate of
+ /// our own channel announcements.
+ IgnoreDuplicateGossip,
/// The peer did something incorrect. Tell them.
SendErrorMessage {
/// The message to send.
a_nonref.into_native(),
)
},
+ ErrorAction::IgnoreDuplicateGossip => nativeErrorAction::IgnoreDuplicateGossip,
ErrorAction::SendErrorMessage {ref msg, } => {
let mut msg_nonref = (*msg).clone();
nativeErrorAction::SendErrorMessage {
a.into_native(),
)
},
+ ErrorAction::IgnoreDuplicateGossip => nativeErrorAction::IgnoreDuplicateGossip,
ErrorAction::SendErrorMessage {mut msg, } => {
nativeErrorAction::SendErrorMessage {
msg: *unsafe { Box::from_raw(msg.take_inner()) },
crate::lightning::util::logger::Level::native_into(a_nonref),
)
},
+ nativeErrorAction::IgnoreDuplicateGossip => ErrorAction::IgnoreDuplicateGossip,
nativeErrorAction::SendErrorMessage {ref msg, } => {
let mut msg_nonref = (*msg).clone();
ErrorAction::SendErrorMessage {
crate::lightning::util::logger::Level::native_into(a),
)
},
+ nativeErrorAction::IgnoreDuplicateGossip => ErrorAction::IgnoreDuplicateGossip,
nativeErrorAction::SendErrorMessage {mut msg, } => {
ErrorAction::SendErrorMessage {
msg: crate::lightning::ln::msgs::ErrorMessage { inner: ObjOps::heap_alloc(msg), is_owned: true },
ErrorAction::IgnoreAndLog(a, )
}
#[no_mangle]
+/// Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
+pub extern "C" fn ErrorAction_ignore_duplicate_gossip() -> ErrorAction {
+ ErrorAction::IgnoreDuplicateGossip}
+#[no_mangle]
/// Utility method to constructs a new SendErrorMessage-variant ErrorAction
pub extern "C" fn ErrorAction_send_error_message(msg: crate::lightning::ln::msgs::ErrorMessage) -> ErrorAction {
ErrorAction::SendErrorMessage {
script: ::bitcoin::blockdata::script::Script::from(script_arg.into_rust()),
}), is_owned: true }
}
+impl Clone for InvalidShutdownScript {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeInvalidShutdownScript>::is_null(self.inner) { std::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn InvalidShutdownScript_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInvalidShutdownScript)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the InvalidShutdownScript
+pub extern "C" fn InvalidShutdownScript_clone(orig: &InvalidShutdownScript) -> InvalidShutdownScript {
+ orig.clone()
+}
#[no_mangle]
/// Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
pub extern "C" fn ShutdownScript_write(obj: &ShutdownScript) -> crate::c_types::derived::CVec_u8Z {
pub mod network_graph;
pub mod router;
-pub mod scorer;
-/// An interface used to score payment channels for path finding.
-///
-///\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
-#[repr(C)]
-pub struct Score {
- /// 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.
- pub this_arg: *mut c_void,
- /// Returns the fee in msats willing to be paid to avoid routing through the given channel
- /// in the direction from `source` to `target`.
- #[must_use]
- pub channel_penalty_msat: extern "C" fn (this_arg: *const c_void, short_channel_id: u64, source: &crate::lightning::routing::network_graph::NodeId, target: &crate::lightning::routing::network_graph::NodeId) -> u64,
- /// Handles updating channel penalties after failing to route through a channel.
- pub payment_path_failed: extern "C" fn (this_arg: *mut c_void, path: crate::c_types::derived::CVec_RouteHopZ, short_channel_id: u64),
- /// Serialize the object into a byte array
- pub write: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z,
- /// 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.
- pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
-}
-unsafe impl Send for Score {}
-unsafe impl Sync for Score {}
-#[no_mangle]
-pub(crate) extern "C" fn Score_clone_fields(orig: &Score) -> Score {
- Score {
- this_arg: orig.this_arg,
- channel_penalty_msat: Clone::clone(&orig.channel_penalty_msat),
- payment_path_failed: Clone::clone(&orig.payment_path_failed),
- write: Clone::clone(&orig.write),
- free: Clone::clone(&orig.free),
- }
-}
-impl lightning::util::ser::Writeable for Score {
- fn write<W: lightning::util::ser::Writer>(&self, w: &mut W) -> Result<(), ::std::io::Error> {
- let vec = (self.write)(self.this_arg);
- w.write_all(vec.as_slice())
- }
-}
-
-use lightning::routing::Score as rustScore;
-impl rustScore for Score {
- fn channel_penalty_msat(&self, mut short_channel_id: u64, mut source: &lightning::routing::network_graph::NodeId, mut target: &lightning::routing::network_graph::NodeId) -> u64 {
- let mut ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id, &crate::lightning::routing::network_graph::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((source as *const lightning::routing::network_graph::NodeId<>) as *mut _) }, is_owned: false }, &crate::lightning::routing::network_graph::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((target as *const lightning::routing::network_graph::NodeId<>) as *mut _) }, is_owned: false });
- ret
- }
- fn payment_path_failed(&mut self, mut path: &[&lightning::routing::router::RouteHop], mut short_channel_id: u64) {
- let mut local_path = Vec::new(); for item in path.iter() { local_path.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::routing::router::RouteHop<>) as *mut _) }, is_owned: false } }); };
- (self.payment_path_failed)(self.this_arg, local_path.into(), short_channel_id)
- }
-}
-
-// We're essentially a pointer already, or at least a set of pointers, so allow us to be used
-// directly as a Deref trait in higher-level structs:
-impl std::ops::Deref for Score {
- type Target = Self;
- fn deref(&self) -> &Self {
- self
- }
-}
-/// Calls the free function if one is set
-#[no_mangle]
-pub extern "C" fn Score_free(this_ptr: Score) { }
-impl Drop for Score {
- fn drop(&mut self) {
- if let Some(f) = self.free {
- f(self.this_arg);
- }
- }
-}
-
-use lightning::routing::LockableScore as nativeLockableScoreImport;
-pub(crate) type nativeLockableScore = nativeLockableScoreImport<crate::lightning::routing::Score>;
-
-/// A scorer that is accessed under a lock.
-///
-/// 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
-#[must_use]
-#[repr(C)]
-pub struct LockableScore {
- /// 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.
- pub inner: *mut nativeLockableScore,
- /// 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.
- pub is_owned: bool,
-}
-
-impl Drop for LockableScore {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeLockableScore>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the LockableScore, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn LockableScore_free(this_obj: LockableScore) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn LockableScore_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeLockableScore); }
-}
-#[allow(unused)]
-impl LockableScore {
- pub(crate) fn get_native_ref(&self) -> &'static nativeLockableScore {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLockableScore {
- unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
- }
- /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
- pub(crate) fn take_inner(mut self) -> *mut nativeLockableScore {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = std::ptr::null_mut();
- ret
- }
-}
-/// Constructs a new LockableScore from a Score
-#[must_use]
-#[no_mangle]
-pub extern "C" fn LockableScore_new(mut score: crate::lightning::routing::Score) -> LockableScore {
- let mut ret = lightning::routing::LockableScore::new(score);
- LockableScore { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-#[no_mangle]
-/// Serialize the LockableScore object into a byte array which can be read by LockableScore_read
-pub extern "C" fn LockableScore_write(obj: &LockableScore) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-pub(crate) extern "C" fn LockableScore_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeLockableScore) })
-}
+pub mod scoring;
let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.announcement_message = local_val;
}
-/// Constructs a new ChannelInfo given each field
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelInfo_new(mut features_arg: crate::lightning::ln::features::ChannelFeatures, mut node_one_arg: crate::lightning::routing::network_graph::NodeId, mut one_to_two_arg: crate::lightning::routing::network_graph::DirectionalChannelInfo, mut node_two_arg: crate::lightning::routing::network_graph::NodeId, mut two_to_one_arg: crate::lightning::routing::network_graph::DirectionalChannelInfo, mut capacity_sats_arg: crate::c_types::derived::COption_u64Z, mut announcement_message_arg: crate::lightning::ln::msgs::ChannelAnnouncement) -> ChannelInfo {
- let mut local_one_to_two_arg = if one_to_two_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(one_to_two_arg.take_inner()) } }) };
- let mut local_two_to_one_arg = if two_to_one_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(two_to_one_arg.take_inner()) } }) };
- let mut local_capacity_sats_arg = if capacity_sats_arg.is_some() { Some( { capacity_sats_arg.take() }) } else { None };
- let mut local_announcement_message_arg = if announcement_message_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(announcement_message_arg.take_inner()) } }) };
- ChannelInfo { inner: ObjOps::heap_alloc(nativeChannelInfo {
- features: *unsafe { Box::from_raw(features_arg.take_inner()) },
- node_one: *unsafe { Box::from_raw(node_one_arg.take_inner()) },
- one_to_two: local_one_to_two_arg,
- node_two: *unsafe { Box::from_raw(node_two_arg.take_inner()) },
- two_to_one: local_two_to_one_arg,
- capacity_sats: local_capacity_sats_arg,
- announcement_message: local_announcement_message_arg,
- }), is_owned: true }
-}
impl Clone for ChannelInfo {
fn clone(&self) -> Self {
Self {
unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fail_node(&_node_id.into_rust(), is_permanent)
}
+/// Removes information about channels that we haven't heard any updates about in some time.
+/// This can be used regularly to prune the network graph of channels that likely no longer
+/// exist.
+///
+/// While there is no formal requirement that nodes regularly re-broadcast their channel
+/// updates every two weeks, the non-normative section of BOLT 7 currently suggests that
+/// pruning occur for updates which are at least two weeks old, which we implement here.
+///
+/// This function takes the current unix time as an argument. For users with the `std` feature
+/// enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
+#[no_mangle]
+pub extern "C" fn NetworkGraph_remove_stale_channels_with_time(this_arg: &NetworkGraph, mut current_time_unix: u64) {
+ unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels_with_time(current_time_unix)
+}
+
/// For an already known (from announcement) channel, update info about one of the directions
/// of the channel.
///
/// You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
/// RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
/// routing messages from a source using a protocol other than the lightning P2P protocol.
+///
+/// If built with `no-std`, any updates with a timestamp more than two weeks in the past or
+/// materially in the future will be rejected.
#[must_use]
#[no_mangle]
pub extern "C" fn NetworkGraph_update_channel(this_arg: &NetworkGraph, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
/// For an already known (from announcement) channel, update info about one of the directions
/// of the channel without verifying the associated signatures. Because we aren't given the
/// associated signatures here we cannot relay the channel update to any of our peers.
+///
+/// If built with `no-std`, any updates with a timestamp more than two weeks in the past or
+/// materially in the future will be rejected.
#[must_use]
#[no_mangle]
pub extern "C" fn NetworkGraph_update_channel_unsigned(this_arg: &NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedChannelUpdate) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
///
/// Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
#[no_mangle]
-pub extern "C" fn find_route(mut our_node_pubkey: crate::c_types::PublicKey, params: &crate::lightning::routing::router::RouteParameters, network: &crate::lightning::routing::network_graph::NetworkGraph, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut logger: crate::lightning::util::logger::Logger, scorer: &crate::lightning::routing::Score) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
+pub extern "C" fn find_route(mut our_node_pubkey: crate::c_types::PublicKey, params: &crate::lightning::routing::router::RouteParameters, network: &crate::lightning::routing::network_graph::NetworkGraph, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut logger: crate::lightning::util::logger::Logger, scorer: &crate::lightning::routing::scoring::Score) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
let mut local_first_hops_base = if first_hops == std::ptr::null_mut() { None } else { Some( { let mut local_first_hops_0 = Vec::new(); for mut item in unsafe { &mut *first_hops }.as_slice().iter() { local_first_hops_0.push( { item.get_native_ref() }); }; local_first_hops_0 }) }; let mut local_first_hops = local_first_hops_base.as_ref().map(|a| &a[..]);
let mut ret = lightning::routing::router::find_route(&our_node_pubkey.into_rust(), params.get_native_ref(), network.get_native_ref(), local_first_hops, logger, scorer);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Route { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+++ /dev/null
-// This file is Copyright its original authors, visible in version control
-// history and in the source files from which this was generated.
-//
-// This file is licensed under the license available in the LICENSE or LICENSE.md
-// file in the root of this repository or, if no such file exists, the same
-// license as that which applies to the original source files from which this
-// source was automatically generated.
-
-//! Utilities for scoring payment channels.
-//!
-//! [`Scorer`] may be given to [`find_route`] to score payment channels during path finding when a
-//! custom [`routing::Score`] implementation is not needed.
-//!
-//! # Example
-//!
-//! ```
-//! # extern crate secp256k1;
-//! #
-//! # use lightning::routing::network_graph::NetworkGraph;
-//! # use lightning::routing::router::{RouteParameters, find_route};
-//! # use lightning::routing::scorer::{Scorer, ScoringParameters};
-//! # use lightning::util::logger::{Logger, Record};
-//! # use secp256k1::key::PublicKey;
-//! #
-//! # struct FakeLogger {};
-//! # impl Logger for FakeLogger {
-//! # fn log(&self, record: &Record) { unimplemented!() }
-//! # }
-//! # fn find_scored_route(payer: PublicKey, params: RouteParameters, network_graph: NetworkGraph) {
-//! # let logger = FakeLogger {};
-//! #
-//! // Use the default channel penalties.
-//! let scorer = Scorer::default();
-//!
-//! // Or use custom channel penalties.
-//! let scorer = Scorer::new(ScoringParameters {
-//! base_penalty_msat: 1000,
-//! failure_penalty_msat: 2 * 1024 * 1000,
-//! ..ScoringParameters::default()
-//! });
-//!
-//! let route = find_route(&payer, ¶ms, &network_graph, None, &logger, &scorer);
-//! # }
-//! ```
-//!
-//! # Note
-//!
-//! If persisting [`Scorer`], it must be restored using the same [`Time`] parameterization. Using a
-//! different type results in undefined behavior. Specifically, persisting when built with feature
-//! `no-std` and restoring without it, or vice versa, uses different types and thus is undefined.
-//!
-//! [`find_route`]: crate::routing::router::find_route
-
-use std::str::FromStr;
-use std::ffi::c_void;
-use core::convert::Infallible;
-use bitcoin::hashes::Hash;
-use crate::c_types::*;
-
-mod sealed {
-
-use std::str::FromStr;
-use std::ffi::c_void;
-use core::convert::Infallible;
-use bitcoin::hashes::Hash;
-use crate::c_types::*;
-
-}
-
-use lightning::routing::scorer::Scorer as nativeScorerImport;
-pub(crate) type nativeScorer = nativeScorerImport;
-
-/// [`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. Will further penalize channels that fail to relay payments.
-///
-/// See [module-level documentation] for usage.
-///
-/// [module-level documentation]: crate::routing::scorer
-#[must_use]
-#[repr(C)]
-pub struct Scorer {
- /// 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.
- pub inner: *mut nativeScorer,
- /// 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.
- pub is_owned: bool,
-}
-
-impl Drop for Scorer {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeScorer>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn Scorer_free(this_obj: Scorer) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn Scorer_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeScorer); }
-}
-#[allow(unused)]
-impl Scorer {
- pub(crate) fn get_native_ref(&self) -> &'static nativeScorer {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeScorer {
- unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
- }
- /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
- pub(crate) fn take_inner(mut self) -> *mut nativeScorer {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = std::ptr::null_mut();
- ret
- }
-}
-
-use lightning::routing::scorer::ScoringParameters as nativeScoringParametersImport;
-pub(crate) type nativeScoringParameters = nativeScoringParametersImport;
-
-/// Parameters for configuring [`Scorer`].
-#[must_use]
-#[repr(C)]
-pub struct ScoringParameters {
- /// 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.
- pub inner: *mut nativeScoringParameters,
- /// 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.
- pub is_owned: bool,
-}
-
-impl Drop for ScoringParameters {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeScoringParameters>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn ScoringParameters_free(this_obj: ScoringParameters) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn ScoringParameters_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeScoringParameters); }
-}
-#[allow(unused)]
-impl ScoringParameters {
- pub(crate) fn get_native_ref(&self) -> &'static nativeScoringParameters {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeScoringParameters {
- unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
- }
- /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
- pub(crate) fn take_inner(mut self) -> *mut nativeScoringParameters {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = std::ptr::null_mut();
- ret
- }
-}
-/// A fixed penalty in msats to apply to each channel.
-#[no_mangle]
-pub extern "C" fn ScoringParameters_get_base_penalty_msat(this_ptr: &ScoringParameters) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().base_penalty_msat;
- *inner_val
-}
-/// A fixed penalty in msats to apply to each channel.
-#[no_mangle]
-pub extern "C" fn ScoringParameters_set_base_penalty_msat(this_ptr: &mut ScoringParameters, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.base_penalty_msat = 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
-#[no_mangle]
-pub extern "C" fn ScoringParameters_get_failure_penalty_msat(this_ptr: &ScoringParameters) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().failure_penalty_msat;
- *inner_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
-#[no_mangle]
-pub extern "C" fn ScoringParameters_set_failure_penalty_msat(this_ptr: &mut ScoringParameters, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.failure_penalty_msat = 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
-#[no_mangle]
-pub extern "C" fn ScoringParameters_get_failure_penalty_half_life(this_ptr: &ScoringParameters) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().failure_penalty_half_life;
- inner_val.as_secs()
-}
-/// 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
-#[no_mangle]
-pub extern "C" fn ScoringParameters_set_failure_penalty_half_life(this_ptr: &mut ScoringParameters, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.failure_penalty_half_life = std::time::Duration::from_secs(val);
-}
-/// Constructs a new ScoringParameters given each field
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ScoringParameters_new(mut base_penalty_msat_arg: u64, mut failure_penalty_msat_arg: u64, mut failure_penalty_half_life_arg: u64) -> ScoringParameters {
- ScoringParameters { inner: ObjOps::heap_alloc(nativeScoringParameters {
- base_penalty_msat: base_penalty_msat_arg,
- failure_penalty_msat: failure_penalty_msat_arg,
- failure_penalty_half_life: std::time::Duration::from_secs(failure_penalty_half_life_arg),
- }), is_owned: true }
-}
-#[no_mangle]
-/// Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
-pub extern "C" fn ScoringParameters_write(obj: &ScoringParameters) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-pub(crate) extern "C" fn ScoringParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeScoringParameters) })
-}
-#[no_mangle]
-/// Read a ScoringParameters from a byte array, created by ScoringParameters_write
-pub extern "C" fn ScoringParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ScoringParametersDecodeErrorZ {
- let res: Result<lightning::routing::scorer::ScoringParameters, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scorer::ScoringParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
- local_res
-}
-/// Creates a new scorer using the given scoring parameters.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn Scorer_new(mut params: crate::lightning::routing::scorer::ScoringParameters) -> Scorer {
- let mut ret = lightning::routing::scorer::Scorer::new(*unsafe { Box::from_raw(params.take_inner()) });
- Scorer { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn Scorer_default() -> Scorer {
- Scorer { inner: ObjOps::heap_alloc(Default::default()), is_owned: true }
-}
-/// Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ScoringParameters_default() -> ScoringParameters {
- ScoringParameters { inner: ObjOps::heap_alloc(Default::default()), is_owned: true }
-}
-impl From<nativeScorer> for crate::lightning::routing::Score {
- fn from(obj: nativeScorer) -> Self {
- let mut rust_obj = Scorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
- let mut ret = Scorer_as_Score(&rust_obj);
- // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn
- rust_obj.inner = std::ptr::null_mut();
- ret.free = Some(Scorer_free_void);
- ret
- }
-}
-/// 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
-#[no_mangle]
-pub extern "C" fn Scorer_as_Score(this_arg: &Scorer) -> crate::lightning::routing::Score {
- crate::lightning::routing::Score {
- this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
- free: None,
- channel_penalty_msat: Scorer_Score_channel_penalty_msat,
- payment_path_failed: Scorer_Score_payment_path_failed,
- write: Scorer_write_void,
- }
-}
-
-#[must_use]
-extern "C" fn Scorer_Score_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, _source: &crate::lightning::routing::network_graph::NodeId, _target: &crate::lightning::routing::network_graph::NodeId) -> u64 {
- let mut ret = <nativeScorer as lightning::routing::Score<>>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeScorer) }, short_channel_id, _source.get_native_ref(), _target.get_native_ref());
- ret
-}
-extern "C" fn Scorer_Score_payment_path_failed(this_arg: *mut c_void, mut _path: crate::c_types::derived::CVec_RouteHopZ, mut short_channel_id: u64) {
- let mut local__path = Vec::new(); for mut item in _path.as_slice().iter() { local__path.push( { item.get_native_ref() }); };
- <nativeScorer as lightning::routing::Score<>>::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeScorer) }, &local__path[..], short_channel_id)
-}
-
-#[no_mangle]
-/// Serialize the Scorer object into a byte array which can be read by Scorer_read
-pub extern "C" fn Scorer_write(obj: &Scorer) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-pub(crate) extern "C" fn Scorer_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeScorer) })
-}
-#[no_mangle]
-/// Read a Scorer from a byte array, created by Scorer_write
-pub extern "C" fn Scorer_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ScorerDecodeErrorZ {
- let res: Result<lightning::routing::scorer::Scorer, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
- let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scorer::Scorer { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
- local_res
-}
--- /dev/null
+// This file is Copyright its original authors, visible in version control
+// history and in the source files from which this was generated.
+//
+// This file is licensed under the license available in the LICENSE or LICENSE.md
+// file in the root of this repository or, if no such file exists, the same
+// license as that which applies to the original source files from which this
+// source was automatically generated.
+
+//! Utilities for scoring payment channels.
+//!
+//! [`Scorer`] may be given to [`find_route`] to score payment channels during path finding when a
+//! custom [`Score`] implementation is not needed.
+//!
+//! # Example
+//!
+//! ```
+//! # extern crate secp256k1;
+//! #
+//! # use lightning::routing::network_graph::NetworkGraph;
+//! # use lightning::routing::router::{RouteParameters, find_route};
+//! # use lightning::routing::scoring::{Scorer, ScoringParameters};
+//! # use lightning::util::logger::{Logger, Record};
+//! # use secp256k1::key::PublicKey;
+//! #
+//! # struct FakeLogger {};
+//! # impl Logger for FakeLogger {
+//! # fn log(&self, record: &Record) { unimplemented!() }
+//! # }
+//! # fn find_scored_route(payer: PublicKey, params: RouteParameters, network_graph: NetworkGraph) {
+//! # let logger = FakeLogger {};
+//! #
+//! // Use the default channel penalties.
+//! let scorer = Scorer::default();
+//!
+//! // Or use custom channel penalties.
+//! let scorer = Scorer::new(ScoringParameters {
+//! base_penalty_msat: 1000,
+//! failure_penalty_msat: 2 * 1024 * 1000,
+//! ..ScoringParameters::default()
+//! });
+//!
+//! let route = find_route(&payer, ¶ms, &network_graph, None, &logger, &scorer);
+//! # }
+//! ```
+//!
+//! # Note
+//!
+//! Persisting when built with feature `no-std` and restoring without it, or vice versa, uses
+//! different types and thus is undefined.
+//!
+//! [`find_route`]: crate::routing::router::find_route
+
+use std::str::FromStr;
+use std::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+
+/// An interface used to score payment channels for path finding.
+///
+///\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
+#[repr(C)]
+pub struct Score {
+ /// 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.
+ pub this_arg: *mut c_void,
+ /// Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
+ /// given channel in the direction from `source` to `target`.
+ ///
+ /// The channel's capacity (less any other MPP parts which are also being considered for use in
+ /// the same payment) is given by `channel_capacity_msat`. It may be guessed from various
+ /// sources or assumed from no data at all.
+ ///
+ /// For hints provided in the invoice, we assume the channel has sufficient capacity to accept
+ /// the invoice's full amount, and provide a `channel_capacity_msat` of `None`. In all other
+ /// cases it is set to `Some`, even if we're guessing at the channel value.
+ ///
+ /// Your code should be overflow-safe through a `channel_capacity_msat` of 21 million BTC.
+ #[must_use]
+ pub channel_penalty_msat: extern "C" fn (this_arg: *const c_void, short_channel_id: u64, send_amt_msat: u64, channel_capacity_msat: crate::c_types::derived::COption_u64Z, source: &crate::lightning::routing::network_graph::NodeId, target: &crate::lightning::routing::network_graph::NodeId) -> u64,
+ /// Handles updating channel penalties after failing to route through a channel.
+ pub payment_path_failed: extern "C" fn (this_arg: *mut c_void, path: crate::c_types::derived::CVec_RouteHopZ, short_channel_id: u64),
+ /// Handles updating channel penalties after successfully routing along a path.
+ pub payment_path_successful: extern "C" fn (this_arg: *mut c_void, path: crate::c_types::derived::CVec_RouteHopZ),
+ /// Serialize the object into a byte array
+ pub write: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z,
+ /// 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.
+ pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
+}
+unsafe impl Send for Score {}
+unsafe impl Sync for Score {}
+#[no_mangle]
+pub(crate) extern "C" fn Score_clone_fields(orig: &Score) -> Score {
+ Score {
+ this_arg: orig.this_arg,
+ channel_penalty_msat: Clone::clone(&orig.channel_penalty_msat),
+ payment_path_failed: Clone::clone(&orig.payment_path_failed),
+ payment_path_successful: Clone::clone(&orig.payment_path_successful),
+ write: Clone::clone(&orig.write),
+ free: Clone::clone(&orig.free),
+ }
+}
+impl lightning::util::ser::Writeable for Score {
+ fn write<W: lightning::util::ser::Writer>(&self, w: &mut W) -> Result<(), ::std::io::Error> {
+ let vec = (self.write)(self.this_arg);
+ w.write_all(vec.as_slice())
+ }
+}
+
+use lightning::routing::scoring::Score as rustScore;
+impl rustScore for Score {
+ fn channel_penalty_msat(&self, mut short_channel_id: u64, mut send_amt_msat: u64, mut channel_capacity_msat: Option<u64>, mut source: &lightning::routing::network_graph::NodeId, mut target: &lightning::routing::network_graph::NodeId) -> u64 {
+ let mut local_channel_capacity_msat = if channel_capacity_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { channel_capacity_msat.unwrap() }) };
+ let mut ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id, send_amt_msat, local_channel_capacity_msat, &crate::lightning::routing::network_graph::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((source as *const lightning::routing::network_graph::NodeId<>) as *mut _) }, is_owned: false }, &crate::lightning::routing::network_graph::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((target as *const lightning::routing::network_graph::NodeId<>) as *mut _) }, is_owned: false });
+ ret
+ }
+ fn payment_path_failed(&mut self, mut path: &[&lightning::routing::router::RouteHop], mut short_channel_id: u64) {
+ let mut local_path = Vec::new(); for item in path.iter() { local_path.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::routing::router::RouteHop<>) as *mut _) }, is_owned: false } }); };
+ (self.payment_path_failed)(self.this_arg, local_path.into(), short_channel_id)
+ }
+ fn payment_path_successful(&mut self, mut path: &[&lightning::routing::router::RouteHop]) {
+ let mut local_path = Vec::new(); for item in path.iter() { local_path.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::routing::router::RouteHop<>) as *mut _) }, is_owned: false } }); };
+ (self.payment_path_successful)(self.this_arg, local_path.into())
+ }
+}
+
+// We're essentially a pointer already, or at least a set of pointers, so allow us to be used
+// directly as a Deref trait in higher-level structs:
+impl std::ops::Deref for Score {
+ type Target = Self;
+ fn deref(&self) -> &Self {
+ self
+ }
+}
+/// Calls the free function if one is set
+#[no_mangle]
+pub extern "C" fn Score_free(this_ptr: Score) { }
+impl Drop for Score {
+ fn drop(&mut self) {
+ if let Some(f) = self.free {
+ f(self.this_arg);
+ }
+ }
+}
+/// A scorer that is accessed under a lock.
+///
+/// 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
+#[repr(C)]
+pub struct LockableScore {
+ /// 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.
+ pub this_arg: *mut c_void,
+ /// Returns the locked scorer.
+ #[must_use]
+ pub lock: extern "C" fn (this_arg: *const c_void) -> crate::lightning::routing::scoring::Score,
+ /// 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.
+ pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
+}
+unsafe impl Send for LockableScore {}
+unsafe impl Sync for LockableScore {}
+#[no_mangle]
+pub(crate) extern "C" fn LockableScore_clone_fields(orig: &LockableScore) -> LockableScore {
+ LockableScore {
+ this_arg: orig.this_arg,
+ lock: Clone::clone(&orig.lock),
+ free: Clone::clone(&orig.free),
+ }
+}
+
+use lightning::routing::scoring::LockableScore as rustLockableScore;
+impl<'a> rustLockableScore<'a> for LockableScore {
+ type Locked = crate::lightning::routing::scoring::Score;
+ fn lock(&'a self) -> crate::lightning::routing::scoring::Score {
+ let mut ret = (self.lock)(self.this_arg);
+ ret
+ }
+}
+
+// We're essentially a pointer already, or at least a set of pointers, so allow us to be used
+// directly as a Deref trait in higher-level structs:
+impl std::ops::Deref for LockableScore {
+ type Target = Self;
+ fn deref(&self) -> &Self {
+ self
+ }
+}
+/// Calls the free function if one is set
+#[no_mangle]
+pub extern "C" fn LockableScore_free(this_ptr: LockableScore) { }
+impl Drop for LockableScore {
+ fn drop(&mut self) {
+ if let Some(f) = self.free {
+ f(self.this_arg);
+ }
+ }
+}
+
+use lightning::routing::scoring::MultiThreadedLockableScore as nativeMultiThreadedLockableScoreImport;
+pub(crate) type nativeMultiThreadedLockableScore = nativeMultiThreadedLockableScoreImport<crate::lightning::routing::scoring::Score>;
+
+/// A concrete implementation of [`LockableScore`] which supports multi-threading.
+#[must_use]
+#[repr(C)]
+pub struct MultiThreadedLockableScore {
+ /// 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.
+ pub inner: *mut nativeMultiThreadedLockableScore,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for MultiThreadedLockableScore {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeMultiThreadedLockableScore>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn MultiThreadedLockableScore_free(this_obj: MultiThreadedLockableScore) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn MultiThreadedLockableScore_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMultiThreadedLockableScore); }
+}
+#[allow(unused)]
+impl MultiThreadedLockableScore {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeMultiThreadedLockableScore {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeMultiThreadedLockableScore {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeMultiThreadedLockableScore {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = std::ptr::null_mut();
+ ret
+ }
+}
+/// Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
+#[must_use]
+#[no_mangle]
+pub extern "C" fn MultiThreadedLockableScore_new(mut score: crate::lightning::routing::scoring::Score) -> MultiThreadedLockableScore {
+ let mut ret = lightning::routing::scoring::MultiThreadedLockableScore::new(score);
+ MultiThreadedLockableScore { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+
+use lightning::routing::scoring::Scorer as nativeScorerImport;
+pub(crate) type nativeScorer = nativeScorerImport;
+
+/// [`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. Will further penalize channels that fail to relay payments.
+///
+/// See [module-level documentation] for usage.
+///
+/// [module-level documentation]: crate::routing::scoring
+#[must_use]
+#[repr(C)]
+pub struct Scorer {
+ /// 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.
+ pub inner: *mut nativeScorer,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for Scorer {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeScorer>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn Scorer_free(this_obj: Scorer) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Scorer_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeScorer); }
+}
+#[allow(unused)]
+impl Scorer {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeScorer {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeScorer {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeScorer {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = std::ptr::null_mut();
+ ret
+ }
+}
+
+use lightning::routing::scoring::ScoringParameters as nativeScoringParametersImport;
+pub(crate) type nativeScoringParameters = nativeScoringParametersImport;
+
+/// Parameters for configuring [`Scorer`].
+#[must_use]
+#[repr(C)]
+pub struct ScoringParameters {
+ /// 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.
+ pub inner: *mut nativeScoringParameters,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for ScoringParameters {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeScoringParameters>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn ScoringParameters_free(this_obj: ScoringParameters) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ScoringParameters_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeScoringParameters); }
+}
+#[allow(unused)]
+impl ScoringParameters {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeScoringParameters {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeScoringParameters {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeScoringParameters {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = std::ptr::null_mut();
+ ret
+ }
+}
+/// A fixed penalty in msats to apply to each channel.
+///
+/// Default value: 500 msat
+#[no_mangle]
+pub extern "C" fn ScoringParameters_get_base_penalty_msat(this_ptr: &ScoringParameters) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().base_penalty_msat;
+ *inner_val
+}
+/// A fixed penalty in msats to apply to each channel.
+///
+/// Default value: 500 msat
+#[no_mangle]
+pub extern "C" fn ScoringParameters_set_base_penalty_msat(this_ptr: &mut ScoringParameters, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.base_penalty_msat = 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`] or when successfully routing through a channel.
+///
+/// Default value: 1,024,000 msat
+///
+/// [`failure_penalty_half_life`]: Self::failure_penalty_half_life
+#[no_mangle]
+pub extern "C" fn ScoringParameters_get_failure_penalty_msat(this_ptr: &ScoringParameters) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().failure_penalty_msat;
+ *inner_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`] or when successfully routing through a channel.
+///
+/// Default value: 1,024,000 msat
+///
+/// [`failure_penalty_half_life`]: Self::failure_penalty_half_life
+#[no_mangle]
+pub extern "C" fn ScoringParameters_set_failure_penalty_msat(this_ptr: &mut ScoringParameters, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.failure_penalty_msat = val;
+}
+/// When the amount being sent over a channel is this many 1024ths of the total channel
+/// capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
+///
+/// Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
+///
+/// [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
+#[no_mangle]
+pub extern "C" fn ScoringParameters_get_overuse_penalty_start_1024th(this_ptr: &ScoringParameters) -> u16 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().overuse_penalty_start_1024th;
+ *inner_val
+}
+/// When the amount being sent over a channel is this many 1024ths of the total channel
+/// capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
+///
+/// Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
+///
+/// [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
+#[no_mangle]
+pub extern "C" fn ScoringParameters_set_overuse_penalty_start_1024th(this_ptr: &mut ScoringParameters, mut val: u16) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.overuse_penalty_start_1024th = val;
+}
+/// A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
+/// over the channel exceeds [`overuse_penalty_start_1024th`] by.
+///
+/// Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
+/// to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
+///
+/// [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
+#[no_mangle]
+pub extern "C" fn ScoringParameters_get_overuse_penalty_msat_per_1024th(this_ptr: &ScoringParameters) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().overuse_penalty_msat_per_1024th;
+ *inner_val
+}
+/// A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
+/// over the channel exceeds [`overuse_penalty_start_1024th`] by.
+///
+/// Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
+/// to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
+///
+/// [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
+#[no_mangle]
+pub extern "C" fn ScoringParameters_set_overuse_penalty_msat_per_1024th(this_ptr: &mut ScoringParameters, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.overuse_penalty_msat_per_1024th = val;
+}
+/// The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
+/// cut in half.
+///
+/// Successfully routing through a channel will immediately cut the penalty in half as well.
+///
+/// # Note
+///
+/// When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
+/// never decay.
+///
+/// [`failure_penalty_msat`]: Self::failure_penalty_msat
+#[no_mangle]
+pub extern "C" fn ScoringParameters_get_failure_penalty_half_life(this_ptr: &ScoringParameters) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().failure_penalty_half_life;
+ inner_val.as_secs()
+}
+/// The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
+/// cut in half.
+///
+/// Successfully routing through a channel will immediately cut the penalty in half as well.
+///
+/// # Note
+///
+/// When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
+/// never decay.
+///
+/// [`failure_penalty_msat`]: Self::failure_penalty_msat
+#[no_mangle]
+pub extern "C" fn ScoringParameters_set_failure_penalty_half_life(this_ptr: &mut ScoringParameters, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.failure_penalty_half_life = std::time::Duration::from_secs(val);
+}
+/// Constructs a new ScoringParameters given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ScoringParameters_new(mut base_penalty_msat_arg: u64, mut failure_penalty_msat_arg: u64, mut overuse_penalty_start_1024th_arg: u16, mut overuse_penalty_msat_per_1024th_arg: u64, mut failure_penalty_half_life_arg: u64) -> ScoringParameters {
+ ScoringParameters { inner: ObjOps::heap_alloc(nativeScoringParameters {
+ base_penalty_msat: base_penalty_msat_arg,
+ failure_penalty_msat: failure_penalty_msat_arg,
+ overuse_penalty_start_1024th: overuse_penalty_start_1024th_arg,
+ overuse_penalty_msat_per_1024th: overuse_penalty_msat_per_1024th_arg,
+ failure_penalty_half_life: std::time::Duration::from_secs(failure_penalty_half_life_arg),
+ }), is_owned: true }
+}
+#[no_mangle]
+/// Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
+pub extern "C" fn ScoringParameters_write(obj: &ScoringParameters) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+}
+#[no_mangle]
+pub(crate) extern "C" fn ScoringParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeScoringParameters) })
+}
+#[no_mangle]
+/// Read a ScoringParameters from a byte array, created by ScoringParameters_write
+pub extern "C" fn ScoringParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ScoringParametersDecodeErrorZ {
+ let res: Result<lightning::routing::scoring::ScoringParameters, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scoring::ScoringParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_res
+}
+/// Creates a new scorer using the given scoring parameters.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Scorer_new(mut params: crate::lightning::routing::scoring::ScoringParameters) -> Scorer {
+ let mut ret = lightning::routing::scoring::Scorer::new(*unsafe { Box::from_raw(params.take_inner()) });
+ Scorer { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+/// Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Scorer_default() -> Scorer {
+ Scorer { inner: ObjOps::heap_alloc(Default::default()), is_owned: true }
+}
+/// Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ScoringParameters_default() -> ScoringParameters {
+ ScoringParameters { inner: ObjOps::heap_alloc(Default::default()), is_owned: true }
+}
+impl From<nativeScorer> for crate::lightning::routing::scoring::Score {
+ fn from(obj: nativeScorer) -> Self {
+ let mut rust_obj = Scorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let mut ret = Scorer_as_Score(&rust_obj);
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn
+ rust_obj.inner = std::ptr::null_mut();
+ ret.free = Some(Scorer_free_void);
+ ret
+ }
+}
+/// 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
+#[no_mangle]
+pub extern "C" fn Scorer_as_Score(this_arg: &Scorer) -> crate::lightning::routing::scoring::Score {
+ crate::lightning::routing::scoring::Score {
+ this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
+ free: None,
+ channel_penalty_msat: Scorer_Score_channel_penalty_msat,
+ payment_path_failed: Scorer_Score_payment_path_failed,
+ payment_path_successful: Scorer_Score_payment_path_successful,
+ write: Scorer_write_void,
+ }
+}
+
+#[must_use]
+extern "C" fn Scorer_Score_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, mut send_amt_msat: u64, mut chan_capacity_opt: crate::c_types::derived::COption_u64Z, _source: &crate::lightning::routing::network_graph::NodeId, _target: &crate::lightning::routing::network_graph::NodeId) -> u64 {
+ let mut local_chan_capacity_opt = if chan_capacity_opt.is_some() { Some( { chan_capacity_opt.take() }) } else { None };
+ let mut ret = <nativeScorer as lightning::routing::scoring::Score<>>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeScorer) }, short_channel_id, send_amt_msat, local_chan_capacity_opt, _source.get_native_ref(), _target.get_native_ref());
+ ret
+}
+extern "C" fn Scorer_Score_payment_path_failed(this_arg: *mut c_void, mut _path: crate::c_types::derived::CVec_RouteHopZ, mut short_channel_id: u64) {
+ let mut local__path = Vec::new(); for mut item in _path.as_slice().iter() { local__path.push( { item.get_native_ref() }); };
+ <nativeScorer as lightning::routing::scoring::Score<>>::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeScorer) }, &local__path[..], short_channel_id)
+}
+extern "C" fn Scorer_Score_payment_path_successful(this_arg: *mut c_void, mut path: crate::c_types::derived::CVec_RouteHopZ) {
+ let mut local_path = Vec::new(); for mut item in path.as_slice().iter() { local_path.push( { item.get_native_ref() }); };
+ <nativeScorer as lightning::routing::scoring::Score<>>::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeScorer) }, &local_path[..])
+}
+
+#[no_mangle]
+/// Serialize the Scorer object into a byte array which can be read by Scorer_read
+pub extern "C" fn Scorer_write(obj: &Scorer) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+}
+#[no_mangle]
+pub(crate) extern "C" fn Scorer_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeScorer) })
+}
+#[no_mangle]
+/// Read a Scorer from a byte array, created by Scorer_write
+pub extern "C" fn Scorer_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ScorerDecodeErrorZ {
+ let res: Result<lightning::routing::scoring::Scorer, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
+ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scoring::Scorer { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_res
+}
+mod time {
+
+use std::str::FromStr;
+use std::ffi::c_void;
+use core::convert::Infallible;
+use bitcoin::hashes::Hash;
+use crate::c_types::*;
+
+}
pub extern "C" fn UserConfig_set_accept_forwards_to_priv_channels(this_ptr: &mut UserConfig, mut val: bool) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.accept_forwards_to_priv_channels = val;
}
+/// If this is set to false, we do not accept inbound requests to open a new channel.
+/// Default value: true.
+#[no_mangle]
+pub extern "C" fn UserConfig_get_accept_inbound_channels(this_ptr: &UserConfig) -> bool {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().accept_inbound_channels;
+ *inner_val
+}
+/// If this is set to false, we do not accept inbound requests to open a new channel.
+/// Default value: true.
+#[no_mangle]
+pub extern "C" fn UserConfig_set_accept_inbound_channels(this_ptr: &mut UserConfig, mut val: bool) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.accept_inbound_channels = val;
+}
/// Constructs a new UserConfig given each field
#[must_use]
#[no_mangle]
-pub extern "C" fn UserConfig_new(mut own_channel_config_arg: crate::lightning::util::config::ChannelHandshakeConfig, mut peer_channel_config_limits_arg: crate::lightning::util::config::ChannelHandshakeLimits, mut channel_options_arg: crate::lightning::util::config::ChannelConfig, mut accept_forwards_to_priv_channels_arg: bool) -> UserConfig {
+pub extern "C" fn UserConfig_new(mut own_channel_config_arg: crate::lightning::util::config::ChannelHandshakeConfig, mut peer_channel_config_limits_arg: crate::lightning::util::config::ChannelHandshakeLimits, mut channel_options_arg: crate::lightning::util::config::ChannelConfig, mut accept_forwards_to_priv_channels_arg: bool, mut accept_inbound_channels_arg: bool) -> UserConfig {
UserConfig { inner: ObjOps::heap_alloc(nativeUserConfig {
own_channel_config: *unsafe { Box::from_raw(own_channel_config_arg.take_inner()) },
peer_channel_config_limits: *unsafe { Box::from_raw(peer_channel_config_limits_arg.take_inner()) },
channel_options: *unsafe { Box::from_raw(channel_options_arg.take_inner()) },
accept_forwards_to_priv_channels: accept_forwards_to_priv_channels_arg,
+ accept_inbound_channels: accept_inbound_channels_arg,
}), is_owned: true }
}
impl Clone for UserConfig {
/// [`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
payment_secret: crate::c_types::ThirtyTwoBytes,
- /// 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
- user_payment_id: u64,
},
/// Because this is a spontaneous payment, the payer generated their own preimage rather than us
/// (the payee) providing a preimage.
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativePaymentPurpose {
match self {
- PaymentPurpose::InvoicePayment {ref payment_preimage, ref payment_secret, ref user_payment_id, } => {
+ PaymentPurpose::InvoicePayment {ref payment_preimage, ref payment_secret, } => {
let mut payment_preimage_nonref = (*payment_preimage).clone();
let mut local_payment_preimage_nonref = if payment_preimage_nonref.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentPreimage(payment_preimage_nonref.data) }) };
let mut payment_secret_nonref = (*payment_secret).clone();
- let mut user_payment_id_nonref = (*user_payment_id).clone();
nativePaymentPurpose::InvoicePayment {
payment_preimage: local_payment_preimage_nonref,
payment_secret: ::lightning::ln::PaymentSecret(payment_secret_nonref.data),
- user_payment_id: user_payment_id_nonref,
}
},
PaymentPurpose::SpontaneousPayment (ref a, ) => {
#[allow(unused)]
pub(crate) fn into_native(self) -> nativePaymentPurpose {
match self {
- PaymentPurpose::InvoicePayment {mut payment_preimage, mut payment_secret, mut user_payment_id, } => {
+ PaymentPurpose::InvoicePayment {mut payment_preimage, mut payment_secret, } => {
let mut local_payment_preimage = if payment_preimage.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentPreimage(payment_preimage.data) }) };
nativePaymentPurpose::InvoicePayment {
payment_preimage: local_payment_preimage,
payment_secret: ::lightning::ln::PaymentSecret(payment_secret.data),
- user_payment_id: user_payment_id,
}
},
PaymentPurpose::SpontaneousPayment (mut a, ) => {
#[allow(unused)]
pub(crate) fn from_native(native: &nativePaymentPurpose) -> Self {
match native {
- nativePaymentPurpose::InvoicePayment {ref payment_preimage, ref payment_secret, ref user_payment_id, } => {
+ nativePaymentPurpose::InvoicePayment {ref payment_preimage, ref payment_secret, } => {
let mut payment_preimage_nonref = (*payment_preimage).clone();
let mut local_payment_preimage_nonref = if payment_preimage_nonref.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_preimage_nonref.unwrap()).0 } } };
let mut payment_secret_nonref = (*payment_secret).clone();
- let mut user_payment_id_nonref = (*user_payment_id).clone();
PaymentPurpose::InvoicePayment {
payment_preimage: local_payment_preimage_nonref,
payment_secret: crate::c_types::ThirtyTwoBytes { data: payment_secret_nonref.0 },
- user_payment_id: user_payment_id_nonref,
}
},
nativePaymentPurpose::SpontaneousPayment (ref a, ) => {
#[allow(unused)]
pub(crate) fn native_into(native: nativePaymentPurpose) -> Self {
match native {
- nativePaymentPurpose::InvoicePayment {mut payment_preimage, mut payment_secret, mut user_payment_id, } => {
+ nativePaymentPurpose::InvoicePayment {mut payment_preimage, mut payment_secret, } => {
let mut local_payment_preimage = if payment_preimage.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_preimage.unwrap()).0 } } };
PaymentPurpose::InvoicePayment {
payment_preimage: local_payment_preimage,
payment_secret: crate::c_types::ThirtyTwoBytes { data: payment_secret.0 },
- user_payment_id: user_payment_id,
}
},
nativePaymentPurpose::SpontaneousPayment (mut a, ) => {
}
#[no_mangle]
/// Utility method to constructs a new InvoicePayment-variant PaymentPurpose
-pub extern "C" fn PaymentPurpose_invoice_payment(payment_preimage: crate::c_types::ThirtyTwoBytes, payment_secret: crate::c_types::ThirtyTwoBytes, user_payment_id: u64) -> PaymentPurpose {
+pub extern "C" fn PaymentPurpose_invoice_payment(payment_preimage: crate::c_types::ThirtyTwoBytes, payment_secret: crate::c_types::ThirtyTwoBytes) -> PaymentPurpose {
PaymentPurpose::InvoicePayment {
payment_preimage,
payment_secret,
- user_payment_id,
}
}
#[no_mangle]
/// commitment transaction came from our counterparty, but it may also have come from
/// a copy of our own `ChannelMonitor`.
CommitmentTxConfirmed,
+ /// The funding transaction failed to confirm in a timely manner on an inbound channel.
+ FundingTimedOut,
/// Closure generated from processing an event, likely a HTLC forward/relay/reception.
ProcessingError {
/// A developer-readable error message which we generated.
ClosureReason::HolderForceClosed => nativeClosureReason::HolderForceClosed,
ClosureReason::CooperativeClosure => nativeClosureReason::CooperativeClosure,
ClosureReason::CommitmentTxConfirmed => nativeClosureReason::CommitmentTxConfirmed,
+ ClosureReason::FundingTimedOut => nativeClosureReason::FundingTimedOut,
ClosureReason::ProcessingError {ref err, } => {
let mut err_nonref = (*err).clone();
nativeClosureReason::ProcessingError {
ClosureReason::HolderForceClosed => nativeClosureReason::HolderForceClosed,
ClosureReason::CooperativeClosure => nativeClosureReason::CooperativeClosure,
ClosureReason::CommitmentTxConfirmed => nativeClosureReason::CommitmentTxConfirmed,
+ ClosureReason::FundingTimedOut => nativeClosureReason::FundingTimedOut,
ClosureReason::ProcessingError {mut err, } => {
nativeClosureReason::ProcessingError {
err: err.into_string(),
nativeClosureReason::HolderForceClosed => ClosureReason::HolderForceClosed,
nativeClosureReason::CooperativeClosure => ClosureReason::CooperativeClosure,
nativeClosureReason::CommitmentTxConfirmed => ClosureReason::CommitmentTxConfirmed,
+ nativeClosureReason::FundingTimedOut => ClosureReason::FundingTimedOut,
nativeClosureReason::ProcessingError {ref err, } => {
let mut err_nonref = (*err).clone();
ClosureReason::ProcessingError {
nativeClosureReason::HolderForceClosed => ClosureReason::HolderForceClosed,
nativeClosureReason::CooperativeClosure => ClosureReason::CooperativeClosure,
nativeClosureReason::CommitmentTxConfirmed => ClosureReason::CommitmentTxConfirmed,
+ nativeClosureReason::FundingTimedOut => ClosureReason::FundingTimedOut,
nativeClosureReason::ProcessingError {mut err, } => {
ClosureReason::ProcessingError {
err: err.into(),
pub extern "C" fn ClosureReason_commitment_tx_confirmed() -> ClosureReason {
ClosureReason::CommitmentTxConfirmed}
#[no_mangle]
+/// Utility method to constructs a new FundingTimedOut-variant ClosureReason
+pub extern "C" fn ClosureReason_funding_timed_out() -> ClosureReason {
+ ClosureReason::FundingTimedOut}
+#[no_mangle]
/// Utility method to constructs a new ProcessingError-variant ClosureReason
pub extern "C" fn ClosureReason_processing_error(err: crate::c_types::Str) -> ClosureReason {
ClosureReason::ProcessingError {
#[repr(C)]
pub enum Event {
/// 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.
+ /// 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!
+ ///
+ /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ /// [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
FundingGenerationReady {
/// The random channel_id we picked which you'll need to pass into
/// ChannelManager::funding_transaction_generated.
/// [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
/// automatically failed.
///
+ /// # Note
+ /// LDK will not stop an inbound payment from being paid multiple times, so multiple
+ /// `PaymentReceived` events may be generated for the same payment.
+ ///
/// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
/// [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
PaymentReceived {
- /// The hash for which the preimage should be handed to the ChannelManager.
+ /// The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
+ /// not stop you from registering duplicate payment hashes for inbound payments.
payment_hash: crate::c_types::ThirtyTwoBytes,
/// The value, in thousandths of a satoshi, that this payment is for.
amt: u64,
/// Note that this serves as a payment receipt, if you wish to have such a thing, you must
/// store it somehow!
payment_preimage: crate::c_types::ThirtyTwoBytes,
- /// The hash which was given to [`ChannelManager::send_payment`].
+ /// The hash that was given to [`ChannelManager::send_payment`].
///
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
payment_hash: crate::c_types::ThirtyTwoBytes,
/// [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
fee_paid_msat: crate::c_types::derived::COption_u64Z,
},
- /// Indicates an outbound payment we made failed. Probably some intermediary node dropped
+ /// Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
/// something. You may wish to retry with a different route.
+ ///
+ /// Note that this does *not* indicate that all paths for an MPP payment have failed, see
+ /// [`Event::PaymentFailed`] and [`all_paths_failed`].
+ ///
+ /// [`all_paths_failed`]: Self::all_paths_failed
PaymentPathFailed {
/// The id returned by [`ChannelManager::send_payment`] and used with
- /// [`ChannelManager::retry_payment`].
+ /// [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
///
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
/// [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+ /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
///
/// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
payment_id: crate::c_types::ThirtyTwoBytes,
- /// The hash which was given to ChannelManager::send_payment.
+ /// The hash that was given to [`ChannelManager::send_payment`].
+ ///
+ /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
payment_hash: crate::c_types::ThirtyTwoBytes,
/// 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
/// 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.
+ ///
+ /// Note that if you are retrying individual MPP parts, using this value to determine if a
+ /// payment has fully failed is race-y. Because multiple failures can happen prior to events
+ /// being processed, you may retry in response to a first failure, with a second failure
+ /// (with `all_paths_failed` set) still pending. Then, when the second failure is processed
+ /// you will see `all_paths_failed` set even though the retry of the first failure still
+ /// has an associated in-flight HTLC. See (1) for an example of such a failure.
+ ///
+ /// If you wish to retry individual MPP parts and learn when a payment has failed, you must
+ /// call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
+ ///
+ /// (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
+ ///
+ /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
all_paths_failed: bool,
/// The payment path that failed.
path: crate::c_types::derived::CVec_RouteHopZ,
/// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
retry: crate::lightning::routing::router::RouteParameters,
},
- /// Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
- /// time in the future.
+ /// Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
+ /// provide failure information for each MPP part in the payment.
+ ///
+ /// This event is provided once there are no further pending HTLCs for the payment and the
+ /// payment is no longer retryable, either due to a several-block timeout or because
+ /// [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
+ ///
+ /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+ PaymentFailed {
+ /// The id returned by [`ChannelManager::send_payment`] and used with
+ /// [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
+ ///
+ /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ /// [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+ /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+ payment_id: crate::c_types::ThirtyTwoBytes,
+ /// The hash that was given to [`ChannelManager::send_payment`].
+ ///
+ /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ payment_hash: crate::c_types::ThirtyTwoBytes,
+ },
+ /// Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
+ /// a time in the future.
+ ///
+ /// [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
PendingHTLCsForwardable {
/// The minimum amount of time that should be waited prior to calling
/// process_pending_htlc_forwards. To increase the effort required to correlate payments,
/// The full transaction received from the user
transaction: crate::c_types::Transaction,
},
+ /// Indicates that a path for an outbound payment was successful.
+ ///
+ /// Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
+ /// [`Event::PaymentSent`] for obtaining the payment preimage.
+ PaymentPathSuccessful {
+ /// 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
+ payment_id: crate::c_types::ThirtyTwoBytes,
+ /// The hash that was given to [`ChannelManager::send_payment`].
+ ///
+ /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ ///
+ /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ payment_hash: crate::c_types::ThirtyTwoBytes,
+ /// The payment path that was successful.
+ ///
+ /// May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
+ path: crate::c_types::derived::CVec_RouteHopZ,
+ },
}
use lightning::util::events::Event as nativeEvent;
impl Event {
retry: local_retry_nonref,
}
},
+ Event::PaymentFailed {ref payment_id, ref payment_hash, } => {
+ let mut payment_id_nonref = (*payment_id).clone();
+ let mut payment_hash_nonref = (*payment_hash).clone();
+ nativeEvent::PaymentFailed {
+ payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data),
+ payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data),
+ }
+ },
Event::PendingHTLCsForwardable {ref time_forwardable, } => {
let mut time_forwardable_nonref = (*time_forwardable).clone();
nativeEvent::PendingHTLCsForwardable {
transaction: transaction_nonref.into_bitcoin(),
}
},
+ Event::PaymentPathSuccessful {ref payment_id, ref payment_hash, ref path, } => {
+ let mut payment_id_nonref = (*payment_id).clone();
+ let mut payment_hash_nonref = (*payment_hash).clone();
+ let mut local_payment_hash_nonref = if payment_hash_nonref.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentHash(payment_hash_nonref.data) }) };
+ let mut path_nonref = (*path).clone();
+ let mut local_path_nonref = Vec::new(); for mut item in path_nonref.into_rust().drain(..) { local_path_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
+ nativeEvent::PaymentPathSuccessful {
+ payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data),
+ payment_hash: local_payment_hash_nonref,
+ path: local_path_nonref,
+ }
+ },
}
}
#[allow(unused)]
retry: local_retry,
}
},
+ Event::PaymentFailed {mut payment_id, mut payment_hash, } => {
+ nativeEvent::PaymentFailed {
+ payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data),
+ payment_hash: ::lightning::ln::PaymentHash(payment_hash.data),
+ }
+ },
Event::PendingHTLCsForwardable {mut time_forwardable, } => {
nativeEvent::PendingHTLCsForwardable {
time_forwardable: std::time::Duration::from_secs(time_forwardable),
transaction: transaction.into_bitcoin(),
}
},
+ Event::PaymentPathSuccessful {mut payment_id, mut payment_hash, mut path, } => {
+ let mut local_payment_hash = if payment_hash.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentHash(payment_hash.data) }) };
+ let mut local_path = Vec::new(); for mut item in path.into_rust().drain(..) { local_path.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
+ nativeEvent::PaymentPathSuccessful {
+ payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data),
+ payment_hash: local_payment_hash,
+ path: local_path,
+ }
+ },
}
}
#[allow(unused)]
retry: local_retry_nonref,
}
},
+ nativeEvent::PaymentFailed {ref payment_id, ref payment_hash, } => {
+ let mut payment_id_nonref = (*payment_id).clone();
+ let mut payment_hash_nonref = (*payment_hash).clone();
+ Event::PaymentFailed {
+ payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 },
+ payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 },
+ }
+ },
nativeEvent::PendingHTLCsForwardable {ref time_forwardable, } => {
let mut time_forwardable_nonref = (*time_forwardable).clone();
Event::PendingHTLCsForwardable {
transaction: crate::c_types::Transaction::from_bitcoin(&transaction_nonref),
}
},
+ nativeEvent::PaymentPathSuccessful {ref payment_id, ref payment_hash, ref path, } => {
+ let mut payment_id_nonref = (*payment_id).clone();
+ let mut payment_hash_nonref = (*payment_hash).clone();
+ let mut local_payment_hash_nonref = if payment_hash_nonref.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_hash_nonref.unwrap()).0 } } };
+ let mut path_nonref = (*path).clone();
+ let mut local_path_nonref = Vec::new(); for mut item in path_nonref.drain(..) { local_path_nonref.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
+ Event::PaymentPathSuccessful {
+ payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 },
+ payment_hash: local_payment_hash_nonref,
+ path: local_path_nonref.into(),
+ }
+ },
}
}
#[allow(unused)]
retry: local_retry,
}
},
+ nativeEvent::PaymentFailed {mut payment_id, mut payment_hash, } => {
+ Event::PaymentFailed {
+ payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 },
+ payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 },
+ }
+ },
nativeEvent::PendingHTLCsForwardable {mut time_forwardable, } => {
Event::PendingHTLCsForwardable {
time_forwardable: time_forwardable.as_secs(),
transaction: crate::c_types::Transaction::from_bitcoin(&transaction),
}
},
+ nativeEvent::PaymentPathSuccessful {mut payment_id, mut payment_hash, mut path, } => {
+ let mut local_payment_hash = if payment_hash.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_hash.unwrap()).0 } } };
+ let mut local_path = Vec::new(); for mut item in path.drain(..) { local_path.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
+ Event::PaymentPathSuccessful {
+ payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 },
+ payment_hash: local_payment_hash,
+ path: local_path.into(),
+ }
+ },
}
}
}
}
}
#[no_mangle]
+/// Utility method to constructs a new PaymentFailed-variant Event
+pub extern "C" fn Event_payment_failed(payment_id: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes) -> Event {
+ Event::PaymentFailed {
+ payment_id,
+ payment_hash,
+ }
+}
+#[no_mangle]
/// Utility method to constructs a new PendingHTLCsForwardable-variant Event
pub extern "C" fn Event_pending_htlcs_forwardable(time_forwardable: u64) -> Event {
Event::PendingHTLCsForwardable {
}
}
#[no_mangle]
+/// Utility method to constructs a new PaymentPathSuccessful-variant Event
+pub extern "C" fn Event_payment_path_successful(payment_id: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes, path: crate::c_types::derived::CVec_RouteHopZ) -> Event {
+ Event::PaymentPathSuccessful {
+ payment_id,
+ payment_hash,
+ path,
+ }
+}
+#[no_mangle]
/// Serialize the Event object into a byte array which can be read by Event_read
pub extern "C" fn Event_write(obj: &Event) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
#[derive(Clone)]
#[repr(C)]
pub enum Level {
+ /// Designates extremely verbose information, including gossip-induced messages
+ Gossip,
/// Designates very low priority, often extremely verbose, information
Trace,
/// Designates lower priority information
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeLevel {
match self {
+ Level::Gossip => nativeLevel::Gossip,
Level::Trace => nativeLevel::Trace,
Level::Debug => nativeLevel::Debug,
Level::Info => nativeLevel::Info,
#[allow(unused)]
pub(crate) fn into_native(self) -> nativeLevel {
match self {
+ Level::Gossip => nativeLevel::Gossip,
Level::Trace => nativeLevel::Trace,
Level::Debug => nativeLevel::Debug,
Level::Info => nativeLevel::Info,
#[allow(unused)]
pub(crate) fn from_native(native: &nativeLevel) -> Self {
match native {
+ nativeLevel::Gossip => Level::Gossip,
nativeLevel::Trace => Level::Trace,
nativeLevel::Debug => Level::Debug,
nativeLevel::Info => Level::Info,
#[allow(unused)]
pub(crate) fn native_into(native: nativeLevel) -> Self {
match native {
+ nativeLevel::Gossip => Level::Gossip,
nativeLevel::Trace => Level::Trace,
nativeLevel::Debug => Level::Debug,
nativeLevel::Info => Level::Info,
orig.clone()
}
#[no_mangle]
+/// Utility method to constructs a new Gossip-variant Level
+pub extern "C" fn Level_gossip() -> Level {
+ Level::Gossip}
+#[no_mangle]
/// Utility method to constructs a new Trace-variant Level
pub extern "C" fn Level_trace() -> Level {
Level::Trace}
/// [`ChannelManager`] persistence should be done in the background.
/// * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
/// at the appropriate intervals.
+/// * Calling [`NetworkGraph::remove_stale_channels`] (if a [`NetGraphMsgHandler`] is provided to
+/// [`BackgroundProcessor::start`]).
///
/// It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
/// upon as doing so may result in high latency.
/// functionality implemented by other handlers.
/// * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
///
-/// [top-level documentation]: Self
+/// [top-level documentation]: BackgroundProcessor
/// [`join`]: Self::join
/// [`stop`]: Self::stop
/// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
TimestampOutOfBounds,
/// The supplied expiry time could cause an overflow if added to a `PositiveTimestamp`
ExpiryTimeOutOfBounds,
+ /// The supplied millisatoshi amount was greater than the total bitcoin supply.
+ InvalidAmount,
}
use lightning_invoice::CreationError as nativeCreationError;
impl CreationError {
CreationError::RouteTooLong => nativeCreationError::RouteTooLong,
CreationError::TimestampOutOfBounds => nativeCreationError::TimestampOutOfBounds,
CreationError::ExpiryTimeOutOfBounds => nativeCreationError::ExpiryTimeOutOfBounds,
+ CreationError::InvalidAmount => nativeCreationError::InvalidAmount,
}
}
#[allow(unused)]
CreationError::RouteTooLong => nativeCreationError::RouteTooLong,
CreationError::TimestampOutOfBounds => nativeCreationError::TimestampOutOfBounds,
CreationError::ExpiryTimeOutOfBounds => nativeCreationError::ExpiryTimeOutOfBounds,
+ CreationError::InvalidAmount => nativeCreationError::InvalidAmount,
}
}
#[allow(unused)]
nativeCreationError::RouteTooLong => CreationError::RouteTooLong,
nativeCreationError::TimestampOutOfBounds => CreationError::TimestampOutOfBounds,
nativeCreationError::ExpiryTimeOutOfBounds => CreationError::ExpiryTimeOutOfBounds,
+ nativeCreationError::InvalidAmount => CreationError::InvalidAmount,
}
}
#[allow(unused)]
nativeCreationError::RouteTooLong => CreationError::RouteTooLong,
nativeCreationError::TimestampOutOfBounds => CreationError::TimestampOutOfBounds,
nativeCreationError::ExpiryTimeOutOfBounds => CreationError::ExpiryTimeOutOfBounds,
+ nativeCreationError::InvalidAmount => CreationError::InvalidAmount,
}
}
}
/// Utility method to constructs a new ExpiryTimeOutOfBounds-variant CreationError
pub extern "C" fn CreationError_expiry_time_out_of_bounds() -> CreationError {
CreationError::ExpiryTimeOutOfBounds}
+#[no_mangle]
+/// Utility method to constructs a new InvalidAmount-variant CreationError
+pub extern "C" fn CreationError_invalid_amount() -> CreationError {
+ CreationError::InvalidAmount}
/// Checks if two CreationErrors contain equal inner contents.
/// This ignores pointers and is_owned flags and looks at the values in fields.
#[no_mangle]
// license as that which applies to the original source files from which this
// source was automatically generated.
-//! A module for paying Lightning invoices.
+//! A module for paying Lightning invoices and sending spontaneous payments.
//!
-//! Defines an [`InvoicePayer`] utility for paying invoices, parameterized by [`Payer`] and
+//! Defines an [`InvoicePayer`] utility for sending payments, parameterized by [`Payer`] and
//! [`Router`] traits. Implementations of [`Payer`] provide the payer's node id, channels, and means
//! to send a payment over a [`Route`]. Implementations of [`Router`] find a [`Route`] between payer
-//! and payee using information provided by the payer and from the payee's [`Invoice`].
+//! and payee using information provided by the payer and from the payee's [`Invoice`], when
+//! applicable.
+//!
+//! [`InvoicePayer`] is parameterized by a [`LockableScore`], which it uses for scoring failed and
+//! successful payment paths upon receiving [`Event::PaymentPathFailed`] and
+//! [`Event::PaymentPathSuccessful`] events, respectively.
//!
//! [`InvoicePayer`] is capable of retrying failed payments. It accomplishes this by implementing
//! [`EventHandler`] which decorates a user-provided handler. It will intercept any
//! # extern crate lightning_invoice;
//! # extern crate secp256k1;
//! #
-//! # use lightning::ln::{PaymentHash, PaymentSecret};
+//! # use lightning::ln::{PaymentHash, PaymentPreimage, PaymentSecret};
//! # use lightning::ln::channelmanager::{ChannelDetails, PaymentId, PaymentSendFailure};
//! # use lightning::ln::msgs::LightningError;
-//! # use lightning::routing::{self, LockableScore};
+//! # use lightning::routing::scoring::Score;
//! # use lightning::routing::network_graph::NodeId;
//! # use lightning::routing::router::{Route, RouteHop, RouteParameters};
//! # use lightning::util::events::{Event, EventHandler, EventsProvider};
//! # use lightning::util::logger::{Logger, Record};
+//! # use lightning::util::ser::{Writeable, Writer};
//! # use lightning_invoice::Invoice;
//! # use lightning_invoice::payment::{InvoicePayer, Payer, RetryAttempts, Router};
//! # use secp256k1::key::PublicKey;
//! # fn send_payment(
//! # &self, route: &Route, payment_hash: PaymentHash, payment_secret: &Option<PaymentSecret>
//! # ) -> Result<PaymentId, PaymentSendFailure> { unimplemented!() }
+//! # fn send_spontaneous_payment(
+//! # &self, route: &Route, payment_preimage: PaymentPreimage
+//! # ) -> Result<PaymentId, PaymentSendFailure> { unimplemented!() }
//! # fn retry_payment(
//! # &self, route: &Route, payment_id: PaymentId
//! # ) -> Result<(), PaymentSendFailure> { unimplemented!() }
+//! # fn abandon_payment(&self, payment_id: PaymentId) { unimplemented!() }
//! # }
//! #
-//! # struct FakeRouter {};
-//! # impl<S: routing::Score> Router<S> for FakeRouter {
+//! # struct FakeRouter {}
+//! # impl<S: Score> Router<S> for FakeRouter {
//! # fn find_route(
-//! # &self, payer: &PublicKey, params: &RouteParameters,
+//! # &self, payer: &PublicKey, params: &RouteParameters, payment_hash: &PaymentHash,
//! # first_hops: Option<&[&ChannelDetails]>, scorer: &S
//! # ) -> Result<Route, LightningError> { unimplemented!() }
//! # }
//! #
-//! # struct FakeScorer {};
-//! # impl lightning::util::ser::Writeable for FakeScorer {
-//! # fn write<W: lightning::util::ser::Writer>(&self, _: &mut W) -> Result<(), std::io::Error> { unreachable!(); }
+//! # struct FakeScorer {}
+//! # impl Writeable for FakeScorer {
+//! # fn write<W: Writer>(&self, w: &mut W) -> Result<(), std::io::Error> { unimplemented!(); }
//! # }
-//! # impl routing::Score for FakeScorer {
+//! # impl Score for FakeScorer {
//! # fn channel_penalty_msat(
-//! # &self, _short_channel_id: u64, _source: &NodeId, _target: &NodeId
+//! # &self, _short_channel_id: u64, _send_amt: u64, _chan_amt: Option<u64>, _source: &NodeId, _target: &NodeId
//! # ) -> u64 { 0 }
//! # fn payment_path_failed(&mut self, _path: &[&RouteHop], _short_channel_id: u64) {}
+//! # fn payment_path_successful(&mut self, _path: &[&RouteHop]) {}
//! # }
//! #
-//! # struct FakeLogger {};
+//! # struct FakeLogger {}
//! # impl Logger for FakeLogger {
//! # fn log(&self, record: &Record) { unimplemented!() }
//! # }
//! };
//! # let payer = FakePayer {};
//! # let router = FakeRouter {};
-//! # let scorer = LockableScore::new(FakeScorer {});
+//! # let scorer = RefCell::new(FakeScorer {});
//! # let logger = FakeLogger {};
//! let invoice_payer = InvoicePayer::new(&payer, router, &scorer, &logger, event_handler, RetryAttempts(2));
//!
//! let invoice = \"...\";
-//! let invoice = invoice.parse::<Invoice>().unwrap();
-//! invoice_payer.pay_invoice(&invoice).unwrap();
+//! if let Ok(invoice) = invoice.parse::<Invoice>() {
+//! invoice_payer.pay_invoice(&invoice).unwrap();
//!
//! # let event_provider = FakeEventProvider {};
-//! loop {
-//! event_provider.process_pending_events(&invoice_payer);
+//! loop {
+//! event_provider.process_pending_events(&invoice_payer);
+//! }
//! }
//! # }
//! ```
use lightning_invoice::payment::InvoicePayer as nativeInvoicePayerImport;
-pub(crate) type nativeInvoicePayer = nativeInvoicePayerImport<crate::lightning_invoice::payment::Payer, crate::lightning_invoice::payment::Router, crate::lightning::routing::Score, &'static lightning::routing::LockableScore<crate::lightning::routing::Score>, crate::lightning::util::logger::Logger, crate::lightning::util::events::EventHandler>;
+pub(crate) type nativeInvoicePayer = nativeInvoicePayerImport<crate::lightning_invoice::payment::Payer, crate::lightning::routing::scoring::Score, crate::lightning_invoice::payment::Router, &'static lightning::routing::scoring::MultiThreadedLockableScore<crate::lightning::routing::scoring::Score>, crate::lightning::util::logger::Logger, crate::lightning::util::events::EventHandler>;
-/// A utility for paying [`Invoice]`s.
+/// A utility for paying [`Invoice`]s and sending spontaneous payments.
+///
+/// See [module-level documentation] for details.
+///
+/// [module-level documentation]: crate::payment
#[must_use]
#[repr(C)]
pub struct InvoicePayer {
/// Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
#[must_use]
pub send_payment: extern "C" fn (this_arg: *const c_void, route: &crate::lightning::routing::router::Route, payment_hash: crate::c_types::ThirtyTwoBytes, payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentIdPaymentSendFailureZ,
+ /// Sends a spontaneous payment over the Lightning Network using the given [`Route`].
+ #[must_use]
+ pub send_spontaneous_payment: extern "C" fn (this_arg: *const c_void, route: &crate::lightning::routing::router::Route, payment_preimage: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentIdPaymentSendFailureZ,
/// Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
#[must_use]
pub retry_payment: extern "C" fn (this_arg: *const c_void, route: &crate::lightning::routing::router::Route, payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ,
+ /// Signals that no further retries for the given payment will occur.
+ pub abandon_payment: extern "C" fn (this_arg: *const c_void, payment_id: crate::c_types::ThirtyTwoBytes),
/// 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.
pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
node_id: Clone::clone(&orig.node_id),
first_hops: Clone::clone(&orig.first_hops),
send_payment: Clone::clone(&orig.send_payment),
+ send_spontaneous_payment: Clone::clone(&orig.send_spontaneous_payment),
retry_payment: Clone::clone(&orig.retry_payment),
+ abandon_payment: Clone::clone(&orig.abandon_payment),
free: Clone::clone(&orig.free),
}
}
let mut local_ret = match ret.result_ok { true => Ok( { ::lightning::ln::channelmanager::PaymentId((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).data) }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })};
local_ret
}
+ fn send_spontaneous_payment(&self, mut route: &lightning::routing::router::Route, mut payment_preimage: lightning::ln::PaymentPreimage) -> Result<lightning::ln::channelmanager::PaymentId, lightning::ln::channelmanager::PaymentSendFailure> {
+ let mut ret = (self.send_spontaneous_payment)(self.this_arg, &crate::lightning::routing::router::Route { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route as *const lightning::routing::router::Route<>) as *mut _) }, is_owned: false }, crate::c_types::ThirtyTwoBytes { data: payment_preimage.0 });
+ let mut local_ret = match ret.result_ok { true => Ok( { ::lightning::ln::channelmanager::PaymentId((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).data) }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })};
+ local_ret
+ }
fn retry_payment(&self, mut route: &lightning::routing::router::Route, mut payment_id: lightning::ln::channelmanager::PaymentId) -> Result<(), lightning::ln::channelmanager::PaymentSendFailure> {
let mut ret = (self.retry_payment)(self.this_arg, &crate::lightning::routing::router::Route { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route as *const lightning::routing::router::Route<>) as *mut _) }, is_owned: false }, crate::c_types::ThirtyTwoBytes { data: payment_id.0 });
let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })};
local_ret
}
+ fn abandon_payment(&self, mut payment_id: lightning::ln::channelmanager::PaymentId) {
+ (self.abandon_payment)(self.this_arg, crate::c_types::ThirtyTwoBytes { data: payment_id.0 })
+ }
}
// We're essentially a pointer already, or at least a set of pointers, so allow us to be used
///
/// Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
#[must_use]
- pub find_route: extern "C" fn (this_arg: *const c_void, payer: crate::c_types::PublicKey, params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, scorer: &crate::lightning::routing::Score) -> crate::c_types::derived::CResult_RouteLightningErrorZ,
+ pub find_route: extern "C" fn (this_arg: *const c_void, payer: crate::c_types::PublicKey, params: &crate::lightning::routing::router::RouteParameters, payment_hash: *const [u8; 32], first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, scorer: &crate::lightning::routing::scoring::Score) -> crate::c_types::derived::CResult_RouteLightningErrorZ,
/// 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.
pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
}
use lightning_invoice::payment::Router as rustRouter;
-impl rustRouter<crate::lightning::routing::Score> for Router {
- fn find_route(&self, mut payer: &secp256k1::key::PublicKey, mut params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channelmanager::ChannelDetails]>, mut scorer: &crate::lightning::routing::Score) -> Result<lightning::routing::router::Route, lightning::ln::msgs::LightningError> {
+impl rustRouter<crate::lightning::routing::scoring::Score> for Router {
+ fn find_route(&self, mut payer: &secp256k1::key::PublicKey, mut params: &lightning::routing::router::RouteParameters, mut payment_hash: &lightning::ln::PaymentHash, mut first_hops: Option<&[&lightning::ln::channelmanager::ChannelDetails]>, mut scorer: &crate::lightning::routing::scoring::Score) -> Result<lightning::routing::router::Route, lightning::ln::msgs::LightningError> {
let mut local_first_hops_base = if first_hops.is_none() { SmartPtr::null() } else { SmartPtr::from_obj( { let mut local_first_hops_0 = Vec::new(); for item in (first_hops.unwrap()).iter() { local_first_hops_0.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::ln::channelmanager::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_first_hops_0.into() }) }; let mut local_first_hops = *local_first_hops_base;
- let mut ret = (self.find_route)(self.this_arg, crate::c_types::PublicKey::from_rust(&payer), &crate::lightning::routing::router::RouteParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((params as *const lightning::routing::router::RouteParameters<>) as *mut _) }, is_owned: false }, local_first_hops, scorer);
+ let mut ret = (self.find_route)(self.this_arg, crate::c_types::PublicKey::from_rust(&payer), &crate::lightning::routing::router::RouteParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((params as *const lightning::routing::router::RouteParameters<>) as *mut _) }, is_owned: false }, &payment_hash.0, local_first_hops, scorer);
let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
local_ret
}
/// `retry_attempts` has been exceeded for a given [`Invoice`].
#[must_use]
#[no_mangle]
-pub extern "C" fn InvoicePayer_new(mut payer: crate::lightning_invoice::payment::Payer, mut router: crate::lightning_invoice::payment::Router, scorer: &crate::lightning::routing::LockableScore, mut logger: crate::lightning::util::logger::Logger, mut event_handler: crate::lightning::util::events::EventHandler, mut retry_attempts: crate::lightning_invoice::payment::RetryAttempts) -> InvoicePayer {
+pub extern "C" fn InvoicePayer_new(mut payer: crate::lightning_invoice::payment::Payer, mut router: crate::lightning_invoice::payment::Router, scorer: &crate::lightning::routing::scoring::MultiThreadedLockableScore, mut logger: crate::lightning::util::logger::Logger, mut event_handler: crate::lightning::util::events::EventHandler, mut retry_attempts: crate::lightning_invoice::payment::RetryAttempts) -> InvoicePayer {
let mut ret = lightning_invoice::payment::InvoicePayer::new(payer, router, scorer.get_native_ref(), logger, event_handler, *unsafe { Box::from_raw(retry_attempts.take_inner()) });
InvoicePayer { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
local_ret
}
+/// Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in
+/// case a retry is needed.
+///
+/// You should ensure that `payment_preimage` is unique and that its `payment_hash` has never
+/// been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn InvoicePayer_pay_pubkey(this_arg: &InvoicePayer, mut pubkey: crate::c_types::PublicKey, mut payment_preimage: crate::c_types::ThirtyTwoBytes, mut amount_msats: u64, mut final_cltv_expiry_delta: u32) -> crate::c_types::derived::CResult_PaymentIdPaymentErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_pubkey(pubkey.into_rust(), ::lightning::ln::PaymentPreimage(payment_preimage.data), amount_msats, final_cltv_expiry_delta);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::payment::PaymentError::native_into(e) }).into() };
+ local_ret
+}
+
/// 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
}
#[must_use]
-extern "C" fn DefaultRouter_Router_find_route(this_arg: *const c_void, mut payer: crate::c_types::PublicKey, params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, scorer: &crate::lightning::routing::Score) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
+extern "C" fn DefaultRouter_Router_find_route(this_arg: *const c_void, mut payer: crate::c_types::PublicKey, params: &crate::lightning::routing::router::RouteParameters, _payment_hash: *const [u8; 32], first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, scorer: &crate::lightning::routing::scoring::Score) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
let mut local_first_hops_base = if first_hops == std::ptr::null_mut() { None } else { Some( { let mut local_first_hops_0 = Vec::new(); for mut item in unsafe { &mut *first_hops }.as_slice().iter() { local_first_hops_0.push( { item.get_native_ref() }); }; local_first_hops_0 }) }; let mut local_first_hops = local_first_hops_base.as_ref().map(|a| &a[..]);
- let mut ret = <nativeDefaultRouter as lightning_invoice::payment::Router<_>>::find_route(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &payer.into_rust(), params.get_native_ref(), local_first_hops, scorer);
+ let mut ret = <nativeDefaultRouter as lightning_invoice::payment::Router<_>>::find_route(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &payer.into_rust(), params.get_native_ref(), &::lightning::ln::PaymentHash(unsafe { *_payment_hash }), local_first_hops, scorer);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Route { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
local_ret
}
node_id: ChannelManager_Payer_node_id,
first_hops: ChannelManager_Payer_first_hops,
send_payment: ChannelManager_Payer_send_payment,
+ send_spontaneous_payment: ChannelManager_Payer_send_spontaneous_payment,
retry_payment: ChannelManager_Payer_retry_payment,
+ abandon_payment: ChannelManager_Payer_abandon_payment,
}
}
local_ret
}
#[must_use]
+extern "C" fn ChannelManager_Payer_send_spontaneous_payment(this_arg: *const c_void, route: &crate::lightning::routing::router::Route, mut payment_preimage: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentIdPaymentSendFailureZ {
+ let mut ret = <nativeChannelManager as lightning_invoice::payment::Payer<>>::send_spontaneous_payment(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, route.get_native_ref(), ::lightning::ln::PaymentPreimage(payment_preimage.data));
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() };
+ local_ret
+}
+#[must_use]
extern "C" fn ChannelManager_Payer_retry_payment(this_arg: *const c_void, route: &crate::lightning::routing::router::Route, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ {
let mut ret = <nativeChannelManager as lightning_invoice::payment::Payer<>>::retry_payment(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, route.get_native_ref(), ::lightning::ln::channelmanager::PaymentId(payment_id.data));
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() };
local_ret
}
+extern "C" fn ChannelManager_Payer_abandon_payment(this_arg: *const c_void, mut payment_id: crate::c_types::ThirtyTwoBytes) {
+ <nativeChannelManager as lightning_invoice::payment::Payer<>>::abandon_payment(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ::lightning::ln::channelmanager::PaymentId(payment_id.data))
+}