- /**
- * Called, if set, after this Sign has been cloned into a duplicate object.
- * The new Sign is provided, and should be mutated as needed to perform a
- * deep copy of the object pointed to by this_arg or avoid any double-freeing.
- */
- void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
- /**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
- */
- void (*free)(void *this_arg);
-} LDKSign;
-
-/**
- * The contents of CResult_SignDecodeErrorZ
- */
-typedef union LDKCResult_SignDecodeErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKSign *result;
- /**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
- */
- struct LDKDecodeError *err;
-} LDKCResult_SignDecodeErrorZPtr;
-
-/**
- * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_SignDecodeErrorZ {
- /**
- * The contents of this CResult_SignDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_SignDecodeErrorZPtr contents;
- /**
- * Whether this CResult_SignDecodeErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_SignDecodeErrorZ;
-
-/**
- * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
- * allows recovering the exact public key which created the signature given the message.
- */
-typedef struct LDKRecoverableSignature {
- /**
- * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
- * recovery.
- */
- uint8_t serialized_form[68];
-} LDKRecoverableSignature;
-
-/**
- * The contents of CResult_RecoverableSignatureNoneZ
- */
-typedef union LDKCResult_RecoverableSignatureNoneZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKRecoverableSignature *result;
- /**
- * Note that this value is always NULL, as there are no contents in the Err variant
- */
- void *err;
-} LDKCResult_RecoverableSignatureNoneZPtr;
-
-/**
- * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::RecoverableSignature on success and a () on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_RecoverableSignatureNoneZ {
- /**
- * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_RecoverableSignatureNoneZPtr contents;
- /**
- * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_RecoverableSignatureNoneZ;
-
-/**
- * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_CVec_u8ZZ {
- /**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- */
- struct LDKCVec_u8Z *data;
- /**
- * The number of elements pointed to by `data`.
- */
- uintptr_t datalen;
-} LDKCVec_CVec_u8ZZ;
-
-/**
- * The contents of CResult_CVec_CVec_u8ZZNoneZ
- */
-typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKCVec_CVec_u8ZZ *result;
- /**
- * Note that this value is always NULL, as there are no contents in the Err variant
- */
- void *err;
-} LDKCResult_CVec_CVec_u8ZZNoneZPtr;
-
-/**
- * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
- /**
- * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
- /**
- * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_CVec_CVec_u8ZZNoneZ;
-
-
-
-/**
- * A simple implementation of Sign that just keeps the private keys in memory.
- *
- * This implementation performs no policy checks and is insufficient by itself as
- * a secure external signer.
- */
-typedef struct MUST_USE_STRUCT LDKInMemorySigner {
- /**
- * A pointer to the opaque Rust object.
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeInMemorySigner *inner;
- /**
- * Indicates that this is the only struct which contains the same pointer.
- * Rust functions which take ownership of an object provided via an argument require
- * this to be true and invalidate the object pointed to by inner.
- */
- bool is_owned;
-} LDKInMemorySigner;
-
-/**
- * The contents of CResult_InMemorySignerDecodeErrorZ
- */
-typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKInMemorySigner *result;
- /**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
- */
- struct LDKDecodeError *err;
-} LDKCResult_InMemorySignerDecodeErrorZPtr;
-
-/**
- * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
- /**
- * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
- /**
- * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_InMemorySignerDecodeErrorZ;
-
-/**
- * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_TxOutZ {
- /**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- */
- struct LDKTxOut *data;
- /**
- * The number of elements pointed to by `data`.
- */
- uintptr_t datalen;
-} LDKCVec_TxOutZ;
-
-/**
- * The contents of CResult_TransactionNoneZ
- */
-typedef union LDKCResult_TransactionNoneZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKTransaction *result;
- /**
- * Note that this value is always NULL, as there are no contents in the Err variant
- */
- void *err;
-} LDKCResult_TransactionNoneZPtr;
-
-/**
- * A CResult_TransactionNoneZ represents the result of a fallible operation,
- * containing a crate::c_types::Transaction on success and a () on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_TransactionNoneZ {
- /**
- * The contents of this CResult_TransactionNoneZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_TransactionNoneZPtr contents;
- /**
- * Whether this CResult_TransactionNoneZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_TransactionNoneZ;
-
-
-
-/**
- * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
- * on-chain transactions to ensure no loss of funds occurs.
- *
- * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
- * information and are actively monitoring the chain.
- *
- * Pending Events or updated HTLCs which have not yet been read out by
- * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
- * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
- * gotten are fully handled before re-serializing the new state.
- *
- * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
- * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
- * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
- * returned block hash and the the current chain and then reconnecting blocks to get to the
- * best chain) upon deserializing the object!
- */
-typedef struct MUST_USE_STRUCT LDKChannelMonitor {
- /**
- * 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.
- */
- LDKnativeChannelMonitor *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;
-} LDKChannelMonitor;
-
-/**
- * A tuple of 2 elements. See the individual fields for the types contained.
- */
-typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
- /**
- * The element at position 0
- */
- struct LDKThirtyTwoBytes a;
- /**
- * The element at position 1
- */
- struct LDKChannelMonitor b;
-} LDKC2Tuple_BlockHashChannelMonitorZ;
-
-/**
- * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
- /**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- */
- struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
- /**
- * The number of elements pointed to by `data`.
- */
- uintptr_t datalen;
-} LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
-
-/**
- * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
- */
-typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
- /**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
- */
- enum LDKIOError *err;
-} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
-
-/**
- * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
- /**
- * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
- /**
- * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
-
-/**
- * An enum which can either contain a u16 or not
- */
-typedef enum LDKCOption_u16Z_Tag {
- /**
- * When we're in this state, this COption_u16Z contains a u16
- */
- LDKCOption_u16Z_Some,
- /**
- * When we're in this state, this COption_u16Z contains nothing
- */
- LDKCOption_u16Z_None,
- /**
- * Must be last for serialization purposes
- */
- LDKCOption_u16Z_Sentinel,
-} LDKCOption_u16Z_Tag;
-
-typedef struct LDKCOption_u16Z {
- LDKCOption_u16Z_Tag tag;
- union {
- struct {
- uint16_t some;
- };
- };
-} LDKCOption_u16Z;
-
-/**
- * Indicates an error on the client's part (usually some variant of attempting to use too-low or
- * too-high values)
- */
-typedef enum LDKAPIError_Tag {
- /**
- * Indicates the API was wholly misused (see err for more). Cases where these can be returned
- * are documented, but generally indicates some precondition of a function was violated.
- */
- LDKAPIError_APIMisuseError,
- /**
- * Due to a high feerate, we were unable to complete the request.
- * For example, this may be returned if the feerate implies we cannot open a channel at the
- * requested value, but opening a larger channel would succeed.
- */
- LDKAPIError_FeeRateTooHigh,
- /**
- * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
- * too-many-hops, etc).
- */
- LDKAPIError_RouteError,
- /**
- * We were unable to complete the request as the Channel required to do so is unable to
- * complete the request (or was not found). This can take many forms, including disconnected
- * peer, channel at capacity, channel shutting down, etc.
- */
- LDKAPIError_ChannelUnavailable,
- /**
- * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
- * attempted action to fail.
- */
- LDKAPIError_MonitorUpdateFailed,
- /**
- * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
- * with the channel counterparty as negotiated in [`InitFeatures`].
- *
- * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
- * a channel or cooperatively close one with this peer (and will have to force-close instead).
- *
- * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
- * [`InitFeatures`]: crate::ln::features::InitFeatures
- */
- LDKAPIError_IncompatibleShutdownScript,
- /**
- * Must be last for serialization purposes
- */
- LDKAPIError_Sentinel,
-} LDKAPIError_Tag;
-
-typedef struct LDKAPIError_LDKAPIMisuseError_Body {
- /**
- * A human-readable error message
- */
- struct LDKStr err;
-} LDKAPIError_LDKAPIMisuseError_Body;
-
-typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
- /**
- * A human-readable error message
- */
- struct LDKStr err;
- /**
- * The feerate which was too high.
- */
- uint32_t feerate;
-} LDKAPIError_LDKFeeRateTooHigh_Body;
-
-typedef struct LDKAPIError_LDKRouteError_Body {
- /**
- * A human-readable error message
- */
- struct LDKStr err;
-} LDKAPIError_LDKRouteError_Body;
-
-typedef struct LDKAPIError_LDKChannelUnavailable_Body {
- /**
- * A human-readable error message
- */
- struct LDKStr err;
-} LDKAPIError_LDKChannelUnavailable_Body;
-
-typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
- /**
- * The incompatible shutdown script.
- */
- struct LDKShutdownScript script;
-} LDKAPIError_LDKIncompatibleShutdownScript_Body;
-
-typedef struct MUST_USE_STRUCT LDKAPIError {
- LDKAPIError_Tag tag;
- union {
- LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
- LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
- LDKAPIError_LDKRouteError_Body route_error;
- LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
- LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
- };
-} LDKAPIError;
-
-/**
- * The contents of CResult_NoneAPIErrorZ
- */
-typedef union LDKCResult_NoneAPIErrorZPtr {
- /**
- * 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 LDKAPIError *err;
-} LDKCResult_NoneAPIErrorZPtr;
-
-/**
- * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
- * containing a () on success and a crate::lightning::util::errors::APIError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_NoneAPIErrorZ {
- /**
- * The contents of this CResult_NoneAPIErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_NoneAPIErrorZPtr contents;
- /**
- * Whether this CResult_NoneAPIErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_NoneAPIErrorZ;
-
-/**
- * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
- /**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- */
- struct LDKCResult_NoneAPIErrorZ *data;
- /**
- * The number of elements pointed to by `data`.
- */
- uintptr_t datalen;
-} LDKCVec_CResult_NoneAPIErrorZZ;
-
-/**
- * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_APIErrorZ {
- /**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- */
- struct LDKAPIError *data;
- /**
- * The number of elements pointed to by `data`.
- */
- uintptr_t datalen;
-} LDKCVec_APIErrorZ;
-
-/**
- * The contents of CResult__u832APIErrorZ
- */
-typedef union LDKCResult__u832APIErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- 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__u832APIErrorZPtr;
-
-/**
- * A CResult__u832APIErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult__u832APIErrorZ {
- /**
- * The contents of this CResult__u832APIErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult__u832APIErrorZPtr contents;
- /**
- * Whether this CResult__u832APIErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult__u832APIErrorZ;
-
-/**
- * If a payment fails to send, it can be in one of several states. This enum is returned as the
- * Err() type describing which state the payment is in, see the description of individual enum
- * states for more.
- */
-typedef enum LDKPaymentSendFailure_Tag {
- /**
- * A parameter which was passed to send_payment was invalid, preventing us from attempting to
- * send the payment at all. No channel state has been changed or messages sent to peers, and
- * once you've changed the parameter at error, you can freely retry the payment in full.
- */
- LDKPaymentSendFailure_ParameterError,
- /**
- * A parameter in a single path which was passed to send_payment was invalid, preventing us
- * from attempting to send the payment at all. No channel state has been changed or messages
- * sent to peers, and once you've changed the parameter at error, you can freely retry the
- * payment in full.
- *
- * The results here are ordered the same as the paths in the route object which was passed to
- * send_payment.
- */
- LDKPaymentSendFailure_PathParameterError,
- /**
- * All paths which were attempted failed to send, with no channel state change taking place.
- * You can freely retry the payment in full (though you probably want to do so over different
- * paths than the ones selected).
- */
- LDKPaymentSendFailure_AllFailedRetrySafe,
- /**
- * Some paths which were attempted failed to send, though possibly not all. At least some
- * paths have irrevocably committed to the HTLC and retrying the payment in full would result
- * in over-/re-payment.
- *
- * The results here are ordered the same as the paths in the route object which was passed to
- * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
- * retried (though there is currently no API with which to do so).
- *
- * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
- * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
- * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
- * with the latest update_id.
- */
- LDKPaymentSendFailure_PartialFailure,
- /**
- * Must be last for serialization purposes
- */
- LDKPaymentSendFailure_Sentinel,
-} LDKPaymentSendFailure_Tag;
-
-typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
- /**
- * The errors themselves, in the same order as the route hops.
- */
- struct LDKCVec_CResult_NoneAPIErrorZZ results;
- /**
- * If some paths failed without irrevocably committing to the new HTLC(s), this will
- * contain a [`RouteParameters`] object which can be used to calculate a new route that
- * will pay all remaining unpaid balance.
- *
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
- */
- struct LDKRouteParameters failed_paths_retry;
- /**
- * The payment id for the payment, which is now at least partially pending.
- */
- struct LDKThirtyTwoBytes payment_id;
-} LDKPaymentSendFailure_LDKPartialFailure_Body;
-
-typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
- LDKPaymentSendFailure_Tag tag;
- union {
- struct {
- struct LDKAPIError parameter_error;
- };
- struct {
- struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
- };
- struct {
- struct LDKCVec_APIErrorZ all_failed_retry_safe;
- };
- LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
- };
-} LDKPaymentSendFailure;