typedef struct nativeDelayedPaymentOutputDescriptorOpaque LDKnativeDelayedPaymentOutputDescriptor;
struct nativeStaticPaymentOutputDescriptorOpaque;
typedef struct nativeStaticPaymentOutputDescriptorOpaque LDKnativeStaticPaymentOutputDescriptor;
+struct nativeChannelDerivationParametersOpaque;
+typedef struct nativeChannelDerivationParametersOpaque LDKnativeChannelDerivationParameters;
+struct nativeHTLCDescriptorOpaque;
+typedef struct nativeHTLCDescriptorOpaque LDKnativeHTLCDescriptor;
struct LDKChannelSigner;
struct nativeInMemorySignerOpaque;
typedef struct nativeInMemorySignerOpaque LDKnativeInMemorySigner;
typedef struct nativeNodeAliasOpaque LDKnativeNodeAlias;
struct nativeNodeInfoOpaque;
typedef struct nativeNodeInfoOpaque LDKnativeNodeInfo;
-struct nativeChannelDerivationParametersOpaque;
-typedef struct nativeChannelDerivationParametersOpaque LDKnativeChannelDerivationParameters;
struct nativeAnchorDescriptorOpaque;
typedef struct nativeAnchorDescriptorOpaque LDKnativeAnchorDescriptor;
-struct nativeHTLCDescriptorOpaque;
-typedef struct nativeHTLCDescriptorOpaque LDKnativeHTLCDescriptor;
struct nativeInputOpaque;
typedef struct nativeInputOpaque LDKnativeInput;
struct nativeUtxoOpaque;
* A payer id was expected but was missing.
*/
LDKBolt12SemanticError_MissingPayerId,
+ /**
+ * The payment id for a refund or request is already in use.
+ */
+ LDKBolt12SemanticError_DuplicatePaymentId,
/**
* Blinded paths were expected but were missing.
*/
*/
typedef enum LDKConfirmationTarget {
/**
- * We'd like a transaction to confirm in the future, but don't want to commit most of the fees
- * required to do so yet. The remaining fees will come via a Child-Pays-For-Parent (CPFP) fee
- * bump of the transaction.
+ * We have some funds available on chain which we need to spend prior to some expiry time at
+ * which point our counterparty may be able to steal them. Generally we have in the high tens
+ * to low hundreds of blocks to get our transaction on-chain, but we shouldn't risk too low a
+ * fee - this should be a relatively high priority feerate.
+ */
+ LDKConfirmationTarget_OnChainSweep,
+ /**
+ * The highest feerate we will allow our channel counterparty to have in a non-anchor channel.
+ *
+ * This is the feerate on the transaction which we (or our counterparty) will broadcast in
+ * order to close the channel unilaterally. Because our counterparty must ensure they can
+ * always broadcast the latest state, this value being too low will cause immediate
+ * force-closures.
*
- * The feerate returned should be the absolute minimum feerate required to enter most node
- * mempools across the network. Note that if you are not able to obtain this feerate estimate,
- * you should likely use the furthest-out estimate allowed by your fee estimator.
+ * Allowing this value to be too high can allow our counterparty to burn our HTLC outputs to
+ * dust, which can result in HTLCs failing or force-closures (when the dust HTLCs exceed
+ * [`ChannelConfig::max_dust_htlc_exposure`]).
+ *
+ * Because most nodes use a feerate estimate which is based on a relatively high priority
+ * transaction entering the current mempool, setting this to a small multiple of your current
+ * high priority feerate estimate should suffice.
+ *
+ * [`ChannelConfig::max_dust_htlc_exposure`]: crate::util::config::ChannelConfig::max_dust_htlc_exposure
*/
- LDKConfirmationTarget_MempoolMinimum,
+ LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee,
/**
- * We are happy with a transaction confirming slowly, at least within a day or so worth of
- * blocks.
+ * This is the lowest feerate we will allow our channel counterparty to have in an anchor
+ * channel in order to close the channel if a channel party goes away.
+ *
+ * This needs to be sufficient to get into the mempool when the channel needs to
+ * be force-closed. Setting too high may result in force-closures if our counterparty attempts
+ * to use a lower feerate. Because this is for anchor channels, we can always bump the feerate
+ * later; the feerate here only needs to be sufficient to enter the mempool.
+ *
+ * A good estimate is the expected mempool minimum at the time of force-closure. Obviously this
+ * is not an estimate which is very easy to calculate because we do not know the future. Using
+ * a simple long-term fee estimate or tracking of the mempool minimum is a good approach to
+ * ensure you can always close the channel. A future change to Bitcoin's P2P network
+ * (package relay) may obviate the need for this entirely.
+ */
+ LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee,
+ /**
+ * The lowest feerate we will allow our channel counterparty to have in a non-anchor channel.
+ *
+ * This is the feerate on the transaction which we (or our counterparty) will broadcast in
+ * order to close the channel if a channel party goes away. Setting this value too high will
+ * cause immediate force-closures in order to avoid having an unbroadcastable state.
+ *
+ * This feerate represents the fee we pick now, which must be sufficient to enter a block at an
+ * arbitrary time in the future. Obviously this is not an estimate which is very easy to
+ * calculate. This can leave channels subject to being unable to close if feerates rise, and in
+ * general you should prefer anchor channels to ensure you can increase the feerate when the
+ * transactions need broadcasting.
+ *
+ * Do note some fee estimators round up to the next full sat/vbyte (ie 250 sats per kw),
+ * causing occasional issues with feerate disagreements between an initiator that wants a
+ * feerate of 1.1 sat/vbyte and a receiver that wants 1.1 rounded up to 2. If your fee
+ * estimator rounds subtracting 250 to your desired feerate here can help avoid this issue.
+ *
+ * [`ChannelConfig::max_dust_htlc_exposure`]: crate::util::config::ChannelConfig::max_dust_htlc_exposure
+ */
+ LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee,
+ /**
+ * This is the feerate on the transaction which we (or our counterparty) will broadcast in
+ * order to close the channel if a channel party goes away.
+ *
+ * This needs to be sufficient to get into the mempool when the channel needs to
+ * be force-closed. Setting too low may result in force-closures. Because this is for anchor
+ * channels, it can be a low value as we can always bump the feerate later.
+ *
+ * A good estimate is the expected mempool minimum at the time of force-closure. Obviously this
+ * is not an estimate which is very easy to calculate because we do not know the future. Using
+ * a simple long-term fee estimate or tracking of the mempool minimum is a good approach to
+ * ensure you can always close the channel. A future change to Bitcoin's P2P network
+ * (package relay) may obviate the need for this entirely.
*/
- LDKConfirmationTarget_Background,
+ LDKConfirmationTarget_AnchorChannelFee,
/**
- * We'd like a transaction to confirm without major delayed, i.e., within the next 12-24 blocks.
+ * Lightning is built around the ability to broadcast a transaction in the future to close our
+ * channel and claim all pending funds. In order to do so, non-anchor channels are built with
+ * transactions which we need to be able to broadcast at some point in the future.
+ *
+ * This feerate represents the fee we pick now, which must be sufficient to enter a block at an
+ * arbitrary time in the future. Obviously this is not an estimate which is very easy to
+ * calculate, so most lightning nodes use some relatively high-priority feerate using the
+ * current mempool. This leaves channels subject to being unable to close if feerates rise, and
+ * in general you should prefer anchor channels to ensure you can increase the feerate when the
+ * transactions need broadcasting.
+ *
+ * Since this should represent the feerate of a channel close that does not need fee
+ * bumping, this is also used as an upper bound for our attempted feerate when doing cooperative
+ * closure of any channel.
*/
- LDKConfirmationTarget_Normal,
+ LDKConfirmationTarget_NonAnchorChannelFee,
/**
- * We'd like a transaction to confirm in the next few blocks.
+ * When cooperatively closing a channel, this is the minimum feerate we will accept.
+ * Recommended at least within a day or so worth of blocks.
+ *
+ * This will also be used when initiating a cooperative close of a channel. When closing a
+ * channel you can override this fee by using
+ * [`ChannelManager::close_channel_with_feerate_and_script`].
+ *
+ * [`ChannelManager::close_channel_with_feerate_and_script`]: crate::ln::channelmanager::ChannelManager::close_channel_with_feerate_and_script
*/
- LDKConfirmationTarget_HighPriority,
+ LDKConfirmationTarget_ChannelCloseMinimum,
/**
* Must be last for serialization purposes
*/
bool result_ok;
} LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ;
+
+
+/**
+ * The parameters required to derive a channel signer via [`SignerProvider`].
+ */
+typedef struct MUST_USE_STRUCT LDKChannelDerivationParameters {
+ /**
+ * 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.
+ */
+ LDKnativeChannelDerivationParameters *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;
+} LDKChannelDerivationParameters;
+
+/**
+ * The contents of CResult_ChannelDerivationParametersDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelDerivationParametersDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKChannelDerivationParameters *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_ChannelDerivationParametersDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::sign::ChannelDerivationParameters 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_ChannelDerivationParametersDecodeErrorZ {
+ /**
+ * The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ChannelDerivationParametersDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ChannelDerivationParametersDecodeErrorZ;
+
+
+
+/**
+ * A descriptor used to sign for a commitment transaction's HTLC output.
+ */
+typedef struct MUST_USE_STRUCT LDKHTLCDescriptor {
+ /**
+ * 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.
+ */
+ LDKnativeHTLCDescriptor *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;
+} LDKHTLCDescriptor;
+
+/**
+ * The contents of CResult_HTLCDescriptorDecodeErrorZ
+ */
+typedef union LDKCResult_HTLCDescriptorDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKHTLCDescriptor *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_HTLCDescriptorDecodeErrorZPtr;
+
+/**
+ * A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::sign::HTLCDescriptor 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_HTLCDescriptorDecodeErrorZ {
+ /**
+ * The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_HTLCDescriptorDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_HTLCDescriptorDecodeErrorZ;
+
/**
* The contents of CResult_NoneNoneZ
*/
-/**
- * A descriptor used to sign for a commitment transaction's HTLC output.
- */
-typedef struct MUST_USE_STRUCT LDKHTLCDescriptor {
- /**
- * 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.
- */
- LDKnativeHTLCDescriptor *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;
-} LDKHTLCDescriptor;
-
-
-
/**
* This class tracks the per-transaction information needed to build a closing transaction and will
* actually build it and sign.
*/
struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
/**
- * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions.
+ * Creates a signature for a holder's commitment transaction.
*
* This will be called
* - with a non-revoked `commitment_tx`.
* - with the latest `commitment_tx` when we initiate a force-close.
- * - with the previous `commitment_tx`, just to get claiming HTLC
- * signatures, if we are reacting to a [`ChannelMonitor`]
- * [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
- * that decided to broadcast before it had been updated to the latest `commitment_tx`.
*
* This may be called multiple times for the same transaction.
*
* An external signer implementation should check that the commitment has not been revoked.
- *
- * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
*/
- struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
+ struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
/**
* Create a signature for the given input in a transaction spending an HTLC transaction output
* or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
/**
* Computes the signature for a commitment transaction's HTLC output used as an input within
* `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
- * must be be computed using [`EcdsaSighashType::All`]. Note that this should only be used to
- * sign HTLC transactions from channels supporting anchor outputs after all additional
- * inputs/outputs have been added to the transaction.
+ * must be be computed using [`EcdsaSighashType::All`].
+ *
+ * Note that this may be called for HTLCs in the penultimate commitment transaction if a
+ * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
+ * broadcasts it before receiving the update for the latest commitment transaction.
*
* [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All
+ * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
*/
struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor);
/**
void *this_arg;
/**
* Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
- * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
- * is unknown.
+ * Returns an error if `chain_hash` is for a different chain or if such a transaction output is
+ * unknown.
*
* [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
*/
- struct LDKUtxoResult (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
+ struct LDKUtxoResult (*get_utxo)(const void *this_arg, const uint8_t (*chain_hash)[32], uint64_t short_channel_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.
};
} LDKCOption_CVec_SocketAddressZZ;
-
-
-/**
- * The parameters required to derive a channel signer via [`SignerProvider`].
- */
-typedef struct MUST_USE_STRUCT LDKChannelDerivationParameters {
- /**
- * 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.
- */
- LDKnativeChannelDerivationParameters *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;
-} LDKChannelDerivationParameters;
-
-/**
- * The contents of CResult_ChannelDerivationParametersDecodeErrorZ
- */
-typedef union LDKCResult_ChannelDerivationParametersDecodeErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKChannelDerivationParameters *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_ChannelDerivationParametersDecodeErrorZPtr;
-
-/**
- * A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::events::bump_transaction::ChannelDerivationParameters 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_ChannelDerivationParametersDecodeErrorZ {
- /**
- * The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_ChannelDerivationParametersDecodeErrorZPtr contents;
- /**
- * Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_ChannelDerivationParametersDecodeErrorZ;
-
-/**
- * The contents of CResult_HTLCDescriptorDecodeErrorZ
- */
-typedef union LDKCResult_HTLCDescriptorDecodeErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKHTLCDescriptor *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_HTLCDescriptorDecodeErrorZPtr;
-
-/**
- * A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::events::bump_transaction::HTLCDescriptor 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_HTLCDescriptorDecodeErrorZ {
- /**
- * The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_HTLCDescriptorDecodeErrorZPtr contents;
- /**
- * Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_HTLCDescriptorDecodeErrorZ;
-
/**
* A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size.
* This corresponds to std::vector in C++
} LDKCVec_HTLCOutputInCommitmentZ;
/**
- * A dynamically-allocated array of crate::lightning::events::bump_transaction::HTLCDescriptors of arbitrary size.
+ * A dynamically-allocated array of crate::lightning::sign::HTLCDescriptors of arbitrary size.
* This corresponds to std::vector in C++
*/
typedef struct LDKCVec_HTLCDescriptorZ {
uintptr_t datalen;
} LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ;
+/**
+ * An enum which can either contain a crate::c_types::Str or not
+ */
+typedef enum LDKCOption_StrZ_Tag {
+ /**
+ * When we're in this state, this COption_StrZ contains a crate::c_types::Str
+ */
+ LDKCOption_StrZ_Some,
+ /**
+ * When we're in this state, this COption_StrZ contains nothing
+ */
+ LDKCOption_StrZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_StrZ_Sentinel,
+} LDKCOption_StrZ_Tag;
+
+typedef struct LDKCOption_StrZ {
+ LDKCOption_StrZ_Tag tag;
+ union {
+ struct {
+ struct LDKStr some;
+ };
+ };
+} LDKCOption_StrZ;
+
+/**
+ * The contents of CResult_NoneBolt12SemanticErrorZ
+ */
+typedef union LDKCResult_NoneBolt12SemanticErrorZPtr {
+ /**
+ * 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.
+ */
+ enum LDKBolt12SemanticError *err;
+} LDKCResult_NoneBolt12SemanticErrorZPtr;
+
+/**
+ * A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NoneBolt12SemanticErrorZ {
+ /**
+ * The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NoneBolt12SemanticErrorZPtr contents;
+ /**
+ * Whether this CResult_NoneBolt12SemanticErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NoneBolt12SemanticErrorZ;
+
/**
* The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
*/
+/**
+ * An `InvoiceRequest` is a request for a [`Bolt12Invoice`] formulated from an [`Offer`].
+ *
+ * An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request
+ * specifies these such that its recipient can send an invoice for payment.
+ *
+ * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
+ * [`Offer`]: crate::offers::offer::Offer
+ */
+typedef struct MUST_USE_STRUCT LDKInvoiceRequest {
+ /**
+ * 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.
+ */
+ LDKnativeInvoiceRequest *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;
+} LDKInvoiceRequest;
+
+
+
+/**
+ * A `Bolt12Invoice` is a payment request, typically corresponding to an [`Offer`] or a [`Refund`].
+ *
+ * An invoice may be sent in response to an [`InvoiceRequest`] in the case of an offer or sent
+ * directly after scanning a refund. It includes all the information needed to pay a recipient.
+ *
+ * [`Offer`]: crate::offers::offer::Offer
+ * [`Refund`]: crate::offers::refund::Refund
+ * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
+ */
+typedef struct MUST_USE_STRUCT LDKBolt12Invoice {
+ /**
+ * 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.
+ */
+ LDKnativeBolt12Invoice *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;
+} LDKBolt12Invoice;
+
+
+
+/**
+ * An error in response to an [`InvoiceRequest`] or an [`Bolt12Invoice`].
+ *
+ * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
+ * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
+ */
+typedef struct MUST_USE_STRUCT LDKInvoiceError {
+ /**
+ * 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.
+ */
+ LDKnativeInvoiceError *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;
+} LDKInvoiceError;
+
+/**
+ * Possible BOLT 12 Offers messages sent and received via an [`OnionMessage`].
+ *
+ * [`OnionMessage`]: crate::ln::msgs::OnionMessage
+ */
+typedef enum LDKOffersMessage_Tag {
+ /**
+ * A request for a [`Bolt12Invoice`] for a particular [`Offer`].
+ *
+ * [`Offer`]: crate::offers::offer::Offer
+ */
+ LDKOffersMessage_InvoiceRequest,
+ /**
+ * A [`Bolt12Invoice`] sent in response to an [`InvoiceRequest`] or a [`Refund`].
+ *
+ * [`Refund`]: crate::offers::refund::Refund
+ */
+ LDKOffersMessage_Invoice,
+ /**
+ * An error from handling an [`OffersMessage`].
+ */
+ LDKOffersMessage_InvoiceError,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKOffersMessage_Sentinel,
+} LDKOffersMessage_Tag;
+
+typedef struct MUST_USE_STRUCT LDKOffersMessage {
+ LDKOffersMessage_Tag tag;
+ union {
+ struct {
+ struct LDKInvoiceRequest invoice_request;
+ };
+ struct {
+ struct LDKBolt12Invoice invoice;
+ };
+ struct {
+ struct LDKInvoiceError invoice_error;
+ };
+ };
+} LDKOffersMessage;
+
+/**
+ * An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
+ */
+typedef enum LDKCOption_OffersMessageZ_Tag {
+ /**
+ * When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
+ */
+ LDKCOption_OffersMessageZ_Some,
+ /**
+ * When we're in this state, this COption_OffersMessageZ contains nothing
+ */
+ LDKCOption_OffersMessageZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_OffersMessageZ_Sentinel,
+} LDKCOption_OffersMessageZ_Tag;
+
+typedef struct LDKCOption_OffersMessageZ {
+ LDKCOption_OffersMessageZ_Tag tag;
+ union {
+ struct {
+ struct LDKOffersMessage some;
+ };
+ };
+} LDKCOption_OffersMessageZ;
+
+/**
+ * The destination of an onion message.
+ */
+typedef enum LDKDestination_Tag {
+ /**
+ * We're sending this onion message to a node.
+ */
+ LDKDestination_Node,
+ /**
+ * We're sending this onion message to a blinded path.
+ */
+ LDKDestination_BlindedPath,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKDestination_Sentinel,
+} LDKDestination_Tag;
+
+typedef struct MUST_USE_STRUCT LDKDestination {
+ LDKDestination_Tag tag;
+ union {
+ struct {
+ struct LDKPublicKey node;
+ };
+ struct {
+ struct LDKBlindedPath blinded_path;
+ };
+ };
+} LDKDestination;
+
+/**
+ * A tuple of 3 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKOffersMessage a;
+ /**
+ * The element at position 1
+ */
+ struct LDKDestination b;
+ /**
+ * The element at position 2
+ */
+ struct LDKBlindedPath c;
+} LDKC3Tuple_OffersMessageDestinationBlindedPathZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ;
+
+
+
/**
* Information needed for constructing an invoice route hint for this channel.
*/
uintptr_t datalen;
} LDKCVec_C2Tuple_PublicKeyTypeZZ;
-
-
-/**
- * An `InvoiceRequest` is a request for a [`Bolt12Invoice`] formulated from an [`Offer`].
- *
- * An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request
- * specifies these such that its recipient can send an invoice for payment.
- *
- * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
- * [`Offer`]: crate::offers::offer::Offer
- */
-typedef struct MUST_USE_STRUCT LDKInvoiceRequest {
- /**
- * 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.
- */
- LDKnativeInvoiceRequest *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;
-} LDKInvoiceRequest;
-
-
-
-/**
- * A `Bolt12Invoice` is a payment request, typically corresponding to an [`Offer`] or a [`Refund`].
- *
- * An invoice may be sent in response to an [`InvoiceRequest`] in the case of an offer or sent
- * directly after scanning a refund. It includes all the information needed to pay a recipient.
- *
- * [`Offer`]: crate::offers::offer::Offer
- * [`Refund`]: crate::offers::refund::Refund
- * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
- */
-typedef struct MUST_USE_STRUCT LDKBolt12Invoice {
- /**
- * 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.
- */
- LDKnativeBolt12Invoice *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;
-} LDKBolt12Invoice;
-
-
-
-/**
- * An error in response to an [`InvoiceRequest`] or an [`Bolt12Invoice`].
- *
- * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
- * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
- */
-typedef struct MUST_USE_STRUCT LDKInvoiceError {
- /**
- * 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.
- */
- LDKnativeInvoiceError *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;
-} LDKInvoiceError;
-
/**
- * Possible BOLT 12 Offers messages sent and received via an [`OnionMessage`].
- *
- * [`OnionMessage`]: crate::ln::msgs::OnionMessage
+ * The contents of an onion message.
*/
-typedef enum LDKOffersMessage_Tag {
- /**
- * A request for a [`Bolt12Invoice`] for a particular [`Offer`].
- *
- * [`Offer`]: crate::offers::offer::Offer
- */
- LDKOffersMessage_InvoiceRequest,
- /**
- * A [`Bolt12Invoice`] sent in response to an [`InvoiceRequest`] or a [`Refund`].
- *
- * [`Refund`]: crate::offers::refund::Refund
- */
- LDKOffersMessage_Invoice,
- /**
- * An error from handling an [`OffersMessage`].
- */
- LDKOffersMessage_InvoiceError,
- /**
- * Must be last for serialization purposes
- */
- LDKOffersMessage_Sentinel,
-} LDKOffersMessage_Tag;
-
-typedef struct MUST_USE_STRUCT LDKOffersMessage {
- LDKOffersMessage_Tag tag;
- union {
- struct {
- struct LDKInvoiceRequest invoice_request;
- };
- struct {
- struct LDKBolt12Invoice invoice;
- };
- struct {
- struct LDKInvoiceError invoice_error;
- };
- };
-} LDKOffersMessage;
-
-/**
- * An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
- */
-typedef enum LDKCOption_OffersMessageZ_Tag {
- /**
- * When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
- */
- LDKCOption_OffersMessageZ_Some,
- /**
- * When we're in this state, this COption_OffersMessageZ contains nothing
- */
- LDKCOption_OffersMessageZ_None,
- /**
- * Must be last for serialization purposes
- */
- LDKCOption_OffersMessageZ_Sentinel,
-} LDKCOption_OffersMessageZ_Tag;
-
-typedef struct LDKCOption_OffersMessageZ {
- LDKCOption_OffersMessageZ_Tag tag;
- union {
- struct {
- struct LDKOffersMessage some;
- };
- };
-} LDKCOption_OffersMessageZ;
-
-/**
- * The contents of a custom onion message.
- */
-typedef struct LDKCustomOnionMessageContents {
+typedef struct LDKOnionMessageContents {
/**
* 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.
*/
struct LDKCVec_u8Z (*write)(const void *this_arg);
/**
- * Called, if set, after this CustomOnionMessageContents has been cloned into a duplicate object.
- * The new CustomOnionMessageContents is provided, and should be mutated as needed to perform a
+ * Called, if set, after this OnionMessageContents has been cloned into a duplicate object.
+ * The new OnionMessageContents 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 LDKCustomOnionMessageContents *NONNULL_PTR new_CustomOnionMessageContents);
+ void (*cloned)(struct LDKOnionMessageContents *NONNULL_PTR new_OnionMessageContents);
/**
* 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);
-} LDKCustomOnionMessageContents;
+} LDKOnionMessageContents;
/**
- * An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
+ * An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not
*/
-typedef enum LDKCOption_CustomOnionMessageContentsZ_Tag {
+typedef enum LDKCOption_OnionMessageContentsZ_Tag {
/**
- * When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
+ * When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents
*/
- LDKCOption_CustomOnionMessageContentsZ_Some,
+ LDKCOption_OnionMessageContentsZ_Some,
/**
- * When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
+ * When we're in this state, this COption_OnionMessageContentsZ contains nothing
*/
- LDKCOption_CustomOnionMessageContentsZ_None,
+ LDKCOption_OnionMessageContentsZ_None,
/**
* Must be last for serialization purposes
*/
- LDKCOption_CustomOnionMessageContentsZ_Sentinel,
-} LDKCOption_CustomOnionMessageContentsZ_Tag;
+ LDKCOption_OnionMessageContentsZ_Sentinel,
+} LDKCOption_OnionMessageContentsZ_Tag;
-typedef struct LDKCOption_CustomOnionMessageContentsZ {
- LDKCOption_CustomOnionMessageContentsZ_Tag tag;
+typedef struct LDKCOption_OnionMessageContentsZ {
+ LDKCOption_OnionMessageContentsZ_Tag tag;
union {
struct {
- struct LDKCustomOnionMessageContents some;
+ struct LDKOnionMessageContents some;
};
};
-} LDKCOption_CustomOnionMessageContentsZ;
+} LDKCOption_OnionMessageContentsZ;
/**
- * The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
+ * The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ
*/
-typedef union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
+typedef union LDKCResult_COption_OnionMessageContentsZDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKCOption_CustomOnionMessageContentsZ *result;
+ struct LDKCOption_OnionMessageContentsZ *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
struct LDKDecodeError *err;
-} LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr;
+} LDKCResult_COption_OnionMessageContentsZDecodeErrorZPtr;
/**
- * A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_OnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
+typedef struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ {
/**
- * The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
+ * The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr contents;
+ union LDKCResult_COption_OnionMessageContentsZDecodeErrorZPtr contents;
/**
- * Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
+ * Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ;
+} LDKCResult_COption_OnionMessageContentsZDecodeErrorZ;
+
+/**
+ * A tuple of 3 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKOnionMessageContents a;
+ /**
+ * The element at position 1
+ */
+ struct LDKDestination b;
+ /**
+ * The element at position 2
+ */
+ struct LDKBlindedPath c;
+} LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ;
/**
* An enum which can either contain a crate::lightning::ln::wire::Type or not
*
* [`EcdsaChannelSigner`]: crate::sign::EcdsaChannelSigner
* [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::sign::EcdsaChannelSigner::sign_holder_htlc_transaction
- * [`HTLCDescriptor::tx_input_witness`]: HTLCDescriptor::tx_input_witness
*/
LDKBumpTransactionEvent_HTLCResolution,
/**
* [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
*/
LDKEvent_PaymentClaimed,
+ /**
+ * Indicates a request for an invoice failed to yield a response in a reasonable amount of time
+ * or was explicitly abandoned by [`ChannelManager::abandon_payment`]. This may be for an
+ * [`InvoiceRequest`] sent for an [`Offer`] or for a [`Refund`] that hasn't been redeemed.
+ *
+ * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+ * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
+ * [`Offer`]: crate::offers::offer::Offer
+ * [`Refund`]: crate::offers::refund::Refund
+ */
+ LDKEvent_InvoiceRequestFailed,
/**
* Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
* and we got back the payment preimage for it).
struct LDKCOption_u64Z sender_intended_total_msat;
} LDKEvent_LDKPaymentClaimed_Body;
+typedef struct LDKEvent_LDKInvoiceRequestFailed_Body {
+ /**
+ * The `payment_id` to have been associated with payment for the requested invoice.
+ */
+ struct LDKThirtyTwoBytes payment_id;
+} LDKEvent_LDKInvoiceRequestFailed_Body;
+
typedef struct LDKEvent_LDKPaymentSent_Body {
/**
* The `payment_id` passed to [`ChannelManager::send_payment`].
LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
LDKEvent_LDKPaymentClaimable_Body payment_claimable;
LDKEvent_LDKPaymentClaimed_Body payment_claimed;
+ LDKEvent_LDKInvoiceRequestFailed_Body invoice_request_failed;
LDKEvent_LDKPaymentSent_Body payment_sent;
LDKEvent_LDKPaymentFailed_Body payment_failed;
LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
/**
- * A path for sending an [`msgs::OnionMessage`].
+ * A path for sending an [`OnionMessage`].
*/
typedef struct MUST_USE_STRUCT LDKOnionMessagePath {
/**
*/
LDKSendError_TooBigPacket,
/**
- * The provided [`Destination`] was an invalid [`BlindedPath`], due to having fewer than two
- * blinded hops.
+ * The provided [`Destination`] was an invalid [`BlindedPath`] due to not having any blinded
+ * hops.
*/
LDKSendError_TooFewBlindedHops,
/**
bool result_ok;
} LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ;
+/**
+ * The contents of an [`OnionMessage`] as read from the wire.
+ *
+ * [`OnionMessage`]: crate::ln::msgs::OnionMessage
+ */
+typedef enum LDKParsedOnionMessageContents_Tag {
+ /**
+ * A message related to BOLT 12 Offers.
+ */
+ LDKParsedOnionMessageContents_Offers,
+ /**
+ * A custom onion message specified by the user.
+ */
+ LDKParsedOnionMessageContents_Custom,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKParsedOnionMessageContents_Sentinel,
+} LDKParsedOnionMessageContents_Tag;
+
+typedef struct MUST_USE_STRUCT LDKParsedOnionMessageContents {
+ LDKParsedOnionMessageContents_Tag tag;
+ union {
+ struct {
+ struct LDKOffersMessage offers;
+ };
+ struct {
+ struct LDKOnionMessageContents custom;
+ };
+ };
+} LDKParsedOnionMessageContents;
+
+/**
+ * A processed incoming onion message, containing either a Forward (another onion message)
+ * or a Receive payload with decrypted contents.
+ */
+typedef enum LDKPeeledOnion_Tag {
+ /**
+ * Forwarded onion, with the next node id and a new onion
+ */
+ LDKPeeledOnion_Forward,
+ /**
+ * Received onion message, with decrypted contents, path_id, and reply path
+ */
+ LDKPeeledOnion_Receive,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKPeeledOnion_Sentinel,
+} LDKPeeledOnion_Tag;
+
+typedef struct LDKPeeledOnion_LDKForward_Body {
+ struct LDKPublicKey _0;
+ struct LDKOnionMessage _1;
+} LDKPeeledOnion_LDKForward_Body;
+
+typedef struct LDKPeeledOnion_LDKReceive_Body {
+ struct LDKParsedOnionMessageContents _0;
+ /**
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKThirtyTwoBytes _1;
+ /**
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKBlindedPath _2;
+} LDKPeeledOnion_LDKReceive_Body;
+
+typedef struct MUST_USE_STRUCT LDKPeeledOnion {
+ LDKPeeledOnion_Tag tag;
+ union {
+ LDKPeeledOnion_LDKForward_Body forward;
+ LDKPeeledOnion_LDKReceive_Body receive;
+ };
+} LDKPeeledOnion;
+
+/**
+ * The contents of CResult_PeeledOnionNoneZ
+ */
+typedef union LDKCResult_PeeledOnionNoneZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKPeeledOnion *result;
+ /**
+ * Note that this value is always NULL, as there are no contents in the Err variant
+ */
+ void *err;
+} LDKCResult_PeeledOnionNoneZPtr;
+
+/**
+ * A CResult_PeeledOnionNoneZ represents the result of a fallible operation,
+ * containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PeeledOnionNoneZ {
+ /**
+ * The contents of this CResult_PeeledOnionNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PeeledOnionNoneZPtr contents;
+ /**
+ * Whether this CResult_PeeledOnionNoneZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PeeledOnionNoneZ;
+
/**
* The contents of CResult_NoneSendErrorZ
*/
*/
struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
/**
- * Gets the genesis hashes for this `ChannelMessageHandler` indicating which chains it supports.
+ * Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports.
*
* If it's `None`, then no particular network chain hash compatibility will be enforced when
* connecting to peers.
*/
- struct LDKCOption_CVec_ThirtyTwoBytesZZ (*get_genesis_hashes)(const void *this_arg);
+ struct LDKCOption_CVec_ThirtyTwoBytesZZ (*get_chain_hashes)(const void *this_arg);
/**
* Implementation of MessageSendEventsProvider for this object.
*/
void (*free)(void *this_arg);
} LDKChannelMessageHandler;
+/**
+ * A handler for an [`OnionMessage`] containing a BOLT 12 Offers message as its payload.
+ *
+ * [`OnionMessage`]: crate::ln::msgs::OnionMessage
+ */
+typedef struct LDKOffersMessageHandler {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment,
+ * or replying with an error.
+ *
+ * The returned [`OffersMessage`], if any, is enqueued to be sent by [`OnionMessenger`].
+ *
+ * [`OnionMessenger`]: crate::onion_message::OnionMessenger
+ */
+ struct LDKCOption_OffersMessageZ (*handle_message)(const void *this_arg, struct LDKOffersMessage message);
+ /**
+ * Releases any [`OffersMessage`]s that need to be sent.
+ *
+ * Typically, this is used for messages initiating a payment flow rather than in response to
+ * another message. The latter should use the return value of [`Self::handle_message`].
+ */
+ struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ (*release_pending_messages)(const void *this_arg);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKOffersMessageHandler;
+
/**
} LDKRoutingMessageHandler;
/**
- * A trait indicating an object may generate onion messages to send
- */
-typedef struct LDKOnionMessageProvider {
- /**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
- */
- void *this_arg;
- /**
- * Gets the next pending onion message for the peer with the given node id.
- *
- * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
- */
- struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id);
- /**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
- */
- void (*free)(void *this_arg);
-} LDKOnionMessageProvider;
-
-/**
- * A trait to describe an object that can receive onion messages.
+ * A handler for received [`OnionMessage`]s and for providing generated ones to send.
*/
typedef struct LDKOnionMessageHandler {
/**
* Handle an incoming `onion_message` message from the given peer.
*/
void (*handle_onion_message)(const void *this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg);
+ /**
+ * Returns the next pending onion message for the peer with the given node id.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id);
/**
* Called when a connection is established with a peer. Can be used to track which peers
* advertise onion message support and are online.
* Note that this method is called before [`Self::peer_connected`].
*/
struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
- /**
- * Implementation of OnionMessageProvider for this object.
- */
- struct LDKOnionMessageProvider OnionMessageProvider;
/**
* 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;
} LDKIgnoringMessageHandler;
-/**
- * A handler for an [`OnionMessage`] containing a BOLT 12 Offers message as its payload.
- *
- * [`OnionMessage`]: crate::ln::msgs::OnionMessage
- */
-typedef struct LDKOffersMessageHandler {
- /**
- * An opaque pointer which is passed to your function implementations as an argument.
- * This has no meaning in the LDK, and can be NULL or any other value.
- */
- void *this_arg;
- /**
- * Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment,
- * or replying with an error.
- */
- struct LDKCOption_OffersMessageZ (*handle_message)(const void *this_arg, struct LDKOffersMessage message);
- /**
- * Frees any resources associated with this object given its this_arg pointer.
- * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
- */
- void (*free)(void *this_arg);
-} LDKOffersMessageHandler;
-
/**
* Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`],
* [`SimpleRefOnionMessenger`], or prefer to ignore inbound custom onion messages,
void *this_arg;
/**
* Called with the custom message that was received, returning a response to send, if any.
+ *
+ * The returned [`Self::CustomMessage`], if any, is enqueued to be sent by [`OnionMessenger`].
*/
- struct LDKCOption_CustomOnionMessageContentsZ (*handle_custom_message)(const void *this_arg, struct LDKCustomOnionMessageContents msg);
+ struct LDKCOption_OnionMessageContentsZ (*handle_custom_message)(const void *this_arg, struct LDKOnionMessageContents msg);
/**
* Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the
* message type is unknown.
*/
- struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer);
+ struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer);
+ /**
+ * Releases any [`Self::CustomMessage`]s that need to be sent.
+ *
+ * Typically, this is used for messages initiating a message flow rather than in response to
+ * another message. The latter should use the return value of [`Self::handle_custom_message`].
+ */
+ struct LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ (*release_pending_custom_messages)(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.
bool is_owned;
} LDKPhantomKeysManager;
-/**
- * The destination of an onion message.
- */
-typedef enum LDKDestination_Tag {
- /**
- * We're sending this onion message to a node.
- */
- LDKDestination_Node,
- /**
- * We're sending this onion message to a blinded path.
- */
- LDKDestination_BlindedPath,
- /**
- * Must be last for serialization purposes
- */
- LDKDestination_Sentinel,
-} LDKDestination_Tag;
-
-typedef struct MUST_USE_STRUCT LDKDestination {
- LDKDestination_Tag tag;
- union {
- struct {
- struct LDKPublicKey node;
- };
- struct {
- struct LDKBlindedPath blinded_path;
- };
- };
-} LDKDestination;
-
/**
* A trait defining behavior for routing an [`OnionMessage`].
- *
- * [`OnionMessage`]: msgs::OnionMessage
*/
typedef struct LDKMessageRouter {
/**
void *this_arg;
/**
* Returns a route for sending an [`OnionMessage`] to the given [`Destination`].
- *
- * [`OnionMessage`]: msgs::OnionMessage
*/
struct LDKCResult_OnionMessagePathNoneZ (*find_path)(const void *this_arg, struct LDKPublicKey sender, struct LDKCVec_PublicKeyZ peers, struct LDKDestination destination);
/**
/**
- * A sender, receiver and forwarder of onion messages. In upcoming releases, this object will be
- * used to retrieve invoices and fulfill invoice requests from [offers]. Currently, only sending
- * and receiving custom onion messages is supported.
+ * A sender, receiver and forwarder of [`OnionMessage`]s.
+ *
+ * # Handling Messages
+ *
+ * `OnionMessenger` implements [`OnionMessageHandler`], making it responsible for either forwarding
+ * messages to peers or delegating to the appropriate handler for the message type. Currently, the
+ * available handlers are:
+ * * [`OffersMessageHandler`], for responding to [`InvoiceRequest`]s and paying [`Bolt12Invoice`]s
+ * * [`CustomOnionMessageHandler`], for handling user-defined message types
+ *
+ * # Sending Messages
+ *
+ * [`OnionMessage`]s are sent initially using [`OnionMessenger::send_onion_message`]. When handling
+ * a message, the matched handler may return a response message which `OnionMessenger` will send
+ * on its behalf.
*
* # Example
*
* # use lightning::sign::KeysManager;
* # use lightning::ln::peer_handler::IgnoringMessageHandler;
* # use lightning::onion_message::messenger::{Destination, MessageRouter, OnionMessenger, OnionMessagePath};
- * # use lightning::onion_message::packet::{CustomOnionMessageContents, OnionMessageContents};
+ * # use lightning::onion_message::packet::OnionMessageContents;
* # use lightning::util::logger::{Logger, Record};
* # use lightning::util::ser::{Writeable, Writer};
* # use lightning::io;
* \t\t// Write your custom onion message to `w`
* \t}
* }
- * impl CustomOnionMessageContents for YourCustomMessage {
+ * impl OnionMessageContents for YourCustomMessage {
* \tfn tlv_type(&self) -> u64 {
* \t\t# let your_custom_message_type = 42;
* \t\tyour_custom_message_type
* \tdestination: Destination::Node(destination_node_id),
* };
* let reply_path = None;
- * # let your_custom_message = YourCustomMessage {};
- * let message = OnionMessageContents::Custom(your_custom_message);
+ * # let message = YourCustomMessage {};
* onion_messenger.send_onion_message(path, message, reply_path);
*
* // Create a blinded path to yourself, for someone to send an onion message to.
* \tdestination: Destination::BlindedPath(blinded_path),
* };
* let reply_path = None;
- * # let your_custom_message = YourCustomMessage {};
- * let message = OnionMessageContents::Custom(your_custom_message);
+ * # let message = YourCustomMessage {};
* onion_messenger.send_onion_message(path, message, reply_path);
* ```
*
- * [offers]: <https://github.com/lightning/bolts/pull/798>
- * [`OnionMessenger`]: crate::onion_message::OnionMessenger
+ * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
+ * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
*/
typedef struct MUST_USE_STRUCT LDKOnionMessenger {
/**
/**
- * A [`MessageRouter`] that always fails.
+ * A [`MessageRouter`] that can only route to a directly connected [`Destination`].
*/
typedef struct MUST_USE_STRUCT LDKDefaultMessageRouter {
/**
bool is_owned;
} LDKDefaultMessageRouter;
-/**
- * The contents of an onion message. In the context of offers, this would be the invoice, invoice
- * request, or invoice error.
- */
-typedef enum LDKOnionMessageContents_Tag {
- /**
- * A message related to BOLT 12 Offers.
- */
- LDKOnionMessageContents_Offers,
- /**
- * A custom onion message specified by the user.
- */
- LDKOnionMessageContents_Custom,
- /**
- * Must be last for serialization purposes
- */
- LDKOnionMessageContents_Sentinel,
-} LDKOnionMessageContents_Tag;
-
-typedef struct MUST_USE_STRUCT LDKOnionMessageContents {
- LDKOnionMessageContents_Tag tag;
- union {
- struct {
- struct LDKOffersMessage offers;
- };
- struct {
- struct LDKCustomOnionMessageContents custom;
- };
- };
-} LDKOnionMessageContents;
-
/**
*/
struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(const struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR orig);
+/**
+ * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_ok(struct LDKChannelDerivationParameters o);
+
+/**
+ * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ.
+ */
+void CResult_ChannelDerivationParametersDecodeErrorZ_free(struct LDKCResult_ChannelDerivationParametersDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state.
+ */
+struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_ok(struct LDKHTLCDescriptor o);
+
+/**
+ * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state.
+ */
+struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_HTLCDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ.
+ */
+void CResult_HTLCDescriptorDecodeErrorZ_free(struct LDKCResult_HTLCDescriptorDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_clone(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_NoneNoneZ in the success state.
*/
*/
struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_clone(const struct LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR orig);
-/**
- * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state.
- */
-struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_ok(struct LDKChannelDerivationParameters o);
-
-/**
- * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state.
- */
-struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_err(struct LDKDecodeError e);
-
-/**
- * Checks if the given object is currently in the success state
- */
-bool CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ.
- */
-void CResult_ChannelDerivationParametersDecodeErrorZ_free(struct LDKCResult_ChannelDerivationParametersDecodeErrorZ _res);
-
-/**
- * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR orig);
-
-/**
- * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state.
- */
-struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_ok(struct LDKHTLCDescriptor o);
-
-/**
- * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state.
- */
-struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
-
-/**
- * Checks if the given object is currently in the success state
- */
-bool CResult_HTLCDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ.
- */
-void CResult_HTLCDescriptorDecodeErrorZ_free(struct LDKCResult_HTLCDescriptorDecodeErrorZ _res);
-
-/**
- * Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_clone(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR orig);
-
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
*/
void CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res);
+/**
+ * Constructs a new COption_StrZ containing a crate::c_types::Str
+ */
+struct LDKCOption_StrZ COption_StrZ_some(struct LDKStr o);
+
+/**
+ * Constructs a new COption_StrZ containing nothing
+ */
+struct LDKCOption_StrZ COption_StrZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::c_types::Str, if we are in the Some state
+ */
+void COption_StrZ_free(struct LDKCOption_StrZ _res);
+
+/**
+ * Creates a new COption_StrZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_StrZ COption_StrZ_clone(const struct LDKCOption_StrZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_NoneBolt12SemanticErrorZ in the success state.
+ */
+struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_ok(void);
+
+/**
+ * Creates a new CResult_NoneBolt12SemanticErrorZ in the error state.
+ */
+struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NoneBolt12SemanticErrorZ_is_ok(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NoneBolt12SemanticErrorZ.
+ */
+void CResult_NoneBolt12SemanticErrorZ_free(struct LDKCResult_NoneBolt12SemanticErrorZ _res);
+
+/**
+ * Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_clone(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state.
*/
*/
struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR orig);
+/**
+ * Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
+ */
+struct LDKCOption_OffersMessageZ COption_OffersMessageZ_some(struct LDKOffersMessage o);
+
+/**
+ * Constructs a new COption_OffersMessageZ containing nothing
+ */
+struct LDKCOption_OffersMessageZ COption_OffersMessageZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
+ */
+void COption_OffersMessageZ_free(struct LDKCOption_OffersMessageZ _res);
+
+/**
+ * Creates a new COption_OffersMessageZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_OffersMessageZ COption_OffersMessageZ_clone(const struct LDKCOption_OffersMessageZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ C3Tuple_OffersMessageDestinationBlindedPathZ_clone(const struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements.
+ */
+struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ C3Tuple_OffersMessageDestinationBlindedPathZ_new(struct LDKOffersMessage a, struct LDKDestination b, struct LDKBlindedPath c);
+
+/**
+ * Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ.
+ */
+void C3Tuple_OffersMessageDestinationBlindedPathZ_free(struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res);
+
/**
* Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
*/
void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
/**
- * Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
+ * Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents
*/
-struct LDKCOption_OffersMessageZ COption_OffersMessageZ_some(struct LDKOffersMessage o);
+struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_some(struct LDKOnionMessageContents o);
/**
- * Constructs a new COption_OffersMessageZ containing nothing
+ * Constructs a new COption_OnionMessageContentsZ containing nothing
*/
-struct LDKCOption_OffersMessageZ COption_OffersMessageZ_none(void);
+struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_none(void);
/**
- * Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
+ * Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state
*/
-void COption_OffersMessageZ_free(struct LDKCOption_OffersMessageZ _res);
+void COption_OnionMessageContentsZ_free(struct LDKCOption_OnionMessageContentsZ _res);
/**
- * Creates a new COption_OffersMessageZ which has the same data as `orig`
+ * Creates a new COption_OnionMessageContentsZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCOption_OffersMessageZ COption_OffersMessageZ_clone(const struct LDKCOption_OffersMessageZ *NONNULL_PTR orig);
+struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_clone(const struct LDKCOption_OnionMessageContentsZ *NONNULL_PTR orig);
/**
- * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
+ * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state.
*/
-struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o);
+struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_OnionMessageContentsZ o);
/**
- * Constructs a new COption_CustomOnionMessageContentsZ containing nothing
+ * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state.
*/
-struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void);
+struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
+ * Checks if the given object is currently in the success state
*/
-void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res);
+bool CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR o);
/**
- * Creates a new COption_CustomOnionMessageContentsZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ.
*/
-struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_clone(const struct LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR orig);
+void CResult_COption_OnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res);
/**
- * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
+ * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o);
+struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(const struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR orig);
/**
- * Checks if the given object is currently in the success state
+ * Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements.
*/
-bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o);
+struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(struct LDKOnionMessageContents a, struct LDKDestination b, struct LDKBlindedPath c);
/**
- * Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
+ * Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ.
*/
-void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res);
+void C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res);
/**
- * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR orig);
+void CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(struct LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res);
/**
* Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
*/
void CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ _res);
+/**
+ * Creates a new CResult_PeeledOnionNoneZ in the success state.
+ */
+struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_ok(struct LDKPeeledOnion o);
+
+/**
+ * Creates a new CResult_PeeledOnionNoneZ in the error state.
+ */
+struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PeeledOnionNoneZ_is_ok(const struct LDKCResult_PeeledOnionNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PeeledOnionNoneZ.
+ */
+void CResult_PeeledOnionNoneZ_free(struct LDKCResult_PeeledOnionNoneZ _res);
+
/**
* Creates a new CResult_NoneSendErrorZ in the success state.
*/
* funder/initiator.
*
* When we are the funder, because we have to pay the channel closing fee, we bound the
- * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
+ * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by
* this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
- * [`Normal`] feerate during normal operation, this value represents the additional fee we're
+ * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're
* willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
* funds.
*
* When we are not the funder, we require the closing transaction fee pay at least our
- * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
+ * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like.
* Thus, this value is ignored when we are not the funder.
*
* Default value: 1000 satoshis.
*
- * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
- * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
+ * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
+ * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum
*/
uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
* funder/initiator.
*
* When we are the funder, because we have to pay the channel closing fee, we bound the
- * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
+ * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by
* this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
- * [`Normal`] feerate during normal operation, this value represents the additional fee we're
+ * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're
* willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
* funds.
*
* When we are not the funder, we require the closing transaction fee pay at least our
- * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
+ * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like.
* Thus, this value is ignored when we are not the funder.
*
* Default value: 1000 satoshis.
*
- * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
- * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
+ * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
+ * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum
*/
void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
/**
- * Utility method to constructs a new MempoolMinimum-variant ConfirmationTarget
+ * Utility method to constructs a new OnChainSweep-variant ConfirmationTarget
+ */
+enum LDKConfirmationTarget ConfirmationTarget_on_chain_sweep(void);
+
+/**
+ * Utility method to constructs a new MaxAllowedNonAnchorChannelRemoteFee-variant ConfirmationTarget
+ */
+enum LDKConfirmationTarget ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee(void);
+
+/**
+ * Utility method to constructs a new MinAllowedAnchorChannelRemoteFee-variant ConfirmationTarget
*/
-enum LDKConfirmationTarget ConfirmationTarget_mempool_minimum(void);
+enum LDKConfirmationTarget ConfirmationTarget_min_allowed_anchor_channel_remote_fee(void);
/**
- * Utility method to constructs a new Background-variant ConfirmationTarget
+ * Utility method to constructs a new MinAllowedNonAnchorChannelRemoteFee-variant ConfirmationTarget
*/
-enum LDKConfirmationTarget ConfirmationTarget_background(void);
+enum LDKConfirmationTarget ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee(void);
/**
- * Utility method to constructs a new Normal-variant ConfirmationTarget
+ * Utility method to constructs a new AnchorChannelFee-variant ConfirmationTarget
*/
-enum LDKConfirmationTarget ConfirmationTarget_normal(void);
+enum LDKConfirmationTarget ConfirmationTarget_anchor_channel_fee(void);
/**
- * Utility method to constructs a new HighPriority-variant ConfirmationTarget
+ * Utility method to constructs a new NonAnchorChannelFee-variant ConfirmationTarget
*/
-enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
+enum LDKConfirmationTarget ConfirmationTarget_non_anchor_channel_fee(void);
+
+/**
+ * Utility method to constructs a new ChannelCloseMinimum-variant ConfirmationTarget
+ */
+enum LDKConfirmationTarget ConfirmationTarget_channel_close_minimum(void);
/**
* Generates a non-cryptographic 64-bit hash of the ConfirmationTarget.
* will be accepted on the given channel, and after additional timeout/the closing of all
* pending HTLCs, the channel will be closed on chain.
*
- * * If we are the channel initiator, we will pay between our [`Background`] and
- * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
- * estimate.
+ * * If we are the channel initiator, we will pay between our [`ChannelCloseMinimum`] and
+ * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`]
+ * fee estimate.
* * If our counterparty is the channel initiator, we will require a channel closing
- * transaction feerate of at least our [`Background`] feerate or the feerate which
+ * transaction feerate of at least our [`ChannelCloseMinimum`] feerate or the feerate which
* would appear on a force-closure transaction, whichever is lower. We will allow our
* counterparty to pay as much fee as they'd like, however.
*
* channel.
*
* [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
- * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
- * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
+ * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum
+ * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
* [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
*/
MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
* the channel being closed or not:
* * If we are the channel initiator, we will pay at least this feerate on the closing
* transaction. The upper-bound is set by
- * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
- * estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
+ * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`]
+ * fee estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
* * If our counterparty is the channel initiator, we will refuse to accept a channel closure
* transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
* will appear on a force-closure transaction, whichever is lower).
* channel.
*
* [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
- * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
- * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
+ * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
* [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
*
* Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None
* wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
* determine the ultimate status of a payment.
*
+ * # Requested Invoices
+ *
+ * In the case of paying a [`Bolt12Invoice`] via [`ChannelManager::pay_for_offer`], abandoning
+ * the payment prior to receiving the invoice will result in an [`Event::InvoiceRequestFailed`]
+ * and prevent any attempts at paying it once received. The other events may only be generated
+ * once the invoice has been received.
+ *
* # Restart Behavior
*
* If an [`Event::PaymentFailed`] is generated and we restart without first persisting the
- * [`ChannelManager`], another [`Event::PaymentFailed`] may be generated.
+ * [`ChannelManager`], another [`Event::PaymentFailed`] may be generated; likewise for
+ * [`Event::InvoiceRequestFailed`].
+ *
+ * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
*/
void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
* with the current [`ChannelConfig`].
* * Removing peers which have disconnected but and no longer have any channels.
* * Force-closing and removing channels which have not completed establishment in a timely manner.
+ * * Forgetting about stale outbound payments, either those that have already been fulfilled
+ * or those awaiting an invoice that hasn't been delivered in the necessary amount of time.
+ * The latter is determined using the system clock in `std` and the highest seen block time
+ * minus two hours in `no-std`.
*
* Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate
* estimate fetches.
*/
MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id);
+/**
+ * Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and
+ * enqueuing it to be sent via an onion message. [`ChannelManager`] will pay the actual
+ * [`Bolt12Invoice`] once it is received.
+ *
+ * Uses [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is recognized by
+ * the [`ChannelManager`] when handling a [`Bolt12Invoice`] message in response to the request.
+ * The optional parameters are used in the builder, if `Some`:
+ * - `quantity` for [`InvoiceRequest::quantity`] which must be set if
+ * [`Offer::expects_quantity`] is `true`.
+ * - `amount_msats` if overpaying what is required for the given `quantity` is desired, and
+ * - `payer_note` for [`InvoiceRequest::payer_note`].
+ *
+ * If `max_total_routing_fee_msat` is not specified, The default from
+ * [`RouteParameters::from_payment_params_and_value`] is applied.
+ *
+ * # Payment
+ *
+ * The provided `payment_id` is used to ensure that only one invoice is paid for the request
+ * when received. See [Avoiding Duplicate Payments] for other requirements once the payment has
+ * been sent.
+ *
+ * To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the
+ * invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the
+ * payment will fail with an [`Event::InvoiceRequestFailed`].
+ *
+ * # Privacy
+ *
+ * Uses a one-hop [`BlindedPath`] for the reply path with [`ChannelManager::get_our_node_id`]
+ * as the introduction node and a derived payer id for payer privacy. As such, currently, the
+ * node must be announced. Otherwise, there is no way to find a path to the introduction node
+ * in order to send the [`Bolt12Invoice`].
+ *
+ * # Limitations
+ *
+ * Requires a direct connection to an introduction node in [`Offer::paths`] or to
+ * [`Offer::signing_pubkey`], if empty. A similar restriction applies to the responding
+ * [`Bolt12Invoice::payment_paths`].
+ *
+ * # Errors
+ *
+ * Errors if a duplicate `payment_id` is provided given the caveats in the aforementioned link
+ * or if the provided parameters are invalid for the offer.
+ *
+ * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
+ * [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity
+ * [`InvoiceRequest::payer_note`]: crate::offers::invoice_request::InvoiceRequest::payer_note
+ * [`InvoiceRequestBuilder`]: crate::offers::invoice_request::InvoiceRequestBuilder
+ * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
+ * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths
+ * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments
+ */
+MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_pay_for_offer(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOffer *NONNULL_PTR offer, struct LDKCOption_u64Z quantity, struct LDKCOption_u64Z amount_msats, struct LDKCOption_StrZ payer_note, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat);
+
+/**
+ * Creates a [`Bolt12Invoice`] for a [`Refund`] and enqueues it to be sent via an onion
+ * message.
+ *
+ * The resulting invoice uses a [`PaymentHash`] recognized by the [`ChannelManager`] and a
+ * [`BlindedPath`] containing the [`PaymentSecret`] needed to reconstruct the corresponding
+ * [`PaymentPreimage`].
+ *
+ * # Limitations
+ *
+ * Requires a direct connection to an introduction node in [`Refund::paths`] or to
+ * [`Refund::payer_id`], if empty. This request is best effort; an invoice will be sent to each
+ * node meeting the aforementioned criteria, but there's no guarantee that they will be
+ * received and no retries will be made.
+ *
+ * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
+ */
+MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_request_refund_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRefund *NONNULL_PTR refund);
+
/**
* Gets a payment secret and payment hash for use in an invoice given to a third party wishing
* to pay us.
MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
/**
- * Fetches the set of [`NodeFeatures`] flags which are provided by or required by
+ * Fetches the set of [`NodeFeatures`] flags that are provided by or required by
* [`ChannelManager`].
*/
MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
/**
- * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by
+ * Fetches the set of [`ChannelFeatures`] flags that are provided by or required by
* [`ChannelManager`].
*/
MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
/**
- * Fetches the set of [`ChannelTypeFeatures`] flags which are provided by or required by
+ * Fetches the set of [`ChannelTypeFeatures`] flags that are provided by or required by
* [`ChannelManager`].
*/
MUST_USE_RES struct LDKChannelTypeFeatures ChannelManager_channel_type_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
/**
- * Fetches the set of [`InitFeatures`] flags which are provided by or required by
+ * Fetches the set of [`InitFeatures`] flags that are provided by or required by
* [`ChannelManager`].
*/
MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
/**
- * Fetches the set of [`InitFeatures`] flags which are provided by or required by
+ * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is
+ */
+struct LDKOffersMessageHandler ChannelManager_as_OffersMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
+
+/**
+ * Fetches the set of [`InitFeatures`] flags that are provided by or required by
* [`ChannelManager`].
*/
struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR config);
*/
struct LDKCResult_SocketAddressSocketAddressParseErrorZ parse_onion_address(struct LDKStr host, uint16_t port);
+/**
+ * Get the string representation of a SocketAddress object
+ */
+struct LDKStr SocketAddress_to_str(const struct LDKSocketAddress *NONNULL_PTR o);
+
/**
* Read a SocketAddress object from a string
*/
*/
struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
-/**
- * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
- * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
- */
-struct LDKOnionMessageProvider IgnoringMessageHandler_as_OnionMessageProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
-
/**
* Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
* This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
*/
MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
+/**
+ * The per commitment point used by the broadcaster.
+ */
+MUST_USE_RES struct LDKPublicKey CommitmentTransaction_per_commitment_point(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
+
/**
* The value to be sent to the broadcaster
*/
*/
struct LDKErroneousField ErroneousField_clone(const struct LDKErroneousField *NONNULL_PTR orig);
+/**
+ * Creates an [`InvoiceError`] with the given message.
+ */
+MUST_USE_RES struct LDKInvoiceError InvoiceError_from_string(struct LDKStr s);
+
/**
* Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read
*/
*/
enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_id(void);
+/**
+ * Utility method to constructs a new DuplicatePaymentId-variant Bolt12SemanticError
+ */
+enum LDKBolt12SemanticError Bolt12SemanticError_duplicate_payment_id(void);
+
/**
* Utility method to constructs a new MissingPaths-variant Bolt12SemanticError
*/
/**
* Handles any network updates originating from [`Event`]s.
+ * Note that this will skip applying any [`NetworkUpdate::ChannelUpdateMessage`] to avoid
+ * leaking possibly identifying information of the sender to the public network.
*
* [`Event`]: crate::events::Event
*/
void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update);
/**
- * Gets the genesis hash for this network graph.
+ * Gets the chain hash for this network graph.
*/
-MUST_USE_RES struct LDKThirtyTwoBytes NetworkGraph_get_genesis_hash(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKThirtyTwoBytes NetworkGraph_get_chain_hash(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
/**
* Verifies the signature of a [`NodeAnnouncement`].
* 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 P2PGossipSync's
- * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
+ * You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'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
*/
MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
+/**
+ * For an already known (from announcement) channel, verify the given [`ChannelUpdate`].
+ *
+ * This checks whether the update currently is applicable by [`Self::update_channel`].
+ *
+ * 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_verify_channel_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
+
/**
* Returns information on a channel with the given id.
*
*/
MUST_USE_RES struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ SpendableOutputDescriptor_create_spendable_outputs_psbt(struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_u32Z locktime);
+/**
+ * Frees any resources used by the ChannelDerivationParameters, if is_owned is set and inner is non-NULL.
+ */
+void ChannelDerivationParameters_free(struct LDKChannelDerivationParameters this_obj);
+
+/**
+ * The value in satoshis of the channel we're attempting to spend the anchor output of.
+ */
+uint64_t ChannelDerivationParameters_get_value_satoshis(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr);
+
+/**
+ * The value in satoshis of the channel we're attempting to spend the anchor output of.
+ */
+void ChannelDerivationParameters_set_value_satoshis(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * The unique identifier to re-derive the signer for the associated channel.
+ */
+const uint8_t (*ChannelDerivationParameters_get_keys_id(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr))[32];
+
+/**
+ * The unique identifier to re-derive the signer for the associated channel.
+ */
+void ChannelDerivationParameters_set_keys_id(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
+
+/**
+ * The necessary channel parameters that need to be provided to the re-derived signer through
+ * [`ChannelSigner::provide_channel_parameters`].
+ */
+struct LDKChannelTransactionParameters ChannelDerivationParameters_get_transaction_parameters(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr);
+
+/**
+ * The necessary channel parameters that need to be provided to the re-derived signer through
+ * [`ChannelSigner::provide_channel_parameters`].
+ */
+void ChannelDerivationParameters_set_transaction_parameters(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val);
+
+/**
+ * Constructs a new ChannelDerivationParameters given each field
+ */
+MUST_USE_RES struct LDKChannelDerivationParameters ChannelDerivationParameters_new(uint64_t value_satoshis_arg, struct LDKThirtyTwoBytes keys_id_arg, struct LDKChannelTransactionParameters transaction_parameters_arg);
+
+/**
+ * Creates a copy of the ChannelDerivationParameters
+ */
+struct LDKChannelDerivationParameters ChannelDerivationParameters_clone(const struct LDKChannelDerivationParameters *NONNULL_PTR orig);
+
+/**
+ * Checks if two ChannelDerivationParameterss 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 ChannelDerivationParameters_eq(const struct LDKChannelDerivationParameters *NONNULL_PTR a, const struct LDKChannelDerivationParameters *NONNULL_PTR b);
+
+/**
+ * Serialize the ChannelDerivationParameters object into a byte array which can be read by ChannelDerivationParameters_read
+ */
+struct LDKCVec_u8Z ChannelDerivationParameters_write(const struct LDKChannelDerivationParameters *NONNULL_PTR obj);
+
+/**
+ * Read a ChannelDerivationParameters from a byte array, created by ChannelDerivationParameters_write
+ */
+struct LDKCResult_ChannelDerivationParametersDecodeErrorZ ChannelDerivationParameters_read(struct LDKu8slice ser);
+
+/**
+ * Frees any resources used by the HTLCDescriptor, if is_owned is set and inner is non-NULL.
+ */
+void HTLCDescriptor_free(struct LDKHTLCDescriptor this_obj);
+
+/**
+ * The parameters required to derive the signer for the HTLC input.
+ */
+struct LDKChannelDerivationParameters HTLCDescriptor_get_channel_derivation_parameters(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
+
+/**
+ * The parameters required to derive the signer for the HTLC input.
+ */
+void HTLCDescriptor_set_channel_derivation_parameters(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val);
+
+/**
+ * The number of the commitment transaction in which the HTLC output lives.
+ */
+uint64_t HTLCDescriptor_get_per_commitment_number(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
+
+/**
+ * The number of the commitment transaction in which the HTLC output lives.
+ */
+void HTLCDescriptor_set_per_commitment_number(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * The key tweak corresponding to the number of the commitment transaction in which the HTLC
+ * output lives. This tweak is applied to all the basepoints for both parties in the channel to
+ * arrive at unique keys per commitment.
+ *
+ * See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
+ */
+struct LDKPublicKey HTLCDescriptor_get_per_commitment_point(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
+
+/**
+ * The key tweak corresponding to the number of the commitment transaction in which the HTLC
+ * output lives. This tweak is applied to all the basepoints for both parties in the channel to
+ * arrive at unique keys per commitment.
+ *
+ * See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
+ */
+void HTLCDescriptor_set_per_commitment_point(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
+
+/**
+ * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs
+ * originating from a channel supporting anchor outputs, otherwise it is the channel's
+ * negotiated feerate at the time the commitment transaction was built.
+ */
+uint32_t HTLCDescriptor_get_feerate_per_kw(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
+
+/**
+ * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs
+ * originating from a channel supporting anchor outputs, otherwise it is the channel's
+ * negotiated feerate at the time the commitment transaction was built.
+ */
+void HTLCDescriptor_set_feerate_per_kw(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint32_t val);
+
+/**
+ * The details of the HTLC as it appears in the commitment transaction.
+ */
+struct LDKHTLCOutputInCommitment HTLCDescriptor_get_htlc(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
+
+/**
+ * The details of the HTLC as it appears in the commitment transaction.
+ */
+void HTLCDescriptor_set_htlc(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKHTLCOutputInCommitment val);
+
+/**
+ * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
+ * taken.
+ */
+struct LDKCOption_ThirtyTwoBytesZ HTLCDescriptor_get_preimage(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
+
+/**
+ * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
+ * taken.
+ */
+void HTLCDescriptor_set_preimage(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val);
+
+/**
+ * The counterparty's signature required to spend the HTLC output.
+ */
+struct LDKECDSASignature HTLCDescriptor_get_counterparty_sig(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
+
+/**
+ * The counterparty's signature required to spend the HTLC output.
+ */
+void HTLCDescriptor_set_counterparty_sig(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
+
+/**
+ * Creates a copy of the HTLCDescriptor
+ */
+struct LDKHTLCDescriptor HTLCDescriptor_clone(const struct LDKHTLCDescriptor *NONNULL_PTR orig);
+
+/**
+ * Checks if two HTLCDescriptors 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 HTLCDescriptor_eq(const struct LDKHTLCDescriptor *NONNULL_PTR a, const struct LDKHTLCDescriptor *NONNULL_PTR b);
+
+/**
+ * Serialize the HTLCDescriptor object into a byte array which can be read by HTLCDescriptor_read
+ */
+struct LDKCVec_u8Z HTLCDescriptor_write(const struct LDKHTLCDescriptor *NONNULL_PTR obj);
+
+/**
+ * Read a HTLCDescriptor from a byte array, created by HTLCDescriptor_write
+ */
+struct LDKCResult_HTLCDescriptorDecodeErrorZ HTLCDescriptor_read(struct LDKu8slice ser);
+
+/**
+ * Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint
+ * being spent by the HTLC input in the HTLC transaction.
+ */
+MUST_USE_RES struct LDKOutPoint HTLCDescriptor_outpoint(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
+
+/**
+ * Returns the UTXO to be spent by the HTLC input, which can be obtained via
+ * [`Self::unsigned_tx_input`].
+ */
+MUST_USE_RES struct LDKTxOut HTLCDescriptor_previous_utxo(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
+
+/**
+ * Returns the unsigned transaction input spending the HTLC output in the commitment
+ * transaction.
+ */
+MUST_USE_RES struct LDKTxIn HTLCDescriptor_unsigned_tx_input(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
+
+/**
+ * Returns the delayed output created as a result of spending the HTLC output in the commitment
+ * transaction.
+ */
+MUST_USE_RES struct LDKTxOut HTLCDescriptor_tx_output(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
+
+/**
+ * Returns the witness script of the HTLC output in the commitment transaction.
+ */
+MUST_USE_RES struct LDKCVec_u8Z HTLCDescriptor_witness_script(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
+
+/**
+ * Returns the fully signed witness required to spend the HTLC output in the commitment
+ * transaction.
+ */
+MUST_USE_RES struct LDKWitness HTLCDescriptor_tx_input_witness(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature, struct LDKu8slice witness_script);
+
+/**
+ * Derives the channel signer required to sign the HTLC input.
+ */
+MUST_USE_RES struct LDKWriteableEcdsaChannelSigner HTLCDescriptor_derive_channel_signer(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider);
+
/**
* Calls the free function if one is set
*/
void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr);
/**
- * Create an onion message with contents `message` to the destination of `path`.
- * Returns (introduction_node_id, onion_msg)
+ * Frees any resources used by the PeeledOnion
+ */
+void PeeledOnion_free(struct LDKPeeledOnion this_ptr);
+
+/**
+ * Creates a copy of the PeeledOnion
+ */
+struct LDKPeeledOnion PeeledOnion_clone(const struct LDKPeeledOnion *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new Forward-variant PeeledOnion
+ */
+struct LDKPeeledOnion PeeledOnion_forward(struct LDKPublicKey a, struct LDKOnionMessage b);
+
+/**
+ * Utility method to constructs a new Receive-variant PeeledOnion
+ */
+struct LDKPeeledOnion PeeledOnion_receive(struct LDKParsedOnionMessageContents a, struct LDKThirtyTwoBytes b, struct LDKBlindedPath c);
+
+/**
+ * Creates an [`OnionMessage`] with the given `contents` for sending to the destination of
+ * `path`.
+ *
+ * Returns both the node id of the peer to send the message to and the message itself.
*
* Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ create_onion_message(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, struct LDKOnionMessagePath path, struct LDKOnionMessageContents message, struct LDKBlindedPath reply_path);
+struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ create_onion_message(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedPath reply_path);
+
+/**
+ * Decode one layer of an incoming [`OnionMessage`].
+ *
+ * Returns either the next layer of the onion for forwarding or the decrypted content for the
+ * receiver.
+ */
+struct LDKCResult_PeeledOnionNoneZ peel_onion_message(const struct LDKOnionMessage *NONNULL_PTR msg, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler);
/**
* Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to
MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKMessageRouter message_router, struct LDKOffersMessageHandler offers_handler, struct LDKCustomOnionMessageHandler custom_handler);
/**
- * Send an onion message with contents `message` to the destination of `path`.
+ * Sends an [`OnionMessage`] with the given `contents` for sending to the destination of
+ * `path`.
*
* See [`OnionMessenger`] for example usage.
*
* Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKOnionMessagePath path, struct LDKOnionMessageContents message, struct LDKBlindedPath reply_path);
+MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedPath reply_path);
/**
* Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
*/
struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
-/**
- * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
- * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
- */
-struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
-
/**
* Calls the free function if one is set
*/
*/
MUST_USE_RES bool OffersMessage_is_known_type(uint64_t tlv_type);
-/**
- * The TLV record type for the message as used in an `onionmsg_tlv` TLV stream.
- */
-MUST_USE_RES uint64_t OffersMessage_tlv_type(const struct LDKOffersMessage *NONNULL_PTR this_arg);
-
/**
* Serialize the OffersMessage object into a byte array which can be read by OffersMessage_read
*/
struct LDKCVec_u8Z Packet_write(const struct LDKPacket *NONNULL_PTR obj);
/**
- * Frees any resources used by the OnionMessageContents
+ * Frees any resources used by the ParsedOnionMessageContents
*/
-void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr);
+void ParsedOnionMessageContents_free(struct LDKParsedOnionMessageContents this_ptr);
/**
- * Creates a copy of the OnionMessageContents
+ * Creates a copy of the ParsedOnionMessageContents
*/
-struct LDKOnionMessageContents OnionMessageContents_clone(const struct LDKOnionMessageContents *NONNULL_PTR orig);
+struct LDKParsedOnionMessageContents ParsedOnionMessageContents_clone(const struct LDKParsedOnionMessageContents *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new Offers-variant ParsedOnionMessageContents
+ */
+struct LDKParsedOnionMessageContents ParsedOnionMessageContents_offers(struct LDKOffersMessage a);
/**
- * Utility method to constructs a new Offers-variant OnionMessageContents
+ * Utility method to constructs a new Custom-variant ParsedOnionMessageContents
*/
-struct LDKOnionMessageContents OnionMessageContents_offers(struct LDKOffersMessage a);
+struct LDKParsedOnionMessageContents ParsedOnionMessageContents_custom(struct LDKOnionMessageContents a);
/**
- * Utility method to constructs a new Custom-variant OnionMessageContents
+ * Constructs a new OnionMessageContents which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is
*/
-struct LDKOnionMessageContents OnionMessageContents_custom(struct LDKCustomOnionMessageContents a);
+struct LDKOnionMessageContents ParsedOnionMessageContents_as_OnionMessageContents(const struct LDKParsedOnionMessageContents *NONNULL_PTR this_arg);
/**
- * Creates a copy of a CustomOnionMessageContents
+ * Serialize the ParsedOnionMessageContents object into a byte array which can be read by ParsedOnionMessageContents_read
*/
-struct LDKCustomOnionMessageContents CustomOnionMessageContents_clone(const struct LDKCustomOnionMessageContents *NONNULL_PTR orig);
+struct LDKCVec_u8Z ParsedOnionMessageContents_write(const struct LDKParsedOnionMessageContents *NONNULL_PTR obj);
+
+/**
+ * Creates a copy of a OnionMessageContents
+ */
+struct LDKOnionMessageContents OnionMessageContents_clone(const struct LDKOnionMessageContents *NONNULL_PTR orig);
/**
* Calls the free function if one is set
*/
-void CustomOnionMessageContents_free(struct LDKCustomOnionMessageContents this_ptr);
+void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr);
/**
* Frees any resources used by the BlindedPath, if is_owned is set and inner is non-NULL.
*/
bool BlindedHop_eq(const struct LDKBlindedHop *NONNULL_PTR a, const struct LDKBlindedHop *NONNULL_PTR b);
+/**
+ * Create a one-hop blinded path for a message.
+ */
+MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_one_hop_for_message(struct LDKPublicKey recipient_node_id, const struct LDKEntropySource *NONNULL_PTR entropy_source);
+
/**
* Create a blinded path for an onion message, to be forwarded along `node_pks`. The last node
* pubkey in `node_pks` will be the destination node.
*
- * Errors if less than two hops are provided or if `node_pk`(s) are invalid.
+ * Errors if no hops are provided or if `node_pk`(s) are invalid.
*/
MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new_for_message(struct LDKCVec_PublicKeyZ node_pks, const struct LDKEntropySource *NONNULL_PTR entropy_source);
void PaymentConstraints_free(struct LDKPaymentConstraints this_obj);
/**
- * The maximum total CLTV delta that is acceptable when relaying a payment over this
- * [`BlindedHop`].
+ * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`].
*/
uint32_t PaymentConstraints_get_max_cltv_expiry(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr);
/**
- * The maximum total CLTV delta that is acceptable when relaying a payment over this
- * [`BlindedHop`].
+ * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`].
*/
void PaymentConstraints_set_max_cltv_expiry(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint32_t val);
*/
struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKCVec_ClaimedHTLCZ htlcs, struct LDKCOption_u64Z sender_intended_total_msat);
+/**
+ * Utility method to constructs a new InvoiceRequestFailed-variant Event
+ */
+struct LDKEvent Event_invoice_request_failed(struct LDKThirtyTwoBytes payment_id);
+
/**
* Utility method to constructs a new PaymentSent-variant Event
*/
*/
void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
-/**
- * Calls the free function if one is set
- */
-void OnionMessageProvider_free(struct LDKOnionMessageProvider this_ptr);
-
/**
* Calls the free function if one is set
*/
*/
void EventHandler_free(struct LDKEventHandler this_ptr);
-/**
- * Frees any resources used by the ChannelDerivationParameters, if is_owned is set and inner is non-NULL.
- */
-void ChannelDerivationParameters_free(struct LDKChannelDerivationParameters this_obj);
-
-/**
- * The value in satoshis of the channel we're attempting to spend the anchor output of.
- */
-uint64_t ChannelDerivationParameters_get_value_satoshis(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr);
-
-/**
- * The value in satoshis of the channel we're attempting to spend the anchor output of.
- */
-void ChannelDerivationParameters_set_value_satoshis(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, uint64_t val);
-
-/**
- * The unique identifier to re-derive the signer for the associated channel.
- */
-const uint8_t (*ChannelDerivationParameters_get_keys_id(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr))[32];
-
-/**
- * The unique identifier to re-derive the signer for the associated channel.
- */
-void ChannelDerivationParameters_set_keys_id(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
-
-/**
- * The necessary channel parameters that need to be provided to the re-derived signer through
- * [`ChannelSigner::provide_channel_parameters`].
- *
- * [`ChannelSigner::provide_channel_parameters`]: crate::sign::ChannelSigner::provide_channel_parameters
- */
-struct LDKChannelTransactionParameters ChannelDerivationParameters_get_transaction_parameters(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr);
-
-/**
- * The necessary channel parameters that need to be provided to the re-derived signer through
- * [`ChannelSigner::provide_channel_parameters`].
- *
- * [`ChannelSigner::provide_channel_parameters`]: crate::sign::ChannelSigner::provide_channel_parameters
- */
-void ChannelDerivationParameters_set_transaction_parameters(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val);
-
-/**
- * Constructs a new ChannelDerivationParameters given each field
- */
-MUST_USE_RES struct LDKChannelDerivationParameters ChannelDerivationParameters_new(uint64_t value_satoshis_arg, struct LDKThirtyTwoBytes keys_id_arg, struct LDKChannelTransactionParameters transaction_parameters_arg);
-
-/**
- * Creates a copy of the ChannelDerivationParameters
- */
-struct LDKChannelDerivationParameters ChannelDerivationParameters_clone(const struct LDKChannelDerivationParameters *NONNULL_PTR orig);
-
-/**
- * Checks if two ChannelDerivationParameterss 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 ChannelDerivationParameters_eq(const struct LDKChannelDerivationParameters *NONNULL_PTR a, const struct LDKChannelDerivationParameters *NONNULL_PTR b);
-
-/**
- * Serialize the ChannelDerivationParameters object into a byte array which can be read by ChannelDerivationParameters_read
- */
-struct LDKCVec_u8Z ChannelDerivationParameters_write(const struct LDKChannelDerivationParameters *NONNULL_PTR obj);
-
-/**
- * Read a ChannelDerivationParameters from a byte array, created by ChannelDerivationParameters_write
- */
-struct LDKCResult_ChannelDerivationParametersDecodeErrorZ ChannelDerivationParameters_read(struct LDKu8slice ser);
-
/**
* Frees any resources used by the AnchorDescriptor, if is_owned is set and inner is non-NULL.
*/
*/
MUST_USE_RES struct LDKWriteableEcdsaChannelSigner AnchorDescriptor_derive_channel_signer(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider);
-/**
- * Frees any resources used by the HTLCDescriptor, if is_owned is set and inner is non-NULL.
- */
-void HTLCDescriptor_free(struct LDKHTLCDescriptor this_obj);
-
-/**
- * The parameters required to derive the signer for the HTLC input.
- */
-struct LDKChannelDerivationParameters HTLCDescriptor_get_channel_derivation_parameters(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
-
-/**
- * The parameters required to derive the signer for the HTLC input.
- */
-void HTLCDescriptor_set_channel_derivation_parameters(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val);
-
-/**
- * The number of the commitment transaction in which the HTLC output lives.
- */
-uint64_t HTLCDescriptor_get_per_commitment_number(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
-
-/**
- * The number of the commitment transaction in which the HTLC output lives.
- */
-void HTLCDescriptor_set_per_commitment_number(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint64_t val);
-
-/**
- * The key tweak corresponding to the number of the commitment transaction in which the HTLC
- * output lives. This tweak is applied to all the basepoints for both parties in the channel to
- * arrive at unique keys per commitment.
- *
- * See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
- */
-struct LDKPublicKey HTLCDescriptor_get_per_commitment_point(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
-
-/**
- * The key tweak corresponding to the number of the commitment transaction in which the HTLC
- * output lives. This tweak is applied to all the basepoints for both parties in the channel to
- * arrive at unique keys per commitment.
- *
- * See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
- */
-void HTLCDescriptor_set_per_commitment_point(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
-
-/**
- * The details of the HTLC as it appears in the commitment transaction.
- */
-struct LDKHTLCOutputInCommitment HTLCDescriptor_get_htlc(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
-
-/**
- * The details of the HTLC as it appears in the commitment transaction.
- */
-void HTLCDescriptor_set_htlc(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKHTLCOutputInCommitment val);
-
-/**
- * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
- * taken.
- */
-struct LDKCOption_ThirtyTwoBytesZ HTLCDescriptor_get_preimage(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
-
-/**
- * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
- * taken.
- */
-void HTLCDescriptor_set_preimage(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val);
-
-/**
- * The counterparty's signature required to spend the HTLC output.
- */
-struct LDKECDSASignature HTLCDescriptor_get_counterparty_sig(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
-
-/**
- * The counterparty's signature required to spend the HTLC output.
- */
-void HTLCDescriptor_set_counterparty_sig(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
-
-/**
- * Creates a copy of the HTLCDescriptor
- */
-struct LDKHTLCDescriptor HTLCDescriptor_clone(const struct LDKHTLCDescriptor *NONNULL_PTR orig);
-
-/**
- * Checks if two HTLCDescriptors 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 HTLCDescriptor_eq(const struct LDKHTLCDescriptor *NONNULL_PTR a, const struct LDKHTLCDescriptor *NONNULL_PTR b);
-
-/**
- * Serialize the HTLCDescriptor object into a byte array which can be read by HTLCDescriptor_read
- */
-struct LDKCVec_u8Z HTLCDescriptor_write(const struct LDKHTLCDescriptor *NONNULL_PTR obj);
-
-/**
- * Read a HTLCDescriptor from a byte array, created by HTLCDescriptor_write
- */
-struct LDKCResult_HTLCDescriptorDecodeErrorZ HTLCDescriptor_read(struct LDKu8slice ser);
-
-/**
- * Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint
- * being spent by the HTLC input in the HTLC transaction.
- */
-MUST_USE_RES struct LDKOutPoint HTLCDescriptor_outpoint(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
-
-/**
- * Returns the UTXO to be spent by the HTLC input, which can be obtained via
- * [`Self::unsigned_tx_input`].
- */
-MUST_USE_RES struct LDKTxOut HTLCDescriptor_previous_utxo(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
-
-/**
- * Returns the unsigned transaction input spending the HTLC output in the commitment
- * transaction.
- */
-MUST_USE_RES struct LDKTxIn HTLCDescriptor_unsigned_tx_input(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
-
-/**
- * Returns the delayed output created as a result of spending the HTLC output in the commitment
- * transaction.
- */
-MUST_USE_RES struct LDKTxOut HTLCDescriptor_tx_output(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
-
-/**
- * Returns the witness script of the HTLC output in the commitment transaction.
- */
-MUST_USE_RES struct LDKCVec_u8Z HTLCDescriptor_witness_script(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
-
-/**
- * Returns the fully signed witness required to spend the HTLC output in the commitment
- * transaction.
- */
-MUST_USE_RES struct LDKWitness HTLCDescriptor_tx_input_witness(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature, struct LDKu8slice witness_script);
-
-/**
- * Derives the channel signer required to sign the HTLC input.
- */
-MUST_USE_RES struct LDKWriteableEcdsaChannelSigner HTLCDescriptor_derive_channel_signer(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider);
-
/**
* Frees any resources used by the BumpTransactionEvent
*/
class DelayedPaymentOutputDescriptor;
class StaticPaymentOutputDescriptor;
class SpendableOutputDescriptor;
+class ChannelDerivationParameters;
+class HTLCDescriptor;
class ChannelSigner;
class EcdsaChannelSigner;
class WriteableEcdsaChannelSigner;
class NodeAnnouncementInfo;
class NodeAlias;
class NodeInfo;
-class ChannelDerivationParameters;
class AnchorDescriptor;
-class HTLCDescriptor;
class BumpTransactionEvent;
class Input;
class Utxo;
class ConfirmationTarget;
class FeeEstimator;
class Packet;
+class ParsedOnionMessageContents;
class OnionMessageContents;
-class CustomOnionMessageContents;
class PaymentPurpose;
class ClaimedHTLC;
class PathFailure;
class Event;
class MessageSendEvent;
class MessageSendEventsProvider;
-class OnionMessageProvider;
class EventsProvider;
class EventHandler;
class Bolt11ParseError;
class Destination;
class SendError;
class CustomOnionMessageHandler;
+class PeeledOnion;
class FilesystemStore;
class BlindedPath;
class BlindedHop;
class CResult_ChannelReadyDecodeErrorZ;
class CResult_UpdateFeeDecodeErrorZ;
class CResult_NoneBolt11SemanticErrorZ;
+class COption_OnionMessageContentsZ;
class CResult_NoneRetryableSendFailureZ;
class CResult_boolLightningErrorZ;
class CResult_NodeIdDecodeErrorZ;
class CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ;
class CResult_CVec_UtxoZNoneZ;
class CResult_CVec_u8ZIOErrorZ;
-class COption_CustomOnionMessageContentsZ;
+class C3Tuple_OffersMessageDestinationBlindedPathZ;
class CVec_ThirtyTwoBytesZ;
class CResult_ChannelMonitorUpdateStatusNoneZ;
class CResult_ClosingSignedDecodeErrorZ;
class CResult_HTLCDescriptorDecodeErrorZ;
class CVec_RecentPaymentDetailsZ;
class CVec_RouteHintHopZ;
+class CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ;
class CResult_UntrustedStringDecodeErrorZ;
class CVec_U5Z;
class CResult_PaymentParametersDecodeErrorZ;
class CResult_InFlightHtlcsDecodeErrorZ;
class CResult_COption_HTLCDestinationZDecodeErrorZ;
class CResult_ThirtyTwoBytesNoneZ;
+class C3Tuple_OnionMessageContentsDestinationBlindedPathZ;
class C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ;
+class CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ;
class CResult_BlindedHopDecodeErrorZ;
class C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ;
class CResult_FixedPenaltyScorerDecodeErrorZ;
class C2Tuple_OutPointCVec_u8ZZ;
class COption_C2Tuple_u64u64ZZ;
class CResult_ChannelAnnouncementDecodeErrorZ;
+class CResult_PeeledOnionNoneZ;
class CResult_HTLCUpdateDecodeErrorZ;
class CResult_TxAddInputDecodeErrorZ;
class CVec_OutPointZ;
class CVec_CVec_u8ZZ;
class CResult_ProbabilisticScorerDecodeErrorZ;
class CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ;
-class CResult_COption_CustomOnionMessageContentsZDecodeErrorZ;
+class COption_StrZ;
class CResult_ShutdownScriptDecodeErrorZ;
class C2Tuple_usizeTransactionZ;
class CResult_NodeAnnouncementDecodeErrorZ;
class C2Tuple_u64u16Z;
class COption_ThirtyTwoBytesZ;
class CVec_u64Z;
+class CResult_NoneBolt12SemanticErrorZ;
class COption_SecretKeyZ;
class CResult_ThirtyTwoBytesPaymentErrorZ;
class COption_EventZ;
class CVec_PrivateRouteZ;
class COption_i64Z;
class C2Tuple_ThirtyTwoBytesChannelManagerZ;
-class CResult_ShutdownDecodeErrorZ;
+class CResult_COption_OnionMessageContentsZDecodeErrorZ;
class C2Tuple_u64CVec_u8ZZ;
class CResult_OfferBolt12ParseErrorZ;
class CResult_ThirtyTwoBytesRetryableSendFailureZ;
class CVec_MonitorEventZ;
+class CResult_ShutdownDecodeErrorZ;
class CResult_BigSizeDecodeErrorZ;
class CResult_TxOutUtxoLookupErrorZ;
class CResult_BlindedPathNoneZ;
const LDKSpendableOutputDescriptor* operator &() const { return &self; }
const LDKSpendableOutputDescriptor* operator ->() const { return &self; }
};
+class ChannelDerivationParameters {
+private:
+ LDKChannelDerivationParameters self;
+public:
+ ChannelDerivationParameters(const ChannelDerivationParameters&) = delete;
+ ChannelDerivationParameters(ChannelDerivationParameters&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelDerivationParameters)); }
+ ChannelDerivationParameters(LDKChannelDerivationParameters&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelDerivationParameters)); }
+ operator LDKChannelDerivationParameters() && { LDKChannelDerivationParameters res = self; memset(&self, 0, sizeof(LDKChannelDerivationParameters)); return res; }
+ ~ChannelDerivationParameters() { ChannelDerivationParameters_free(self); }
+ ChannelDerivationParameters& operator=(ChannelDerivationParameters&& o) { ChannelDerivationParameters_free(self); self = o.self; memset(&o, 0, sizeof(ChannelDerivationParameters)); return *this; }
+ LDKChannelDerivationParameters* operator &() { return &self; }
+ LDKChannelDerivationParameters* operator ->() { return &self; }
+ const LDKChannelDerivationParameters* operator &() const { return &self; }
+ const LDKChannelDerivationParameters* operator ->() const { return &self; }
+};
+class HTLCDescriptor {
+private:
+ LDKHTLCDescriptor self;
+public:
+ HTLCDescriptor(const HTLCDescriptor&) = delete;
+ HTLCDescriptor(HTLCDescriptor&& o) : self(o.self) { memset(&o, 0, sizeof(HTLCDescriptor)); }
+ HTLCDescriptor(LDKHTLCDescriptor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHTLCDescriptor)); }
+ operator LDKHTLCDescriptor() && { LDKHTLCDescriptor res = self; memset(&self, 0, sizeof(LDKHTLCDescriptor)); return res; }
+ ~HTLCDescriptor() { HTLCDescriptor_free(self); }
+ HTLCDescriptor& operator=(HTLCDescriptor&& o) { HTLCDescriptor_free(self); self = o.self; memset(&o, 0, sizeof(HTLCDescriptor)); return *this; }
+ LDKHTLCDescriptor* operator &() { return &self; }
+ LDKHTLCDescriptor* operator ->() { return &self; }
+ const LDKHTLCDescriptor* operator &() const { return &self; }
+ const LDKHTLCDescriptor* operator ->() const { return &self; }
+};
class ChannelSigner {
private:
LDKChannelSigner self;
*/
inline LDK::CResult_NoneNoneZ validate_counterparty_revocation(uint64_t idx, const uint8_t (*secret)[32]);
/**
- * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions.
+ * Creates a signature for a holder's commitment transaction.
*
* This will be called
* - with a non-revoked `commitment_tx`.
* - with the latest `commitment_tx` when we initiate a force-close.
- * - with the previous `commitment_tx`, just to get claiming HTLC
- * signatures, if we are reacting to a [`ChannelMonitor`]
- * [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
- * that decided to broadcast before it had been updated to the latest `commitment_tx`.
*
* This may be called multiple times for the same transaction.
*
* An external signer implementation should check that the commitment has not been revoked.
- *
- * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
*/
- inline LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_holder_commitment_and_htlcs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
+ inline LDK::CResult_ECDSASignatureNoneZ sign_holder_commitment(const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
/**
* Create a signature for the given input in a transaction spending an HTLC transaction output
* or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
/**
* Computes the signature for a commitment transaction's HTLC output used as an input within
* `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
- * must be be computed using [`EcdsaSighashType::All`]. Note that this should only be used to
- * sign HTLC transactions from channels supporting anchor outputs after all additional
- * inputs/outputs have been added to the transaction.
+ * must be be computed using [`EcdsaSighashType::All`].
+ *
+ * Note that this may be called for HTLCs in the penultimate commitment transaction if a
+ * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
+ * broadcasts it before receiving the update for the latest commitment transaction.
*
* [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All
+ * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
*/
inline LDK::CResult_ECDSASignatureNoneZ sign_holder_htlc_transaction(struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor);
/**
const LDKNodeInfo* operator &() const { return &self; }
const LDKNodeInfo* operator ->() const { return &self; }
};
-class ChannelDerivationParameters {
-private:
- LDKChannelDerivationParameters self;
-public:
- ChannelDerivationParameters(const ChannelDerivationParameters&) = delete;
- ChannelDerivationParameters(ChannelDerivationParameters&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelDerivationParameters)); }
- ChannelDerivationParameters(LDKChannelDerivationParameters&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelDerivationParameters)); }
- operator LDKChannelDerivationParameters() && { LDKChannelDerivationParameters res = self; memset(&self, 0, sizeof(LDKChannelDerivationParameters)); return res; }
- ~ChannelDerivationParameters() { ChannelDerivationParameters_free(self); }
- ChannelDerivationParameters& operator=(ChannelDerivationParameters&& o) { ChannelDerivationParameters_free(self); self = o.self; memset(&o, 0, sizeof(ChannelDerivationParameters)); return *this; }
- LDKChannelDerivationParameters* operator &() { return &self; }
- LDKChannelDerivationParameters* operator ->() { return &self; }
- const LDKChannelDerivationParameters* operator &() const { return &self; }
- const LDKChannelDerivationParameters* operator ->() const { return &self; }
-};
class AnchorDescriptor {
private:
LDKAnchorDescriptor self;
const LDKAnchorDescriptor* operator &() const { return &self; }
const LDKAnchorDescriptor* operator ->() const { return &self; }
};
-class HTLCDescriptor {
-private:
- LDKHTLCDescriptor self;
-public:
- HTLCDescriptor(const HTLCDescriptor&) = delete;
- HTLCDescriptor(HTLCDescriptor&& o) : self(o.self) { memset(&o, 0, sizeof(HTLCDescriptor)); }
- HTLCDescriptor(LDKHTLCDescriptor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHTLCDescriptor)); }
- operator LDKHTLCDescriptor() && { LDKHTLCDescriptor res = self; memset(&self, 0, sizeof(LDKHTLCDescriptor)); return res; }
- ~HTLCDescriptor() { HTLCDescriptor_free(self); }
- HTLCDescriptor& operator=(HTLCDescriptor&& o) { HTLCDescriptor_free(self); self = o.self; memset(&o, 0, sizeof(HTLCDescriptor)); return *this; }
- LDKHTLCDescriptor* operator &() { return &self; }
- LDKHTLCDescriptor* operator ->() { return &self; }
- const LDKHTLCDescriptor* operator &() const { return &self; }
- const LDKHTLCDescriptor* operator ->() const { return &self; }
-};
class BumpTransactionEvent {
private:
LDKBumpTransactionEvent self;
*/
inline LDK::InitFeatures provided_init_features(struct LDKPublicKey their_node_id);
/**
- * Gets the genesis hashes for this `ChannelMessageHandler` indicating which chains it supports.
+ * Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports.
*
* If it's `None`, then no particular network chain hash compatibility will be enforced when
* connecting to peers.
*/
- inline LDK::COption_CVec_ThirtyTwoBytesZZ get_genesis_hashes();
+ inline LDK::COption_CVec_ThirtyTwoBytesZZ get_chain_hashes();
};
class RoutingMessageHandler {
private:
* Handle an incoming `onion_message` message from the given peer.
*/
inline void handle_onion_message(struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg);
+ /**
+ * Returns the next pending onion message for the peer with the given node id.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ inline LDK::OnionMessage next_onion_message_for_peer(struct LDKPublicKey peer_node_id);
/**
* Called when a connection is established with a peer. Can be used to track which peers
* advertise onion message support and are online.
/**
* Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment,
* or replying with an error.
+ *
+ * The returned [`OffersMessage`], if any, is enqueued to be sent by [`OnionMessenger`].
+ *
+ * [`OnionMessenger`]: crate::onion_message::OnionMessenger
*/
inline LDK::COption_OffersMessageZ handle_message(struct LDKOffersMessage message);
+ /**
+ * Releases any [`OffersMessage`]s that need to be sent.
+ *
+ * Typically, this is used for messages initiating a payment flow rather than in response to
+ * another message. The latter should use the return value of [`Self::handle_message`].
+ */
+ inline LDK::CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages();
};
class OffersMessage {
private:
const LDKPacket* operator &() const { return &self; }
const LDKPacket* operator ->() const { return &self; }
};
+class ParsedOnionMessageContents {
+private:
+ LDKParsedOnionMessageContents self;
+public:
+ ParsedOnionMessageContents(const ParsedOnionMessageContents&) = delete;
+ ParsedOnionMessageContents(ParsedOnionMessageContents&& o) : self(o.self) { memset(&o, 0, sizeof(ParsedOnionMessageContents)); }
+ ParsedOnionMessageContents(LDKParsedOnionMessageContents&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKParsedOnionMessageContents)); }
+ operator LDKParsedOnionMessageContents() && { LDKParsedOnionMessageContents res = self; memset(&self, 0, sizeof(LDKParsedOnionMessageContents)); return res; }
+ ~ParsedOnionMessageContents() { ParsedOnionMessageContents_free(self); }
+ ParsedOnionMessageContents& operator=(ParsedOnionMessageContents&& o) { ParsedOnionMessageContents_free(self); self = o.self; memset(&o, 0, sizeof(ParsedOnionMessageContents)); return *this; }
+ LDKParsedOnionMessageContents* operator &() { return &self; }
+ LDKParsedOnionMessageContents* operator ->() { return &self; }
+ const LDKParsedOnionMessageContents* operator &() const { return &self; }
+ const LDKParsedOnionMessageContents* operator ->() const { return &self; }
+};
class OnionMessageContents {
private:
LDKOnionMessageContents self;
LDKOnionMessageContents* operator ->() { return &self; }
const LDKOnionMessageContents* operator &() const { return &self; }
const LDKOnionMessageContents* operator ->() const { return &self; }
-};
-class CustomOnionMessageContents {
-private:
- LDKCustomOnionMessageContents self;
-public:
- CustomOnionMessageContents(const CustomOnionMessageContents&) = delete;
- CustomOnionMessageContents(CustomOnionMessageContents&& o) : self(o.self) { memset(&o, 0, sizeof(CustomOnionMessageContents)); }
- CustomOnionMessageContents(LDKCustomOnionMessageContents&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCustomOnionMessageContents)); }
- operator LDKCustomOnionMessageContents() && { LDKCustomOnionMessageContents res = self; memset(&self, 0, sizeof(LDKCustomOnionMessageContents)); return res; }
- ~CustomOnionMessageContents() { CustomOnionMessageContents_free(self); }
- CustomOnionMessageContents& operator=(CustomOnionMessageContents&& o) { CustomOnionMessageContents_free(self); self = o.self; memset(&o, 0, sizeof(CustomOnionMessageContents)); return *this; }
- LDKCustomOnionMessageContents* operator &() { return &self; }
- LDKCustomOnionMessageContents* operator ->() { return &self; }
- const LDKCustomOnionMessageContents* operator &() const { return &self; }
- const LDKCustomOnionMessageContents* operator ->() const { return &self; }
/**
* Returns the TLV type identifying the message contents. MUST be >= 64.
*/
*/
inline LDK::CVec_MessageSendEventZ get_and_clear_pending_msg_events();
};
-class OnionMessageProvider {
-private:
- LDKOnionMessageProvider self;
-public:
- OnionMessageProvider(const OnionMessageProvider&) = delete;
- OnionMessageProvider(OnionMessageProvider&& o) : self(o.self) { memset(&o, 0, sizeof(OnionMessageProvider)); }
- OnionMessageProvider(LDKOnionMessageProvider&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOnionMessageProvider)); }
- operator LDKOnionMessageProvider() && { LDKOnionMessageProvider res = self; memset(&self, 0, sizeof(LDKOnionMessageProvider)); return res; }
- ~OnionMessageProvider() { OnionMessageProvider_free(self); }
- OnionMessageProvider& operator=(OnionMessageProvider&& o) { OnionMessageProvider_free(self); self = o.self; memset(&o, 0, sizeof(OnionMessageProvider)); return *this; }
- LDKOnionMessageProvider* operator &() { return &self; }
- LDKOnionMessageProvider* operator ->() { return &self; }
- const LDKOnionMessageProvider* operator &() const { return &self; }
- const LDKOnionMessageProvider* operator ->() const { return &self; }
- /**
- * Gets the next pending onion message for the peer with the given node id.
- *
- * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
- */
- inline LDK::OnionMessage next_onion_message_for_peer(struct LDKPublicKey peer_node_id);
-};
class EventsProvider {
private:
LDKEventsProvider self;
const LDKUtxoLookup* operator ->() const { return &self; }
/**
* Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
- * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
- * is unknown.
+ * Returns an error if `chain_hash` is for a different chain or if such a transaction output is
+ * unknown.
*
* [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
*/
- inline LDK::UtxoResult get_utxo(const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
+ inline LDK::UtxoResult get_utxo(const uint8_t (*chain_hash)[32], uint64_t short_channel_id);
};
class UtxoFuture {
private:
const LDKMessageRouter* operator ->() const { return &self; }
/**
* Returns a route for sending an [`OnionMessage`] to the given [`Destination`].
- *
- * [`OnionMessage`]: msgs::OnionMessage
*/
inline LDK::CResult_OnionMessagePathNoneZ find_path(struct LDKPublicKey sender, struct LDKCVec_PublicKeyZ peers, struct LDKDestination destination);
};
const LDKCustomOnionMessageHandler* operator ->() const { return &self; }
/**
* Called with the custom message that was received, returning a response to send, if any.
+ *
+ * The returned [`Self::CustomMessage`], if any, is enqueued to be sent by [`OnionMessenger`].
*/
- inline LDK::COption_CustomOnionMessageContentsZ handle_custom_message(struct LDKCustomOnionMessageContents msg);
+ inline LDK::COption_OnionMessageContentsZ handle_custom_message(struct LDKOnionMessageContents msg);
/**
* Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the
* message type is unknown.
*/
- inline LDK::CResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message(uint64_t message_type, struct LDKu8slice buffer);
+ inline LDK::CResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message(uint64_t message_type, struct LDKu8slice buffer);
+ /**
+ * Releases any [`Self::CustomMessage`]s that need to be sent.
+ *
+ * Typically, this is used for messages initiating a message flow rather than in response to
+ * another message. The latter should use the return value of [`Self::handle_custom_message`].
+ */
+ inline LDK::CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages();
+};
+class PeeledOnion {
+private:
+ LDKPeeledOnion self;
+public:
+ PeeledOnion(const PeeledOnion&) = delete;
+ PeeledOnion(PeeledOnion&& o) : self(o.self) { memset(&o, 0, sizeof(PeeledOnion)); }
+ PeeledOnion(LDKPeeledOnion&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPeeledOnion)); }
+ operator LDKPeeledOnion() && { LDKPeeledOnion res = self; memset(&self, 0, sizeof(LDKPeeledOnion)); return res; }
+ ~PeeledOnion() { PeeledOnion_free(self); }
+ PeeledOnion& operator=(PeeledOnion&& o) { PeeledOnion_free(self); self = o.self; memset(&o, 0, sizeof(PeeledOnion)); return *this; }
+ LDKPeeledOnion* operator &() { return &self; }
+ LDKPeeledOnion* operator ->() { return &self; }
+ const LDKPeeledOnion* operator &() const { return &self; }
+ const LDKPeeledOnion* operator ->() const { return &self; }
};
class FilesystemStore {
private:
const LDKCResult_NoneBolt11SemanticErrorZ* operator &() const { return &self; }
const LDKCResult_NoneBolt11SemanticErrorZ* operator ->() const { return &self; }
};
+class COption_OnionMessageContentsZ {
+private:
+ LDKCOption_OnionMessageContentsZ self;
+public:
+ COption_OnionMessageContentsZ(const COption_OnionMessageContentsZ&) = delete;
+ COption_OnionMessageContentsZ(COption_OnionMessageContentsZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_OnionMessageContentsZ)); }
+ COption_OnionMessageContentsZ(LDKCOption_OnionMessageContentsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_OnionMessageContentsZ)); }
+ operator LDKCOption_OnionMessageContentsZ() && { LDKCOption_OnionMessageContentsZ res = self; memset(&self, 0, sizeof(LDKCOption_OnionMessageContentsZ)); return res; }
+ ~COption_OnionMessageContentsZ() { COption_OnionMessageContentsZ_free(self); }
+ COption_OnionMessageContentsZ& operator=(COption_OnionMessageContentsZ&& o) { COption_OnionMessageContentsZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_OnionMessageContentsZ)); return *this; }
+ LDKCOption_OnionMessageContentsZ* operator &() { return &self; }
+ LDKCOption_OnionMessageContentsZ* operator ->() { return &self; }
+ const LDKCOption_OnionMessageContentsZ* operator &() const { return &self; }
+ const LDKCOption_OnionMessageContentsZ* operator ->() const { return &self; }
+};
class CResult_NoneRetryableSendFailureZ {
private:
LDKCResult_NoneRetryableSendFailureZ self;
const LDKCResult_CVec_u8ZIOErrorZ* operator &() const { return &self; }
const LDKCResult_CVec_u8ZIOErrorZ* operator ->() const { return &self; }
};
-class COption_CustomOnionMessageContentsZ {
+class C3Tuple_OffersMessageDestinationBlindedPathZ {
private:
- LDKCOption_CustomOnionMessageContentsZ self;
+ LDKC3Tuple_OffersMessageDestinationBlindedPathZ self;
public:
- COption_CustomOnionMessageContentsZ(const COption_CustomOnionMessageContentsZ&) = delete;
- COption_CustomOnionMessageContentsZ(COption_CustomOnionMessageContentsZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_CustomOnionMessageContentsZ)); }
- COption_CustomOnionMessageContentsZ(LDKCOption_CustomOnionMessageContentsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_CustomOnionMessageContentsZ)); }
- operator LDKCOption_CustomOnionMessageContentsZ() && { LDKCOption_CustomOnionMessageContentsZ res = self; memset(&self, 0, sizeof(LDKCOption_CustomOnionMessageContentsZ)); return res; }
- ~COption_CustomOnionMessageContentsZ() { COption_CustomOnionMessageContentsZ_free(self); }
- COption_CustomOnionMessageContentsZ& operator=(COption_CustomOnionMessageContentsZ&& o) { COption_CustomOnionMessageContentsZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_CustomOnionMessageContentsZ)); return *this; }
- LDKCOption_CustomOnionMessageContentsZ* operator &() { return &self; }
- LDKCOption_CustomOnionMessageContentsZ* operator ->() { return &self; }
- const LDKCOption_CustomOnionMessageContentsZ* operator &() const { return &self; }
- const LDKCOption_CustomOnionMessageContentsZ* operator ->() const { return &self; }
+ C3Tuple_OffersMessageDestinationBlindedPathZ(const C3Tuple_OffersMessageDestinationBlindedPathZ&) = delete;
+ C3Tuple_OffersMessageDestinationBlindedPathZ(C3Tuple_OffersMessageDestinationBlindedPathZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_OffersMessageDestinationBlindedPathZ)); }
+ C3Tuple_OffersMessageDestinationBlindedPathZ(LDKC3Tuple_OffersMessageDestinationBlindedPathZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ)); }
+ operator LDKC3Tuple_OffersMessageDestinationBlindedPathZ() && { LDKC3Tuple_OffersMessageDestinationBlindedPathZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ)); return res; }
+ ~C3Tuple_OffersMessageDestinationBlindedPathZ() { C3Tuple_OffersMessageDestinationBlindedPathZ_free(self); }
+ C3Tuple_OffersMessageDestinationBlindedPathZ& operator=(C3Tuple_OffersMessageDestinationBlindedPathZ&& o) { C3Tuple_OffersMessageDestinationBlindedPathZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_OffersMessageDestinationBlindedPathZ)); return *this; }
+ LDKC3Tuple_OffersMessageDestinationBlindedPathZ* operator &() { return &self; }
+ LDKC3Tuple_OffersMessageDestinationBlindedPathZ* operator ->() { return &self; }
+ const LDKC3Tuple_OffersMessageDestinationBlindedPathZ* operator &() const { return &self; }
+ const LDKC3Tuple_OffersMessageDestinationBlindedPathZ* operator ->() const { return &self; }
};
class CVec_ThirtyTwoBytesZ {
private:
const LDKCVec_RouteHintHopZ* operator &() const { return &self; }
const LDKCVec_RouteHintHopZ* operator ->() const { return &self; }
};
+class CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
+private:
+ LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ self;
+public:
+ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ(const CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ&) = delete;
+ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ(CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ)); }
+ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ(LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ)); }
+ operator LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ() && { LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ res = self; memset(&self, 0, sizeof(LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ)); return res; }
+ ~CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ() { CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(self); }
+ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ& operator=(CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ&& o) { CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ)); return *this; }
+ LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ* operator &() { return &self; }
+ LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ* operator ->() { return &self; }
+ const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ* operator &() const { return &self; }
+ const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ* operator ->() const { return &self; }
+};
class CResult_UntrustedStringDecodeErrorZ {
private:
LDKCResult_UntrustedStringDecodeErrorZ self;
const LDKCResult_ThirtyTwoBytesNoneZ* operator &() const { return &self; }
const LDKCResult_ThirtyTwoBytesNoneZ* operator ->() const { return &self; }
};
+class C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
+private:
+ LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ self;
+public:
+ C3Tuple_OnionMessageContentsDestinationBlindedPathZ(const C3Tuple_OnionMessageContentsDestinationBlindedPathZ&) = delete;
+ C3Tuple_OnionMessageContentsDestinationBlindedPathZ(C3Tuple_OnionMessageContentsDestinationBlindedPathZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_OnionMessageContentsDestinationBlindedPathZ)); }
+ C3Tuple_OnionMessageContentsDestinationBlindedPathZ(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ)); }
+ operator LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ() && { LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ)); return res; }
+ ~C3Tuple_OnionMessageContentsDestinationBlindedPathZ() { C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(self); }
+ C3Tuple_OnionMessageContentsDestinationBlindedPathZ& operator=(C3Tuple_OnionMessageContentsDestinationBlindedPathZ&& o) { C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_OnionMessageContentsDestinationBlindedPathZ)); return *this; }
+ LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* operator &() { return &self; }
+ LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* operator ->() { return &self; }
+ const LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* operator &() const { return &self; }
+ const LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* operator ->() const { return &self; }
+};
class C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
private:
LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ self;
const LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* operator &() const { return &self; }
const LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* operator ->() const { return &self; }
};
+class CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
+private:
+ LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ self;
+public:
+ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ(const CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ&) = delete;
+ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ(CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ)); }
+ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ(LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ)); }
+ operator LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ() && { LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ res = self; memset(&self, 0, sizeof(LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ)); return res; }
+ ~CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ() { CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(self); }
+ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ& operator=(CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ&& o) { CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ)); return *this; }
+ LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ* operator &() { return &self; }
+ LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ* operator ->() { return &self; }
+ const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ* operator &() const { return &self; }
+ const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ* operator ->() const { return &self; }
+};
class CResult_BlindedHopDecodeErrorZ {
private:
LDKCResult_BlindedHopDecodeErrorZ self;
const LDKCResult_ChannelAnnouncementDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_ChannelAnnouncementDecodeErrorZ* operator ->() const { return &self; }
};
+class CResult_PeeledOnionNoneZ {
+private:
+ LDKCResult_PeeledOnionNoneZ self;
+public:
+ CResult_PeeledOnionNoneZ(const CResult_PeeledOnionNoneZ&) = delete;
+ CResult_PeeledOnionNoneZ(CResult_PeeledOnionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PeeledOnionNoneZ)); }
+ CResult_PeeledOnionNoneZ(LDKCResult_PeeledOnionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PeeledOnionNoneZ)); }
+ operator LDKCResult_PeeledOnionNoneZ() && { LDKCResult_PeeledOnionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_PeeledOnionNoneZ)); return res; }
+ ~CResult_PeeledOnionNoneZ() { CResult_PeeledOnionNoneZ_free(self); }
+ CResult_PeeledOnionNoneZ& operator=(CResult_PeeledOnionNoneZ&& o) { CResult_PeeledOnionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PeeledOnionNoneZ)); return *this; }
+ LDKCResult_PeeledOnionNoneZ* operator &() { return &self; }
+ LDKCResult_PeeledOnionNoneZ* operator ->() { return &self; }
+ const LDKCResult_PeeledOnionNoneZ* operator &() const { return &self; }
+ const LDKCResult_PeeledOnionNoneZ* operator ->() const { return &self; }
+};
class CResult_HTLCUpdateDecodeErrorZ {
private:
LDKCResult_HTLCUpdateDecodeErrorZ self;
const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ* operator &() const { return &self; }
const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ* operator ->() const { return &self; }
};
-class CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
+class COption_StrZ {
private:
- LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ self;
+ LDKCOption_StrZ self;
public:
- CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(const CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&) = delete;
- CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); }
- CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); }
- operator LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ() && { LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); return res; }
- ~CResult_COption_CustomOnionMessageContentsZDecodeErrorZ() { CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(self); }
- CResult_COption_CustomOnionMessageContentsZDecodeErrorZ& operator=(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& o) { CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); return *this; }
- LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator &() { return &self; }
- LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator ->() const { return &self; }
+ COption_StrZ(const COption_StrZ&) = delete;
+ COption_StrZ(COption_StrZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_StrZ)); }
+ COption_StrZ(LDKCOption_StrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_StrZ)); }
+ operator LDKCOption_StrZ() && { LDKCOption_StrZ res = self; memset(&self, 0, sizeof(LDKCOption_StrZ)); return res; }
+ ~COption_StrZ() { COption_StrZ_free(self); }
+ COption_StrZ& operator=(COption_StrZ&& o) { COption_StrZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_StrZ)); return *this; }
+ LDKCOption_StrZ* operator &() { return &self; }
+ LDKCOption_StrZ* operator ->() { return &self; }
+ const LDKCOption_StrZ* operator &() const { return &self; }
+ const LDKCOption_StrZ* operator ->() const { return &self; }
};
class CResult_ShutdownScriptDecodeErrorZ {
private:
const LDKCVec_u64Z* operator &() const { return &self; }
const LDKCVec_u64Z* operator ->() const { return &self; }
};
+class CResult_NoneBolt12SemanticErrorZ {
+private:
+ LDKCResult_NoneBolt12SemanticErrorZ self;
+public:
+ CResult_NoneBolt12SemanticErrorZ(const CResult_NoneBolt12SemanticErrorZ&) = delete;
+ CResult_NoneBolt12SemanticErrorZ(CResult_NoneBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneBolt12SemanticErrorZ)); }
+ CResult_NoneBolt12SemanticErrorZ(LDKCResult_NoneBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneBolt12SemanticErrorZ)); }
+ operator LDKCResult_NoneBolt12SemanticErrorZ() && { LDKCResult_NoneBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneBolt12SemanticErrorZ)); return res; }
+ ~CResult_NoneBolt12SemanticErrorZ() { CResult_NoneBolt12SemanticErrorZ_free(self); }
+ CResult_NoneBolt12SemanticErrorZ& operator=(CResult_NoneBolt12SemanticErrorZ&& o) { CResult_NoneBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneBolt12SemanticErrorZ)); return *this; }
+ LDKCResult_NoneBolt12SemanticErrorZ* operator &() { return &self; }
+ LDKCResult_NoneBolt12SemanticErrorZ* operator ->() { return &self; }
+ const LDKCResult_NoneBolt12SemanticErrorZ* operator &() const { return &self; }
+ const LDKCResult_NoneBolt12SemanticErrorZ* operator ->() const { return &self; }
+};
class COption_SecretKeyZ {
private:
LDKCOption_SecretKeyZ self;
const LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* operator &() const { return &self; }
const LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* operator ->() const { return &self; }
};
-class CResult_ShutdownDecodeErrorZ {
+class CResult_COption_OnionMessageContentsZDecodeErrorZ {
private:
- LDKCResult_ShutdownDecodeErrorZ self;
+ LDKCResult_COption_OnionMessageContentsZDecodeErrorZ self;
public:
- CResult_ShutdownDecodeErrorZ(const CResult_ShutdownDecodeErrorZ&) = delete;
- CResult_ShutdownDecodeErrorZ(CResult_ShutdownDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ShutdownDecodeErrorZ)); }
- CResult_ShutdownDecodeErrorZ(LDKCResult_ShutdownDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ShutdownDecodeErrorZ)); }
- operator LDKCResult_ShutdownDecodeErrorZ() && { LDKCResult_ShutdownDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ShutdownDecodeErrorZ)); return res; }
- ~CResult_ShutdownDecodeErrorZ() { CResult_ShutdownDecodeErrorZ_free(self); }
- CResult_ShutdownDecodeErrorZ& operator=(CResult_ShutdownDecodeErrorZ&& o) { CResult_ShutdownDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ShutdownDecodeErrorZ)); return *this; }
- LDKCResult_ShutdownDecodeErrorZ* operator &() { return &self; }
- LDKCResult_ShutdownDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_ShutdownDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_ShutdownDecodeErrorZ* operator ->() const { return &self; }
+ CResult_COption_OnionMessageContentsZDecodeErrorZ(const CResult_COption_OnionMessageContentsZDecodeErrorZ&) = delete;
+ CResult_COption_OnionMessageContentsZDecodeErrorZ(CResult_COption_OnionMessageContentsZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_OnionMessageContentsZDecodeErrorZ)); }
+ CResult_COption_OnionMessageContentsZDecodeErrorZ(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ)); }
+ operator LDKCResult_COption_OnionMessageContentsZDecodeErrorZ() && { LDKCResult_COption_OnionMessageContentsZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ)); return res; }
+ ~CResult_COption_OnionMessageContentsZDecodeErrorZ() { CResult_COption_OnionMessageContentsZDecodeErrorZ_free(self); }
+ CResult_COption_OnionMessageContentsZDecodeErrorZ& operator=(CResult_COption_OnionMessageContentsZDecodeErrorZ&& o) { CResult_COption_OnionMessageContentsZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_OnionMessageContentsZDecodeErrorZ)); return *this; }
+ LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* operator ->() const { return &self; }
};
class C2Tuple_u64CVec_u8ZZ {
private:
const LDKCVec_MonitorEventZ* operator &() const { return &self; }
const LDKCVec_MonitorEventZ* operator ->() const { return &self; }
};
+class CResult_ShutdownDecodeErrorZ {
+private:
+ LDKCResult_ShutdownDecodeErrorZ self;
+public:
+ CResult_ShutdownDecodeErrorZ(const CResult_ShutdownDecodeErrorZ&) = delete;
+ CResult_ShutdownDecodeErrorZ(CResult_ShutdownDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ShutdownDecodeErrorZ)); }
+ CResult_ShutdownDecodeErrorZ(LDKCResult_ShutdownDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ShutdownDecodeErrorZ)); }
+ operator LDKCResult_ShutdownDecodeErrorZ() && { LDKCResult_ShutdownDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ShutdownDecodeErrorZ)); return res; }
+ ~CResult_ShutdownDecodeErrorZ() { CResult_ShutdownDecodeErrorZ_free(self); }
+ CResult_ShutdownDecodeErrorZ& operator=(CResult_ShutdownDecodeErrorZ&& o) { CResult_ShutdownDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ShutdownDecodeErrorZ)); return *this; }
+ LDKCResult_ShutdownDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_ShutdownDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_ShutdownDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_ShutdownDecodeErrorZ* operator ->() const { return &self; }
+};
class CResult_BigSizeDecodeErrorZ {
private:
LDKCResult_BigSizeDecodeErrorZ self;
LDK::CResult_NoneNoneZ ret = (self.validate_counterparty_revocation)(self.this_arg, idx, secret);
return ret;
}
-inline LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ EcdsaChannelSigner::sign_holder_commitment_and_htlcs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx) {
- LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret = (self.sign_holder_commitment_and_htlcs)(self.this_arg, commitment_tx);
+inline LDK::CResult_ECDSASignatureNoneZ EcdsaChannelSigner::sign_holder_commitment(const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx) {
+ LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_holder_commitment)(self.this_arg, commitment_tx);
return ret;
}
inline LDK::CResult_ECDSASignatureNoneZ EcdsaChannelSigner::sign_justice_revoked_output(struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]) {
LDK::InitFeatures ret = (self.provided_init_features)(self.this_arg, their_node_id);
return ret;
}
-inline LDK::COption_CVec_ThirtyTwoBytesZZ ChannelMessageHandler::get_genesis_hashes() {
- LDK::COption_CVec_ThirtyTwoBytesZZ ret = (self.get_genesis_hashes)(self.this_arg);
+inline LDK::COption_CVec_ThirtyTwoBytesZZ ChannelMessageHandler::get_chain_hashes() {
+ LDK::COption_CVec_ThirtyTwoBytesZZ ret = (self.get_chain_hashes)(self.this_arg);
return ret;
}
inline LDK::CResult_boolLightningErrorZ RoutingMessageHandler::handle_node_announcement(const struct LDKNodeAnnouncement *NONNULL_PTR msg) {
inline void OnionMessageHandler::handle_onion_message(struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg) {
(self.handle_onion_message)(self.this_arg, peer_node_id, msg);
}
+inline LDK::OnionMessage OnionMessageHandler::next_onion_message_for_peer(struct LDKPublicKey peer_node_id) {
+ LDK::OnionMessage ret = (self.next_onion_message_for_peer)(self.this_arg, peer_node_id);
+ return ret;
+}
inline LDK::CResult_NoneNoneZ OnionMessageHandler::peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound) {
LDK::CResult_NoneNoneZ ret = (self.peer_connected)(self.this_arg, their_node_id, init, inbound);
return ret;
LDK::COption_OffersMessageZ ret = (self.handle_message)(self.this_arg, message);
return ret;
}
+inline LDK::CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ OffersMessageHandler::release_pending_messages() {
+ LDK::CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = (self.release_pending_messages)(self.this_arg);
+ return ret;
+}
inline void BroadcasterInterface::broadcast_transactions(struct LDKCVec_TransactionZ txs) {
(self.broadcast_transactions)(self.this_arg, txs);
}
uint32_t ret = (self.get_est_sat_per_1000_weight)(self.this_arg, confirmation_target);
return ret;
}
-inline uint64_t CustomOnionMessageContents::tlv_type() {
+inline uint64_t OnionMessageContents::tlv_type() {
uint64_t ret = (self.tlv_type)(self.this_arg);
return ret;
}
LDK::CVec_MessageSendEventZ ret = (self.get_and_clear_pending_msg_events)(self.this_arg);
return ret;
}
-inline LDK::OnionMessage OnionMessageProvider::next_onion_message_for_peer(struct LDKPublicKey peer_node_id) {
- LDK::OnionMessage ret = (self.next_onion_message_for_peer)(self.this_arg, peer_node_id);
- return ret;
-}
inline void EventsProvider::process_pending_events(struct LDKEventHandler handler) {
(self.process_pending_events)(self.this_arg, handler);
}
LDK::Str ret = (self.debug_str)(self.this_arg);
return ret;
}
-inline LDK::UtxoResult UtxoLookup::get_utxo(const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
- LDK::UtxoResult ret = (self.get_utxo)(self.this_arg, genesis_hash, short_channel_id);
+inline LDK::UtxoResult UtxoLookup::get_utxo(const uint8_t (*chain_hash)[32], uint64_t short_channel_id) {
+ LDK::UtxoResult ret = (self.get_utxo)(self.this_arg, chain_hash, short_channel_id);
return ret;
}
inline LDK::CResult_OnionMessagePathNoneZ MessageRouter::find_path(struct LDKPublicKey sender, struct LDKCVec_PublicKeyZ peers, struct LDKDestination destination) {
LDK::CResult_OnionMessagePathNoneZ ret = (self.find_path)(self.this_arg, sender, peers, destination);
return ret;
}
-inline LDK::COption_CustomOnionMessageContentsZ CustomOnionMessageHandler::handle_custom_message(struct LDKCustomOnionMessageContents msg) {
- LDK::COption_CustomOnionMessageContentsZ ret = (self.handle_custom_message)(self.this_arg, msg);
+inline LDK::COption_OnionMessageContentsZ CustomOnionMessageHandler::handle_custom_message(struct LDKOnionMessageContents msg) {
+ LDK::COption_OnionMessageContentsZ ret = (self.handle_custom_message)(self.this_arg, msg);
+ return ret;
+}
+inline LDK::CResult_COption_OnionMessageContentsZDecodeErrorZ CustomOnionMessageHandler::read_custom_message(uint64_t message_type, struct LDKu8slice buffer) {
+ LDK::CResult_COption_OnionMessageContentsZDecodeErrorZ ret = (self.read_custom_message)(self.this_arg, message_type, buffer);
return ret;
}
-inline LDK::CResult_COption_CustomOnionMessageContentsZDecodeErrorZ CustomOnionMessageHandler::read_custom_message(uint64_t message_type, struct LDKu8slice buffer) {
- LDK::CResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret = (self.read_custom_message)(self.this_arg, message_type, buffer);
+inline LDK::CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CustomOnionMessageHandler::release_pending_custom_messages() {
+ LDK::CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = (self.release_pending_custom_messages)(self.this_arg);
return ret;
}
inline LDK::ChannelMonitorUpdateStatus Persist::persist_new_channel(struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id) {
/// but with all dynamically-allocated buffers duplicated in new buffers.
pub extern "C" fn CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(orig: &CResult_C2Tuple_CVec_u8ZusizeZNoneZ) -> CResult_C2Tuple_CVec_u8ZusizeZNoneZ { Clone::clone(&orig) }
#[repr(C)]
+/// The contents of CResult_ChannelDerivationParametersDecodeErrorZ
+pub union CResult_ChannelDerivationParametersDecodeErrorZPtr {
+ /// 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::sign::ChannelDerivationParameters,
+ /// 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_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::sign::ChannelDerivationParameters 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_ChannelDerivationParametersDecodeErrorZ {
+ /// The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_ChannelDerivationParametersDecodeErrorZPtr,
+ /// Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state.
+ pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state.
+pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_ok(o: crate::lightning::sign::ChannelDerivationParameters) -> CResult_ChannelDerivationParametersDecodeErrorZ {
+ CResult_ChannelDerivationParametersDecodeErrorZ {
+ contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state.
+pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDerivationParametersDecodeErrorZ {
+ CResult_ChannelDerivationParametersDecodeErrorZ {
+ contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
+ 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_ChannelDerivationParametersDecodeErrorZ_is_ok(o: &CResult_ChannelDerivationParametersDecodeErrorZ) -> bool {
+ o.result_ok
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ.
+pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_free(_res: CResult_ChannelDerivationParametersDecodeErrorZ) { }
+impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ {
+ 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::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDerivationParametersDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_ChannelDerivationParametersDecodeErrorZPtr { result }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_ChannelDerivationParametersDecodeErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
+ }
+}
+impl Clone for CResult_ChannelDerivationParametersDecodeErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::sign::ChannelDerivationParameters>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig: &CResult_ChannelDerivationParametersDecodeErrorZ) -> CResult_ChannelDerivationParametersDecodeErrorZ { Clone::clone(&orig) }
+#[repr(C)]
+/// The contents of CResult_HTLCDescriptorDecodeErrorZ
+pub union CResult_HTLCDescriptorDecodeErrorZPtr {
+ /// 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::sign::HTLCDescriptor,
+ /// 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_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning::sign::HTLCDescriptor 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_HTLCDescriptorDecodeErrorZ {
+ /// The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_HTLCDescriptorDecodeErrorZPtr,
+ /// Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state.
+ pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state.
+pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::HTLCDescriptor) -> CResult_HTLCDescriptorDecodeErrorZ {
+ CResult_HTLCDescriptorDecodeErrorZ {
+ contents: CResult_HTLCDescriptorDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state.
+pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCDescriptorDecodeErrorZ {
+ CResult_HTLCDescriptorDecodeErrorZ {
+ contents: CResult_HTLCDescriptorDecodeErrorZPtr {
+ 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_HTLCDescriptorDecodeErrorZ_is_ok(o: &CResult_HTLCDescriptorDecodeErrorZ) -> bool {
+ o.result_ok
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ.
+pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_free(_res: CResult_HTLCDescriptorDecodeErrorZ) { }
+impl Drop for CResult_HTLCDescriptorDecodeErrorZ {
+ 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::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCDescriptorDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_HTLCDescriptorDecodeErrorZPtr { result }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_HTLCDescriptorDecodeErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
+ }
+}
+impl Clone for CResult_HTLCDescriptorDecodeErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning::sign::HTLCDescriptor>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_clone(orig: &CResult_HTLCDescriptorDecodeErrorZ) -> CResult_HTLCDescriptorDecodeErrorZ { Clone::clone(&orig) }
+#[repr(C)]
/// The contents of CResult_NoneNoneZ
pub union CResult_NoneNoneZPtr {
/// Note that this value is always NULL, as there are no contents in the OK variant
/// but with all dynamically-allocated buffers duplicated in new buffers.
pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_ChannelDerivationParametersDecodeErrorZ
-pub union CResult_ChannelDerivationParametersDecodeErrorZPtr {
- /// 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::events::bump_transaction::ChannelDerivationParameters,
- /// 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_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::events::bump_transaction::ChannelDerivationParameters 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_ChannelDerivationParametersDecodeErrorZ {
- /// The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either
- /// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_ChannelDerivationParametersDecodeErrorZPtr,
- /// Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state.
- pub result_ok: bool,
-}
-#[no_mangle]
-/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state.
-pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_ok(o: crate::lightning::events::bump_transaction::ChannelDerivationParameters) -> CResult_ChannelDerivationParametersDecodeErrorZ {
- CResult_ChannelDerivationParametersDecodeErrorZ {
- contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
- result: Box::into_raw(Box::new(o)),
- },
- result_ok: true,
- }
-}
-#[no_mangle]
-/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state.
-pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDerivationParametersDecodeErrorZ {
- CResult_ChannelDerivationParametersDecodeErrorZ {
- contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
- 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_ChannelDerivationParametersDecodeErrorZ_is_ok(o: &CResult_ChannelDerivationParametersDecodeErrorZ) -> bool {
- o.result_ok
-}
-#[no_mangle]
-/// Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ.
-pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_free(_res: CResult_ChannelDerivationParametersDecodeErrorZ) { }
-impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ {
- 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::events::bump_transaction::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDerivationParametersDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
- let contents = if o.result_ok {
- let result = unsafe { o.contents.result };
- unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_ChannelDerivationParametersDecodeErrorZPtr { result }
- } else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_ChannelDerivationParametersDecodeErrorZPtr { err }
- };
- Self {
- contents,
- result_ok: o.result_ok,
- }
- }
-}
-impl Clone for CResult_ChannelDerivationParametersDecodeErrorZ {
- fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::ChannelDerivationParameters>::clone(unsafe { &*self.contents.result })))
- } }
- } else {
- Self { result_ok: false, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
- } }
- }
- }
-}
-#[no_mangle]
-/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig: &CResult_ChannelDerivationParametersDecodeErrorZ) -> CResult_ChannelDerivationParametersDecodeErrorZ { Clone::clone(&orig) }
-#[repr(C)]
-/// The contents of CResult_HTLCDescriptorDecodeErrorZ
-pub union CResult_HTLCDescriptorDecodeErrorZPtr {
- /// 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::events::bump_transaction::HTLCDescriptor,
- /// 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_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning::events::bump_transaction::HTLCDescriptor 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_HTLCDescriptorDecodeErrorZ {
- /// The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either
- /// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_HTLCDescriptorDecodeErrorZPtr,
- /// Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state.
- pub result_ok: bool,
-}
-#[no_mangle]
-/// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state.
-pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_ok(o: crate::lightning::events::bump_transaction::HTLCDescriptor) -> CResult_HTLCDescriptorDecodeErrorZ {
- CResult_HTLCDescriptorDecodeErrorZ {
- contents: CResult_HTLCDescriptorDecodeErrorZPtr {
- result: Box::into_raw(Box::new(o)),
- },
- result_ok: true,
- }
-}
-#[no_mangle]
-/// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state.
-pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCDescriptorDecodeErrorZ {
- CResult_HTLCDescriptorDecodeErrorZ {
- contents: CResult_HTLCDescriptorDecodeErrorZPtr {
- 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_HTLCDescriptorDecodeErrorZ_is_ok(o: &CResult_HTLCDescriptorDecodeErrorZ) -> bool {
- o.result_ok
-}
-#[no_mangle]
-/// Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ.
-pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_free(_res: CResult_HTLCDescriptorDecodeErrorZ) { }
-impl Drop for CResult_HTLCDescriptorDecodeErrorZ {
- 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::events::bump_transaction::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCDescriptorDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
- let contents = if o.result_ok {
- let result = unsafe { o.contents.result };
- unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_HTLCDescriptorDecodeErrorZPtr { result }
- } else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_HTLCDescriptorDecodeErrorZPtr { err }
- };
- Self {
- contents,
- result_ok: o.result_ok,
- }
- }
-}
-impl Clone for CResult_HTLCDescriptorDecodeErrorZ {
- fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::HTLCDescriptor>::clone(unsafe { &*self.contents.result })))
- } }
- } else {
- Self { result_ok: false, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
- err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
- } }
- }
- }
-}
-#[no_mangle]
-/// Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_clone(orig: &CResult_HTLCDescriptorDecodeErrorZ) -> CResult_HTLCDescriptorDecodeErrorZ { Clone::clone(&orig) }
-#[repr(C)]
/// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size.
/// This corresponds to std::vector in C++
pub struct CVec_HTLCOutputInCommitmentZ {
}
}
#[repr(C)]
-/// A dynamically-allocated array of crate::lightning::events::bump_transaction::HTLCDescriptors of arbitrary size.
+/// A dynamically-allocated array of crate::lightning::sign::HTLCDescriptors of arbitrary size.
/// This corresponds to std::vector in C++
pub struct CVec_HTLCDescriptorZ {
/// The elements in the array.
/// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- pub data: *mut crate::lightning::events::bump_transaction::HTLCDescriptor,
+ pub data: *mut crate::lightning::sign::HTLCDescriptor,
/// The number of elements pointed to by `data`.
pub datalen: usize
}
impl CVec_HTLCDescriptorZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::HTLCDescriptor> {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::HTLCDescriptor> {
if self.datalen == 0 { return Vec::new(); }
let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
self.data = core::ptr::null_mut();
self.datalen = 0;
ret
}
- #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::HTLCDescriptor] {
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::HTLCDescriptor] {
unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-impl From<Vec<crate::lightning::events::bump_transaction::HTLCDescriptor>> for CVec_HTLCDescriptorZ {
- fn from(v: Vec<crate::lightning::events::bump_transaction::HTLCDescriptor>) -> Self {
+impl From<Vec<crate::lightning::sign::HTLCDescriptor>> for CVec_HTLCDescriptorZ {
+ fn from(v: Vec<crate::lightning::sign::HTLCDescriptor>) -> Self {
let datalen = v.len();
let data = Box::into_raw(v.into_boxed_slice());
Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
}
}
#[repr(C)]
+#[derive(Clone)]
+/// An enum which can either contain a crate::c_types::Str or not
+pub enum COption_StrZ {
+ /// When we're in this state, this COption_StrZ contains a crate::c_types::Str
+ Some(crate::c_types::Str),
+ /// When we're in this state, this COption_StrZ contains nothing
+ None
+}
+impl COption_StrZ {
+ #[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()
+ }
+ #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::Str {
+ if let Self::Some(v) = self { v } else { unreachable!() }
+ }
+}
+#[no_mangle]
+/// Constructs a new COption_StrZ containing a crate::c_types::Str
+pub extern "C" fn COption_StrZ_some(o: crate::c_types::Str) -> COption_StrZ {
+ COption_StrZ::Some(o)
+}
+#[no_mangle]
+/// Constructs a new COption_StrZ containing nothing
+pub extern "C" fn COption_StrZ_none() -> COption_StrZ {
+ COption_StrZ::None
+}
+#[no_mangle]
+/// Frees any resources associated with the crate::c_types::Str, if we are in the Some state
+pub extern "C" fn COption_StrZ_free(_res: COption_StrZ) { }
+#[no_mangle]
+/// Creates a new COption_StrZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn COption_StrZ_clone(orig: &COption_StrZ) -> COption_StrZ { Clone::clone(&orig) }
+#[repr(C)]
+/// The contents of CResult_NoneBolt12SemanticErrorZ
+pub union CResult_NoneBolt12SemanticErrorZPtr {
+ /// Note that this value is always NULL, as there are no contents in the OK variant
+ pub result: *mut core::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::offers::parse::Bolt12SemanticError,
+}
+#[repr(C)]
+/// A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation,
+/// containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_NoneBolt12SemanticErrorZ {
+ /// The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_NoneBolt12SemanticErrorZPtr,
+ /// Whether this CResult_NoneBolt12SemanticErrorZ represents a success state.
+ pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_NoneBolt12SemanticErrorZ in the success state.
+pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_ok() -> CResult_NoneBolt12SemanticErrorZ {
+ CResult_NoneBolt12SemanticErrorZ {
+ contents: CResult_NoneBolt12SemanticErrorZPtr {
+ result: core::ptr::null_mut(),
+ },
+ result_ok: true,
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_NoneBolt12SemanticErrorZ in the error state.
+pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_NoneBolt12SemanticErrorZ {
+ CResult_NoneBolt12SemanticErrorZ {
+ contents: CResult_NoneBolt12SemanticErrorZPtr {
+ 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_NoneBolt12SemanticErrorZ_is_ok(o: &CResult_NoneBolt12SemanticErrorZ) -> bool {
+ o.result_ok
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_NoneBolt12SemanticErrorZ.
+pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_free(_res: CResult_NoneBolt12SemanticErrorZ) { }
+impl Drop for CResult_NoneBolt12SemanticErrorZ {
+ 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::offers::parse::Bolt12SemanticError>> for CResult_NoneBolt12SemanticErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
+ let contents = if o.result_ok {
+ let _ = unsafe { Box::from_raw(o.contents.result) };
+ o.contents.result = core::ptr::null_mut();
+ CResult_NoneBolt12SemanticErrorZPtr { result: core::ptr::null_mut() }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = core::ptr::null_mut(); }
+ CResult_NoneBolt12SemanticErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
+ }
+}
+impl Clone for CResult_NoneBolt12SemanticErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_NoneBolt12SemanticErrorZPtr {
+ result: core::ptr::null_mut()
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_NoneBolt12SemanticErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_clone(orig: &CResult_NoneBolt12SemanticErrorZ) -> CResult_NoneBolt12SemanticErrorZ { Clone::clone(&orig) }
+#[repr(C)]
/// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
/// A pointer to the contents in the success state.
/// but with all dynamically-allocated buffers duplicated in new buffers.
pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) }
#[repr(C)]
+#[derive(Clone)]
+/// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
+pub enum COption_OffersMessageZ {
+ /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
+ Some(crate::lightning::onion_message::offers::OffersMessage),
+ /// When we're in this state, this COption_OffersMessageZ contains nothing
+ None
+}
+impl COption_OffersMessageZ {
+ #[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()
+ }
+ #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
+ if let Self::Some(v) = self { v } else { unreachable!() }
+ }
+}
+#[no_mangle]
+/// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
+pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
+ COption_OffersMessageZ::Some(o)
+}
+#[no_mangle]
+/// Constructs a new COption_OffersMessageZ containing nothing
+pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
+ COption_OffersMessageZ::None
+}
+#[no_mangle]
+/// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
+pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
+#[no_mangle]
+/// Creates a new COption_OffersMessageZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
+#[repr(C)]
+/// A tuple of 3 elements. See the individual fields for the types contained.
+pub struct C3Tuple_OffersMessageDestinationBlindedPathZ {
+ /// The element at position 0
+ pub a: crate::lightning::onion_message::offers::OffersMessage,
+ /// The element at position 1
+ pub b: crate::lightning::onion_message::messenger::Destination,
+ /// The element at position 2
+ pub c: crate::lightning::blinded_path::BlindedPath,
+}
+impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OffersMessageDestinationBlindedPathZ {
+ fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
+ c: tup.2,
+ }
+ }
+}
+impl C3Tuple_OffersMessageDestinationBlindedPathZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath) {
+ (self.a, self.b, self.c)
+ }
+}
+impl Clone for C3Tuple_OffersMessageDestinationBlindedPathZ {
+ fn clone(&self) -> Self {
+ Self {
+ a: Clone::clone(&self.a),
+ b: Clone::clone(&self.b),
+ c: Clone::clone(&self.c),
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new tuple which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig: &C3Tuple_OffersMessageDestinationBlindedPathZ) -> C3Tuple_OffersMessageDestinationBlindedPathZ { Clone::clone(&orig) }
+/// Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements.
+#[no_mangle]
+pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_new(a: crate::lightning::onion_message::offers::OffersMessage, b: crate::lightning::onion_message::messenger::Destination, c: crate::lightning::blinded_path::BlindedPath) -> C3Tuple_OffersMessageDestinationBlindedPathZ {
+ C3Tuple_OffersMessageDestinationBlindedPathZ { a, b, c, }
+}
+
+#[no_mangle]
+/// Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ.
+pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res: C3Tuple_OffersMessageDestinationBlindedPathZ) { }
+#[repr(C)]
+/// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
+ /// The elements in the array.
+ /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ pub data: *mut crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ> {
+ if self.datalen == 0 { return Vec::new(); }
+ let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
+ self.data = core::ptr::null_mut();
+ self.datalen = 0;
+ ret
+ }
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>> for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
+ fn from(v: Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>) -> Self {
+ let datalen = v.len();
+ let data = Box::into_raw(v.into_boxed_slice());
+ Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
+ }
+}
+#[no_mangle]
+/// Frees the buffer pointed to by `data` if `datalen` is non-0.
+pub extern "C" fn CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ) { }
+impl Drop for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
+ fn clone(&self) -> Self {
+ let mut res = Vec::new();
+ if self.datalen == 0 { return Self::from(res); }
+ res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
+ Self::from(res)
+ }
+}
+#[repr(C)]
/// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
/// A pointer to the contents in the success state.
}
#[repr(C)]
#[derive(Clone)]
-/// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
-pub enum COption_OffersMessageZ {
- /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
- Some(crate::lightning::onion_message::offers::OffersMessage),
- /// When we're in this state, this COption_OffersMessageZ contains nothing
- None
-}
-impl COption_OffersMessageZ {
- #[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()
- }
- #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
- if let Self::Some(v) = self { v } else { unreachable!() }
- }
-}
-#[no_mangle]
-/// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
-pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
- COption_OffersMessageZ::Some(o)
-}
-#[no_mangle]
-/// Constructs a new COption_OffersMessageZ containing nothing
-pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
- COption_OffersMessageZ::None
-}
-#[no_mangle]
-/// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
-pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
-#[no_mangle]
-/// Creates a new COption_OffersMessageZ which has the same data as `orig`
-/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
-#[repr(C)]
-#[derive(Clone)]
-/// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
-pub enum COption_CustomOnionMessageContentsZ {
- /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
- Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
- /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
+/// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not
+pub enum COption_OnionMessageContentsZ {
+ /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents
+ Some(crate::lightning::onion_message::packet::OnionMessageContents),
+ /// When we're in this state, this COption_OnionMessageContentsZ contains nothing
None
}
-impl COption_CustomOnionMessageContentsZ {
+impl COption_OnionMessageContentsZ {
#[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()
}
- #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
+ #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::OnionMessageContents {
if let Self::Some(v) = self { v } else { unreachable!() }
}
}
#[no_mangle]
-/// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
-pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
- COption_CustomOnionMessageContentsZ::Some(o)
+/// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents
+pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ {
+ COption_OnionMessageContentsZ::Some(o)
}
#[no_mangle]
-/// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
-pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
- COption_CustomOnionMessageContentsZ::None
+/// Constructs a new COption_OnionMessageContentsZ containing nothing
+pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ {
+ COption_OnionMessageContentsZ::None
}
#[no_mangle]
-/// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
-pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
+/// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state
+pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { }
#[no_mangle]
-/// Creates a new COption_CustomOnionMessageContentsZ which has the same data as `orig`
+/// Creates a new COption_OnionMessageContentsZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn COption_CustomOnionMessageContentsZ_clone(orig: &COption_CustomOnionMessageContentsZ) -> COption_CustomOnionMessageContentsZ { Clone::clone(&orig) }
+pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) }
#[repr(C)]
-/// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
-pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
+/// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ
+pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
/// 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::COption_CustomOnionMessageContentsZ,
+ pub result: *mut crate::c_types::derived::COption_OnionMessageContentsZ,
/// 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_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
-/// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+/// A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
+/// containing a crate::c_types::derived::COption_OnionMessageContentsZ 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_COption_CustomOnionMessageContentsZDecodeErrorZ {
- /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
+pub struct CResult_COption_OnionMessageContentsZDecodeErrorZ {
+ /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
- /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
+ pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr,
+ /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
-pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
- CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
- contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
+/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state.
+pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
+ CResult_COption_OnionMessageContentsZDecodeErrorZ {
+ contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
-pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
- CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
- contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
+/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state.
+pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
+ CResult_COption_OnionMessageContentsZDecodeErrorZ {
+ contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
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_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
+pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool {
o.result_ok
}
#[no_mangle]
-/// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
-pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
-impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
+/// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ.
+pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { }
+impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_OnionMessageContentsZDecodeErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = core::ptr::null_mut() };
- CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
+ CResult_COption_OnionMessageContentsZDecodeErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = core::ptr::null_mut(); }
- CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
+ CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
+impl Clone for CResult_COption_OnionMessageContentsZDecodeErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::derived::COption_CustomOnionMessageContentsZ>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::derived::COption_OnionMessageContentsZ>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
+ Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ which has the same data as `orig`
+/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) }
+#[repr(C)]
+/// A tuple of 3 elements. See the individual fields for the types contained.
+pub struct C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
+ /// The element at position 0
+ pub a: crate::lightning::onion_message::packet::OnionMessageContents,
+ /// The element at position 1
+ pub b: crate::lightning::onion_message::messenger::Destination,
+ /// The element at position 2
+ pub c: crate::lightning::blinded_path::BlindedPath,
+}
+impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
+ fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
+ c: tup.2,
+ }
+ }
+}
+impl C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath) {
+ (self.a, self.b, self.c)
+ }
+}
+impl Clone for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
+ fn clone(&self) -> Self {
+ Self {
+ a: Clone::clone(&self.a),
+ b: Clone::clone(&self.b),
+ c: Clone::clone(&self.c),
+ }
+ }
+}
+#[no_mangle]
+/// Creates a new tuple which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) }
+pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig: &C3Tuple_OnionMessageContentsDestinationBlindedPathZ) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { Clone::clone(&orig) }
+/// Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements.
+#[no_mangle]
+pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::Destination, c: crate::lightning::blinded_path::BlindedPath) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
+ C3Tuple_OnionMessageContentsDestinationBlindedPathZ { a, b, c, }
+}
+
+#[no_mangle]
+/// Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ.
+pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res: C3Tuple_OnionMessageContentsDestinationBlindedPathZ) { }
+#[repr(C)]
+/// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size.
+/// This corresponds to std::vector in C++
+pub struct CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
+ /// The elements in the array.
+ /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ pub data: *mut crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ,
+ /// The number of elements pointed to by `data`.
+ pub datalen: usize
+}
+impl CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ> {
+ if self.datalen == 0 { return Vec::new(); }
+ let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
+ self.data = core::ptr::null_mut();
+ self.datalen = 0;
+ ret
+ }
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ] {
+ unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>> for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
+ fn from(v: Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>) -> Self {
+ let datalen = v.len();
+ let data = Box::into_raw(v.into_boxed_slice());
+ Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
+ }
+}
+#[no_mangle]
+/// Frees the buffer pointed to by `data` if `datalen` is non-0.
+pub extern "C" fn CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ) { }
+impl Drop for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
+ fn clone(&self) -> Self {
+ let mut res = Vec::new();
+ if self.datalen == 0 { return Self::from(res); }
+ res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
+ Self::from(res)
+ }
+}
#[repr(C)]
#[derive(Clone)]
/// An enum which can either contain a crate::lightning::ln::wire::Type or not
}
}
#[repr(C)]
+/// The contents of CResult_PeeledOnionNoneZ
+pub union CResult_PeeledOnionNoneZPtr {
+ /// 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::onion_message::messenger::PeeledOnion,
+ /// Note that this value is always NULL, as there are no contents in the Err variant
+ pub err: *mut core::ffi::c_void,
+}
+#[repr(C)]
+/// A CResult_PeeledOnionNoneZ represents the result of a fallible operation,
+/// containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure.
+/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
+pub struct CResult_PeeledOnionNoneZ {
+ /// The contents of this CResult_PeeledOnionNoneZ, accessible via either
+ /// `err` or `result` depending on the state of `result_ok`.
+ pub contents: CResult_PeeledOnionNoneZPtr,
+ /// Whether this CResult_PeeledOnionNoneZ represents a success state.
+ pub result_ok: bool,
+}
+#[no_mangle]
+/// Creates a new CResult_PeeledOnionNoneZ in the success state.
+pub extern "C" fn CResult_PeeledOnionNoneZ_ok(o: crate::lightning::onion_message::messenger::PeeledOnion) -> CResult_PeeledOnionNoneZ {
+ CResult_PeeledOnionNoneZ {
+ contents: CResult_PeeledOnionNoneZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
+ }
+}
+#[no_mangle]
+/// Creates a new CResult_PeeledOnionNoneZ in the error state.
+pub extern "C" fn CResult_PeeledOnionNoneZ_err() -> CResult_PeeledOnionNoneZ {
+ CResult_PeeledOnionNoneZ {
+ contents: CResult_PeeledOnionNoneZPtr {
+ err: core::ptr::null_mut(),
+ },
+ result_ok: false,
+ }
+}
+/// Checks if the given object is currently in the success state
+#[no_mangle]
+pub extern "C" fn CResult_PeeledOnionNoneZ_is_ok(o: &CResult_PeeledOnionNoneZ) -> bool {
+ o.result_ok
+}
+#[no_mangle]
+/// Frees any resources used by the CResult_PeeledOnionNoneZ.
+pub extern "C" fn CResult_PeeledOnionNoneZ_free(_res: CResult_PeeledOnionNoneZ) { }
+impl Drop for CResult_PeeledOnionNoneZ {
+ 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::lightning::onion_message::messenger::PeeledOnion, ()>> for CResult_PeeledOnionNoneZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = core::ptr::null_mut() };
+ CResult_PeeledOnionNoneZPtr { result }
+ } else {
+ let _ = unsafe { Box::from_raw(o.contents.err) };
+ o.contents.err = core::ptr::null_mut();
+ CResult_PeeledOnionNoneZPtr { err: core::ptr::null_mut() }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
+ }
+}
+#[repr(C)]
/// The contents of CResult_NoneSendErrorZ
pub union CResult_NoneSendErrorZPtr {
/// Note that this value is always NULL, as there are no contents in the OK variant
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn BlindedPath_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBlindedPath)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedPath)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the BlindedPath
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn BlindedHop_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBlindedHop)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedHop)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the BlindedHop
if a.inner.is_null() || b.inner.is_null() { return false; }
if a.get_native_ref() == b.get_native_ref() { true } else { false }
}
+/// Create a one-hop blinded path for a message.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn BlindedPath_one_hop_for_message(mut recipient_node_id: crate::c_types::PublicKey, entropy_source: &crate::lightning::sign::EntropySource) -> crate::c_types::derived::CResult_BlindedPathNoneZ {
+ let mut ret = lightning::blinded_path::BlindedPath::one_hop_for_message(recipient_node_id.into_rust(), entropy_source, secp256k1::global::SECP256K1);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::blinded_path::BlindedPath { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+ local_ret
+}
+
/// Create a blinded path for an onion message, to be forwarded along `node_pks`. The last node
/// pubkey in `node_pks` will be the destination node.
///
-/// Errors if less than two hops are provided or if `node_pk`(s) are invalid.
+/// Errors if no hops are provided or if `node_pk`(s) are invalid.
#[must_use]
#[no_mangle]
pub extern "C" fn BlindedPath_new_for_message(mut node_pks: crate::c_types::derived::CVec_PublicKeyZ, entropy_source: &crate::lightning::sign::EntropySource) -> crate::c_types::derived::CResult_BlindedPathNoneZ {
pub extern "C" fn BlindedPath_write(obj: &crate::lightning::blinded_path::BlindedPath) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn BlindedPath_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBlindedPath) })
}
pub extern "C" fn BlindedHop_write(obj: &crate::lightning::blinded_path::BlindedHop) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn BlindedHop_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBlindedHop) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ForwardNode_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeForwardNode)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeForwardNode)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ForwardNode
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ForwardTlvs_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeForwardTlvs)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeForwardTlvs)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ForwardTlvs
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ReceiveTlvs_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReceiveTlvs)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeReceiveTlvs)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ReceiveTlvs
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn PaymentRelay_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePaymentRelay)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePaymentRelay)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the PaymentRelay
ret
}
}
-/// The maximum total CLTV delta that is acceptable when relaying a payment over this
-/// [`BlindedHop`].
+/// The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`].
#[no_mangle]
pub extern "C" fn PaymentConstraints_get_max_cltv_expiry(this_ptr: &PaymentConstraints) -> u32 {
let mut inner_val = &mut this_ptr.get_native_mut_ref().max_cltv_expiry;
*inner_val
}
-/// The maximum total CLTV delta that is acceptable when relaying a payment over this
-/// [`BlindedHop`].
+/// The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`].
#[no_mangle]
pub extern "C" fn PaymentConstraints_set_max_cltv_expiry(this_ptr: &mut PaymentConstraints, mut val: u32) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_cltv_expiry = val;
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn PaymentConstraints_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePaymentConstraints)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePaymentConstraints)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the PaymentConstraints
pub extern "C" fn ForwardTlvs_write(obj: &crate::lightning::blinded_path::payment::ForwardTlvs) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ForwardTlvs_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeForwardTlvs) })
}
pub extern "C" fn ReceiveTlvs_write(obj: &crate::lightning::blinded_path::payment::ReceiveTlvs) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ReceiveTlvs_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReceiveTlvs) })
}
pub extern "C" fn PaymentRelay_write(obj: &crate::lightning::blinded_path::payment::PaymentRelay) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn PaymentRelay_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePaymentRelay) })
}
pub extern "C" fn PaymentConstraints_write(obj: &crate::lightning::blinded_path::payment::PaymentConstraints) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn PaymentConstraints_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePaymentConstraints) })
}
}
unsafe impl Send for BroadcasterInterface {}
unsafe impl Sync for BroadcasterInterface {}
+#[allow(unused)]
pub(crate) fn BroadcasterInterface_clone_fields(orig: &BroadcasterInterface) -> BroadcasterInterface {
BroadcasterInterface {
this_arg: orig.this_arg,
#[must_use]
#[repr(C)]
pub enum ConfirmationTarget {
- /// We'd like a transaction to confirm in the future, but don't want to commit most of the fees
- /// required to do so yet. The remaining fees will come via a Child-Pays-For-Parent (CPFP) fee
- /// bump of the transaction.
+ /// We have some funds available on chain which we need to spend prior to some expiry time at
+ /// which point our counterparty may be able to steal them. Generally we have in the high tens
+ /// to low hundreds of blocks to get our transaction on-chain, but we shouldn't risk too low a
+ /// fee - this should be a relatively high priority feerate.
+ OnChainSweep,
+ /// The highest feerate we will allow our channel counterparty to have in a non-anchor channel.
///
- /// The feerate returned should be the absolute minimum feerate required to enter most node
- /// mempools across the network. Note that if you are not able to obtain this feerate estimate,
- /// you should likely use the furthest-out estimate allowed by your fee estimator.
- MempoolMinimum,
- /// We are happy with a transaction confirming slowly, at least within a day or so worth of
- /// blocks.
- Background,
- /// We'd like a transaction to confirm without major delayed, i.e., within the next 12-24 blocks.
- Normal,
- /// We'd like a transaction to confirm in the next few blocks.
- HighPriority,
+ /// This is the feerate on the transaction which we (or our counterparty) will broadcast in
+ /// order to close the channel unilaterally. Because our counterparty must ensure they can
+ /// always broadcast the latest state, this value being too low will cause immediate
+ /// force-closures.
+ ///
+ /// Allowing this value to be too high can allow our counterparty to burn our HTLC outputs to
+ /// dust, which can result in HTLCs failing or force-closures (when the dust HTLCs exceed
+ /// [`ChannelConfig::max_dust_htlc_exposure`]).
+ ///
+ /// Because most nodes use a feerate estimate which is based on a relatively high priority
+ /// transaction entering the current mempool, setting this to a small multiple of your current
+ /// high priority feerate estimate should suffice.
+ ///
+ /// [`ChannelConfig::max_dust_htlc_exposure`]: crate::util::config::ChannelConfig::max_dust_htlc_exposure
+ MaxAllowedNonAnchorChannelRemoteFee,
+ /// This is the lowest feerate we will allow our channel counterparty to have in an anchor
+ /// channel in order to close the channel if a channel party goes away.
+ ///
+ /// This needs to be sufficient to get into the mempool when the channel needs to
+ /// be force-closed. Setting too high may result in force-closures if our counterparty attempts
+ /// to use a lower feerate. Because this is for anchor channels, we can always bump the feerate
+ /// later; the feerate here only needs to be sufficient to enter the mempool.
+ ///
+ /// A good estimate is the expected mempool minimum at the time of force-closure. Obviously this
+ /// is not an estimate which is very easy to calculate because we do not know the future. Using
+ /// a simple long-term fee estimate or tracking of the mempool minimum is a good approach to
+ /// ensure you can always close the channel. A future change to Bitcoin's P2P network
+ /// (package relay) may obviate the need for this entirely.
+ MinAllowedAnchorChannelRemoteFee,
+ /// The lowest feerate we will allow our channel counterparty to have in a non-anchor channel.
+ ///
+ /// This is the feerate on the transaction which we (or our counterparty) will broadcast in
+ /// order to close the channel if a channel party goes away. Setting this value too high will
+ /// cause immediate force-closures in order to avoid having an unbroadcastable state.
+ ///
+ /// This feerate represents the fee we pick now, which must be sufficient to enter a block at an
+ /// arbitrary time in the future. Obviously this is not an estimate which is very easy to
+ /// calculate. This can leave channels subject to being unable to close if feerates rise, and in
+ /// general you should prefer anchor channels to ensure you can increase the feerate when the
+ /// transactions need broadcasting.
+ ///
+ /// Do note some fee estimators round up to the next full sat/vbyte (ie 250 sats per kw),
+ /// causing occasional issues with feerate disagreements between an initiator that wants a
+ /// feerate of 1.1 sat/vbyte and a receiver that wants 1.1 rounded up to 2. If your fee
+ /// estimator rounds subtracting 250 to your desired feerate here can help avoid this issue.
+ ///
+ /// [`ChannelConfig::max_dust_htlc_exposure`]: crate::util::config::ChannelConfig::max_dust_htlc_exposure
+ MinAllowedNonAnchorChannelRemoteFee,
+ /// This is the feerate on the transaction which we (or our counterparty) will broadcast in
+ /// order to close the channel if a channel party goes away.
+ ///
+ /// This needs to be sufficient to get into the mempool when the channel needs to
+ /// be force-closed. Setting too low may result in force-closures. Because this is for anchor
+ /// channels, it can be a low value as we can always bump the feerate later.
+ ///
+ /// A good estimate is the expected mempool minimum at the time of force-closure. Obviously this
+ /// is not an estimate which is very easy to calculate because we do not know the future. Using
+ /// a simple long-term fee estimate or tracking of the mempool minimum is a good approach to
+ /// ensure you can always close the channel. A future change to Bitcoin's P2P network
+ /// (package relay) may obviate the need for this entirely.
+ AnchorChannelFee,
+ /// Lightning is built around the ability to broadcast a transaction in the future to close our
+ /// channel and claim all pending funds. In order to do so, non-anchor channels are built with
+ /// transactions which we need to be able to broadcast at some point in the future.
+ ///
+ /// This feerate represents the fee we pick now, which must be sufficient to enter a block at an
+ /// arbitrary time in the future. Obviously this is not an estimate which is very easy to
+ /// calculate, so most lightning nodes use some relatively high-priority feerate using the
+ /// current mempool. This leaves channels subject to being unable to close if feerates rise, and
+ /// in general you should prefer anchor channels to ensure you can increase the feerate when the
+ /// transactions need broadcasting.
+ ///
+ /// Since this should represent the feerate of a channel close that does not need fee
+ /// bumping, this is also used as an upper bound for our attempted feerate when doing cooperative
+ /// closure of any channel.
+ NonAnchorChannelFee,
+ /// When cooperatively closing a channel, this is the minimum feerate we will accept.
+ /// Recommended at least within a day or so worth of blocks.
+ ///
+ /// This will also be used when initiating a cooperative close of a channel. When closing a
+ /// channel you can override this fee by using
+ /// [`ChannelManager::close_channel_with_feerate_and_script`].
+ ///
+ /// [`ChannelManager::close_channel_with_feerate_and_script`]: crate::ln::channelmanager::ChannelManager::close_channel_with_feerate_and_script
+ ChannelCloseMinimum,
}
use lightning::chain::chaininterface::ConfirmationTarget as ConfirmationTargetImport;
pub(crate) type nativeConfirmationTarget = ConfirmationTargetImport;
#[allow(unused)]
pub(crate) fn to_native(&self) -> nativeConfirmationTarget {
match self {
- ConfirmationTarget::MempoolMinimum => nativeConfirmationTarget::MempoolMinimum,
- ConfirmationTarget::Background => nativeConfirmationTarget::Background,
- ConfirmationTarget::Normal => nativeConfirmationTarget::Normal,
- ConfirmationTarget::HighPriority => nativeConfirmationTarget::HighPriority,
+ ConfirmationTarget::OnChainSweep => nativeConfirmationTarget::OnChainSweep,
+ ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee => nativeConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee,
+ ConfirmationTarget::MinAllowedAnchorChannelRemoteFee => nativeConfirmationTarget::MinAllowedAnchorChannelRemoteFee,
+ ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee => nativeConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee,
+ ConfirmationTarget::AnchorChannelFee => nativeConfirmationTarget::AnchorChannelFee,
+ ConfirmationTarget::NonAnchorChannelFee => nativeConfirmationTarget::NonAnchorChannelFee,
+ ConfirmationTarget::ChannelCloseMinimum => nativeConfirmationTarget::ChannelCloseMinimum,
}
}
#[allow(unused)]
pub(crate) fn into_native(self) -> nativeConfirmationTarget {
match self {
- ConfirmationTarget::MempoolMinimum => nativeConfirmationTarget::MempoolMinimum,
- ConfirmationTarget::Background => nativeConfirmationTarget::Background,
- ConfirmationTarget::Normal => nativeConfirmationTarget::Normal,
- ConfirmationTarget::HighPriority => nativeConfirmationTarget::HighPriority,
+ ConfirmationTarget::OnChainSweep => nativeConfirmationTarget::OnChainSweep,
+ ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee => nativeConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee,
+ ConfirmationTarget::MinAllowedAnchorChannelRemoteFee => nativeConfirmationTarget::MinAllowedAnchorChannelRemoteFee,
+ ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee => nativeConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee,
+ ConfirmationTarget::AnchorChannelFee => nativeConfirmationTarget::AnchorChannelFee,
+ ConfirmationTarget::NonAnchorChannelFee => nativeConfirmationTarget::NonAnchorChannelFee,
+ ConfirmationTarget::ChannelCloseMinimum => nativeConfirmationTarget::ChannelCloseMinimum,
}
}
#[allow(unused)]
pub(crate) fn from_native(native: &nativeConfirmationTarget) -> Self {
match native {
- nativeConfirmationTarget::MempoolMinimum => ConfirmationTarget::MempoolMinimum,
- nativeConfirmationTarget::Background => ConfirmationTarget::Background,
- nativeConfirmationTarget::Normal => ConfirmationTarget::Normal,
- nativeConfirmationTarget::HighPriority => ConfirmationTarget::HighPriority,
+ nativeConfirmationTarget::OnChainSweep => ConfirmationTarget::OnChainSweep,
+ nativeConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee => ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee,
+ nativeConfirmationTarget::MinAllowedAnchorChannelRemoteFee => ConfirmationTarget::MinAllowedAnchorChannelRemoteFee,
+ nativeConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee => ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee,
+ nativeConfirmationTarget::AnchorChannelFee => ConfirmationTarget::AnchorChannelFee,
+ nativeConfirmationTarget::NonAnchorChannelFee => ConfirmationTarget::NonAnchorChannelFee,
+ nativeConfirmationTarget::ChannelCloseMinimum => ConfirmationTarget::ChannelCloseMinimum,
}
}
#[allow(unused)]
pub(crate) fn native_into(native: nativeConfirmationTarget) -> Self {
match native {
- nativeConfirmationTarget::MempoolMinimum => ConfirmationTarget::MempoolMinimum,
- nativeConfirmationTarget::Background => ConfirmationTarget::Background,
- nativeConfirmationTarget::Normal => ConfirmationTarget::Normal,
- nativeConfirmationTarget::HighPriority => ConfirmationTarget::HighPriority,
+ nativeConfirmationTarget::OnChainSweep => ConfirmationTarget::OnChainSweep,
+ nativeConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee => ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee,
+ nativeConfirmationTarget::MinAllowedAnchorChannelRemoteFee => ConfirmationTarget::MinAllowedAnchorChannelRemoteFee,
+ nativeConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee => ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee,
+ nativeConfirmationTarget::AnchorChannelFee => ConfirmationTarget::AnchorChannelFee,
+ nativeConfirmationTarget::NonAnchorChannelFee => ConfirmationTarget::NonAnchorChannelFee,
+ nativeConfirmationTarget::ChannelCloseMinimum => ConfirmationTarget::ChannelCloseMinimum,
}
}
}
pub extern "C" fn ConfirmationTarget_clone(orig: &ConfirmationTarget) -> ConfirmationTarget {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ConfirmationTarget_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ConfirmationTarget)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ConfirmationTarget_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut ConfirmationTarget) };
+}
+#[no_mangle]
+/// Utility method to constructs a new OnChainSweep-variant ConfirmationTarget
+pub extern "C" fn ConfirmationTarget_on_chain_sweep() -> ConfirmationTarget {
+ ConfirmationTarget::OnChainSweep}
+#[no_mangle]
+/// Utility method to constructs a new MaxAllowedNonAnchorChannelRemoteFee-variant ConfirmationTarget
+pub extern "C" fn ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee() -> ConfirmationTarget {
+ ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee}
+#[no_mangle]
+/// Utility method to constructs a new MinAllowedAnchorChannelRemoteFee-variant ConfirmationTarget
+pub extern "C" fn ConfirmationTarget_min_allowed_anchor_channel_remote_fee() -> ConfirmationTarget {
+ ConfirmationTarget::MinAllowedAnchorChannelRemoteFee}
#[no_mangle]
-/// Utility method to constructs a new MempoolMinimum-variant ConfirmationTarget
-pub extern "C" fn ConfirmationTarget_mempool_minimum() -> ConfirmationTarget {
- ConfirmationTarget::MempoolMinimum}
+/// Utility method to constructs a new MinAllowedNonAnchorChannelRemoteFee-variant ConfirmationTarget
+pub extern "C" fn ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee() -> ConfirmationTarget {
+ ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee}
#[no_mangle]
-/// Utility method to constructs a new Background-variant ConfirmationTarget
-pub extern "C" fn ConfirmationTarget_background() -> ConfirmationTarget {
- ConfirmationTarget::Background}
+/// Utility method to constructs a new AnchorChannelFee-variant ConfirmationTarget
+pub extern "C" fn ConfirmationTarget_anchor_channel_fee() -> ConfirmationTarget {
+ ConfirmationTarget::AnchorChannelFee}
#[no_mangle]
-/// Utility method to constructs a new Normal-variant ConfirmationTarget
-pub extern "C" fn ConfirmationTarget_normal() -> ConfirmationTarget {
- ConfirmationTarget::Normal}
+/// Utility method to constructs a new NonAnchorChannelFee-variant ConfirmationTarget
+pub extern "C" fn ConfirmationTarget_non_anchor_channel_fee() -> ConfirmationTarget {
+ ConfirmationTarget::NonAnchorChannelFee}
#[no_mangle]
-/// Utility method to constructs a new HighPriority-variant ConfirmationTarget
-pub extern "C" fn ConfirmationTarget_high_priority() -> ConfirmationTarget {
- ConfirmationTarget::HighPriority}
+/// Utility method to constructs a new ChannelCloseMinimum-variant ConfirmationTarget
+pub extern "C" fn ConfirmationTarget_channel_close_minimum() -> ConfirmationTarget {
+ ConfirmationTarget::ChannelCloseMinimum}
/// Generates a non-cryptographic 64-bit hash of the ConfirmationTarget.
#[no_mangle]
pub extern "C" fn ConfirmationTarget_hash(o: &ConfirmationTarget) -> u64 {
}
unsafe impl Send for FeeEstimator {}
unsafe impl Sync for FeeEstimator {}
+#[allow(unused)]
pub(crate) fn FeeEstimator_clone_fields(orig: &FeeEstimator) -> FeeEstimator {
FeeEstimator {
this_arg: orig.this_arg,
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn MonitorUpdateId_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeMonitorUpdateId)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeMonitorUpdateId)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the MonitorUpdateId
}
unsafe impl Send for Persist {}
unsafe impl Sync for Persist {}
+#[allow(unused)]
pub(crate) fn Persist_clone_fields(orig: &Persist) -> Persist {
Persist {
this_arg: orig.this_arg,
impl From<nativeChainMonitor> for crate::lightning::chain::Listen {
fn from(obj: nativeChainMonitor) -> Self {
- let mut rust_obj = ChainMonitor { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::chain::chainmonitor::ChainMonitor { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ChainMonitor_as_Listen(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ChainMonitor_free_void);
ret
}
impl From<nativeChainMonitor> for crate::lightning::chain::Confirm {
fn from(obj: nativeChainMonitor) -> Self {
- let mut rust_obj = ChainMonitor { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::chain::chainmonitor::ChainMonitor { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ChainMonitor_as_Confirm(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ChainMonitor_free_void);
ret
}
impl From<nativeChainMonitor> for crate::lightning::chain::Watch {
fn from(obj: nativeChainMonitor) -> Self {
- let mut rust_obj = ChainMonitor { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::chain::chainmonitor::ChainMonitor { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ChainMonitor_as_Watch(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ChainMonitor_free_void);
ret
}
impl From<nativeChainMonitor> for crate::lightning::events::EventsProvider {
fn from(obj: nativeChainMonitor) -> Self {
- let mut rust_obj = ChainMonitor { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::chain::chainmonitor::ChainMonitor { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ChainMonitor_as_EventsProvider(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ChainMonitor_free_void);
ret
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelMonitorUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelMonitorUpdate)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelMonitorUpdate)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelMonitorUpdate
pub extern "C" fn ChannelMonitorUpdate_write(obj: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelMonitorUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelMonitorUpdate) })
}
pub extern "C" fn MonitorEvent_clone(orig: &MonitorEvent) -> MonitorEvent {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn MonitorEvent_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const MonitorEvent)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn MonitorEvent_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut MonitorEvent) };
+}
#[no_mangle]
/// Utility method to constructs a new HTLCEvent-variant MonitorEvent
pub extern "C" fn MonitorEvent_htlcevent(a: crate::lightning::chain::channelmonitor::HTLCUpdate) -> MonitorEvent {
pub extern "C" fn MonitorEvent_write(obj: &crate::lightning::chain::channelmonitor::MonitorEvent) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn MonitorEvent_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ MonitorEvent_write(unsafe { &*(obj as *const MonitorEvent) })
+}
#[no_mangle]
/// Read a MonitorEvent from a byte array, created by MonitorEvent_write
pub extern "C" fn MonitorEvent_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_MonitorEventZDecodeErrorZ {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn HTLCUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeHTLCUpdate)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHTLCUpdate)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the HTLCUpdate
pub extern "C" fn HTLCUpdate_write(obj: &crate::lightning::chain::channelmonitor::HTLCUpdate) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn HTLCUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeHTLCUpdate) })
}
pub extern "C" fn Balance_clone(orig: &Balance) -> Balance {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Balance_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Balance)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Balance_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut Balance) };
+}
#[no_mangle]
/// Utility method to constructs a new ClaimableOnChannelClose-variant Balance
pub extern "C" fn Balance_claimable_on_channel_close(amount_satoshis: u64) -> Balance {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelMonitor_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelMonitor)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelMonitor)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelMonitor
pub extern "C" fn ChannelMonitor_write(obj: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelMonitor_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelMonitor) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn BestBlock_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBestBlock)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBestBlock)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the BestBlock
}
unsafe impl Send for Listen {}
unsafe impl Sync for Listen {}
+#[allow(unused)]
pub(crate) fn Listen_clone_fields(orig: &Listen) -> Listen {
Listen {
this_arg: orig.this_arg,
}
unsafe impl Send for Confirm {}
unsafe impl Sync for Confirm {}
+#[allow(unused)]
pub(crate) fn Confirm_clone_fields(orig: &Confirm) -> Confirm {
Confirm {
this_arg: orig.this_arg,
pub extern "C" fn ChannelMonitorUpdateStatus_clone(orig: &ChannelMonitorUpdateStatus) -> ChannelMonitorUpdateStatus {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelMonitorUpdateStatus_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ChannelMonitorUpdateStatus)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelMonitorUpdateStatus_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut ChannelMonitorUpdateStatus) };
+}
#[no_mangle]
/// Utility method to constructs a new Completed-variant ChannelMonitorUpdateStatus
pub extern "C" fn ChannelMonitorUpdateStatus_completed() -> ChannelMonitorUpdateStatus {
}
unsafe impl Send for Watch {}
unsafe impl Sync for Watch {}
+#[allow(unused)]
pub(crate) fn Watch_clone_fields(orig: &Watch) -> Watch {
Watch {
this_arg: orig.this_arg,
}
unsafe impl Send for Filter {}
unsafe impl Sync for Filter {}
+#[allow(unused)]
pub(crate) fn Filter_clone_fields(orig: &Filter) -> Filter {
Filter {
this_arg: orig.this_arg,
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn WatchedOutput_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeWatchedOutput)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeWatchedOutput)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the WatchedOutput
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn OutPoint_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOutPoint)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOutPoint)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the OutPoint
pub extern "C" fn OutPoint_write(obj: &crate::lightning::chain::transaction::OutPoint) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn OutPoint_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeOutPoint) })
}
use alloc::{vec::Vec, boxed::Box};
-use lightning::events::bump_transaction::ChannelDerivationParameters as nativeChannelDerivationParametersImport;
-pub(crate) type nativeChannelDerivationParameters = nativeChannelDerivationParametersImport;
-
-/// The parameters required to derive a channel signer via [`SignerProvider`].
-#[must_use]
-#[repr(C)]
-pub struct ChannelDerivationParameters {
- /// 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 nativeChannelDerivationParameters,
- /// 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 ChannelDerivationParameters {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeChannelDerivationParameters>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the ChannelDerivationParameters, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn ChannelDerivationParameters_free(this_obj: ChannelDerivationParameters) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn ChannelDerivationParameters_free_void(this_ptr: *mut c_void) {
- let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelDerivationParameters) };
-}
-#[allow(unused)]
-impl ChannelDerivationParameters {
- pub(crate) fn get_native_ref(&self) -> &'static nativeChannelDerivationParameters {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelDerivationParameters {
- 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 nativeChannelDerivationParameters {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-/// The value in satoshis of the channel we're attempting to spend the anchor output of.
-#[no_mangle]
-pub extern "C" fn ChannelDerivationParameters_get_value_satoshis(this_ptr: &ChannelDerivationParameters) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().value_satoshis;
- *inner_val
-}
-/// The value in satoshis of the channel we're attempting to spend the anchor output of.
-#[no_mangle]
-pub extern "C" fn ChannelDerivationParameters_set_value_satoshis(this_ptr: &mut ChannelDerivationParameters, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.value_satoshis = val;
-}
-/// The unique identifier to re-derive the signer for the associated channel.
-#[no_mangle]
-pub extern "C" fn ChannelDerivationParameters_get_keys_id(this_ptr: &ChannelDerivationParameters) -> *const [u8; 32] {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().keys_id;
- inner_val
-}
-/// The unique identifier to re-derive the signer for the associated channel.
-#[no_mangle]
-pub extern "C" fn ChannelDerivationParameters_set_keys_id(this_ptr: &mut ChannelDerivationParameters, mut val: crate::c_types::ThirtyTwoBytes) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.keys_id = val.data;
-}
-/// The necessary channel parameters that need to be provided to the re-derived signer through
-/// [`ChannelSigner::provide_channel_parameters`].
-///
-/// [`ChannelSigner::provide_channel_parameters`]: crate::sign::ChannelSigner::provide_channel_parameters
-#[no_mangle]
-pub extern "C" fn ChannelDerivationParameters_get_transaction_parameters(this_ptr: &ChannelDerivationParameters) -> crate::lightning::ln::chan_utils::ChannelTransactionParameters {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().transaction_parameters;
- crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }
-}
-/// The necessary channel parameters that need to be provided to the re-derived signer through
-/// [`ChannelSigner::provide_channel_parameters`].
-///
-/// [`ChannelSigner::provide_channel_parameters`]: crate::sign::ChannelSigner::provide_channel_parameters
-#[no_mangle]
-pub extern "C" fn ChannelDerivationParameters_set_transaction_parameters(this_ptr: &mut ChannelDerivationParameters, mut val: crate::lightning::ln::chan_utils::ChannelTransactionParameters) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.transaction_parameters = *unsafe { Box::from_raw(val.take_inner()) };
-}
-/// Constructs a new ChannelDerivationParameters given each field
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelDerivationParameters_new(mut value_satoshis_arg: u64, mut keys_id_arg: crate::c_types::ThirtyTwoBytes, mut transaction_parameters_arg: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> ChannelDerivationParameters {
- ChannelDerivationParameters { inner: ObjOps::heap_alloc(nativeChannelDerivationParameters {
- value_satoshis: value_satoshis_arg,
- keys_id: keys_id_arg.data,
- transaction_parameters: *unsafe { Box::from_raw(transaction_parameters_arg.take_inner()) },
- }), is_owned: true }
-}
-impl Clone for ChannelDerivationParameters {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeChannelDerivationParameters>::is_null(self.inner) { core::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 ChannelDerivationParameters_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelDerivationParameters)).clone() })) as *mut c_void
-}
-#[no_mangle]
-/// Creates a copy of the ChannelDerivationParameters
-pub extern "C" fn ChannelDerivationParameters_clone(orig: &ChannelDerivationParameters) -> ChannelDerivationParameters {
- orig.clone()
-}
-/// Checks if two ChannelDerivationParameterss 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 ChannelDerivationParameters_eq(a: &ChannelDerivationParameters, b: &ChannelDerivationParameters) -> 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 }
-}
-#[no_mangle]
-/// Serialize the ChannelDerivationParameters object into a byte array which can be read by ChannelDerivationParameters_read
-pub extern "C" fn ChannelDerivationParameters_write(obj: &crate::lightning::events::bump_transaction::ChannelDerivationParameters) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-pub(crate) extern "C" fn ChannelDerivationParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelDerivationParameters) })
-}
-#[no_mangle]
-/// Read a ChannelDerivationParameters from a byte array, created by ChannelDerivationParameters_write
-pub extern "C" fn ChannelDerivationParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelDerivationParametersDecodeErrorZ {
- let res: Result<lightning::events::bump_transaction::ChannelDerivationParameters, 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::events::bump_transaction::ChannelDerivationParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
- local_res
-}
-
use lightning::events::bump_transaction::AnchorDescriptor as nativeAnchorDescriptorImport;
pub(crate) type nativeAnchorDescriptor = nativeAnchorDescriptorImport;
}
/// The parameters required to derive the signer for the anchor input.
#[no_mangle]
-pub extern "C" fn AnchorDescriptor_get_channel_derivation_parameters(this_ptr: &AnchorDescriptor) -> crate::lightning::events::bump_transaction::ChannelDerivationParameters {
+pub extern "C" fn AnchorDescriptor_get_channel_derivation_parameters(this_ptr: &AnchorDescriptor) -> crate::lightning::sign::ChannelDerivationParameters {
let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_derivation_parameters;
- crate::lightning::events::bump_transaction::ChannelDerivationParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::events::bump_transaction::ChannelDerivationParameters<>) as *mut _) }, is_owned: false }
+ crate::lightning::sign::ChannelDerivationParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::sign::ChannelDerivationParameters<>) as *mut _) }, is_owned: false }
}
/// The parameters required to derive the signer for the anchor input.
#[no_mangle]
-pub extern "C" fn AnchorDescriptor_set_channel_derivation_parameters(this_ptr: &mut AnchorDescriptor, mut val: crate::lightning::events::bump_transaction::ChannelDerivationParameters) {
+pub extern "C" fn AnchorDescriptor_set_channel_derivation_parameters(this_ptr: &mut AnchorDescriptor, mut val: crate::lightning::sign::ChannelDerivationParameters) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_derivation_parameters = *unsafe { Box::from_raw(val.take_inner()) };
}
/// The transaction input's outpoint corresponding to the commitment transaction's anchor
/// Constructs a new AnchorDescriptor given each field
#[must_use]
#[no_mangle]
-pub extern "C" fn AnchorDescriptor_new(mut channel_derivation_parameters_arg: crate::lightning::events::bump_transaction::ChannelDerivationParameters, mut outpoint_arg: crate::lightning::chain::transaction::OutPoint) -> AnchorDescriptor {
+pub extern "C" fn AnchorDescriptor_new(mut channel_derivation_parameters_arg: crate::lightning::sign::ChannelDerivationParameters, mut outpoint_arg: crate::lightning::chain::transaction::OutPoint) -> AnchorDescriptor {
AnchorDescriptor { inner: ObjOps::heap_alloc(nativeAnchorDescriptor {
channel_derivation_parameters: *unsafe { Box::from_raw(channel_derivation_parameters_arg.take_inner()) },
outpoint: crate::c_types::C_to_bitcoin_outpoint(outpoint_arg),
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn AnchorDescriptor_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAnchorDescriptor)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeAnchorDescriptor)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the AnchorDescriptor
Into::into(ret)
}
-
-use lightning::events::bump_transaction::HTLCDescriptor as nativeHTLCDescriptorImport;
-pub(crate) type nativeHTLCDescriptor = nativeHTLCDescriptorImport;
-
-/// A descriptor used to sign for a commitment transaction's HTLC output.
-#[must_use]
-#[repr(C)]
-pub struct HTLCDescriptor {
- /// 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 nativeHTLCDescriptor,
- /// 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 HTLCDescriptor {
- fn drop(&mut self) {
- if self.is_owned && !<*mut nativeHTLCDescriptor>::is_null(self.inner) {
- let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
- }
- }
-}
-/// Frees any resources used by the HTLCDescriptor, if is_owned is set and inner is non-NULL.
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_free(this_obj: HTLCDescriptor) { }
-#[allow(unused)]
-/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn HTLCDescriptor_free_void(this_ptr: *mut c_void) {
- let _ = unsafe { Box::from_raw(this_ptr as *mut nativeHTLCDescriptor) };
-}
-#[allow(unused)]
-impl HTLCDescriptor {
- pub(crate) fn get_native_ref(&self) -> &'static nativeHTLCDescriptor {
- unsafe { &*ObjOps::untweak_ptr(self.inner) }
- }
- pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeHTLCDescriptor {
- 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 nativeHTLCDescriptor {
- assert!(self.is_owned);
- let ret = ObjOps::untweak_ptr(self.inner);
- self.inner = core::ptr::null_mut();
- ret
- }
-}
-/// The parameters required to derive the signer for the HTLC input.
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_get_channel_derivation_parameters(this_ptr: &HTLCDescriptor) -> crate::lightning::events::bump_transaction::ChannelDerivationParameters {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_derivation_parameters;
- crate::lightning::events::bump_transaction::ChannelDerivationParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::events::bump_transaction::ChannelDerivationParameters<>) as *mut _) }, is_owned: false }
-}
-/// The parameters required to derive the signer for the HTLC input.
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_set_channel_derivation_parameters(this_ptr: &mut HTLCDescriptor, mut val: crate::lightning::events::bump_transaction::ChannelDerivationParameters) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_derivation_parameters = *unsafe { Box::from_raw(val.take_inner()) };
-}
-/// The number of the commitment transaction in which the HTLC output lives.
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_get_per_commitment_number(this_ptr: &HTLCDescriptor) -> u64 {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().per_commitment_number;
- *inner_val
-}
-/// The number of the commitment transaction in which the HTLC output lives.
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_set_per_commitment_number(this_ptr: &mut HTLCDescriptor, mut val: u64) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.per_commitment_number = val;
-}
-/// The key tweak corresponding to the number of the commitment transaction in which the HTLC
-/// output lives. This tweak is applied to all the basepoints for both parties in the channel to
-/// arrive at unique keys per commitment.
-///
-/// See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_get_per_commitment_point(this_ptr: &HTLCDescriptor) -> crate::c_types::PublicKey {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().per_commitment_point;
- crate::c_types::PublicKey::from_rust(&inner_val)
-}
-/// The key tweak corresponding to the number of the commitment transaction in which the HTLC
-/// output lives. This tweak is applied to all the basepoints for both parties in the channel to
-/// arrive at unique keys per commitment.
-///
-/// See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_set_per_commitment_point(this_ptr: &mut HTLCDescriptor, mut val: crate::c_types::PublicKey) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.per_commitment_point = val.into_rust();
-}
-/// The details of the HTLC as it appears in the commitment transaction.
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_get_htlc(this_ptr: &HTLCDescriptor) -> crate::lightning::ln::chan_utils::HTLCOutputInCommitment {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc;
- crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) as *mut _) }, is_owned: false }
-}
-/// The details of the HTLC as it appears in the commitment transaction.
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_set_htlc(this_ptr: &mut HTLCDescriptor, mut val: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc = *unsafe { Box::from_raw(val.take_inner()) };
-}
-/// The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
-/// taken.
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_get_preimage(this_ptr: &HTLCDescriptor) -> crate::c_types::derived::COption_ThirtyTwoBytesZ {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().preimage;
- let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option<Enum> is otherwise un-expressable. */ { crate::c_types::ThirtyTwoBytes { data: (*inner_val.as_ref().unwrap()).clone().0 } }) };
- local_inner_val
-}
-/// The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
-/// taken.
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_set_preimage(this_ptr: &mut HTLCDescriptor, mut val: crate::c_types::derived::COption_ThirtyTwoBytesZ) {
- let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::lightning::ln::PaymentPreimage({ val_opt.take() }.data) }})} };
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.preimage = local_val;
-}
-/// The counterparty's signature required to spend the HTLC output.
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_get_counterparty_sig(this_ptr: &HTLCDescriptor) -> crate::c_types::ECDSASignature {
- let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty_sig;
- crate::c_types::ECDSASignature::from_rust(&inner_val)
-}
-/// The counterparty's signature required to spend the HTLC output.
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_set_counterparty_sig(this_ptr: &mut HTLCDescriptor, mut val: crate::c_types::ECDSASignature) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.counterparty_sig = val.into_rust();
-}
-impl Clone for HTLCDescriptor {
- fn clone(&self) -> Self {
- Self {
- inner: if <*mut nativeHTLCDescriptor>::is_null(self.inner) { core::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 HTLCDescriptor_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeHTLCDescriptor)).clone() })) as *mut c_void
-}
-#[no_mangle]
-/// Creates a copy of the HTLCDescriptor
-pub extern "C" fn HTLCDescriptor_clone(orig: &HTLCDescriptor) -> HTLCDescriptor {
- orig.clone()
-}
-/// Checks if two HTLCDescriptors 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 HTLCDescriptor_eq(a: &HTLCDescriptor, b: &HTLCDescriptor) -> 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 }
-}
-#[no_mangle]
-/// Serialize the HTLCDescriptor object into a byte array which can be read by HTLCDescriptor_read
-pub extern "C" fn HTLCDescriptor_write(obj: &crate::lightning::events::bump_transaction::HTLCDescriptor) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
-}
-#[no_mangle]
-pub(crate) extern "C" fn HTLCDescriptor_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
- crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeHTLCDescriptor) })
-}
-#[no_mangle]
-/// Read a HTLCDescriptor from a byte array, created by HTLCDescriptor_write
-pub extern "C" fn HTLCDescriptor_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_HTLCDescriptorDecodeErrorZ {
- let res: Result<lightning::events::bump_transaction::HTLCDescriptor, 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::events::bump_transaction::HTLCDescriptor { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
- local_res
-}
-/// Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint
-/// being spent by the HTLC input in the HTLC transaction.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_outpoint(this_arg: &crate::lightning::events::bump_transaction::HTLCDescriptor) -> crate::lightning::chain::transaction::OutPoint {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.outpoint();
- crate::c_types::bitcoin_to_C_outpoint(&ret)
-}
-
-/// Returns the UTXO to be spent by the HTLC input, which can be obtained via
-/// [`Self::unsigned_tx_input`].
-#[must_use]
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_previous_utxo(this_arg: &crate::lightning::events::bump_transaction::HTLCDescriptor) -> crate::c_types::TxOut {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.previous_utxo(secp256k1::global::SECP256K1);
- crate::c_types::TxOut::from_rust(&ret)
-}
-
-/// Returns the unsigned transaction input spending the HTLC output in the commitment
-/// transaction.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_unsigned_tx_input(this_arg: &crate::lightning::events::bump_transaction::HTLCDescriptor) -> crate::c_types::TxIn {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.unsigned_tx_input();
- crate::c_types::TxIn::from_rust(&ret)
-}
-
-/// Returns the delayed output created as a result of spending the HTLC output in the commitment
-/// transaction.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_tx_output(this_arg: &crate::lightning::events::bump_transaction::HTLCDescriptor) -> crate::c_types::TxOut {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.tx_output(secp256k1::global::SECP256K1);
- crate::c_types::TxOut::from_rust(&ret)
-}
-
-/// Returns the witness script of the HTLC output in the commitment transaction.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_witness_script(this_arg: &crate::lightning::events::bump_transaction::HTLCDescriptor) -> crate::c_types::derived::CVec_u8Z {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.witness_script(secp256k1::global::SECP256K1);
- ret.into_bytes().into()
-}
-
-/// Returns the fully signed witness required to spend the HTLC output in the commitment
-/// transaction.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_tx_input_witness(this_arg: &crate::lightning::events::bump_transaction::HTLCDescriptor, mut signature: crate::c_types::ECDSASignature, mut witness_script: crate::c_types::u8slice) -> crate::c_types::Witness {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.tx_input_witness(&signature.into_rust(), &::bitcoin::blockdata::script::Script::from(Vec::from(witness_script.to_slice())));
- crate::c_types::Witness::from_bitcoin(&ret)
-}
-
-/// Derives the channel signer required to sign the HTLC input.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn HTLCDescriptor_derive_channel_signer(this_arg: &crate::lightning::events::bump_transaction::HTLCDescriptor, signer_provider: &crate::lightning::sign::SignerProvider) -> crate::lightning::sign::WriteableEcdsaChannelSigner {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.derive_channel_signer(signer_provider);
- Into::into(ret)
-}
-
/// Represents the different types of transactions, originating from LDK, to be bumped.
#[derive(Clone)]
#[must_use]
///
/// [`EcdsaChannelSigner`]: crate::sign::EcdsaChannelSigner
/// [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::sign::EcdsaChannelSigner::sign_holder_htlc_transaction
- /// [`HTLCDescriptor::tx_input_witness`]: HTLCDescriptor::tx_input_witness
HTLCResolution {
/// The unique identifier for the claim of the HTLCs in the confirmed commitment
/// transaction.
let mut claim_id_nonref = Clone::clone(claim_id);
let mut target_feerate_sat_per_1000_weight_nonref = Clone::clone(target_feerate_sat_per_1000_weight);
let mut htlc_descriptors_nonref = Clone::clone(htlc_descriptors);
- let mut local_htlc_descriptors_nonref = Vec::new(); for mut item in htlc_descriptors_nonref.drain(..) { local_htlc_descriptors_nonref.push( { crate::lightning::events::bump_transaction::HTLCDescriptor { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
+ let mut local_htlc_descriptors_nonref = Vec::new(); for mut item in htlc_descriptors_nonref.drain(..) { local_htlc_descriptors_nonref.push( { crate::lightning::sign::HTLCDescriptor { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
let mut tx_lock_time_nonref = Clone::clone(tx_lock_time);
BumpTransactionEvent::HTLCResolution {
claim_id: crate::c_types::ThirtyTwoBytes { data: claim_id_nonref.0 },
}
},
nativeBumpTransactionEvent::HTLCResolution {mut claim_id, mut target_feerate_sat_per_1000_weight, mut htlc_descriptors, mut tx_lock_time, } => {
- let mut local_htlc_descriptors = Vec::new(); for mut item in htlc_descriptors.drain(..) { local_htlc_descriptors.push( { crate::lightning::events::bump_transaction::HTLCDescriptor { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
+ let mut local_htlc_descriptors = Vec::new(); for mut item in htlc_descriptors.drain(..) { local_htlc_descriptors.push( { crate::lightning::sign::HTLCDescriptor { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
BumpTransactionEvent::HTLCResolution {
claim_id: crate::c_types::ThirtyTwoBytes { data: claim_id.0 },
target_feerate_sat_per_1000_weight: target_feerate_sat_per_1000_weight,
pub extern "C" fn BumpTransactionEvent_clone(orig: &BumpTransactionEvent) -> BumpTransactionEvent {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn BumpTransactionEvent_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const BumpTransactionEvent)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn BumpTransactionEvent_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut BumpTransactionEvent) };
+}
#[no_mangle]
/// Utility method to constructs a new ChannelClose-variant BumpTransactionEvent
pub extern "C" fn BumpTransactionEvent_channel_close(claim_id: crate::c_types::ThirtyTwoBytes, package_target_feerate_sat_per_1000_weight: u32, commitment_tx: crate::c_types::Transaction, commitment_tx_fee_satoshis: u64, anchor_descriptor: crate::lightning::events::bump_transaction::AnchorDescriptor, pending_htlcs: crate::c_types::derived::CVec_HTLCOutputInCommitmentZ) -> BumpTransactionEvent {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Input_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInput)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInput)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Input
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Utxo_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUtxo)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUtxo)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Utxo
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn CoinSelection_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCoinSelection)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCoinSelection)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the CoinSelection
}
unsafe impl Send for CoinSelectionSource {}
unsafe impl Sync for CoinSelectionSource {}
+#[allow(unused)]
pub(crate) fn CoinSelectionSource_clone_fields(orig: &CoinSelectionSource) -> CoinSelectionSource {
CoinSelectionSource {
this_arg: orig.this_arg,
}
unsafe impl Send for WalletSource {}
unsafe impl Sync for WalletSource {}
+#[allow(unused)]
pub(crate) fn WalletSource_clone_fields(orig: &WalletSource) -> WalletSource {
WalletSource {
this_arg: orig.this_arg,
impl From<nativeWallet> for crate::lightning::events::bump_transaction::CoinSelectionSource {
fn from(obj: nativeWallet) -> Self {
- let mut rust_obj = Wallet { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::events::bump_transaction::Wallet { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = Wallet_as_CoinSelectionSource(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(Wallet_free_void);
ret
}
pub extern "C" fn PaymentPurpose_clone(orig: &PaymentPurpose) -> PaymentPurpose {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn PaymentPurpose_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const PaymentPurpose)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn PaymentPurpose_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut PaymentPurpose) };
+}
#[no_mangle]
/// Utility method to constructs a new InvoicePayment-variant PaymentPurpose
pub extern "C" fn PaymentPurpose_invoice_payment(payment_preimage: crate::c_types::derived::COption_ThirtyTwoBytesZ, payment_secret: crate::c_types::ThirtyTwoBytes) -> PaymentPurpose {
pub extern "C" fn PaymentPurpose_write(obj: &crate::lightning::events::PaymentPurpose) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn PaymentPurpose_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ PaymentPurpose_write(unsafe { &*(obj as *const PaymentPurpose) })
+}
#[no_mangle]
/// Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
pub extern "C" fn PaymentPurpose_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PaymentPurposeDecodeErrorZ {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ClaimedHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeClaimedHTLC)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeClaimedHTLC)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ClaimedHTLC
pub extern "C" fn ClaimedHTLC_write(obj: &crate::lightning::events::ClaimedHTLC) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ClaimedHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeClaimedHTLC) })
}
pub extern "C" fn PathFailure_clone(orig: &PathFailure) -> PathFailure {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn PathFailure_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const PathFailure)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn PathFailure_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut PathFailure) };
+}
#[no_mangle]
/// Utility method to constructs a new InitialSend-variant PathFailure
pub extern "C" fn PathFailure_initial_send(err: crate::lightning::util::errors::APIError) -> PathFailure {
pub extern "C" fn PathFailure_write(obj: &crate::lightning::events::PathFailure) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn PathFailure_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ PathFailure_write(unsafe { &*(obj as *const PathFailure) })
+}
#[no_mangle]
/// Read a PathFailure from a byte array, created by PathFailure_write
pub extern "C" fn PathFailure_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_PathFailureZDecodeErrorZ {
pub extern "C" fn ClosureReason_clone(orig: &ClosureReason) -> ClosureReason {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ClosureReason_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ClosureReason)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ClosureReason_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut ClosureReason) };
+}
#[no_mangle]
/// Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
pub extern "C" fn ClosureReason_counterparty_force_closed(peer_msg: crate::lightning::util::string::UntrustedString) -> ClosureReason {
pub extern "C" fn ClosureReason_write(obj: &crate::lightning::events::ClosureReason) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn ClosureReason_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ ClosureReason_write(unsafe { &*(obj as *const ClosureReason) })
+}
#[no_mangle]
/// Read a ClosureReason from a byte array, created by ClosureReason_write
pub extern "C" fn ClosureReason_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_ClosureReasonZDecodeErrorZ {
pub extern "C" fn HTLCDestination_clone(orig: &HTLCDestination) -> HTLCDestination {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn HTLCDestination_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const HTLCDestination)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn HTLCDestination_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut HTLCDestination) };
+}
#[no_mangle]
/// Utility method to constructs a new NextHopChannel-variant HTLCDestination
pub extern "C" fn HTLCDestination_next_hop_channel(node_id: crate::c_types::PublicKey, channel_id: crate::c_types::ThirtyTwoBytes) -> HTLCDestination {
pub extern "C" fn HTLCDestination_write(obj: &crate::lightning::events::HTLCDestination) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn HTLCDestination_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ HTLCDestination_write(unsafe { &*(obj as *const HTLCDestination) })
+}
#[no_mangle]
/// Read a HTLCDestination from a byte array, created by HTLCDestination_write
pub extern "C" fn HTLCDestination_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_HTLCDestinationZDecodeErrorZ {
pub extern "C" fn PaymentFailureReason_clone(orig: &PaymentFailureReason) -> PaymentFailureReason {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn PaymentFailureReason_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const PaymentFailureReason)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn PaymentFailureReason_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut PaymentFailureReason) };
+}
#[no_mangle]
/// Utility method to constructs a new RecipientRejected-variant PaymentFailureReason
pub extern "C" fn PaymentFailureReason_recipient_rejected() -> PaymentFailureReason {
pub extern "C" fn PaymentFailureReason_write(obj: &crate::lightning::events::PaymentFailureReason) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn PaymentFailureReason_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ PaymentFailureReason_write(unsafe { &*(obj as *const PaymentFailureReason) })
+}
#[no_mangle]
/// Read a PaymentFailureReason from a byte array, created by PaymentFailureReason_write
pub extern "C" fn PaymentFailureReason_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PaymentFailureReasonDecodeErrorZ {
/// serialized prior to LDK version 0.0.117.
sender_intended_total_msat: crate::c_types::derived::COption_u64Z,
},
+ /// Indicates a request for an invoice failed to yield a response in a reasonable amount of time
+ /// or was explicitly abandoned by [`ChannelManager::abandon_payment`]. This may be for an
+ /// [`InvoiceRequest`] sent for an [`Offer`] or for a [`Refund`] that hasn't been redeemed.
+ ///
+ /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+ /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
+ /// [`Offer`]: crate::offers::offer::Offer
+ /// [`Refund`]: crate::offers::refund::Refund
+ InvoiceRequestFailed {
+ /// The `payment_id` to have been associated with payment for the requested invoice.
+ payment_id: crate::c_types::ThirtyTwoBytes,
+ },
/// Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
/// and we got back the payment preimage for it).
///
sender_intended_total_msat: local_sender_intended_total_msat_nonref,
}
},
+ Event::InvoiceRequestFailed {ref payment_id, } => {
+ let mut payment_id_nonref = Clone::clone(payment_id);
+ nativeEvent::InvoiceRequestFailed {
+ payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data),
+ }
+ },
Event::PaymentSent {ref payment_id, ref payment_preimage, ref payment_hash, ref fee_paid_msat, } => {
let mut payment_id_nonref = Clone::clone(payment_id);
let mut local_payment_id_nonref = { /*payment_id_nonref*/ let payment_id_nonref_opt = payment_id_nonref; if payment_id_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::channelmanager::PaymentId({ payment_id_nonref_opt.take() }.data) }})} };
sender_intended_total_msat: local_sender_intended_total_msat,
}
},
+ Event::InvoiceRequestFailed {mut payment_id, } => {
+ nativeEvent::InvoiceRequestFailed {
+ payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data),
+ }
+ },
Event::PaymentSent {mut payment_id, mut payment_preimage, mut payment_hash, mut fee_paid_msat, } => {
let mut local_payment_id = { /*payment_id*/ let payment_id_opt = payment_id; if payment_id_opt.is_none() { None } else { Some({ { ::lightning::ln::channelmanager::PaymentId({ payment_id_opt.take() }.data) }})} };
let mut local_fee_paid_msat = if fee_paid_msat.is_some() { Some( { fee_paid_msat.take() }) } else { None };
sender_intended_total_msat: local_sender_intended_total_msat_nonref,
}
},
+ nativeEvent::InvoiceRequestFailed {ref payment_id, } => {
+ let mut payment_id_nonref = Clone::clone(payment_id);
+ Event::InvoiceRequestFailed {
+ payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 },
+ }
+ },
nativeEvent::PaymentSent {ref payment_id, ref payment_preimage, ref payment_hash, ref fee_paid_msat, } => {
let mut payment_id_nonref = Clone::clone(payment_id);
let mut local_payment_id_nonref = if payment_id_nonref.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.unwrap().0 } }) };
sender_intended_total_msat: local_sender_intended_total_msat,
}
},
+ nativeEvent::InvoiceRequestFailed {mut payment_id, } => {
+ Event::InvoiceRequestFailed {
+ payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 },
+ }
+ },
nativeEvent::PaymentSent {mut payment_id, mut payment_preimage, mut payment_hash, mut fee_paid_msat, } => {
let mut local_payment_id = if payment_id.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_id.unwrap().0 } }) };
let mut local_fee_paid_msat = if fee_paid_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { fee_paid_msat.unwrap() }) };
pub extern "C" fn Event_clone(orig: &Event) -> Event {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Event_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Event)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Event_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut Event) };
+}
#[no_mangle]
/// Utility method to constructs a new FundingGenerationReady-variant Event
pub extern "C" fn Event_funding_generation_ready(temporary_channel_id: crate::c_types::ThirtyTwoBytes, counterparty_node_id: crate::c_types::PublicKey, channel_value_satoshis: u64, output_script: crate::c_types::derived::CVec_u8Z, user_channel_id: crate::c_types::U128) -> Event {
}
}
#[no_mangle]
+/// Utility method to constructs a new InvoiceRequestFailed-variant Event
+pub extern "C" fn Event_invoice_request_failed(payment_id: crate::c_types::ThirtyTwoBytes) -> Event {
+ Event::InvoiceRequestFailed {
+ payment_id,
+ }
+}
+#[no_mangle]
/// Utility method to constructs a new PaymentSent-variant Event
pub extern "C" fn Event_payment_sent(payment_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, payment_preimage: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes, fee_paid_msat: crate::c_types::derived::COption_u64Z) -> Event {
Event::PaymentSent {
pub extern "C" fn Event_write(obj: &crate::lightning::events::Event) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn Event_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ Event_write(unsafe { &*(obj as *const Event) })
+}
#[no_mangle]
/// Read a Event from a byte array, created by Event_write
pub extern "C" fn Event_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_EventZDecodeErrorZ {
pub extern "C" fn MessageSendEvent_clone(orig: &MessageSendEvent) -> MessageSendEvent {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn MessageSendEvent_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const MessageSendEvent)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn MessageSendEvent_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut MessageSendEvent) };
+}
#[no_mangle]
/// Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
pub extern "C" fn MessageSendEvent_send_accept_channel(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::AcceptChannel) -> MessageSendEvent {
}
unsafe impl Send for MessageSendEventsProvider {}
unsafe impl Sync for MessageSendEventsProvider {}
+#[allow(unused)]
pub(crate) fn MessageSendEventsProvider_clone_fields(orig: &MessageSendEventsProvider) -> MessageSendEventsProvider {
MessageSendEventsProvider {
this_arg: orig.this_arg,
}
}
}
-/// A trait indicating an object may generate onion messages to send
-#[repr(C)]
-pub struct OnionMessageProvider {
- /// 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,
- /// Gets the next pending onion message for the peer with the given node id.
- ///
- /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
- pub next_onion_message_for_peer: extern "C" fn (this_arg: *const c_void, peer_node_id: crate::c_types::PublicKey) -> crate::lightning::ln::msgs::OnionMessage,
- /// 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 OnionMessageProvider {}
-unsafe impl Sync for OnionMessageProvider {}
-pub(crate) fn OnionMessageProvider_clone_fields(orig: &OnionMessageProvider) -> OnionMessageProvider {
- OnionMessageProvider {
- this_arg: orig.this_arg,
- next_onion_message_for_peer: Clone::clone(&orig.next_onion_message_for_peer),
- free: Clone::clone(&orig.free),
- }
-}
-
-use lightning::events::OnionMessageProvider as rustOnionMessageProvider;
-impl rustOnionMessageProvider for OnionMessageProvider {
- fn next_onion_message_for_peer(&self, mut peer_node_id: bitcoin::secp256k1::PublicKey) -> Option<lightning::ln::msgs::OnionMessage> {
- let mut ret = (self.next_onion_message_for_peer)(self.this_arg, crate::c_types::PublicKey::from_rust(&peer_node_id));
- let mut local_ret = if ret.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(ret.take_inner()) } }) };
- local_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 core::ops::Deref for OnionMessageProvider {
- type Target = Self;
- fn deref(&self) -> &Self {
- self
- }
-}
-impl core::ops::DerefMut for OnionMessageProvider {
- fn deref_mut(&mut self) -> &mut Self {
- self
- }
-}
-/// Calls the free function if one is set
-#[no_mangle]
-pub extern "C" fn OnionMessageProvider_free(this_ptr: OnionMessageProvider) { }
-impl Drop for OnionMessageProvider {
- fn drop(&mut self) {
- if let Some(f) = self.free {
- f(self.this_arg);
- }
- }
-}
/// A trait indicating an object may generate events.
///
/// Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
}
unsafe impl Send for EventsProvider {}
unsafe impl Sync for EventsProvider {}
+#[allow(unused)]
pub(crate) fn EventsProvider_clone_fields(orig: &EventsProvider) -> EventsProvider {
EventsProvider {
this_arg: orig.this_arg,
}
unsafe impl Send for EventHandler {}
unsafe impl Sync for EventHandler {}
+#[allow(unused)]
pub(crate) fn EventHandler_clone_fields(orig: &EventHandler) -> EventHandler {
EventHandler {
this_arg: orig.this_arg,
pub extern "C" fn HTLCClaim_clone(orig: &HTLCClaim) -> HTLCClaim {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn HTLCClaim_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const HTLCClaim)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn HTLCClaim_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut HTLCClaim) };
+}
#[no_mangle]
/// Utility method to constructs a new OfferedTimeout-variant HTLCClaim
pub extern "C" fn HTLCClaim_offered_timeout() -> HTLCClaim {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn CounterpartyCommitmentSecrets_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCounterpartyCommitmentSecrets)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCounterpartyCommitmentSecrets)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the CounterpartyCommitmentSecrets
pub extern "C" fn CounterpartyCommitmentSecrets_write(obj: &crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn CounterpartyCommitmentSecrets_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeCounterpartyCommitmentSecrets) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn TxCreationKeys_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeTxCreationKeys)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxCreationKeys)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the TxCreationKeys
pub extern "C" fn TxCreationKeys_write(obj: &crate::lightning::ln::chan_utils::TxCreationKeys) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn TxCreationKeys_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeTxCreationKeys) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelPublicKeys_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelPublicKeys)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelPublicKeys)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelPublicKeys
pub extern "C" fn ChannelPublicKeys_write(obj: &crate::lightning::ln::chan_utils::ChannelPublicKeys) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelPublicKeys_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelPublicKeys) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn HTLCOutputInCommitment_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeHTLCOutputInCommitment)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHTLCOutputInCommitment)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the HTLCOutputInCommitment
pub extern "C" fn HTLCOutputInCommitment_write(obj: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn HTLCOutputInCommitment_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeHTLCOutputInCommitment) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelTransactionParameters_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelTransactionParameters)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelTransactionParameters)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelTransactionParameters
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn CounterpartyChannelTransactionParameters_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCounterpartyChannelTransactionParameters)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCounterpartyChannelTransactionParameters)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the CounterpartyChannelTransactionParameters
pub extern "C" fn CounterpartyChannelTransactionParameters_write(obj: &crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn CounterpartyChannelTransactionParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeCounterpartyChannelTransactionParameters) })
}
pub extern "C" fn ChannelTransactionParameters_write(obj: &crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelTransactionParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelTransactionParameters) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn HolderCommitmentTransaction_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeHolderCommitmentTransaction)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHolderCommitmentTransaction)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the HolderCommitmentTransaction
pub extern "C" fn HolderCommitmentTransaction_write(obj: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn HolderCommitmentTransaction_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeHolderCommitmentTransaction) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn BuiltCommitmentTransaction_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBuiltCommitmentTransaction)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBuiltCommitmentTransaction)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the BuiltCommitmentTransaction
pub extern "C" fn BuiltCommitmentTransaction_write(obj: &crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn BuiltCommitmentTransaction_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBuiltCommitmentTransaction) })
}
#[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
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeClosingTransaction)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ClosingTransaction
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn CommitmentTransaction_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCommitmentTransaction)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCommitmentTransaction)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the CommitmentTransaction
pub extern "C" fn CommitmentTransaction_write(obj: &crate::lightning::ln::chan_utils::CommitmentTransaction) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn CommitmentTransaction_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeCommitmentTransaction) })
}
ret
}
+/// The per commitment point used by the broadcaster.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn CommitmentTransaction_per_commitment_point(this_arg: &crate::lightning::ln::chan_utils::CommitmentTransaction) -> crate::c_types::PublicKey {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.per_commitment_point();
+ crate::c_types::PublicKey::from_rust(&ret)
+}
+
/// The value to be sent to the broadcaster
#[must_use]
#[no_mangle]
pub extern "C" fn FailureCode_clone(orig: &FailureCode) -> FailureCode {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn FailureCode_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const FailureCode)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn FailureCode_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut FailureCode) };
+}
#[no_mangle]
/// Utility method to constructs a new TemporaryNodeFailure-variant FailureCode
pub extern "C" fn FailureCode_temporary_node_failure() -> FailureCode {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChainParameters_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChainParameters)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChainParameters)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChainParameters
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn CounterpartyForwardingInfo_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCounterpartyForwardingInfo)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCounterpartyForwardingInfo)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the CounterpartyForwardingInfo
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelCounterparty_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelCounterparty)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelCounterparty)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelCounterparty
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelDetails_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelDetails)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelDetails)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelDetails
pub extern "C" fn ChannelShutdownState_clone(orig: &ChannelShutdownState) -> ChannelShutdownState {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelShutdownState_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ChannelShutdownState)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelShutdownState_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut ChannelShutdownState) };
+}
#[no_mangle]
/// Utility method to constructs a new NotShuttingDown-variant ChannelShutdownState
pub extern "C" fn ChannelShutdownState_not_shutting_down() -> ChannelShutdownState {
pub extern "C" fn RecentPaymentDetails_clone(orig: &RecentPaymentDetails) -> RecentPaymentDetails {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn RecentPaymentDetails_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const RecentPaymentDetails)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn RecentPaymentDetails_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut RecentPaymentDetails) };
+}
#[no_mangle]
/// Utility method to constructs a new AwaitingInvoice-variant RecentPaymentDetails
pub extern "C" fn RecentPaymentDetails_awaiting_invoice(payment_id: crate::c_types::ThirtyTwoBytes) -> RecentPaymentDetails {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn PhantomRouteHints_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePhantomRouteHints)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePhantomRouteHints)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the PhantomRouteHints
/// will be accepted on the given channel, and after additional timeout/the closing of all
/// pending HTLCs, the channel will be closed on chain.
///
-/// * If we are the channel initiator, we will pay between our [`Background`] and
-/// [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
-/// estimate.
+/// * If we are the channel initiator, we will pay between our [`ChannelCloseMinimum`] and
+/// [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`]
+/// fee estimate.
/// * If our counterparty is the channel initiator, we will require a channel closing
-/// transaction feerate of at least our [`Background`] feerate or the feerate which
+/// transaction feerate of at least our [`ChannelCloseMinimum`] feerate or the feerate which
/// would appear on a force-closure transaction, whichever is lower. We will allow our
/// counterparty to pay as much fee as they'd like, however.
///
/// channel.
///
/// [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
-/// [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
-/// [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
+/// [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum
+/// [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
/// [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
#[must_use]
#[no_mangle]
/// the channel being closed or not:
/// * If we are the channel initiator, we will pay at least this feerate on the closing
/// transaction. The upper-bound is set by
-/// [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
-/// estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
+/// [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`]
+/// fee estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
/// * If our counterparty is the channel initiator, we will refuse to accept a channel closure
/// transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
/// will appear on a force-closure transaction, whichever is lower).
/// channel.
///
/// [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
-/// [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
-/// [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
+/// [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
/// [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
///
/// Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None
/// wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
/// determine the ultimate status of a payment.
///
+/// # Requested Invoices
+///
+/// In the case of paying a [`Bolt12Invoice`] via [`ChannelManager::pay_for_offer`], abandoning
+/// the payment prior to receiving the invoice will result in an [`Event::InvoiceRequestFailed`]
+/// and prevent any attempts at paying it once received. The other events may only be generated
+/// once the invoice has been received.
+///
/// # Restart Behavior
///
/// If an [`Event::PaymentFailed`] is generated and we restart without first persisting the
-/// [`ChannelManager`], another [`Event::PaymentFailed`] may be generated.
+/// [`ChannelManager`], another [`Event::PaymentFailed`] may be generated; likewise for
+/// [`Event::InvoiceRequestFailed`].
+///
+/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
#[no_mangle]
pub extern "C" fn ChannelManager_abandon_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_id: crate::c_types::ThirtyTwoBytes) {
unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.abandon_payment(::lightning::ln::channelmanager::PaymentId(payment_id.data))
/// with the current [`ChannelConfig`].
/// * Removing peers which have disconnected but and no longer have any channels.
/// * Force-closing and removing channels which have not completed establishment in a timely manner.
+/// * Forgetting about stale outbound payments, either those that have already been fulfilled
+/// or those awaiting an invoice that hasn't been delivered in the necessary amount of time.
+/// The latter is determined using the system clock in `std` and the highest seen block time
+/// minus two hours in `no-std`.
///
/// Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate
/// estimate fetches.
local_ret
}
+/// Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and
+/// enqueuing it to be sent via an onion message. [`ChannelManager`] will pay the actual
+/// [`Bolt12Invoice`] once it is received.
+///
+/// Uses [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is recognized by
+/// the [`ChannelManager`] when handling a [`Bolt12Invoice`] message in response to the request.
+/// The optional parameters are used in the builder, if `Some`:
+/// - `quantity` for [`InvoiceRequest::quantity`] which must be set if
+/// [`Offer::expects_quantity`] is `true`.
+/// - `amount_msats` if overpaying what is required for the given `quantity` is desired, and
+/// - `payer_note` for [`InvoiceRequest::payer_note`].
+///
+/// If `max_total_routing_fee_msat` is not specified, The default from
+/// [`RouteParameters::from_payment_params_and_value`] is applied.
+///
+/// # Payment
+///
+/// The provided `payment_id` is used to ensure that only one invoice is paid for the request
+/// when received. See [Avoiding Duplicate Payments] for other requirements once the payment has
+/// been sent.
+///
+/// To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the
+/// invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the
+/// payment will fail with an [`Event::InvoiceRequestFailed`].
+///
+/// # Privacy
+///
+/// Uses a one-hop [`BlindedPath`] for the reply path with [`ChannelManager::get_our_node_id`]
+/// as the introduction node and a derived payer id for payer privacy. As such, currently, the
+/// node must be announced. Otherwise, there is no way to find a path to the introduction node
+/// in order to send the [`Bolt12Invoice`].
+///
+/// # Limitations
+///
+/// Requires a direct connection to an introduction node in [`Offer::paths`] or to
+/// [`Offer::signing_pubkey`], if empty. A similar restriction applies to the responding
+/// [`Bolt12Invoice::payment_paths`].
+///
+/// # Errors
+///
+/// Errors if a duplicate `payment_id` is provided given the caveats in the aforementioned link
+/// or if the provided parameters are invalid for the offer.
+///
+/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
+/// [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity
+/// [`InvoiceRequest::payer_note`]: crate::offers::invoice_request::InvoiceRequest::payer_note
+/// [`InvoiceRequestBuilder`]: crate::offers::invoice_request::InvoiceRequestBuilder
+/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
+/// [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths
+/// [Avoiding Duplicate Payments]: #avoiding-duplicate-payments
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_pay_for_offer(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, offer: &crate::lightning::offers::offer::Offer, mut quantity: crate::c_types::derived::COption_u64Z, mut amount_msats: crate::c_types::derived::COption_u64Z, mut payer_note: crate::c_types::derived::COption_StrZ, mut payment_id: crate::c_types::ThirtyTwoBytes, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, mut max_total_routing_fee_msat: crate::c_types::derived::COption_u64Z) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ {
+ let mut local_quantity = if quantity.is_some() { Some( { quantity.take() }) } else { None };
+ let mut local_amount_msats = if amount_msats.is_some() { Some( { amount_msats.take() }) } else { None };
+ let mut local_payer_note = { /*payer_note*/ let payer_note_opt = payer_note; if payer_note_opt.is_none() { None } else { Some({ { { payer_note_opt.take() }.into_string() }})} };
+ let mut local_max_total_routing_fee_msat = if max_total_routing_fee_msat.is_some() { Some( { max_total_routing_fee_msat.take() }) } else { None };
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_for_offer(offer.get_native_ref(), local_quantity, local_amount_msats, local_payer_note, ::lightning::ln::channelmanager::PaymentId(payment_id.data), retry_strategy.into_native(), local_max_total_routing_fee_msat);
+ 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::offers::parse::Bolt12SemanticError::native_into(e) }).into() };
+ local_ret
+}
+
+/// Creates a [`Bolt12Invoice`] for a [`Refund`] and enqueues it to be sent via an onion
+/// message.
+///
+/// The resulting invoice uses a [`PaymentHash`] recognized by the [`ChannelManager`] and a
+/// [`BlindedPath`] containing the [`PaymentSecret`] needed to reconstruct the corresponding
+/// [`PaymentPreimage`].
+///
+/// # Limitations
+///
+/// Requires a direct connection to an introduction node in [`Refund::paths`] or to
+/// [`Refund::payer_id`], if empty. This request is best effort; an invoice will be sent to each
+/// node meeting the aforementioned criteria, but there's no guarantee that they will be
+/// received and no retries will be made.
+///
+/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_request_refund_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, refund: &crate::lightning::offers::refund::Refund) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.request_refund_payment(refund.get_native_ref());
+ 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::offers::parse::Bolt12SemanticError::native_into(e) }).into() };
+ local_ret
+}
+
/// Gets a payment secret and payment hash for use in an invoice given to a third party wishing
/// to pay us.
///
impl From<nativeChannelManager> for crate::lightning::events::MessageSendEventsProvider {
fn from(obj: nativeChannelManager) -> Self {
- let mut rust_obj = ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ChannelManager_as_MessageSendEventsProvider(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ChannelManager_free_void);
ret
}
impl From<nativeChannelManager> for crate::lightning::events::EventsProvider {
fn from(obj: nativeChannelManager) -> Self {
- let mut rust_obj = ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ChannelManager_as_EventsProvider(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ChannelManager_free_void);
ret
}
impl From<nativeChannelManager> for crate::lightning::chain::Listen {
fn from(obj: nativeChannelManager) -> Self {
- let mut rust_obj = ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ChannelManager_as_Listen(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ChannelManager_free_void);
ret
}
impl From<nativeChannelManager> for crate::lightning::chain::Confirm {
fn from(obj: nativeChannelManager) -> Self {
- let mut rust_obj = ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ChannelManager_as_Confirm(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ChannelManager_free_void);
ret
}
crate::lightning::chain::BestBlock { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
-/// Fetches the set of [`NodeFeatures`] flags which are provided by or required by
+/// Fetches the set of [`NodeFeatures`] flags that are provided by or required by
/// [`ChannelManager`].
#[must_use]
#[no_mangle]
crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
-/// Fetches the set of [`ChannelFeatures`] flags which are provided by or required by
+/// Fetches the set of [`ChannelFeatures`] flags that are provided by or required by
/// [`ChannelManager`].
#[must_use]
#[no_mangle]
crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
-/// Fetches the set of [`ChannelTypeFeatures`] flags which are provided by or required by
+/// Fetches the set of [`ChannelTypeFeatures`] flags that are provided by or required by
/// [`ChannelManager`].
#[must_use]
#[no_mangle]
crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
-/// Fetches the set of [`InitFeatures`] flags which are provided by or required by
+/// Fetches the set of [`InitFeatures`] flags that are provided by or required by
/// [`ChannelManager`].
#[must_use]
#[no_mangle]
impl From<nativeChannelManager> for crate::lightning::ln::msgs::ChannelMessageHandler {
fn from(obj: nativeChannelManager) -> Self {
- let mut rust_obj = ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ChannelManager_as_ChannelMessageHandler(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ChannelManager_free_void);
ret
}
handle_error: ChannelManager_ChannelMessageHandler_handle_error,
provided_node_features: ChannelManager_ChannelMessageHandler_provided_node_features,
provided_init_features: ChannelManager_ChannelMessageHandler_provided_init_features,
- get_genesis_hashes: ChannelManager_ChannelMessageHandler_get_genesis_hashes,
+ get_chain_hashes: ChannelManager_ChannelMessageHandler_get_chain_hashes,
MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider {
this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
free: None,
crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
#[must_use]
-extern "C" fn ChannelManager_ChannelMessageHandler_get_genesis_hashes(this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ {
- let mut ret = <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::get_genesis_hashes(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, );
+extern "C" fn ChannelManager_ChannelMessageHandler_get_chain_hashes(this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ {
+ let mut ret = <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::get_chain_hashes(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, );
let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::None } else { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; local_ret_0.into() }) };
local_ret
}
-/// Fetches the set of [`InitFeatures`] flags which are provided by or required by
+impl From<nativeChannelManager> for crate::lightning::onion_message::offers::OffersMessageHandler {
+ fn from(obj: nativeChannelManager) -> Self {
+ let rust_obj = crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let mut ret = ChannelManager_as_OffersMessageHandler(&rust_obj);
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
+ ret.free = Some(ChannelManager_free_void);
+ ret
+ }
+}
+/// Constructs a new OffersMessageHandler which calls the relevant methods on this_arg.
+/// This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is
+#[no_mangle]
+pub extern "C" fn ChannelManager_as_OffersMessageHandler(this_arg: &ChannelManager) -> crate::lightning::onion_message::offers::OffersMessageHandler {
+ crate::lightning::onion_message::offers::OffersMessageHandler {
+ this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
+ free: None,
+ handle_message: ChannelManager_OffersMessageHandler_handle_message,
+ release_pending_messages: ChannelManager_OffersMessageHandler_release_pending_messages,
+ }
+}
+
+#[must_use]
+extern "C" fn ChannelManager_OffersMessageHandler_handle_message(this_arg: *const c_void, mut message: crate::lightning::onion_message::offers::OffersMessage) -> crate::c_types::derived::COption_OffersMessageZ {
+ let mut ret = <nativeChannelManager as lightning::onion_message::offers::OffersMessageHandler<>>::handle_message(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, message.into_native());
+ let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_OffersMessageZ::None } else { crate::c_types::derived::COption_OffersMessageZ::Some( { crate::lightning::onion_message::offers::OffersMessage::native_into(ret.unwrap()) }) };
+ local_ret
+}
+#[must_use]
+extern "C" fn ChannelManager_OffersMessageHandler_release_pending_messages(this_arg: *const c_void) -> crate::c_types::derived::CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
+ let mut ret = <nativeChannelManager as lightning::onion_message::offers::OffersMessageHandler<>>::release_pending_messages(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, );
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2) = item; let mut local_orig_ret_0_2 = crate::lightning::blinded_path::BlindedPath { inner: if orig_ret_0_2.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((orig_ret_0_2.unwrap())) } }, is_owned: true }; let mut local_ret_0 = (crate::lightning::onion_message::offers::OffersMessage::native_into(orig_ret_0_0), crate::lightning::onion_message::messenger::Destination::native_into(orig_ret_0_1), local_orig_ret_0_2).into(); local_ret_0 }); };
+ local_ret.into()
+}
+
+/// Fetches the set of [`InitFeatures`] flags that are provided by or required by
/// [`ChannelManager`].
#[no_mangle]
pub extern "C" fn provided_init_features(config: &crate::lightning::util::config::UserConfig) -> crate::lightning::ln::features::InitFeatures {
pub extern "C" fn CounterpartyForwardingInfo_write(obj: &crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn CounterpartyForwardingInfo_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeCounterpartyForwardingInfo) })
}
pub extern "C" fn ChannelCounterparty_write(obj: &crate::lightning::ln::channelmanager::ChannelCounterparty) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelCounterparty_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelCounterparty) })
}
pub extern "C" fn ChannelDetails_write(obj: &crate::lightning::ln::channelmanager::ChannelDetails) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelDetails_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelDetails) })
}
pub extern "C" fn PhantomRouteHints_write(obj: &crate::lightning::ln::channelmanager::PhantomRouteHints) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn PhantomRouteHints_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePhantomRouteHints) })
}
pub extern "C" fn ChannelManager_write(obj: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelManager_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelManager) })
}
pub extern "C" fn ChannelShutdownState_write(obj: &crate::lightning::ln::channelmanager::ChannelShutdownState) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn ChannelShutdownState_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ ChannelShutdownState_write(unsafe { &*(obj as *const ChannelShutdownState) })
+}
#[no_mangle]
/// Read a ChannelShutdownState from a byte array, created by ChannelShutdownState_write
pub extern "C" fn ChannelShutdownState_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelShutdownStateDecodeErrorZ {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn InitFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInitFeatures)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInitFeatures)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the InitFeatures
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn NodeFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeFeatures)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeNodeFeatures)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the NodeFeatures
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelFeatures)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelFeatures)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelFeatures
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Bolt11InvoiceFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBolt11InvoiceFeatures)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt11InvoiceFeatures)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Bolt11InvoiceFeatures
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn OfferFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOfferFeatures)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOfferFeatures)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the OfferFeatures
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn InvoiceRequestFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInvoiceRequestFeatures)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInvoiceRequestFeatures)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the InvoiceRequestFeatures
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Bolt12InvoiceFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBolt12InvoiceFeatures)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt12InvoiceFeatures)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Bolt12InvoiceFeatures
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn BlindedHopFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBlindedHopFeatures)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedHopFeatures)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the BlindedHopFeatures
#[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
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelTypeFeatures)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelTypeFeatures
pub extern "C" fn InitFeatures_write(obj: &crate::lightning::ln::features::InitFeatures) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn InitFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInitFeatures) })
}
pub extern "C" fn ChannelFeatures_write(obj: &crate::lightning::ln::features::ChannelFeatures) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelFeatures) })
}
pub extern "C" fn NodeFeatures_write(obj: &crate::lightning::ln::features::NodeFeatures) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
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) })
}
pub extern "C" fn Bolt11InvoiceFeatures_write(obj: &crate::lightning::ln::features::Bolt11InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn Bolt11InvoiceFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBolt11InvoiceFeatures) })
}
pub extern "C" fn Bolt12InvoiceFeatures_write(obj: &crate::lightning::ln::features::Bolt12InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn Bolt12InvoiceFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBolt12InvoiceFeatures) })
}
pub extern "C" fn BlindedHopFeatures_write(obj: &crate::lightning::ln::features::BlindedHopFeatures) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn BlindedHopFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBlindedHopFeatures) })
}
pub extern "C" fn ChannelTypeFeatures_write(obj: &crate::lightning::ln::features::ChannelTypeFeatures) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
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) })
}
pub extern "C" fn DecodeError_clone(orig: &DecodeError) -> DecodeError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn DecodeError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const DecodeError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn DecodeError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut DecodeError) };
+}
#[no_mangle]
/// Utility method to constructs a new UnknownVersion-variant DecodeError
pub extern "C" fn DecodeError_unknown_version() -> DecodeError {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Init_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInit)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInit)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Init
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ErrorMessage_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeErrorMessage)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeErrorMessage)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ErrorMessage
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn WarningMessage_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeWarningMessage)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeWarningMessage)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the WarningMessage
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Ping_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePing)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePing)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Ping
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Pong_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePong)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePong)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Pong
#[no_mangle]
pub extern "C" fn OpenChannel_get_chain_hash(this_ptr: &OpenChannel) -> *const [u8; 32] {
let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash;
- inner_val.as_inner()
+ inner_val.as_bytes()
}
/// The genesis hash of the blockchain where the channel is to be opened
#[no_mangle]
pub extern "C" fn OpenChannel_set_chain_hash(this_ptr: &mut OpenChannel, mut val: crate::c_types::ThirtyTwoBytes) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::blockdata::constants::ChainHash::from(&val.data[..]);
}
/// A temporary channel ID, until the funding outpoint is announced
#[no_mangle]
let mut local_shutdown_scriptpubkey_arg = { /*shutdown_scriptpubkey_arg*/ let shutdown_scriptpubkey_arg_opt = shutdown_scriptpubkey_arg; if shutdown_scriptpubkey_arg_opt.is_none() { None } else { Some({ { ::bitcoin::blockdata::script::Script::from({ shutdown_scriptpubkey_arg_opt.take() }.into_rust()) }})} };
let mut local_channel_type_arg = if channel_type_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_type_arg.take_inner()) } }) };
OpenChannel { inner: ObjOps::heap_alloc(nativeOpenChannel {
- chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
+ chain_hash: ::bitcoin::blockdata::constants::ChainHash::from(&chain_hash_arg.data[..]),
temporary_channel_id: ::lightning::ln::ChannelId(temporary_channel_id_arg.data),
funding_satoshis: funding_satoshis_arg,
push_msat: push_msat_arg,
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn OpenChannel_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOpenChannel)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOpenChannel)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the OpenChannel
#[no_mangle]
pub extern "C" fn OpenChannelV2_get_chain_hash(this_ptr: &OpenChannelV2) -> *const [u8; 32] {
let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash;
- inner_val.as_inner()
+ inner_val.as_bytes()
}
/// The genesis hash of the blockchain where the channel is to be opened
#[no_mangle]
pub extern "C" fn OpenChannelV2_set_chain_hash(this_ptr: &mut OpenChannelV2, mut val: crate::c_types::ThirtyTwoBytes) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::blockdata::constants::ChainHash::from(&val.data[..]);
}
/// A temporary channel ID derived using a zeroed out value for the channel acceptor's revocation basepoint
#[no_mangle]
let mut local_channel_type_arg = if channel_type_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_type_arg.take_inner()) } }) };
let mut local_require_confirmed_inputs_arg = if require_confirmed_inputs_arg.is_some() { Some( { () /*require_confirmed_inputs_arg.take()*/ }) } else { None };
OpenChannelV2 { inner: ObjOps::heap_alloc(nativeOpenChannelV2 {
- chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
+ chain_hash: ::bitcoin::blockdata::constants::ChainHash::from(&chain_hash_arg.data[..]),
temporary_channel_id: ::lightning::ln::ChannelId(temporary_channel_id_arg.data),
funding_feerate_sat_per_1000_weight: funding_feerate_sat_per_1000_weight_arg,
commitment_feerate_sat_per_1000_weight: commitment_feerate_sat_per_1000_weight_arg,
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn OpenChannelV2_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOpenChannelV2)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOpenChannelV2)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the OpenChannelV2
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn AcceptChannel_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAcceptChannel)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeAcceptChannel)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the AcceptChannel
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn AcceptChannelV2_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAcceptChannelV2)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeAcceptChannelV2)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the AcceptChannelV2
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn FundingCreated_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingCreated)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeFundingCreated)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the FundingCreated
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn FundingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingSigned)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeFundingSigned)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the FundingSigned
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelReady_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelReady)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelReady)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelReady
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn TxAddInput_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeTxAddInput)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxAddInput)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the TxAddInput
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn TxAddOutput_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeTxAddOutput)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxAddOutput)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the TxAddOutput
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn TxRemoveInput_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeTxRemoveInput)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxRemoveInput)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the TxRemoveInput
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn TxRemoveOutput_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeTxRemoveOutput)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxRemoveOutput)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the TxRemoveOutput
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn TxComplete_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeTxComplete)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxComplete)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the TxComplete
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn TxSignatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeTxSignatures)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxSignatures)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the TxSignatures
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn TxInitRbf_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeTxInitRbf)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxInitRbf)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the TxInitRbf
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn TxAckRbf_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeTxAckRbf)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxAckRbf)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the TxAckRbf
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn TxAbort_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeTxAbort)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxAbort)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the TxAbort
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Shutdown_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeShutdown)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeShutdown)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Shutdown
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ClosingSignedFeeRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeClosingSignedFeeRange)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeClosingSignedFeeRange)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ClosingSignedFeeRange
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ClosingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeClosingSigned)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeClosingSigned)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ClosingSigned
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn UpdateAddHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateAddHTLC)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUpdateAddHTLC)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the UpdateAddHTLC
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn OnionMessage_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOnionMessage)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOnionMessage)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the OnionMessage
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn UpdateFulfillHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFulfillHTLC)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUpdateFulfillHTLC)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the UpdateFulfillHTLC
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn UpdateFailHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFailHTLC)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUpdateFailHTLC)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the UpdateFailHTLC
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn UpdateFailMalformedHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFailMalformedHTLC)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUpdateFailMalformedHTLC)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the UpdateFailMalformedHTLC
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn CommitmentSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCommitmentSigned)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCommitmentSigned)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the CommitmentSigned
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn RevokeAndACK_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRevokeAndACK)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRevokeAndACK)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the RevokeAndACK
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn UpdateFee_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFee)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUpdateFee)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the UpdateFee
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelReestablish_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelReestablish)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelReestablish)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelReestablish
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn AnnouncementSignatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAnnouncementSignatures)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeAnnouncementSignatures)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the AnnouncementSignatures
pub extern "C" fn SocketAddress_clone(orig: &SocketAddress) -> SocketAddress {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SocketAddress_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const SocketAddress)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SocketAddress_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut SocketAddress) };
+}
#[no_mangle]
/// Utility method to constructs a new TcpIpV4-variant SocketAddress
pub extern "C" fn SocketAddress_tcp_ip_v4(addr: crate::c_types::FourBytes, port: u16) -> SocketAddress {
pub extern "C" fn SocketAddress_write(obj: &crate::lightning::ln::msgs::SocketAddress) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn SocketAddress_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ SocketAddress_write(unsafe { &*(obj as *const SocketAddress) })
+}
#[no_mangle]
/// Read a SocketAddress from a byte array, created by SocketAddress_write
pub extern "C" fn SocketAddress_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_SocketAddressDecodeErrorZ {
pub extern "C" fn SocketAddressParseError_clone(orig: &SocketAddressParseError) -> SocketAddressParseError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SocketAddressParseError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const SocketAddressParseError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SocketAddressParseError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut SocketAddressParseError) };
+}
#[no_mangle]
/// Utility method to constructs a new SocketAddrParse-variant SocketAddressParseError
pub extern "C" fn SocketAddressParseError_socket_addr_parse() -> SocketAddressParseError {
local_ret
}
+#[no_mangle]
+/// Get the string representation of a SocketAddress object
+pub extern "C" fn SocketAddress_to_str(o: &crate::lightning::ln::msgs::SocketAddress) -> Str {
+ alloc::format!("{}", &o.to_native()).into()
+}
#[no_mangle]
/// Read a SocketAddress object from a string
pub extern "C" fn SocketAddress_from_str(s: crate::c_types::Str) -> crate::c_types::derived::CResult_SocketAddressSocketAddressParseErrorZ {
pub extern "C" fn UnsignedGossipMessage_clone(orig: &UnsignedGossipMessage) -> UnsignedGossipMessage {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn UnsignedGossipMessage_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const UnsignedGossipMessage)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn UnsignedGossipMessage_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut UnsignedGossipMessage) };
+}
#[no_mangle]
/// Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage
pub extern "C" fn UnsignedGossipMessage_channel_announcement(a: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> UnsignedGossipMessage {
pub extern "C" fn UnsignedGossipMessage_write(obj: &crate::lightning::ln::msgs::UnsignedGossipMessage) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn UnsignedGossipMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ UnsignedGossipMessage_write(unsafe { &*(obj as *const UnsignedGossipMessage) })
+}
use lightning::ln::msgs::UnsignedNodeAnnouncement as nativeUnsignedNodeAnnouncementImport;
pub(crate) type nativeUnsignedNodeAnnouncement = nativeUnsignedNodeAnnouncementImport;
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn UnsignedNodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedNodeAnnouncement)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUnsignedNodeAnnouncement)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the UnsignedNodeAnnouncement
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn NodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeAnnouncement)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeNodeAnnouncement)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the NodeAnnouncement
#[no_mangle]
pub extern "C" fn UnsignedChannelAnnouncement_get_chain_hash(this_ptr: &UnsignedChannelAnnouncement) -> *const [u8; 32] {
let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash;
- inner_val.as_inner()
+ inner_val.as_bytes()
}
/// The genesis hash of the blockchain where the channel is to be opened
#[no_mangle]
pub extern "C" fn UnsignedChannelAnnouncement_set_chain_hash(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::ThirtyTwoBytes) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::blockdata::constants::ChainHash::from(&val.data[..]);
}
/// The short channel ID
#[no_mangle]
let mut local_excess_data_arg = Vec::new(); for mut item in excess_data_arg.into_rust().drain(..) { local_excess_data_arg.push( { item }); };
UnsignedChannelAnnouncement { inner: ObjOps::heap_alloc(nativeUnsignedChannelAnnouncement {
features: *unsafe { Box::from_raw(features_arg.take_inner()) },
- chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
+ chain_hash: ::bitcoin::blockdata::constants::ChainHash::from(&chain_hash_arg.data[..]),
short_channel_id: short_channel_id_arg,
node_id_1: *unsafe { Box::from_raw(node_id_1_arg.take_inner()) },
node_id_2: *unsafe { Box::from_raw(node_id_2_arg.take_inner()) },
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn UnsignedChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedChannelAnnouncement)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUnsignedChannelAnnouncement)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the UnsignedChannelAnnouncement
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelAnnouncement)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelAnnouncement)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelAnnouncement
#[no_mangle]
pub extern "C" fn UnsignedChannelUpdate_get_chain_hash(this_ptr: &UnsignedChannelUpdate) -> *const [u8; 32] {
let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash;
- inner_val.as_inner()
+ inner_val.as_bytes()
}
/// The genesis hash of the blockchain where the channel is to be opened
#[no_mangle]
pub extern "C" fn UnsignedChannelUpdate_set_chain_hash(this_ptr: &mut UnsignedChannelUpdate, mut val: crate::c_types::ThirtyTwoBytes) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::blockdata::constants::ChainHash::from(&val.data[..]);
}
/// The short channel ID
#[no_mangle]
pub extern "C" fn UnsignedChannelUpdate_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut short_channel_id_arg: u64, mut timestamp_arg: u32, mut flags_arg: u8, mut cltv_expiry_delta_arg: u16, mut htlc_minimum_msat_arg: u64, mut htlc_maximum_msat_arg: u64, mut fee_base_msat_arg: u32, mut fee_proportional_millionths_arg: u32, mut excess_data_arg: crate::c_types::derived::CVec_u8Z) -> UnsignedChannelUpdate {
let mut local_excess_data_arg = Vec::new(); for mut item in excess_data_arg.into_rust().drain(..) { local_excess_data_arg.push( { item }); };
UnsignedChannelUpdate { inner: ObjOps::heap_alloc(nativeUnsignedChannelUpdate {
- chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
+ chain_hash: ::bitcoin::blockdata::constants::ChainHash::from(&chain_hash_arg.data[..]),
short_channel_id: short_channel_id_arg,
timestamp: timestamp_arg,
flags: flags_arg,
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn UnsignedChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedChannelUpdate)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUnsignedChannelUpdate)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the UnsignedChannelUpdate
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelUpdate)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelUpdate)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelUpdate
#[no_mangle]
pub extern "C" fn QueryChannelRange_get_chain_hash(this_ptr: &QueryChannelRange) -> *const [u8; 32] {
let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash;
- inner_val.as_inner()
+ inner_val.as_bytes()
}
/// The genesis hash of the blockchain being queried
#[no_mangle]
pub extern "C" fn QueryChannelRange_set_chain_hash(this_ptr: &mut QueryChannelRange, mut val: crate::c_types::ThirtyTwoBytes) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::blockdata::constants::ChainHash::from(&val.data[..]);
}
/// The height of the first block for the channel UTXOs being queried
#[no_mangle]
#[no_mangle]
pub extern "C" fn QueryChannelRange_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut first_blocknum_arg: u32, mut number_of_blocks_arg: u32) -> QueryChannelRange {
QueryChannelRange { inner: ObjOps::heap_alloc(nativeQueryChannelRange {
- chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
+ chain_hash: ::bitcoin::blockdata::constants::ChainHash::from(&chain_hash_arg.data[..]),
first_blocknum: first_blocknum_arg,
number_of_blocks: number_of_blocks_arg,
}), 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 QueryChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQueryChannelRange)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeQueryChannelRange)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the QueryChannelRange
#[no_mangle]
pub extern "C" fn ReplyChannelRange_get_chain_hash(this_ptr: &ReplyChannelRange) -> *const [u8; 32] {
let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash;
- inner_val.as_inner()
+ inner_val.as_bytes()
}
/// The genesis hash of the blockchain being queried
#[no_mangle]
pub extern "C" fn ReplyChannelRange_set_chain_hash(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::ThirtyTwoBytes) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::blockdata::constants::ChainHash::from(&val.data[..]);
}
/// The height of the first block in the range of the reply
#[no_mangle]
pub extern "C" fn ReplyChannelRange_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut first_blocknum_arg: u32, mut number_of_blocks_arg: u32, mut sync_complete_arg: bool, mut short_channel_ids_arg: crate::c_types::derived::CVec_u64Z) -> ReplyChannelRange {
let mut local_short_channel_ids_arg = Vec::new(); for mut item in short_channel_ids_arg.into_rust().drain(..) { local_short_channel_ids_arg.push( { item }); };
ReplyChannelRange { inner: ObjOps::heap_alloc(nativeReplyChannelRange {
- chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
+ chain_hash: ::bitcoin::blockdata::constants::ChainHash::from(&chain_hash_arg.data[..]),
first_blocknum: first_blocknum_arg,
number_of_blocks: number_of_blocks_arg,
sync_complete: sync_complete_arg,
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ReplyChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReplyChannelRange)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeReplyChannelRange)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ReplyChannelRange
#[no_mangle]
pub extern "C" fn QueryShortChannelIds_get_chain_hash(this_ptr: &QueryShortChannelIds) -> *const [u8; 32] {
let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash;
- inner_val.as_inner()
+ inner_val.as_bytes()
}
/// The genesis hash of the blockchain being queried
#[no_mangle]
pub extern "C" fn QueryShortChannelIds_set_chain_hash(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::ThirtyTwoBytes) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::blockdata::constants::ChainHash::from(&val.data[..]);
}
/// The short_channel_ids that are being queried
///
pub extern "C" fn QueryShortChannelIds_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut short_channel_ids_arg: crate::c_types::derived::CVec_u64Z) -> QueryShortChannelIds {
let mut local_short_channel_ids_arg = Vec::new(); for mut item in short_channel_ids_arg.into_rust().drain(..) { local_short_channel_ids_arg.push( { item }); };
QueryShortChannelIds { inner: ObjOps::heap_alloc(nativeQueryShortChannelIds {
- chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
+ chain_hash: ::bitcoin::blockdata::constants::ChainHash::from(&chain_hash_arg.data[..]),
short_channel_ids: local_short_channel_ids_arg,
}), 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 QueryShortChannelIds_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQueryShortChannelIds)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeQueryShortChannelIds)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the QueryShortChannelIds
#[no_mangle]
pub extern "C" fn ReplyShortChannelIdsEnd_get_chain_hash(this_ptr: &ReplyShortChannelIdsEnd) -> *const [u8; 32] {
let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash;
- inner_val.as_inner()
+ inner_val.as_bytes()
}
/// The genesis hash of the blockchain that was queried
#[no_mangle]
pub extern "C" fn ReplyShortChannelIdsEnd_set_chain_hash(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: crate::c_types::ThirtyTwoBytes) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::blockdata::constants::ChainHash::from(&val.data[..]);
}
/// Indicates if the query recipient maintains up-to-date channel
/// information for the `chain_hash`
#[no_mangle]
pub extern "C" fn ReplyShortChannelIdsEnd_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut full_information_arg: bool) -> ReplyShortChannelIdsEnd {
ReplyShortChannelIdsEnd { inner: ObjOps::heap_alloc(nativeReplyShortChannelIdsEnd {
- chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
+ chain_hash: ::bitcoin::blockdata::constants::ChainHash::from(&chain_hash_arg.data[..]),
full_information: full_information_arg,
}), 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 ReplyShortChannelIdsEnd_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReplyShortChannelIdsEnd)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeReplyShortChannelIdsEnd)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ReplyShortChannelIdsEnd
#[no_mangle]
pub extern "C" fn GossipTimestampFilter_get_chain_hash(this_ptr: &GossipTimestampFilter) -> *const [u8; 32] {
let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash;
- inner_val.as_inner()
+ inner_val.as_bytes()
}
/// The genesis hash of the blockchain for channel and node information
#[no_mangle]
pub extern "C" fn GossipTimestampFilter_set_chain_hash(this_ptr: &mut GossipTimestampFilter, mut val: crate::c_types::ThirtyTwoBytes) {
- unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::blockdata::constants::ChainHash::from(&val.data[..]);
}
/// The starting unix timestamp
#[no_mangle]
#[no_mangle]
pub extern "C" fn GossipTimestampFilter_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut first_timestamp_arg: u32, mut timestamp_range_arg: u32) -> GossipTimestampFilter {
GossipTimestampFilter { inner: ObjOps::heap_alloc(nativeGossipTimestampFilter {
- chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
+ chain_hash: ::bitcoin::blockdata::constants::ChainHash::from(&chain_hash_arg.data[..]),
first_timestamp: first_timestamp_arg,
timestamp_range: timestamp_range_arg,
}), 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 GossipTimestampFilter_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeGossipTimestampFilter)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeGossipTimestampFilter)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the GossipTimestampFilter
pub extern "C" fn ErrorAction_clone(orig: &ErrorAction) -> ErrorAction {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ErrorAction_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ErrorAction)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ErrorAction_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut ErrorAction) };
+}
#[no_mangle]
/// Utility method to constructs a new DisconnectPeer-variant ErrorAction
pub extern "C" fn ErrorAction_disconnect_peer(msg: crate::lightning::ln::msgs::ErrorMessage) -> ErrorAction {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn LightningError_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeLightningError)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLightningError)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the LightningError
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn CommitmentUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCommitmentUpdate)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCommitmentUpdate)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the CommitmentUpdate
///
/// Note that this method is called before [`Self::peer_connected`].
pub provided_init_features: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey) -> crate::lightning::ln::features::InitFeatures,
- /// Gets the genesis hashes for this `ChannelMessageHandler` indicating which chains it supports.
+ /// Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports.
///
/// If it's `None`, then no particular network chain hash compatibility will be enforced when
/// connecting to peers.
- pub get_genesis_hashes: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ,
+ pub get_chain_hashes: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ,
/// Implementation of MessageSendEventsProvider for this object.
pub MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider,
/// Frees any resources associated with this object given its this_arg pointer.
}
unsafe impl Send for ChannelMessageHandler {}
unsafe impl Sync for ChannelMessageHandler {}
+#[allow(unused)]
pub(crate) fn ChannelMessageHandler_clone_fields(orig: &ChannelMessageHandler) -> ChannelMessageHandler {
ChannelMessageHandler {
this_arg: orig.this_arg,
handle_error: Clone::clone(&orig.handle_error),
provided_node_features: Clone::clone(&orig.provided_node_features),
provided_init_features: Clone::clone(&orig.provided_init_features),
- get_genesis_hashes: Clone::clone(&orig.get_genesis_hashes),
+ get_chain_hashes: Clone::clone(&orig.get_chain_hashes),
MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider_clone_fields(&orig.MessageSendEventsProvider),
free: Clone::clone(&orig.free),
}
let mut ret = (self.provided_init_features)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id));
*unsafe { Box::from_raw(ret.take_inner()) }
}
- fn get_genesis_hashes(&self) -> Option<Vec<bitcoin::blockdata::constants::ChainHash>> {
- let mut ret = (self.get_genesis_hashes)(self.this_arg);
+ fn get_chain_hashes(&self) -> Option<Vec<bitcoin::blockdata::constants::ChainHash>> {
+ let mut ret = (self.get_chain_hashes)(self.this_arg);
let mut local_ret = { /*ret*/ let ret_opt = ret; if ret_opt.is_none() { None } else { Some({ { let mut local_ret_0 = Vec::new(); for mut item in { ret_opt.take() }.into_rust().drain(..) { local_ret_0.push( { ::bitcoin::blockdata::constants::ChainHash::from(&item.data[..]) }); }; local_ret_0 }})} };
local_ret
}
}
unsafe impl Send for RoutingMessageHandler {}
unsafe impl Sync for RoutingMessageHandler {}
+#[allow(unused)]
pub(crate) fn RoutingMessageHandler_clone_fields(orig: &RoutingMessageHandler) -> RoutingMessageHandler {
RoutingMessageHandler {
this_arg: orig.this_arg,
}
}
}
-/// A trait to describe an object that can receive onion messages.
+/// A handler for received [`OnionMessage`]s and for providing generated ones to send.
#[repr(C)]
pub struct OnionMessageHandler {
/// An opaque pointer which is passed to your function implementations as an argument.
pub this_arg: *mut c_void,
/// Handle an incoming `onion_message` message from the given peer.
pub handle_onion_message: extern "C" fn (this_arg: *const c_void, peer_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::OnionMessage),
+ /// Returns the next pending onion message for the peer with the given node id.
+ ///
+ /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ pub next_onion_message_for_peer: extern "C" fn (this_arg: *const c_void, peer_node_id: crate::c_types::PublicKey) -> crate::lightning::ln::msgs::OnionMessage,
/// Called when a connection is established with a peer. Can be used to track which peers
/// advertise onion message support and are online.
///
///
/// Note that this method is called before [`Self::peer_connected`].
pub provided_init_features: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey) -> crate::lightning::ln::features::InitFeatures,
- /// Implementation of OnionMessageProvider for this object.
- pub OnionMessageProvider: crate::lightning::events::OnionMessageProvider,
/// 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 OnionMessageHandler {}
unsafe impl Sync for OnionMessageHandler {}
+#[allow(unused)]
pub(crate) fn OnionMessageHandler_clone_fields(orig: &OnionMessageHandler) -> OnionMessageHandler {
OnionMessageHandler {
this_arg: orig.this_arg,
handle_onion_message: Clone::clone(&orig.handle_onion_message),
+ next_onion_message_for_peer: Clone::clone(&orig.next_onion_message_for_peer),
peer_connected: Clone::clone(&orig.peer_connected),
peer_disconnected: Clone::clone(&orig.peer_disconnected),
provided_node_features: Clone::clone(&orig.provided_node_features),
provided_init_features: Clone::clone(&orig.provided_init_features),
- OnionMessageProvider: crate::lightning::events::OnionMessageProvider_clone_fields(&orig.OnionMessageProvider),
free: Clone::clone(&orig.free),
}
}
-impl lightning::events::OnionMessageProvider for OnionMessageHandler {
- fn next_onion_message_for_peer(&self, mut peer_node_id: bitcoin::secp256k1::PublicKey) -> Option<lightning::ln::msgs::OnionMessage> {
- let mut ret = (self.OnionMessageProvider.next_onion_message_for_peer)(self.OnionMessageProvider.this_arg, crate::c_types::PublicKey::from_rust(&peer_node_id));
- let mut local_ret = if ret.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(ret.take_inner()) } }) };
- local_ret
- }
-}
use lightning::ln::msgs::OnionMessageHandler as rustOnionMessageHandler;
impl rustOnionMessageHandler for OnionMessageHandler {
fn handle_onion_message(&self, mut peer_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::OnionMessage) {
(self.handle_onion_message)(self.this_arg, crate::c_types::PublicKey::from_rust(&peer_node_id), &crate::lightning::ln::msgs::OnionMessage { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::OnionMessage<>) as *mut _) }, is_owned: false })
}
+ fn next_onion_message_for_peer(&self, mut peer_node_id: bitcoin::secp256k1::PublicKey) -> Option<lightning::ln::msgs::OnionMessage> {
+ let mut ret = (self.next_onion_message_for_peer)(self.this_arg, crate::c_types::PublicKey::from_rust(&peer_node_id));
+ let mut local_ret = if ret.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(ret.take_inner()) } }) };
+ local_ret
+ }
fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> {
let mut ret = (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((init as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound);
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)) })*/ })};
pub extern "C" fn AcceptChannel_write(obj: &crate::lightning::ln::msgs::AcceptChannel) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn AcceptChannel_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeAcceptChannel) })
}
pub extern "C" fn AcceptChannelV2_write(obj: &crate::lightning::ln::msgs::AcceptChannelV2) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn AcceptChannelV2_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeAcceptChannelV2) })
}
pub extern "C" fn TxAddInput_write(obj: &crate::lightning::ln::msgs::TxAddInput) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn TxAddInput_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeTxAddInput) })
}
pub extern "C" fn TxAddOutput_write(obj: &crate::lightning::ln::msgs::TxAddOutput) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn TxAddOutput_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeTxAddOutput) })
}
pub extern "C" fn TxRemoveInput_write(obj: &crate::lightning::ln::msgs::TxRemoveInput) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn TxRemoveInput_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeTxRemoveInput) })
}
pub extern "C" fn TxRemoveOutput_write(obj: &crate::lightning::ln::msgs::TxRemoveOutput) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn TxRemoveOutput_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeTxRemoveOutput) })
}
pub extern "C" fn TxComplete_write(obj: &crate::lightning::ln::msgs::TxComplete) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn TxComplete_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeTxComplete) })
}
pub extern "C" fn TxSignatures_write(obj: &crate::lightning::ln::msgs::TxSignatures) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn TxSignatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeTxSignatures) })
}
pub extern "C" fn TxInitRbf_write(obj: &crate::lightning::ln::msgs::TxInitRbf) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn TxInitRbf_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeTxInitRbf) })
}
pub extern "C" fn TxAckRbf_write(obj: &crate::lightning::ln::msgs::TxAckRbf) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn TxAckRbf_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeTxAckRbf) })
}
pub extern "C" fn TxAbort_write(obj: &crate::lightning::ln::msgs::TxAbort) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn TxAbort_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeTxAbort) })
}
pub extern "C" fn AnnouncementSignatures_write(obj: &crate::lightning::ln::msgs::AnnouncementSignatures) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn AnnouncementSignatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeAnnouncementSignatures) })
}
pub extern "C" fn ChannelReestablish_write(obj: &crate::lightning::ln::msgs::ChannelReestablish) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelReestablish_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelReestablish) })
}
pub extern "C" fn ClosingSigned_write(obj: &crate::lightning::ln::msgs::ClosingSigned) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ClosingSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeClosingSigned) })
}
pub extern "C" fn ClosingSignedFeeRange_write(obj: &crate::lightning::ln::msgs::ClosingSignedFeeRange) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ClosingSignedFeeRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeClosingSignedFeeRange) })
}
pub extern "C" fn CommitmentSigned_write(obj: &crate::lightning::ln::msgs::CommitmentSigned) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn CommitmentSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeCommitmentSigned) })
}
pub extern "C" fn FundingCreated_write(obj: &crate::lightning::ln::msgs::FundingCreated) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn FundingCreated_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingCreated) })
}
pub extern "C" fn FundingSigned_write(obj: &crate::lightning::ln::msgs::FundingSigned) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn FundingSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingSigned) })
}
pub extern "C" fn ChannelReady_write(obj: &crate::lightning::ln::msgs::ChannelReady) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelReady_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelReady) })
}
pub extern "C" fn Init_write(obj: &crate::lightning::ln::msgs::Init) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn Init_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInit) })
}
pub extern "C" fn OpenChannel_write(obj: &crate::lightning::ln::msgs::OpenChannel) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn OpenChannel_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeOpenChannel) })
}
pub extern "C" fn OpenChannelV2_write(obj: &crate::lightning::ln::msgs::OpenChannelV2) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn OpenChannelV2_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeOpenChannelV2) })
}
pub extern "C" fn RevokeAndACK_write(obj: &crate::lightning::ln::msgs::RevokeAndACK) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn RevokeAndACK_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRevokeAndACK) })
}
pub extern "C" fn Shutdown_write(obj: &crate::lightning::ln::msgs::Shutdown) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn Shutdown_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeShutdown) })
}
pub extern "C" fn UpdateFailHTLC_write(obj: &crate::lightning::ln::msgs::UpdateFailHTLC) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn UpdateFailHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFailHTLC) })
}
pub extern "C" fn UpdateFailMalformedHTLC_write(obj: &crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn UpdateFailMalformedHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFailMalformedHTLC) })
}
pub extern "C" fn UpdateFee_write(obj: &crate::lightning::ln::msgs::UpdateFee) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn UpdateFee_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFee) })
}
pub extern "C" fn UpdateFulfillHTLC_write(obj: &crate::lightning::ln::msgs::UpdateFulfillHTLC) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn UpdateFulfillHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFulfillHTLC) })
}
pub extern "C" fn UpdateAddHTLC_write(obj: &crate::lightning::ln::msgs::UpdateAddHTLC) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn UpdateAddHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateAddHTLC) })
}
pub extern "C" fn OnionMessage_write(obj: &crate::lightning::ln::msgs::OnionMessage) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn OnionMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeOnionMessage) })
}
pub extern "C" fn Ping_write(obj: &crate::lightning::ln::msgs::Ping) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn Ping_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePing) })
}
pub extern "C" fn Pong_write(obj: &crate::lightning::ln::msgs::Pong) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn Pong_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePong) })
}
pub extern "C" fn UnsignedChannelAnnouncement_write(obj: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn UnsignedChannelAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedChannelAnnouncement) })
}
pub extern "C" fn ChannelAnnouncement_write(obj: &crate::lightning::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelAnnouncement) })
}
pub extern "C" fn UnsignedChannelUpdate_write(obj: &crate::lightning::ln::msgs::UnsignedChannelUpdate) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn UnsignedChannelUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedChannelUpdate) })
}
pub extern "C" fn ChannelUpdate_write(obj: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelUpdate) })
}
pub extern "C" fn ErrorMessage_write(obj: &crate::lightning::ln::msgs::ErrorMessage) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ErrorMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeErrorMessage) })
}
pub extern "C" fn WarningMessage_write(obj: &crate::lightning::ln::msgs::WarningMessage) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn WarningMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeWarningMessage) })
}
pub extern "C" fn UnsignedNodeAnnouncement_write(obj: &crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn UnsignedNodeAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedNodeAnnouncement) })
}
pub extern "C" fn NodeAnnouncement_write(obj: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn NodeAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeAnnouncement) })
}
pub extern "C" fn QueryShortChannelIds_write(obj: &crate::lightning::ln::msgs::QueryShortChannelIds) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn QueryShortChannelIds_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeQueryShortChannelIds) })
}
pub extern "C" fn ReplyShortChannelIdsEnd_write(obj: &crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ReplyShortChannelIdsEnd_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReplyShortChannelIdsEnd) })
}
pub extern "C" fn QueryChannelRange_write(obj: &crate::lightning::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn QueryChannelRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeQueryChannelRange) })
}
pub extern "C" fn ReplyChannelRange_write(obj: &crate::lightning::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ReplyChannelRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReplyChannelRange) })
}
pub extern "C" fn GossipTimestampFilter_write(obj: &crate::lightning::ln::msgs::GossipTimestampFilter) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn GossipTimestampFilter_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeGossipTimestampFilter) })
}
pub extern "C" fn Retry_clone(orig: &Retry) -> Retry {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Retry_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Retry)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Retry_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut Retry) };
+}
#[no_mangle]
/// Utility method to constructs a new Attempts-variant Retry
pub extern "C" fn Retry_attempts(a: u32) -> Retry {
pub extern "C" fn Retry_write(obj: &crate::lightning::ln::outbound_payment::Retry) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn Retry_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ Retry_write(unsafe { &*(obj as *const Retry) })
+}
#[no_mangle]
/// Read a Retry from a byte array, created by Retry_write
pub extern "C" fn Retry_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RetryDecodeErrorZ {
pub extern "C" fn RetryableSendFailure_clone(orig: &RetryableSendFailure) -> RetryableSendFailure {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn RetryableSendFailure_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const RetryableSendFailure)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn RetryableSendFailure_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut RetryableSendFailure) };
+}
#[no_mangle]
/// Utility method to constructs a new PaymentExpired-variant RetryableSendFailure
pub extern "C" fn RetryableSendFailure_payment_expired() -> RetryableSendFailure {
pub extern "C" fn PaymentSendFailure_clone(orig: &PaymentSendFailure) -> PaymentSendFailure {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn PaymentSendFailure_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const PaymentSendFailure)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn PaymentSendFailure_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut PaymentSendFailure) };
+}
#[no_mangle]
/// Utility method to constructs a new ParameterError-variant PaymentSendFailure
pub extern "C" fn PaymentSendFailure_parameter_error(a: crate::lightning::util::errors::APIError) -> PaymentSendFailure {
pub extern "C" fn ProbeSendFailure_clone(orig: &ProbeSendFailure) -> ProbeSendFailure {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ProbeSendFailure_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ProbeSendFailure)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ProbeSendFailure_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut ProbeSendFailure) };
+}
#[no_mangle]
/// Utility method to constructs a new RouteNotFound-variant ProbeSendFailure
pub extern "C" fn ProbeSendFailure_route_not_found() -> ProbeSendFailure {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn RecipientOnionFields_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRecipientOnionFields)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRecipientOnionFields)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the RecipientOnionFields
pub extern "C" fn RecipientOnionFields_write(obj: &crate::lightning::ln::outbound_payment::RecipientOnionFields) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn RecipientOnionFields_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRecipientOnionFields) })
}
}
unsafe impl Send for CustomMessageHandler {}
unsafe impl Sync for CustomMessageHandler {}
+#[allow(unused)]
pub(crate) fn CustomMessageHandler_clone_fields(orig: &CustomMessageHandler) -> CustomMessageHandler {
CustomMessageHandler {
this_arg: orig.this_arg,
}
impl From<nativeIgnoringMessageHandler> for crate::lightning::events::MessageSendEventsProvider {
fn from(obj: nativeIgnoringMessageHandler) -> Self {
- let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(IgnoringMessageHandler_free_void);
ret
}
impl From<nativeIgnoringMessageHandler> for crate::lightning::ln::msgs::RoutingMessageHandler {
fn from(obj: nativeIgnoringMessageHandler) -> Self {
- let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = IgnoringMessageHandler_as_RoutingMessageHandler(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(IgnoringMessageHandler_free_void);
ret
}
crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
-impl From<nativeIgnoringMessageHandler> for crate::lightning::events::OnionMessageProvider {
- fn from(obj: nativeIgnoringMessageHandler) -> Self {
- let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
- let mut ret = IgnoringMessageHandler_as_OnionMessageProvider(&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 = core::ptr::null_mut();
- ret.free = Some(IgnoringMessageHandler_free_void);
- ret
- }
-}
-/// Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
-/// This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
-#[no_mangle]
-pub extern "C" fn IgnoringMessageHandler_as_OnionMessageProvider(this_arg: &IgnoringMessageHandler) -> crate::lightning::events::OnionMessageProvider {
- crate::lightning::events::OnionMessageProvider {
- this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
- free: None,
- next_onion_message_for_peer: IgnoringMessageHandler_OnionMessageProvider_next_onion_message_for_peer,
- }
-}
-
-#[must_use]
-extern "C" fn IgnoringMessageHandler_OnionMessageProvider_next_onion_message_for_peer(this_arg: *const c_void, mut peer_node_id: crate::c_types::PublicKey) -> crate::lightning::ln::msgs::OnionMessage {
- let mut ret = <nativeIgnoringMessageHandler as lightning::events::OnionMessageProvider<>>::next_onion_message_for_peer(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, peer_node_id.into_rust());
- let mut local_ret = crate::lightning::ln::msgs::OnionMessage { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true };
- local_ret
-}
-
impl From<nativeIgnoringMessageHandler> for crate::lightning::ln::msgs::OnionMessageHandler {
fn from(obj: nativeIgnoringMessageHandler) -> Self {
- let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = IgnoringMessageHandler_as_OnionMessageHandler(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(IgnoringMessageHandler_free_void);
ret
}
this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
free: None,
handle_onion_message: IgnoringMessageHandler_OnionMessageHandler_handle_onion_message,
+ next_onion_message_for_peer: IgnoringMessageHandler_OnionMessageHandler_next_onion_message_for_peer,
peer_connected: IgnoringMessageHandler_OnionMessageHandler_peer_connected,
peer_disconnected: IgnoringMessageHandler_OnionMessageHandler_peer_disconnected,
provided_node_features: IgnoringMessageHandler_OnionMessageHandler_provided_node_features,
provided_init_features: IgnoringMessageHandler_OnionMessageHandler_provided_init_features,
- OnionMessageProvider: crate::lightning::events::OnionMessageProvider {
- this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
- free: None,
- next_onion_message_for_peer: IgnoringMessageHandler_OnionMessageProvider_next_onion_message_for_peer,
- },
}
}
<nativeIgnoringMessageHandler as lightning::ln::msgs::OnionMessageHandler<>>::handle_onion_message(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &peer_node_id.into_rust(), msg.get_native_ref())
}
#[must_use]
+extern "C" fn IgnoringMessageHandler_OnionMessageHandler_next_onion_message_for_peer(this_arg: *const c_void, mut peer_node_id: crate::c_types::PublicKey) -> crate::lightning::ln::msgs::OnionMessage {
+ let mut ret = <nativeIgnoringMessageHandler as lightning::ln::msgs::OnionMessageHandler<>>::next_onion_message_for_peer(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, peer_node_id.into_rust());
+ let mut local_ret = crate::lightning::ln::msgs::OnionMessage { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true };
+ local_ret
+}
+#[must_use]
extern "C" fn IgnoringMessageHandler_OnionMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ {
let mut ret = <nativeIgnoringMessageHandler as lightning::ln::msgs::OnionMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust(), init.get_native_ref(), inbound);
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() };
impl From<nativeIgnoringMessageHandler> for crate::lightning::onion_message::offers::OffersMessageHandler {
fn from(obj: nativeIgnoringMessageHandler) -> Self {
- let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = IgnoringMessageHandler_as_OffersMessageHandler(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(IgnoringMessageHandler_free_void);
ret
}
this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
free: None,
handle_message: IgnoringMessageHandler_OffersMessageHandler_handle_message,
+ release_pending_messages: IgnoringMessageHandler_OffersMessageHandler_release_pending_messages,
}
}
let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_OffersMessageZ::None } else { crate::c_types::derived::COption_OffersMessageZ::Some( { crate::lightning::onion_message::offers::OffersMessage::native_into(ret.unwrap()) }) };
local_ret
}
+#[must_use]
+extern "C" fn IgnoringMessageHandler_OffersMessageHandler_release_pending_messages(this_arg: *const c_void) -> crate::c_types::derived::CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
+ let mut ret = <nativeIgnoringMessageHandler as lightning::onion_message::offers::OffersMessageHandler<>>::release_pending_messages(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, );
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2) = item; let mut local_orig_ret_0_2 = crate::lightning::blinded_path::BlindedPath { inner: if orig_ret_0_2.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((orig_ret_0_2.unwrap())) } }, is_owned: true }; let mut local_ret_0 = (crate::lightning::onion_message::offers::OffersMessage::native_into(orig_ret_0_0), crate::lightning::onion_message::messenger::Destination::native_into(orig_ret_0_1), local_orig_ret_0_2).into(); local_ret_0 }); };
+ local_ret.into()
+}
impl From<nativeIgnoringMessageHandler> for crate::lightning::onion_message::messenger::CustomOnionMessageHandler {
fn from(obj: nativeIgnoringMessageHandler) -> Self {
- let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(IgnoringMessageHandler_free_void);
ret
}
free: None,
handle_custom_message: IgnoringMessageHandler_CustomOnionMessageHandler_handle_custom_message,
read_custom_message: IgnoringMessageHandler_CustomOnionMessageHandler_read_custom_message,
+ release_pending_custom_messages: IgnoringMessageHandler_CustomOnionMessageHandler_release_pending_custom_messages,
}
}
#[must_use]
-extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_handle_custom_message(this_arg: *const c_void, mut msg: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> crate::c_types::derived::COption_CustomOnionMessageContentsZ {
+extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_handle_custom_message(this_arg: *const c_void, mut msg: crate::lightning::onion_message::packet::OnionMessageContents) -> crate::c_types::derived::COption_OnionMessageContentsZ {
unreachable!();
}
#[must_use]
-extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_read_custom_message(this_arg: *const c_void, mut message_type: u64, mut buffer: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
+extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_read_custom_message(this_arg: *const c_void, mut message_type: u64, mut buffer: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_OnionMessageContentsZDecodeErrorZ {
let mut ret = <nativeIgnoringMessageHandler as lightning::onion_message::messenger::CustomOnionMessageHandler<>>::read_custom_message(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, message_type, &mut buffer.to_reader());
- let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = if o.is_none() { crate::c_types::derived::COption_CustomOnionMessageContentsZ::None } else { crate::c_types::derived::COption_CustomOnionMessageContentsZ::Some( { Into::into(o.unwrap()) }) }; local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = if o.is_none() { crate::c_types::derived::COption_OnionMessageContentsZ::None } else { crate::c_types::derived::COption_OnionMessageContentsZ::Some( { Into::into(o.unwrap()) }) }; local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
local_ret
}
+#[must_use]
+extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_release_pending_custom_messages(this_arg: *const c_void) -> crate::c_types::derived::CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
+ let mut ret = <nativeIgnoringMessageHandler as lightning::onion_message::messenger::CustomOnionMessageHandler<>>::release_pending_custom_messages(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, );
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2) = item; let mut local_orig_ret_0_2 = crate::lightning::blinded_path::BlindedPath { inner: if orig_ret_0_2.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((orig_ret_0_2.unwrap())) } }, is_owned: true }; let mut local_ret_0 = (Into::into(orig_ret_0_0), crate::lightning::onion_message::messenger::Destination::native_into(orig_ret_0_1), local_orig_ret_0_2).into(); local_ret_0 }); };
+ local_ret.into()
+}
-impl From<nativeInfallible> for crate::lightning::onion_message::packet::CustomOnionMessageContents {
+impl From<nativeInfallible> for crate::lightning::onion_message::packet::OnionMessageContents {
fn from(obj: nativeInfallible) -> Self {
unreachable!();
}
}
impl From<nativeIgnoringMessageHandler> for crate::lightning::ln::wire::CustomMessageReader {
fn from(obj: nativeIgnoringMessageHandler) -> Self {
- let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = IgnoringMessageHandler_as_CustomMessageReader(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(IgnoringMessageHandler_free_void);
ret
}
impl From<nativeIgnoringMessageHandler> for crate::lightning::ln::peer_handler::CustomMessageHandler {
fn from(obj: nativeIgnoringMessageHandler) -> Self {
- let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = IgnoringMessageHandler_as_CustomMessageHandler(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(IgnoringMessageHandler_free_void);
ret
}
impl From<nativeErroringMessageHandler> for crate::lightning::events::MessageSendEventsProvider {
fn from(obj: nativeErroringMessageHandler) -> Self {
- let mut rust_obj = ErroringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::ln::peer_handler::ErroringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ErroringMessageHandler_as_MessageSendEventsProvider(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ErroringMessageHandler_free_void);
ret
}
impl From<nativeErroringMessageHandler> for crate::lightning::ln::msgs::ChannelMessageHandler {
fn from(obj: nativeErroringMessageHandler) -> Self {
- let mut rust_obj = ErroringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::ln::peer_handler::ErroringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ErroringMessageHandler_as_ChannelMessageHandler(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ErroringMessageHandler_free_void);
ret
}
handle_error: ErroringMessageHandler_ChannelMessageHandler_handle_error,
provided_node_features: ErroringMessageHandler_ChannelMessageHandler_provided_node_features,
provided_init_features: ErroringMessageHandler_ChannelMessageHandler_provided_init_features,
- get_genesis_hashes: ErroringMessageHandler_ChannelMessageHandler_get_genesis_hashes,
+ get_chain_hashes: ErroringMessageHandler_ChannelMessageHandler_get_chain_hashes,
MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider {
this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
free: None,
crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
#[must_use]
-extern "C" fn ErroringMessageHandler_ChannelMessageHandler_get_genesis_hashes(this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ {
- let mut ret = <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::get_genesis_hashes(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, );
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_get_chain_hashes(this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ {
+ let mut ret = <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::get_chain_hashes(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, );
let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::None } else { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; local_ret_0.into() }) };
local_ret
}
}
unsafe impl Send for SocketDescriptor {}
unsafe impl Sync for SocketDescriptor {}
+#[allow(unused)]
pub(crate) fn SocketDescriptor_clone_fields(orig: &SocketDescriptor) -> SocketDescriptor {
SocketDescriptor {
this_arg: orig.this_arg,
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn PeerHandleError_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePeerHandleError)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePeerHandleError)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the PeerHandleError
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ShutdownScript_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeShutdownScript)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeShutdownScript)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ShutdownScript
#[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
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInvalidShutdownScript)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the InvalidShutdownScript
pub extern "C" fn ShutdownScript_write(obj: &crate::lightning::ln::script::ShutdownScript) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ShutdownScript_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeShutdownScript) })
}
}
unsafe impl Send for CustomMessageReader {}
unsafe impl Sync for CustomMessageReader {}
+#[allow(unused)]
pub(crate) fn CustomMessageReader_clone_fields(orig: &CustomMessageReader) -> CustomMessageReader {
CustomMessageReader {
this_arg: orig.this_arg,
}
unsafe impl Send for Type {}
unsafe impl Sync for Type {}
+#[allow(unused)]
pub(crate) fn Type_clone_fields(orig: &Type) -> Type {
Type {
this_arg: orig.this_arg,
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Bolt12Invoice_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBolt12Invoice)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt12Invoice)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Bolt12Invoice
pub extern "C" fn UnsignedBolt12Invoice_write(obj: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn UnsignedBolt12Invoice_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedBolt12Invoice) })
}
pub extern "C" fn Bolt12Invoice_write(obj: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn Bolt12Invoice_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBolt12Invoice) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn BlindedPayInfo_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBlindedPayInfo)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedPayInfo)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the BlindedPayInfo
pub extern "C" fn BlindedPayInfo_write(obj: &crate::lightning::offers::invoice::BlindedPayInfo) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn BlindedPayInfo_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBlindedPayInfo) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn InvoiceError_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInvoiceError)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInvoiceError)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the InvoiceError
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ErroneousField_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeErroneousField)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeErroneousField)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ErroneousField
pub extern "C" fn ErroneousField_clone(orig: &ErroneousField) -> ErroneousField {
orig.clone()
}
+/// Creates an [`InvoiceError`] with the given message.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn InvoiceError_from_string(mut s: crate::c_types::Str) -> crate::lightning::offers::invoice_error::InvoiceError {
+ let mut ret = lightning::offers::invoice_error::InvoiceError::from_string(s.into_string());
+ crate::lightning::offers::invoice_error::InvoiceError { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
#[no_mangle]
/// Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read
pub extern "C" fn InvoiceError_write(obj: &crate::lightning::offers::invoice_error::InvoiceError) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn InvoiceError_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInvoiceError) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn InvoiceRequest_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInvoiceRequest)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInvoiceRequest)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the InvoiceRequest
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn VerifiedInvoiceRequest_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeVerifiedInvoiceRequest)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeVerifiedInvoiceRequest)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the VerifiedInvoiceRequest
pub extern "C" fn UnsignedInvoiceRequest_write(obj: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn UnsignedInvoiceRequest_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedInvoiceRequest) })
}
pub extern "C" fn InvoiceRequest_write(obj: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn InvoiceRequest_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInvoiceRequest) })
}
//! published as a QR code to be scanned by a customer. The customer uses the offer to request an
//! invoice from the merchant to be paid.
//!
+//! # Example
+//!
//! ```
//! extern crate bitcoin;
//! extern crate core;
//! # Ok(())
//! # }
//! ```
+//!
+//! # Note
+//!
+//! If constructing an [`Offer`] for use with a [`ChannelManager`], use
+//! [`ChannelManager::create_offer_builder`] instead of [`OfferBuilder::new`].
+//!
+//! [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+//! [`ChannelManager::create_offer_builder`]: crate::ln::channelmanager::ChannelManager::create_offer_builder
use alloc::str::FromStr;
use alloc::string::String;
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Offer_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOffer)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOffer)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Offer
pub extern "C" fn Offer_write(obj: &crate::lightning::offers::offer::Offer) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn Offer_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeOffer) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Amount_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAmount)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeAmount)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Amount
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Quantity_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQuantity)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeQuantity)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Quantity
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Bolt12ParseError_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBolt12ParseError)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt12ParseError)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Bolt12ParseError
MissingPayerMetadata,
/// A payer id was expected but was missing.
MissingPayerId,
+ /// The payment id for a refund or request is already in use.
+ DuplicatePaymentId,
/// Blinded paths were expected but were missing.
MissingPaths,
/// The blinded payinfo given does not match the number of blinded path hops.
Bolt12SemanticError::UnexpectedMetadata => nativeBolt12SemanticError::UnexpectedMetadata,
Bolt12SemanticError::MissingPayerMetadata => nativeBolt12SemanticError::MissingPayerMetadata,
Bolt12SemanticError::MissingPayerId => nativeBolt12SemanticError::MissingPayerId,
+ Bolt12SemanticError::DuplicatePaymentId => nativeBolt12SemanticError::DuplicatePaymentId,
Bolt12SemanticError::MissingPaths => nativeBolt12SemanticError::MissingPaths,
Bolt12SemanticError::InvalidPayInfo => nativeBolt12SemanticError::InvalidPayInfo,
Bolt12SemanticError::MissingCreationTime => nativeBolt12SemanticError::MissingCreationTime,
Bolt12SemanticError::UnexpectedMetadata => nativeBolt12SemanticError::UnexpectedMetadata,
Bolt12SemanticError::MissingPayerMetadata => nativeBolt12SemanticError::MissingPayerMetadata,
Bolt12SemanticError::MissingPayerId => nativeBolt12SemanticError::MissingPayerId,
+ Bolt12SemanticError::DuplicatePaymentId => nativeBolt12SemanticError::DuplicatePaymentId,
Bolt12SemanticError::MissingPaths => nativeBolt12SemanticError::MissingPaths,
Bolt12SemanticError::InvalidPayInfo => nativeBolt12SemanticError::InvalidPayInfo,
Bolt12SemanticError::MissingCreationTime => nativeBolt12SemanticError::MissingCreationTime,
nativeBolt12SemanticError::UnexpectedMetadata => Bolt12SemanticError::UnexpectedMetadata,
nativeBolt12SemanticError::MissingPayerMetadata => Bolt12SemanticError::MissingPayerMetadata,
nativeBolt12SemanticError::MissingPayerId => Bolt12SemanticError::MissingPayerId,
+ nativeBolt12SemanticError::DuplicatePaymentId => Bolt12SemanticError::DuplicatePaymentId,
nativeBolt12SemanticError::MissingPaths => Bolt12SemanticError::MissingPaths,
nativeBolt12SemanticError::InvalidPayInfo => Bolt12SemanticError::InvalidPayInfo,
nativeBolt12SemanticError::MissingCreationTime => Bolt12SemanticError::MissingCreationTime,
nativeBolt12SemanticError::UnexpectedMetadata => Bolt12SemanticError::UnexpectedMetadata,
nativeBolt12SemanticError::MissingPayerMetadata => Bolt12SemanticError::MissingPayerMetadata,
nativeBolt12SemanticError::MissingPayerId => Bolt12SemanticError::MissingPayerId,
+ nativeBolt12SemanticError::DuplicatePaymentId => Bolt12SemanticError::DuplicatePaymentId,
nativeBolt12SemanticError::MissingPaths => Bolt12SemanticError::MissingPaths,
nativeBolt12SemanticError::InvalidPayInfo => Bolt12SemanticError::InvalidPayInfo,
nativeBolt12SemanticError::MissingCreationTime => Bolt12SemanticError::MissingCreationTime,
pub extern "C" fn Bolt12SemanticError_clone(orig: &Bolt12SemanticError) -> Bolt12SemanticError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Bolt12SemanticError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Bolt12SemanticError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Bolt12SemanticError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut Bolt12SemanticError) };
+}
#[no_mangle]
/// Utility method to constructs a new AlreadyExpired-variant Bolt12SemanticError
pub extern "C" fn Bolt12SemanticError_already_expired() -> Bolt12SemanticError {
pub extern "C" fn Bolt12SemanticError_missing_payer_id() -> Bolt12SemanticError {
Bolt12SemanticError::MissingPayerId}
#[no_mangle]
+/// Utility method to constructs a new DuplicatePaymentId-variant Bolt12SemanticError
+pub extern "C" fn Bolt12SemanticError_duplicate_payment_id() -> Bolt12SemanticError {
+ Bolt12SemanticError::DuplicatePaymentId}
+#[no_mangle]
/// Utility method to constructs a new MissingPaths-variant Bolt12SemanticError
pub extern "C" fn Bolt12SemanticError_missing_paths() -> Bolt12SemanticError {
Bolt12SemanticError::MissingPaths}
//! [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
//! [`Offer`]: crate::offers::offer::Offer
//!
+//! # Example
+//!
//! ```
//! extern crate bitcoin;
//! extern crate core;
//! # Ok(())
//! # }
//! ```
+//!
+//! # Note
+//!
+//! If constructing a [`Refund`] for use with a [`ChannelManager`], use
+//! [`ChannelManager::create_refund_builder`] instead of [`RefundBuilder::new`].
+//!
+//! [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+//! [`ChannelManager::create_refund_builder`]: crate::ln::channelmanager::ChannelManager::create_refund_builder
use alloc::str::FromStr;
use alloc::string::String;
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Refund_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRefund)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRefund)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Refund
pub extern "C" fn Refund_write(obj: &crate::lightning::offers::refund::Refund) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn Refund_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRefund) })
}
use lightning::onion_message::messenger::OnionMessenger as nativeOnionMessengerImport;
pub(crate) type nativeOnionMessenger = nativeOnionMessengerImport<crate::lightning::sign::EntropySource, crate::lightning::sign::NodeSigner, crate::lightning::util::logger::Logger, crate::lightning::onion_message::messenger::MessageRouter, crate::lightning::onion_message::offers::OffersMessageHandler, crate::lightning::onion_message::messenger::CustomOnionMessageHandler>;
-/// A sender, receiver and forwarder of onion messages. In upcoming releases, this object will be
-/// used to retrieve invoices and fulfill invoice requests from [offers]. Currently, only sending
-/// and receiving custom onion messages is supported.
+/// A sender, receiver and forwarder of [`OnionMessage`]s.
+///
+/// # Handling Messages
+///
+/// `OnionMessenger` implements [`OnionMessageHandler`], making it responsible for either forwarding
+/// messages to peers or delegating to the appropriate handler for the message type. Currently, the
+/// available handlers are:
+/// * [`OffersMessageHandler`], for responding to [`InvoiceRequest`]s and paying [`Bolt12Invoice`]s
+/// * [`CustomOnionMessageHandler`], for handling user-defined message types
+///
+/// # Sending Messages
+///
+/// [`OnionMessage`]s are sent initially using [`OnionMessenger::send_onion_message`]. When handling
+/// a message, the matched handler may return a response message which `OnionMessenger` will send
+/// on its behalf.
///
/// # Example
///
/// # use lightning::sign::KeysManager;
/// # use lightning::ln::peer_handler::IgnoringMessageHandler;
/// # use lightning::onion_message::messenger::{Destination, MessageRouter, OnionMessenger, OnionMessagePath};
-/// # use lightning::onion_message::packet::{CustomOnionMessageContents, OnionMessageContents};
+/// # use lightning::onion_message::packet::OnionMessageContents;
/// # use lightning::util::logger::{Logger, Record};
/// # use lightning::util::ser::{Writeable, Writer};
/// # use lightning::io;
/// \t\t// Write your custom onion message to `w`
/// \t}
/// }
-/// impl CustomOnionMessageContents for YourCustomMessage {
+/// impl OnionMessageContents for YourCustomMessage {
/// \tfn tlv_type(&self) -> u64 {
/// \t\t# let your_custom_message_type = 42;
/// \t\tyour_custom_message_type
/// \tdestination: Destination::Node(destination_node_id),
/// };
/// let reply_path = None;
-/// # let your_custom_message = YourCustomMessage {};
-/// let message = OnionMessageContents::Custom(your_custom_message);
+/// # let message = YourCustomMessage {};
/// onion_messenger.send_onion_message(path, message, reply_path);
///
/// // Create a blinded path to yourself, for someone to send an onion message to.
/// \tdestination: Destination::BlindedPath(blinded_path),
/// };
/// let reply_path = None;
-/// # let your_custom_message = YourCustomMessage {};
-/// let message = OnionMessageContents::Custom(your_custom_message);
+/// # let message = YourCustomMessage {};
/// onion_messenger.send_onion_message(path, message, reply_path);
/// ```
///
-/// [offers]: <https://github.com/lightning/bolts/pull/798>
-/// [`OnionMessenger`]: crate::onion_message::OnionMessenger
+/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
+/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
#[must_use]
#[repr(C)]
pub struct OnionMessenger {
}
}
/// A trait defining behavior for routing an [`OnionMessage`].
-///
-/// [`OnionMessage`]: msgs::OnionMessage
#[repr(C)]
pub struct MessageRouter {
/// 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 a route for sending an [`OnionMessage`] to the given [`Destination`].
- ///
- /// [`OnionMessage`]: msgs::OnionMessage
pub find_path: extern "C" fn (this_arg: *const c_void, sender: crate::c_types::PublicKey, peers: crate::c_types::derived::CVec_PublicKeyZ, destination: crate::lightning::onion_message::messenger::Destination) -> crate::c_types::derived::CResult_OnionMessagePathNoneZ,
/// 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.
}
unsafe impl Send for MessageRouter {}
unsafe impl Sync for MessageRouter {}
+#[allow(unused)]
pub(crate) fn MessageRouter_clone_fields(orig: &MessageRouter) -> MessageRouter {
MessageRouter {
this_arg: orig.this_arg,
use lightning::onion_message::messenger::DefaultMessageRouter as nativeDefaultMessageRouterImport;
pub(crate) type nativeDefaultMessageRouter = nativeDefaultMessageRouterImport;
-/// A [`MessageRouter`] that always fails.
+/// A [`MessageRouter`] that can only route to a directly connected [`Destination`].
#[must_use]
#[repr(C)]
pub struct DefaultMessageRouter {
}
impl From<nativeDefaultMessageRouter> for crate::lightning::onion_message::messenger::MessageRouter {
fn from(obj: nativeDefaultMessageRouter) -> Self {
- let mut rust_obj = DefaultMessageRouter { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::onion_message::messenger::DefaultMessageRouter { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = DefaultMessageRouter_as_MessageRouter(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(DefaultMessageRouter_free_void);
ret
}
use lightning::onion_message::messenger::OnionMessagePath as nativeOnionMessagePathImport;
pub(crate) type nativeOnionMessagePath = nativeOnionMessagePathImport;
-/// A path for sending an [`msgs::OnionMessage`].
+/// A path for sending an [`OnionMessage`].
#[must_use]
#[repr(C)]
pub struct OnionMessagePath {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn OnionMessagePath_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOnionMessagePath)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOnionMessagePath)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the OnionMessagePath
pub extern "C" fn Destination_clone(orig: &Destination) -> Destination {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Destination_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Destination)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Destination_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut Destination) };
+}
#[no_mangle]
/// Utility method to constructs a new Node-variant Destination
pub extern "C" fn Destination_node(a: crate::c_types::PublicKey) -> Destination {
/// Because implementations such as Eclair will drop onion messages where the message packet
/// exceeds 32834 bytes, we refuse to send messages where the packet exceeds this size.
TooBigPacket,
- /// The provided [`Destination`] was an invalid [`BlindedPath`], due to having fewer than two
- /// blinded hops.
+ /// The provided [`Destination`] was an invalid [`BlindedPath`] due to not having any blinded
+ /// hops.
TooFewBlindedHops,
/// Our next-hop peer was offline or does not support onion message forwarding.
InvalidFirstHop,
pub extern "C" fn SendError_clone(orig: &SendError) -> SendError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SendError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const SendError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SendError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut SendError) };
+}
#[no_mangle]
/// Utility method to constructs a new Secp256k1-variant SendError
pub extern "C" fn SendError_secp256k1(a: crate::c_types::Secp256k1Error) -> SendError {
/// This has no meaning in the LDK, and can be NULL or any other value.
pub this_arg: *mut c_void,
/// Called with the custom message that was received, returning a response to send, if any.
- pub handle_custom_message: extern "C" fn (this_arg: *const c_void, msg: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> crate::c_types::derived::COption_CustomOnionMessageContentsZ,
+ ///
+ /// The returned [`Self::CustomMessage`], if any, is enqueued to be sent by [`OnionMessenger`].
+ pub handle_custom_message: extern "C" fn (this_arg: *const c_void, msg: crate::lightning::onion_message::packet::OnionMessageContents) -> crate::c_types::derived::COption_OnionMessageContentsZ,
/// Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the
/// message type is unknown.
- pub read_custom_message: extern "C" fn (this_arg: *const c_void, message_type: u64, buffer: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_CustomOnionMessageContentsZDecodeErrorZ,
+ pub read_custom_message: extern "C" fn (this_arg: *const c_void, message_type: u64, buffer: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_OnionMessageContentsZDecodeErrorZ,
+ /// Releases any [`Self::CustomMessage`]s that need to be sent.
+ ///
+ /// Typically, this is used for messages initiating a message flow rather than in response to
+ /// another message. The latter should use the return value of [`Self::handle_custom_message`].
+ pub release_pending_custom_messages: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ,
/// 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 CustomOnionMessageHandler {}
unsafe impl Sync for CustomOnionMessageHandler {}
+#[allow(unused)]
pub(crate) fn CustomOnionMessageHandler_clone_fields(orig: &CustomOnionMessageHandler) -> CustomOnionMessageHandler {
CustomOnionMessageHandler {
this_arg: orig.this_arg,
handle_custom_message: Clone::clone(&orig.handle_custom_message),
read_custom_message: Clone::clone(&orig.read_custom_message),
+ release_pending_custom_messages: Clone::clone(&orig.release_pending_custom_messages),
free: Clone::clone(&orig.free),
}
}
use lightning::onion_message::messenger::CustomOnionMessageHandler as rustCustomOnionMessageHandler;
impl rustCustomOnionMessageHandler for CustomOnionMessageHandler {
- type CustomMessage = crate::lightning::onion_message::packet::CustomOnionMessageContents;
- fn handle_custom_message(&self, mut msg: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> Option<crate::lightning::onion_message::packet::CustomOnionMessageContents> {
+ type CustomMessage = crate::lightning::onion_message::packet::OnionMessageContents;
+ fn handle_custom_message(&self, mut msg: crate::lightning::onion_message::packet::OnionMessageContents) -> Option<crate::lightning::onion_message::packet::OnionMessageContents> {
let mut ret = (self.handle_custom_message)(self.this_arg, Into::into(msg));
let mut local_ret = { /*ret*/ let ret_opt = ret; if ret_opt.is_none() { None } else { Some({ { { ret_opt.take() } }})} };
local_ret
}
- fn read_custom_message<R:crate::c_types::io::Read>(&self, mut message_type: u64, mut buffer: &mut R) -> Result<Option<crate::lightning::onion_message::packet::CustomOnionMessageContents>, lightning::ln::msgs::DecodeError> {
+ fn read_custom_message<R:crate::c_types::io::Read>(&self, mut message_type: u64, mut buffer: &mut R) -> Result<Option<crate::lightning::onion_message::packet::OnionMessageContents>, lightning::ln::msgs::DecodeError> {
let mut ret = (self.read_custom_message)(self.this_arg, message_type, crate::c_types::u8slice::from_vec(&crate::c_types::reader_to_vec(buffer)));
let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = { /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ let ret_0_opt = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }); if ret_0_opt.is_none() { None } else { Some({ { { ret_0_opt.take() } }})} }; local_ret_0 }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })};
local_ret
}
+ fn release_pending_custom_messages(&self) -> Vec<(crate::lightning::onion_message::packet::OnionMessageContents, lightning::onion_message::messenger::Destination, Option<lightning::blinded_path::BlindedPath>)> {
+ let mut ret = (self.release_pending_custom_messages)(self.this_arg);
+ let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2) = item.to_rust(); let mut local_orig_ret_0_2 = if orig_ret_0_2.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(orig_ret_0_2.take_inner()) } }) }; let mut local_ret_0 = (orig_ret_0_0, orig_ret_0_1.into_native(), local_orig_ret_0_2); local_ret_0 }); };
+ local_ret
+ }
}
// We're essentially a pointer already, or at least a set of pointers, so allow us to be used
}
}
}
-/// Create an onion message with contents `message` to the destination of `path`.
-/// Returns (introduction_node_id, onion_msg)
+/// A processed incoming onion message, containing either a Forward (another onion message)
+/// or a Receive payload with decrypted contents.
+#[derive(Clone)]
+#[must_use]
+#[repr(C)]
+pub enum PeeledOnion {
+ /// Forwarded onion, with the next node id and a new onion
+ Forward(
+ crate::c_types::PublicKey,
+ crate::lightning::ln::msgs::OnionMessage),
+ /// Received onion message, with decrypted contents, path_id, and reply path
+ Receive(
+ crate::lightning::onion_message::packet::ParsedOnionMessageContents,
+ ///
+ /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ crate::c_types::ThirtyTwoBytes,
+ ///
+ /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ crate::lightning::blinded_path::BlindedPath),
+}
+use lightning::onion_message::messenger::PeeledOnion as PeeledOnionImport;
+pub(crate) type nativePeeledOnion = PeeledOnionImport<crate::lightning::onion_message::packet::OnionMessageContents>;
+
+impl PeeledOnion {
+ #[allow(unused)]
+ pub(crate) fn to_native(&self) -> nativePeeledOnion {
+ match self {
+ PeeledOnion::Forward (ref a, ref b, ) => {
+ let mut a_nonref = Clone::clone(a);
+ let mut b_nonref = Clone::clone(b);
+ nativePeeledOnion::Forward (
+ a_nonref.into_rust(),
+ *unsafe { Box::from_raw(b_nonref.take_inner()) },
+ )
+ },
+ PeeledOnion::Receive (ref a, ref b, ref c, ) => {
+ let mut a_nonref = Clone::clone(a);
+ let mut b_nonref = Clone::clone(b);
+ let mut local_b_nonref = if b_nonref.data == [0; 32] { None } else { Some( { b_nonref.data }) };
+ let mut c_nonref = Clone::clone(c);
+ let mut local_c_nonref = if c_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(c_nonref.take_inner()) } }) };
+ nativePeeledOnion::Receive (
+ a_nonref.into_native(),
+ local_b_nonref,
+ local_c_nonref,
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn into_native(self) -> nativePeeledOnion {
+ match self {
+ PeeledOnion::Forward (mut a, mut b, ) => {
+ nativePeeledOnion::Forward (
+ a.into_rust(),
+ *unsafe { Box::from_raw(b.take_inner()) },
+ )
+ },
+ PeeledOnion::Receive (mut a, mut b, mut c, ) => {
+ let mut local_b = if b.data == [0; 32] { None } else { Some( { b.data }) };
+ let mut local_c = if c.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(c.take_inner()) } }) };
+ nativePeeledOnion::Receive (
+ a.into_native(),
+ local_b,
+ local_c,
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn from_native(native: &nativePeeledOnion) -> Self {
+ match native {
+ nativePeeledOnion::Forward (ref a, ref b, ) => {
+ let mut a_nonref = Clone::clone(a);
+ let mut b_nonref = Clone::clone(b);
+ PeeledOnion::Forward (
+ crate::c_types::PublicKey::from_rust(&a_nonref),
+ crate::lightning::ln::msgs::OnionMessage { inner: ObjOps::heap_alloc(b_nonref), is_owned: true },
+ )
+ },
+ nativePeeledOnion::Receive (ref a, ref b, ref c, ) => {
+ let mut a_nonref = Clone::clone(a);
+ let mut b_nonref = Clone::clone(b);
+ let mut local_b_nonref = if b_nonref.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (b_nonref.unwrap()) } } };
+ let mut c_nonref = Clone::clone(c);
+ let mut local_c_nonref = crate::lightning::blinded_path::BlindedPath { inner: if c_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((c_nonref.unwrap())) } }, is_owned: true };
+ PeeledOnion::Receive (
+ crate::lightning::onion_message::packet::ParsedOnionMessageContents::native_into(a_nonref),
+ local_b_nonref,
+ local_c_nonref,
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn native_into(native: nativePeeledOnion) -> Self {
+ match native {
+ nativePeeledOnion::Forward (mut a, mut b, ) => {
+ PeeledOnion::Forward (
+ crate::c_types::PublicKey::from_rust(&a),
+ crate::lightning::ln::msgs::OnionMessage { inner: ObjOps::heap_alloc(b), is_owned: true },
+ )
+ },
+ nativePeeledOnion::Receive (mut a, mut b, mut c, ) => {
+ let mut local_b = if b.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (b.unwrap()) } } };
+ let mut local_c = crate::lightning::blinded_path::BlindedPath { inner: if c.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((c.unwrap())) } }, is_owned: true };
+ PeeledOnion::Receive (
+ crate::lightning::onion_message::packet::ParsedOnionMessageContents::native_into(a),
+ local_b,
+ local_c,
+ )
+ },
+ }
+ }
+}
+/// Frees any resources used by the PeeledOnion
+#[no_mangle]
+pub extern "C" fn PeeledOnion_free(this_ptr: PeeledOnion) { }
+/// Creates a copy of the PeeledOnion
+#[no_mangle]
+pub extern "C" fn PeeledOnion_clone(orig: &PeeledOnion) -> PeeledOnion {
+ orig.clone()
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn PeeledOnion_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const PeeledOnion)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn PeeledOnion_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut PeeledOnion) };
+}
+#[no_mangle]
+/// Utility method to constructs a new Forward-variant PeeledOnion
+pub extern "C" fn PeeledOnion_forward(a: crate::c_types::PublicKey,b: crate::lightning::ln::msgs::OnionMessage) -> PeeledOnion {
+ PeeledOnion::Forward(a, b, )
+}
+#[no_mangle]
+/// Utility method to constructs a new Receive-variant PeeledOnion
+pub extern "C" fn PeeledOnion_receive(a: crate::lightning::onion_message::packet::ParsedOnionMessageContents,b: crate::c_types::ThirtyTwoBytes,c: crate::lightning::blinded_path::BlindedPath) -> PeeledOnion {
+ PeeledOnion::Receive(a, b, c, )
+}
+/// Creates an [`OnionMessage`] with the given `contents` for sending to the destination of
+/// `path`.
+///
+/// Returns both the node id of the peer to send the message to and the message itself.
///
/// Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
#[no_mangle]
-pub extern "C" fn create_onion_message(entropy_source: &crate::lightning::sign::EntropySource, node_signer: &crate::lightning::sign::NodeSigner, mut path: crate::lightning::onion_message::messenger::OnionMessagePath, mut message: crate::lightning::onion_message::packet::OnionMessageContents, mut reply_path: crate::lightning::blinded_path::BlindedPath) -> crate::c_types::derived::CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
+pub extern "C" fn create_onion_message(entropy_source: &crate::lightning::sign::EntropySource, node_signer: &crate::lightning::sign::NodeSigner, mut path: crate::lightning::onion_message::messenger::OnionMessagePath, mut contents: crate::lightning::onion_message::packet::OnionMessageContents, mut reply_path: crate::lightning::blinded_path::BlindedPath) -> crate::c_types::derived::CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
let mut local_reply_path = if reply_path.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(reply_path.take_inner()) } }) };
- let mut ret = lightning::onion_message::messenger::create_onion_message::<crate::lightning::sign::EntropySource, crate::lightning::sign::NodeSigner, crate::lightning::onion_message::packet::CustomOnionMessageContents>(entropy_source, node_signer, secp256k1::global::SECP256K1, *unsafe { Box::from_raw(path.take_inner()) }, message.into_native(), local_reply_path);
+ let mut ret = lightning::onion_message::messenger::create_onion_message::<crate::lightning::sign::EntropySource, crate::lightning::sign::NodeSigner, crate::lightning::onion_message::packet::OnionMessageContents>(entropy_source, node_signer, secp256k1::global::SECP256K1, *unsafe { Box::from_raw(path.take_inner()) }, contents, local_reply_path);
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::PublicKey::from_rust(&orig_ret_0_0), crate::lightning::ln::msgs::OnionMessage { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::onion_message::messenger::SendError::native_into(e) }).into() };
local_ret
}
+/// Decode one layer of an incoming [`OnionMessage`].
+///
+/// Returns either the next layer of the onion for forwarding or the decrypted content for the
+/// receiver.
+#[no_mangle]
+pub extern "C" fn peel_onion_message(msg: &crate::lightning::ln::msgs::OnionMessage, mut node_signer: crate::lightning::sign::NodeSigner, mut logger: crate::lightning::util::logger::Logger, mut custom_handler: crate::lightning::onion_message::messenger::CustomOnionMessageHandler) -> crate::c_types::derived::CResult_PeeledOnionNoneZ {
+ let mut ret = lightning::onion_message::messenger::peel_onion_message::<crate::lightning::sign::NodeSigner, crate::lightning::util::logger::Logger, crate::lightning::onion_message::messenger::CustomOnionMessageHandler>(msg.get_native_ref(), secp256k1::global::SECP256K1, node_signer, logger, custom_handler);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::messenger::PeeledOnion::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+ local_ret
+}
+
/// Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to
/// their respective handlers.
#[must_use]
crate::lightning::onion_message::messenger::OnionMessenger { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
-/// Send an onion message with contents `message` to the destination of `path`.
+/// Sends an [`OnionMessage`] with the given `contents` for sending to the destination of
+/// `path`.
///
/// See [`OnionMessenger`] for example usage.
///
/// Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
#[must_use]
#[no_mangle]
-pub extern "C" fn OnionMessenger_send_onion_message(this_arg: &crate::lightning::onion_message::messenger::OnionMessenger, mut path: crate::lightning::onion_message::messenger::OnionMessagePath, mut message: crate::lightning::onion_message::packet::OnionMessageContents, mut reply_path: crate::lightning::blinded_path::BlindedPath) -> crate::c_types::derived::CResult_NoneSendErrorZ {
+pub extern "C" fn OnionMessenger_send_onion_message(this_arg: &crate::lightning::onion_message::messenger::OnionMessenger, mut path: crate::lightning::onion_message::messenger::OnionMessagePath, mut contents: crate::lightning::onion_message::packet::OnionMessageContents, mut reply_path: crate::lightning::blinded_path::BlindedPath) -> crate::c_types::derived::CResult_NoneSendErrorZ {
let mut local_reply_path = if reply_path.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(reply_path.take_inner()) } }) };
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_onion_message(*unsafe { Box::from_raw(path.take_inner()) }, message.into_native(), local_reply_path);
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_onion_message(*unsafe { Box::from_raw(path.take_inner()) }, contents, local_reply_path);
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::onion_message::messenger::SendError::native_into(e) }).into() };
local_ret
}
impl From<nativeOnionMessenger> for crate::lightning::ln::msgs::OnionMessageHandler {
fn from(obj: nativeOnionMessenger) -> Self {
- let mut rust_obj = OnionMessenger { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::onion_message::messenger::OnionMessenger { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = OnionMessenger_as_OnionMessageHandler(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(OnionMessenger_free_void);
ret
}
this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
free: None,
handle_onion_message: OnionMessenger_OnionMessageHandler_handle_onion_message,
+ next_onion_message_for_peer: OnionMessenger_OnionMessageHandler_next_onion_message_for_peer,
peer_connected: OnionMessenger_OnionMessageHandler_peer_connected,
peer_disconnected: OnionMessenger_OnionMessageHandler_peer_disconnected,
provided_node_features: OnionMessenger_OnionMessageHandler_provided_node_features,
provided_init_features: OnionMessenger_OnionMessageHandler_provided_init_features,
- OnionMessageProvider: crate::lightning::events::OnionMessageProvider {
- this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
- free: None,
- next_onion_message_for_peer: OnionMessenger_OnionMessageProvider_next_onion_message_for_peer,
- },
}
}
<nativeOnionMessenger as lightning::ln::msgs::OnionMessageHandler<>>::handle_onion_message(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, &peer_node_id.into_rust(), msg.get_native_ref())
}
#[must_use]
+extern "C" fn OnionMessenger_OnionMessageHandler_next_onion_message_for_peer(this_arg: *const c_void, mut peer_node_id: crate::c_types::PublicKey) -> crate::lightning::ln::msgs::OnionMessage {
+ let mut ret = <nativeOnionMessenger as lightning::ln::msgs::OnionMessageHandler<>>::next_onion_message_for_peer(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, peer_node_id.into_rust());
+ let mut local_ret = crate::lightning::ln::msgs::OnionMessage { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true };
+ local_ret
+}
+#[must_use]
extern "C" fn OnionMessenger_OnionMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ {
let mut ret = <nativeOnionMessenger as lightning::ln::msgs::OnionMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, &their_node_id.into_rust(), init.get_native_ref(), inbound);
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() };
crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
}
-impl From<nativeOnionMessenger> for crate::lightning::events::OnionMessageProvider {
- fn from(obj: nativeOnionMessenger) -> Self {
- let mut rust_obj = OnionMessenger { inner: ObjOps::heap_alloc(obj), is_owned: true };
- let mut ret = OnionMessenger_as_OnionMessageProvider(&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 = core::ptr::null_mut();
- ret.free = Some(OnionMessenger_free_void);
- ret
- }
-}
-/// Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
-/// This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
-#[no_mangle]
-pub extern "C" fn OnionMessenger_as_OnionMessageProvider(this_arg: &OnionMessenger) -> crate::lightning::events::OnionMessageProvider {
- crate::lightning::events::OnionMessageProvider {
- this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void },
- free: None,
- next_onion_message_for_peer: OnionMessenger_OnionMessageProvider_next_onion_message_for_peer,
- }
-}
-
-#[must_use]
-extern "C" fn OnionMessenger_OnionMessageProvider_next_onion_message_for_peer(this_arg: *const c_void, mut peer_node_id: crate::c_types::PublicKey) -> crate::lightning::ln::msgs::OnionMessage {
- let mut ret = <nativeOnionMessenger as lightning::events::OnionMessageProvider<>>::next_onion_message_for_peer(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, peer_node_id.into_rust());
- let mut local_ret = crate::lightning::ln::msgs::OnionMessage { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true };
- local_ret
-}
-
pub this_arg: *mut c_void,
/// Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment,
/// or replying with an error.
+ ///
+ /// The returned [`OffersMessage`], if any, is enqueued to be sent by [`OnionMessenger`].
+ ///
+ /// [`OnionMessenger`]: crate::onion_message::OnionMessenger
pub handle_message: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::offers::OffersMessage) -> crate::c_types::derived::COption_OffersMessageZ,
+ /// Releases any [`OffersMessage`]s that need to be sent.
+ ///
+ /// Typically, this is used for messages initiating a payment flow rather than in response to
+ /// another message. The latter should use the return value of [`Self::handle_message`].
+ pub release_pending_messages: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ,
/// 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 OffersMessageHandler {}
unsafe impl Sync for OffersMessageHandler {}
+#[allow(unused)]
pub(crate) fn OffersMessageHandler_clone_fields(orig: &OffersMessageHandler) -> OffersMessageHandler {
OffersMessageHandler {
this_arg: orig.this_arg,
handle_message: Clone::clone(&orig.handle_message),
+ release_pending_messages: Clone::clone(&orig.release_pending_messages),
free: Clone::clone(&orig.free),
}
}
let mut local_ret = { /*ret*/ let ret_opt = ret; if ret_opt.is_none() { None } else { Some({ { { ret_opt.take() }.into_native() }})} };
local_ret
}
+ fn release_pending_messages(&self) -> Vec<(lightning::onion_message::offers::OffersMessage, lightning::onion_message::messenger::Destination, Option<lightning::blinded_path::BlindedPath>)> {
+ let mut ret = (self.release_pending_messages)(self.this_arg);
+ let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2) = item.to_rust(); let mut local_orig_ret_0_2 = if orig_ret_0_2.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(orig_ret_0_2.take_inner()) } }) }; let mut local_ret_0 = (orig_ret_0_0.into_native(), orig_ret_0_1.into_native(), local_orig_ret_0_2); local_ret_0 }); };
+ local_ret
+ }
}
// We're essentially a pointer already, or at least a set of pointers, so allow us to be used
pub extern "C" fn OffersMessage_clone(orig: &OffersMessage) -> OffersMessage {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn OffersMessage_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const OffersMessage)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn OffersMessage_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut OffersMessage) };
+}
#[no_mangle]
/// Utility method to constructs a new InvoiceRequest-variant OffersMessage
pub extern "C" fn OffersMessage_invoice_request(a: crate::lightning::offers::invoice_request::InvoiceRequest) -> OffersMessage {
ret
}
-/// The TLV record type for the message as used in an `onionmsg_tlv` TLV stream.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn OffersMessage_tlv_type(this_arg: &crate::lightning::onion_message::offers::OffersMessage) -> u64 {
- let mut ret = this_arg.to_native().tlv_type();
- ret
-}
-
#[no_mangle]
/// Serialize the OffersMessage object into a byte array which can be read by OffersMessage_read
pub extern "C" fn OffersMessage_write(obj: &crate::lightning::onion_message::offers::OffersMessage) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn OffersMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ OffersMessage_write(unsafe { &*(obj as *const OffersMessage) })
+}
#[no_mangle]
/// Read a OffersMessage from a byte array, created by OffersMessage_write
pub extern "C" fn OffersMessage_read(ser: crate::c_types::u8slice, arg_a: u64, arg_b: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_OffersMessageDecodeErrorZ {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Packet_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePacket)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePacket)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Packet
pub extern "C" fn Packet_write(obj: &crate::lightning::onion_message::packet::Packet) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn Packet_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePacket) })
}
-/// The contents of an onion message. In the context of offers, this would be the invoice, invoice
-/// request, or invoice error.
+/// The contents of an [`OnionMessage`] as read from the wire.
+///
+/// [`OnionMessage`]: crate::ln::msgs::OnionMessage
#[derive(Clone)]
#[must_use]
#[repr(C)]
-pub enum OnionMessageContents {
+pub enum ParsedOnionMessageContents {
/// A message related to BOLT 12 Offers.
Offers(
crate::lightning::onion_message::offers::OffersMessage),
/// A custom onion message specified by the user.
Custom(
- crate::lightning::onion_message::packet::CustomOnionMessageContents),
+ crate::lightning::onion_message::packet::OnionMessageContents),
}
-use lightning::onion_message::packet::OnionMessageContents as OnionMessageContentsImport;
-pub(crate) type nativeOnionMessageContents = OnionMessageContentsImport<crate::lightning::onion_message::packet::CustomOnionMessageContents>;
+use lightning::onion_message::packet::ParsedOnionMessageContents as ParsedOnionMessageContentsImport;
+pub(crate) type nativeParsedOnionMessageContents = ParsedOnionMessageContentsImport<crate::lightning::onion_message::packet::OnionMessageContents>;
-impl OnionMessageContents {
+impl ParsedOnionMessageContents {
#[allow(unused)]
- pub(crate) fn to_native(&self) -> nativeOnionMessageContents {
+ pub(crate) fn to_native(&self) -> nativeParsedOnionMessageContents {
match self {
- OnionMessageContents::Offers (ref a, ) => {
+ ParsedOnionMessageContents::Offers (ref a, ) => {
let mut a_nonref = Clone::clone(a);
- nativeOnionMessageContents::Offers (
+ nativeParsedOnionMessageContents::Offers (
a_nonref.into_native(),
)
},
- OnionMessageContents::Custom (ref a, ) => {
+ ParsedOnionMessageContents::Custom (ref a, ) => {
let mut a_nonref = Clone::clone(a);
- nativeOnionMessageContents::Custom (
+ nativeParsedOnionMessageContents::Custom (
a_nonref,
)
},
}
}
#[allow(unused)]
- pub(crate) fn into_native(self) -> nativeOnionMessageContents {
+ pub(crate) fn into_native(self) -> nativeParsedOnionMessageContents {
match self {
- OnionMessageContents::Offers (mut a, ) => {
- nativeOnionMessageContents::Offers (
+ ParsedOnionMessageContents::Offers (mut a, ) => {
+ nativeParsedOnionMessageContents::Offers (
a.into_native(),
)
},
- OnionMessageContents::Custom (mut a, ) => {
- nativeOnionMessageContents::Custom (
+ ParsedOnionMessageContents::Custom (mut a, ) => {
+ nativeParsedOnionMessageContents::Custom (
a,
)
},
}
}
#[allow(unused)]
- pub(crate) fn from_native(native: &nativeOnionMessageContents) -> Self {
+ pub(crate) fn from_native(native: &nativeParsedOnionMessageContents) -> Self {
match native {
- nativeOnionMessageContents::Offers (ref a, ) => {
+ nativeParsedOnionMessageContents::Offers (ref a, ) => {
let mut a_nonref = Clone::clone(a);
- OnionMessageContents::Offers (
+ ParsedOnionMessageContents::Offers (
crate::lightning::onion_message::offers::OffersMessage::native_into(a_nonref),
)
},
- nativeOnionMessageContents::Custom (ref a, ) => {
+ nativeParsedOnionMessageContents::Custom (ref a, ) => {
let mut a_nonref = Clone::clone(a);
- OnionMessageContents::Custom (
+ ParsedOnionMessageContents::Custom (
Into::into(a_nonref),
)
},
}
}
#[allow(unused)]
- pub(crate) fn native_into(native: nativeOnionMessageContents) -> Self {
+ pub(crate) fn native_into(native: nativeParsedOnionMessageContents) -> Self {
match native {
- nativeOnionMessageContents::Offers (mut a, ) => {
- OnionMessageContents::Offers (
+ nativeParsedOnionMessageContents::Offers (mut a, ) => {
+ ParsedOnionMessageContents::Offers (
crate::lightning::onion_message::offers::OffersMessage::native_into(a),
)
},
- nativeOnionMessageContents::Custom (mut a, ) => {
- OnionMessageContents::Custom (
+ nativeParsedOnionMessageContents::Custom (mut a, ) => {
+ ParsedOnionMessageContents::Custom (
Into::into(a),
)
},
}
}
}
-/// Frees any resources used by the OnionMessageContents
+/// Frees any resources used by the ParsedOnionMessageContents
#[no_mangle]
-pub extern "C" fn OnionMessageContents_free(this_ptr: OnionMessageContents) { }
-/// Creates a copy of the OnionMessageContents
+pub extern "C" fn ParsedOnionMessageContents_free(this_ptr: ParsedOnionMessageContents) { }
+/// Creates a copy of the ParsedOnionMessageContents
#[no_mangle]
-pub extern "C" fn OnionMessageContents_clone(orig: &OnionMessageContents) -> OnionMessageContents {
+pub extern "C" fn ParsedOnionMessageContents_clone(orig: &ParsedOnionMessageContents) -> ParsedOnionMessageContents {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ParsedOnionMessageContents_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ParsedOnionMessageContents)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ParsedOnionMessageContents_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut ParsedOnionMessageContents) };
+}
+#[no_mangle]
+/// Utility method to constructs a new Offers-variant ParsedOnionMessageContents
+pub extern "C" fn ParsedOnionMessageContents_offers(a: crate::lightning::onion_message::offers::OffersMessage) -> ParsedOnionMessageContents {
+ ParsedOnionMessageContents::Offers(a, )
+}
+#[no_mangle]
+/// Utility method to constructs a new Custom-variant ParsedOnionMessageContents
+pub extern "C" fn ParsedOnionMessageContents_custom(a: crate::lightning::onion_message::packet::OnionMessageContents) -> ParsedOnionMessageContents {
+ ParsedOnionMessageContents::Custom(a, )
+}
+impl From<nativeParsedOnionMessageContents> for crate::lightning::onion_message::packet::OnionMessageContents {
+ fn from(obj: nativeParsedOnionMessageContents) -> Self {
+ let rust_obj = crate::lightning::onion_message::packet::ParsedOnionMessageContents::native_into(obj);
+ let mut ret = ParsedOnionMessageContents_as_OnionMessageContents(&rust_obj);
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
+ ret.free = Some(ParsedOnionMessageContents_free_void);
+ ret
+ }
+}
+/// Constructs a new OnionMessageContents which calls the relevant methods on this_arg.
+/// This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is
#[no_mangle]
-/// Utility method to constructs a new Offers-variant OnionMessageContents
-pub extern "C" fn OnionMessageContents_offers(a: crate::lightning::onion_message::offers::OffersMessage) -> OnionMessageContents {
- OnionMessageContents::Offers(a, )
+pub extern "C" fn ParsedOnionMessageContents_as_OnionMessageContents(this_arg: &ParsedOnionMessageContents) -> crate::lightning::onion_message::packet::OnionMessageContents {
+ crate::lightning::onion_message::packet::OnionMessageContents {
+ this_arg: unsafe { ObjOps::untweak_ptr(this_arg as *const ParsedOnionMessageContents as *mut ParsedOnionMessageContents) as *mut c_void },
+ free: None,
+ tlv_type: ParsedOnionMessageContents_OnionMessageContents_tlv_type,
+ write: ParsedOnionMessageContents_write_void,
+ cloned: Some(OnionMessageContents_ParsedOnionMessageContents_cloned),
+ }
+}
+
+#[must_use]
+extern "C" fn ParsedOnionMessageContents_OnionMessageContents_tlv_type(this_arg: *const c_void) -> u64 {
+ let mut ret = <nativeParsedOnionMessageContents as lightning::onion_message::packet::OnionMessageContents<>>::tlv_type(unsafe { &mut *(this_arg as *mut nativeParsedOnionMessageContents) }, );
+ ret
}
+extern "C" fn OnionMessageContents_ParsedOnionMessageContents_cloned(new_obj: &mut crate::lightning::onion_message::packet::OnionMessageContents) {
+ new_obj.this_arg = ParsedOnionMessageContents_clone_void(new_obj.this_arg);
+ new_obj.free = Some(ParsedOnionMessageContents_free_void);
+}
+
#[no_mangle]
-/// Utility method to constructs a new Custom-variant OnionMessageContents
-pub extern "C" fn OnionMessageContents_custom(a: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> OnionMessageContents {
- OnionMessageContents::Custom(a, )
+/// Serialize the ParsedOnionMessageContents object into a byte array which can be read by ParsedOnionMessageContents_read
+pub extern "C" fn ParsedOnionMessageContents_write(obj: &crate::lightning::onion_message::packet::ParsedOnionMessageContents) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
+}
+#[allow(unused)]
+pub(crate) extern "C" fn ParsedOnionMessageContents_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ ParsedOnionMessageContents_write(unsafe { &*(obj as *const ParsedOnionMessageContents) })
}
-/// The contents of a custom onion message.
+/// The contents of an onion message.
#[repr(C)]
-pub struct CustomOnionMessageContents {
+pub struct OnionMessageContents {
/// 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,
pub tlv_type: extern "C" fn (this_arg: *const c_void) -> u64,
/// Serialize the object into a byte array
pub write: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z,
- /// Called, if set, after this CustomOnionMessageContents has been cloned into a duplicate object.
- /// The new CustomOnionMessageContents is provided, and should be mutated as needed to perform a
+ /// Called, if set, after this OnionMessageContents has been cloned into a duplicate object.
+ /// The new OnionMessageContents 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.
- pub cloned: Option<extern "C" fn (new_CustomOnionMessageContents: &mut CustomOnionMessageContents)>,
+ pub cloned: Option<extern "C" fn (new_OnionMessageContents: &mut OnionMessageContents)>,
/// 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 CustomOnionMessageContents {}
-unsafe impl Sync for CustomOnionMessageContents {}
-pub(crate) fn CustomOnionMessageContents_clone_fields(orig: &CustomOnionMessageContents) -> CustomOnionMessageContents {
- CustomOnionMessageContents {
+unsafe impl Send for OnionMessageContents {}
+unsafe impl Sync for OnionMessageContents {}
+#[allow(unused)]
+pub(crate) fn OnionMessageContents_clone_fields(orig: &OnionMessageContents) -> OnionMessageContents {
+ OnionMessageContents {
this_arg: orig.this_arg,
tlv_type: Clone::clone(&orig.tlv_type),
write: Clone::clone(&orig.write),
free: Clone::clone(&orig.free),
}
}
-impl lightning::util::ser::Writeable for CustomOnionMessageContents {
+impl lightning::util::ser::Writeable for OnionMessageContents {
fn write<W: lightning::util::ser::Writer>(&self, w: &mut W) -> Result<(), crate::c_types::io::Error> {
let vec = (self.write)(self.this_arg);
w.write_all(vec.as_slice())
}
}
#[no_mangle]
-/// Creates a copy of a CustomOnionMessageContents
-pub extern "C" fn CustomOnionMessageContents_clone(orig: &CustomOnionMessageContents) -> CustomOnionMessageContents {
- let mut res = CustomOnionMessageContents_clone_fields(orig);
+/// Creates a copy of a OnionMessageContents
+pub extern "C" fn OnionMessageContents_clone(orig: &OnionMessageContents) -> OnionMessageContents {
+ let mut res = OnionMessageContents_clone_fields(orig);
if let Some(f) = orig.cloned { (f)(&mut res) };
res
}
-impl Clone for CustomOnionMessageContents {
+impl Clone for OnionMessageContents {
fn clone(&self) -> Self {
- CustomOnionMessageContents_clone(self)
+ OnionMessageContents_clone(self)
}
}
-use lightning::onion_message::packet::CustomOnionMessageContents as rustCustomOnionMessageContents;
-impl rustCustomOnionMessageContents for CustomOnionMessageContents {
+use lightning::onion_message::packet::OnionMessageContents as rustOnionMessageContents;
+impl rustOnionMessageContents for OnionMessageContents {
fn tlv_type(&self) -> u64 {
let mut ret = (self.tlv_type)(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 core::ops::Deref for CustomOnionMessageContents {
+impl core::ops::Deref for OnionMessageContents {
type Target = Self;
fn deref(&self) -> &Self {
self
}
}
-impl core::ops::DerefMut for CustomOnionMessageContents {
+impl core::ops::DerefMut for OnionMessageContents {
fn deref_mut(&mut self) -> &mut Self {
self
}
}
/// Calls the free function if one is set
#[no_mangle]
-pub extern "C" fn CustomOnionMessageContents_free(this_ptr: CustomOnionMessageContents) { }
-impl Drop for CustomOnionMessageContents {
+pub extern "C" fn OnionMessageContents_free(this_ptr: OnionMessageContents) { }
+impl Drop for OnionMessageContents {
fn drop(&mut self) {
if let Some(f) = self.free {
f(self.this_arg);
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn NodeId_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeId)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeNodeId)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the NodeId
pub extern "C" fn NodeId_write(obj: &crate::lightning::routing::gossip::NodeId) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn NodeId_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeId) })
}
pub extern "C" fn NetworkUpdate_clone(orig: &NetworkUpdate) -> NetworkUpdate {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn NetworkUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const NetworkUpdate)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn NetworkUpdate_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut NetworkUpdate) };
+}
#[no_mangle]
/// Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
pub extern "C" fn NetworkUpdate_channel_update_message(msg: crate::lightning::ln::msgs::ChannelUpdate) -> NetworkUpdate {
pub extern "C" fn NetworkUpdate_write(obj: &crate::lightning::routing::gossip::NetworkUpdate) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn NetworkUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ NetworkUpdate_write(unsafe { &*(obj as *const NetworkUpdate) })
+}
#[no_mangle]
/// Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
pub extern "C" fn NetworkUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_NetworkUpdateZDecodeErrorZ {
}
/// Handles any network updates originating from [`Event`]s.
+/// Note that this will skip applying any [`NetworkUpdate::ChannelUpdateMessage`] to avoid
+/// leaking possibly identifying information of the sender to the public network.
///
/// [`Event`]: crate::events::Event
#[no_mangle]
unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.handle_network_update(&network_update.to_native())
}
-/// Gets the genesis hash for this network graph.
+/// Gets the chain hash for this network graph.
#[must_use]
#[no_mangle]
-pub extern "C" fn NetworkGraph_get_genesis_hash(this_arg: &crate::lightning::routing::gossip::NetworkGraph) -> crate::c_types::ThirtyTwoBytes {
- let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_genesis_hash();
- crate::c_types::ThirtyTwoBytes { data: ret.into_inner() }
+pub extern "C" fn NetworkGraph_get_chain_hash(this_arg: &crate::lightning::routing::gossip::NetworkGraph) -> crate::c_types::ThirtyTwoBytes {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_chain_hash();
+ crate::c_types::ThirtyTwoBytes { data: ret.to_bytes() }
}
/// Verifies the signature of a [`NodeAnnouncement`].
impl From<nativeP2PGossipSync> for crate::lightning::ln::msgs::RoutingMessageHandler {
fn from(obj: nativeP2PGossipSync) -> Self {
- let mut rust_obj = P2PGossipSync { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::routing::gossip::P2PGossipSync { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = P2PGossipSync_as_RoutingMessageHandler(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(P2PGossipSync_free_void);
ret
}
impl From<nativeP2PGossipSync> for crate::lightning::events::MessageSendEventsProvider {
fn from(obj: nativeP2PGossipSync) -> Self {
- let mut rust_obj = P2PGossipSync { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::routing::gossip::P2PGossipSync { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = P2PGossipSync_as_MessageSendEventsProvider(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(P2PGossipSync_free_void);
ret
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelUpdateInfo_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelUpdateInfo)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelUpdateInfo)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelUpdateInfo
pub extern "C" fn ChannelUpdateInfo_write(obj: &crate::lightning::routing::gossip::ChannelUpdateInfo) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelUpdateInfo_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelUpdateInfo) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelInfo_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelInfo)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelInfo)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelInfo
pub extern "C" fn ChannelInfo_write(obj: &crate::lightning::routing::gossip::ChannelInfo) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelInfo_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelInfo) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn DirectedChannelInfo_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDirectedChannelInfo)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeDirectedChannelInfo)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the DirectedChannelInfo
pub extern "C" fn EffectiveCapacity_clone(orig: &EffectiveCapacity) -> EffectiveCapacity {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn EffectiveCapacity_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const EffectiveCapacity)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn EffectiveCapacity_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut EffectiveCapacity) };
+}
#[no_mangle]
/// Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
pub extern "C" fn EffectiveCapacity_exact_liquidity(liquidity_msat: u64) -> EffectiveCapacity {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn RoutingFees_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRoutingFees)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRoutingFees)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the RoutingFees
pub extern "C" fn RoutingFees_write(obj: &crate::lightning::routing::gossip::RoutingFees) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn RoutingFees_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRoutingFees) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn NodeAnnouncementInfo_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeAnnouncementInfo)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeNodeAnnouncementInfo)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the NodeAnnouncementInfo
pub extern "C" fn NodeAnnouncementInfo_write(obj: &crate::lightning::routing::gossip::NodeAnnouncementInfo) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn NodeAnnouncementInfo_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeAnnouncementInfo) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn NodeAlias_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeAlias)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeNodeAlias)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the NodeAlias
pub extern "C" fn NodeAlias_write(obj: &crate::lightning::routing::gossip::NodeAlias) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn NodeAlias_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeAlias) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn NodeInfo_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeInfo)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeNodeInfo)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the NodeInfo
pub extern "C" fn NodeInfo_write(obj: &crate::lightning::routing::gossip::NodeInfo) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn NodeInfo_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeInfo) })
}
pub extern "C" fn NetworkGraph_write(obj: &crate::lightning::routing::gossip::NetworkGraph) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn NetworkGraph_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNetworkGraph) })
}
/// 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 P2PGossipSync's
-/// RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
+/// You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'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
local_ret
}
+/// For an already known (from announcement) channel, verify the given [`ChannelUpdate`].
+///
+/// This checks whether the update currently is applicable by [`Self::update_channel`].
+///
+/// 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_verify_channel_update(this_arg: &crate::lightning::routing::gossip::NetworkGraph, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.verify_channel_update(msg.get_native_ref());
+ 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
+ local_ret
+}
+
/// Returns information on a channel with the given id.
///
/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
impl From<nativeDefaultRouter> for crate::lightning::routing::router::Router {
fn from(obj: nativeDefaultRouter) -> Self {
- let mut rust_obj = DefaultRouter { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::routing::router::DefaultRouter { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = DefaultRouter_as_Router(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(DefaultRouter_free_void);
ret
}
}
unsafe impl Send for Router {}
unsafe impl Sync for Router {}
+#[allow(unused)]
pub(crate) fn Router_clone_fields(orig: &Router) -> Router {
Router {
this_arg: orig.this_arg,
impl From<nativeScorerAccountingForInFlightHtlcs> for crate::lightning::routing::scoring::ScoreLookUp {
fn from(obj: nativeScorerAccountingForInFlightHtlcs) -> Self {
- let mut rust_obj = ScorerAccountingForInFlightHtlcs { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::routing::router::ScorerAccountingForInFlightHtlcs { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ScorerAccountingForInFlightHtlcs_free_void);
ret
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn InFlightHtlcs_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInFlightHtlcs)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInFlightHtlcs)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the InFlightHtlcs
pub extern "C" fn InFlightHtlcs_write(obj: &crate::lightning::routing::router::InFlightHtlcs) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn InFlightHtlcs_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInFlightHtlcs) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn RouteHop_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRouteHop)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRouteHop)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the RouteHop
pub extern "C" fn RouteHop_write(obj: &crate::lightning::routing::router::RouteHop) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn RouteHop_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRouteHop) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn BlindedTail_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBlindedTail)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedTail)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the BlindedTail
pub extern "C" fn BlindedTail_write(obj: &crate::lightning::routing::router::BlindedTail) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn BlindedTail_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBlindedTail) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Path_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePath)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePath)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Path
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Route_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRoute)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRoute)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Route
pub extern "C" fn Route_write(obj: &crate::lightning::routing::router::Route) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn Route_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRoute) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn RouteParameters_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRouteParameters)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRouteParameters)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the RouteParameters
pub extern "C" fn RouteParameters_write(obj: &crate::lightning::routing::router::RouteParameters) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn RouteParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRouteParameters) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn PaymentParameters_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePaymentParameters)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePaymentParameters)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the PaymentParameters
pub extern "C" fn PaymentParameters_write(obj: &crate::lightning::routing::router::PaymentParameters) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn PaymentParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePaymentParameters) })
}
pub extern "C" fn Payee_clone(orig: &Payee) -> Payee {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Payee_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Payee)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Payee_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut Payee) };
+}
#[no_mangle]
/// Utility method to constructs a new Blinded-variant Payee
pub extern "C" fn Payee_blinded(route_hints: crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ, features: crate::lightning::ln::features::Bolt12InvoiceFeatures) -> Payee {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn RouteHint_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRouteHint)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRouteHint)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the RouteHint
pub extern "C" fn RouteHint_write(obj: &crate::lightning::routing::router::RouteHint) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn RouteHint_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRouteHint) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn RouteHintHop_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRouteHintHop)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRouteHintHop)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the RouteHintHop
pub extern "C" fn RouteHintHop_write(obj: &crate::lightning::routing::router::RouteHintHop) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn RouteHintHop_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRouteHintHop) })
}
}
unsafe impl Send for ScoreLookUp {}
unsafe impl Sync for ScoreLookUp {}
+#[allow(unused)]
pub(crate) fn ScoreLookUp_clone_fields(orig: &ScoreLookUp) -> ScoreLookUp {
ScoreLookUp {
this_arg: orig.this_arg,
}
unsafe impl Send for ScoreUpdate {}
unsafe impl Sync for ScoreUpdate {}
+#[allow(unused)]
pub(crate) fn ScoreUpdate_clone_fields(orig: &ScoreUpdate) -> ScoreUpdate {
ScoreUpdate {
this_arg: orig.this_arg,
}
unsafe impl Send for Score {}
unsafe impl Sync for Score {}
+#[allow(unused)]
pub(crate) fn Score_clone_fields(orig: &Score) -> Score {
Score {
this_arg: orig.this_arg,
}
unsafe impl Send for LockableScore {}
unsafe impl Sync for LockableScore {}
+#[allow(unused)]
pub(crate) fn LockableScore_clone_fields(orig: &LockableScore) -> LockableScore {
LockableScore {
this_arg: orig.this_arg,
}
unsafe impl Send for WriteableScore {}
unsafe impl Sync for WriteableScore {}
+#[allow(unused)]
pub(crate) fn WriteableScore_clone_fields(orig: &WriteableScore) -> WriteableScore {
WriteableScore {
this_arg: orig.this_arg,
}
impl From<nativeMultiThreadedLockableScore> for crate::lightning::routing::scoring::LockableScore {
fn from(obj: nativeMultiThreadedLockableScore) -> Self {
- let mut rust_obj = MultiThreadedLockableScore { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::routing::scoring::MultiThreadedLockableScore { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = MultiThreadedLockableScore_as_LockableScore(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(MultiThreadedLockableScore_free_void);
ret
}
pub extern "C" fn MultiThreadedLockableScore_write(obj: &crate::lightning::routing::scoring::MultiThreadedLockableScore) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn MultiThreadedLockableScore_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeMultiThreadedLockableScore) })
}
impl From<nativeMultiThreadedLockableScore> for crate::lightning::routing::scoring::WriteableScore {
fn from(obj: nativeMultiThreadedLockableScore) -> Self {
- let mut rust_obj = MultiThreadedLockableScore { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::routing::scoring::MultiThreadedLockableScore { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = MultiThreadedLockableScore_as_WriteableScore(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(MultiThreadedLockableScore_free_void);
ret
}
}
impl From<nativeMultiThreadedScoreLockRead> for crate::lightning::routing::scoring::ScoreLookUp {
fn from(obj: nativeMultiThreadedScoreLockRead) -> Self {
- let mut rust_obj = MultiThreadedScoreLockRead { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::routing::scoring::MultiThreadedScoreLockRead { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(MultiThreadedScoreLockRead_free_void);
ret
}
pub extern "C" fn MultiThreadedScoreLockWrite_write(obj: &crate::lightning::routing::scoring::MultiThreadedScoreLockWrite) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn MultiThreadedScoreLockWrite_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeMultiThreadedScoreLockWrite) })
}
impl From<nativeMultiThreadedScoreLockWrite> for crate::lightning::routing::scoring::ScoreUpdate {
fn from(obj: nativeMultiThreadedScoreLockWrite) -> Self {
- let mut rust_obj = MultiThreadedScoreLockWrite { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::routing::scoring::MultiThreadedScoreLockWrite { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(MultiThreadedScoreLockWrite_free_void);
ret
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelUsage_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelUsage)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelUsage)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelUsage
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn FixedPenaltyScorer_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFixedPenaltyScorer)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeFixedPenaltyScorer)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the FixedPenaltyScorer
impl From<nativeFixedPenaltyScorer> for crate::lightning::routing::scoring::ScoreLookUp {
fn from(obj: nativeFixedPenaltyScorer) -> Self {
- let mut rust_obj = FixedPenaltyScorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::routing::scoring::FixedPenaltyScorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = FixedPenaltyScorer_as_ScoreLookUp(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(FixedPenaltyScorer_free_void);
ret
}
impl From<nativeFixedPenaltyScorer> for crate::lightning::routing::scoring::ScoreUpdate {
fn from(obj: nativeFixedPenaltyScorer) -> Self {
- let mut rust_obj = FixedPenaltyScorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::routing::scoring::FixedPenaltyScorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = FixedPenaltyScorer_as_ScoreUpdate(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(FixedPenaltyScorer_free_void);
ret
}
pub extern "C" fn FixedPenaltyScorer_write(obj: &crate::lightning::routing::scoring::FixedPenaltyScorer) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn FixedPenaltyScorer_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFixedPenaltyScorer) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ProbabilisticScoringFeeParameters_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeProbabilisticScoringFeeParameters)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeProbabilisticScoringFeeParameters)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ProbabilisticScoringFeeParameters
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ProbabilisticScoringDecayParameters_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeProbabilisticScoringDecayParameters)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeProbabilisticScoringDecayParameters)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ProbabilisticScoringDecayParameters
impl From<nativeProbabilisticScorer> for crate::lightning::routing::scoring::ScoreLookUp {
fn from(obj: nativeProbabilisticScorer) -> Self {
- let mut rust_obj = ProbabilisticScorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::routing::scoring::ProbabilisticScorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ProbabilisticScorer_as_ScoreLookUp(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ProbabilisticScorer_free_void);
ret
}
impl From<nativeProbabilisticScorer> for crate::lightning::routing::scoring::ScoreUpdate {
fn from(obj: nativeProbabilisticScorer) -> Self {
- let mut rust_obj = ProbabilisticScorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::routing::scoring::ProbabilisticScorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ProbabilisticScorer_as_ScoreUpdate(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ProbabilisticScorer_free_void);
ret
}
impl From<nativeProbabilisticScorer> for crate::lightning::routing::scoring::Score {
fn from(obj: nativeProbabilisticScorer) -> Self {
- let mut rust_obj = ProbabilisticScorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::routing::scoring::ProbabilisticScorer { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = ProbabilisticScorer_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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(ProbabilisticScorer_free_void);
ret
}
pub extern "C" fn ProbabilisticScorer_write(obj: &crate::lightning::routing::scoring::ProbabilisticScorer) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ProbabilisticScorer_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeProbabilisticScorer) })
}
pub extern "C" fn UtxoLookupError_clone(orig: &UtxoLookupError) -> UtxoLookupError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn UtxoLookupError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const UtxoLookupError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn UtxoLookupError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut UtxoLookupError) };
+}
#[no_mangle]
/// Utility method to constructs a new UnknownChain-variant UtxoLookupError
pub extern "C" fn UtxoLookupError_unknown_chain() -> UtxoLookupError {
pub extern "C" fn UtxoResult_clone(orig: &UtxoResult) -> UtxoResult {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn UtxoResult_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const UtxoResult)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn UtxoResult_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut UtxoResult) };
+}
#[no_mangle]
/// Utility method to constructs a new Sync-variant UtxoResult
pub extern "C" fn UtxoResult_sync(a: crate::c_types::derived::CResult_TxOutUtxoLookupErrorZ) -> UtxoResult {
/// This has no meaning in the LDK, and can be NULL or any other value.
pub this_arg: *mut c_void,
/// Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
- /// Returns an error if `genesis_hash` is for a different chain or if such a transaction output
- /// is unknown.
+ /// Returns an error if `chain_hash` is for a different chain or if such a transaction output is
+ /// unknown.
///
/// [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
- pub get_utxo: extern "C" fn (this_arg: *const c_void, genesis_hash: *const [u8; 32], short_channel_id: u64) -> crate::lightning::routing::utxo::UtxoResult,
+ pub get_utxo: extern "C" fn (this_arg: *const c_void, chain_hash: *const [u8; 32], short_channel_id: u64) -> crate::lightning::routing::utxo::UtxoResult,
/// 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 UtxoLookup {}
unsafe impl Sync for UtxoLookup {}
+#[allow(unused)]
pub(crate) fn UtxoLookup_clone_fields(orig: &UtxoLookup) -> UtxoLookup {
UtxoLookup {
this_arg: orig.this_arg,
use lightning::routing::utxo::UtxoLookup as rustUtxoLookup;
impl rustUtxoLookup for UtxoLookup {
- fn get_utxo(&self, mut genesis_hash: &bitcoin::BlockHash, mut short_channel_id: u64) -> lightning::routing::utxo::UtxoResult {
- let mut ret = (self.get_utxo)(self.this_arg, genesis_hash.as_inner(), short_channel_id);
+ fn get_utxo(&self, mut chain_hash: &bitcoin::blockdata::constants::ChainHash, mut short_channel_id: u64) -> lightning::routing::utxo::UtxoResult {
+ let mut ret = (self.get_utxo)(self.this_arg, chain_hash.as_bytes(), short_channel_id);
ret.into_native()
}
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn UtxoFuture_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUtxoFuture)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUtxoFuture)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the UtxoFuture
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn DelayedPaymentOutputDescriptor_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDelayedPaymentOutputDescriptor)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeDelayedPaymentOutputDescriptor)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the DelayedPaymentOutputDescriptor
pub extern "C" fn DelayedPaymentOutputDescriptor_write(obj: &crate::lightning::sign::DelayedPaymentOutputDescriptor) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn DelayedPaymentOutputDescriptor_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeDelayedPaymentOutputDescriptor) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn StaticPaymentOutputDescriptor_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeStaticPaymentOutputDescriptor)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeStaticPaymentOutputDescriptor)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the StaticPaymentOutputDescriptor
pub extern "C" fn StaticPaymentOutputDescriptor_write(obj: &crate::lightning::sign::StaticPaymentOutputDescriptor) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn StaticPaymentOutputDescriptor_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeStaticPaymentOutputDescriptor) })
}
pub extern "C" fn SpendableOutputDescriptor_clone(orig: &SpendableOutputDescriptor) -> SpendableOutputDescriptor {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SpendableOutputDescriptor_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const SpendableOutputDescriptor)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SpendableOutputDescriptor_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut SpendableOutputDescriptor) };
+}
#[no_mangle]
/// Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
pub extern "C" fn SpendableOutputDescriptor_static_output(outpoint: crate::lightning::chain::transaction::OutPoint, output: crate::c_types::TxOut) -> SpendableOutputDescriptor {
pub extern "C" fn SpendableOutputDescriptor_write(obj: &crate::lightning::sign::SpendableOutputDescriptor) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn SpendableOutputDescriptor_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ SpendableOutputDescriptor_write(unsafe { &*(obj as *const SpendableOutputDescriptor) })
+}
#[no_mangle]
/// Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
pub extern "C" fn SpendableOutputDescriptor_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_SpendableOutputDescriptorDecodeErrorZ {
local_ret
}
+
+use lightning::sign::ChannelDerivationParameters as nativeChannelDerivationParametersImport;
+pub(crate) type nativeChannelDerivationParameters = nativeChannelDerivationParametersImport;
+
+/// The parameters required to derive a channel signer via [`SignerProvider`].
+#[must_use]
+#[repr(C)]
+pub struct ChannelDerivationParameters {
+ /// 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 nativeChannelDerivationParameters,
+ /// 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 ChannelDerivationParameters {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeChannelDerivationParameters>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the ChannelDerivationParameters, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn ChannelDerivationParameters_free(this_obj: ChannelDerivationParameters) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelDerivationParameters_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelDerivationParameters) };
+}
+#[allow(unused)]
+impl ChannelDerivationParameters {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeChannelDerivationParameters {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelDerivationParameters {
+ 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 nativeChannelDerivationParameters {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The value in satoshis of the channel we're attempting to spend the anchor output of.
+#[no_mangle]
+pub extern "C" fn ChannelDerivationParameters_get_value_satoshis(this_ptr: &ChannelDerivationParameters) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().value_satoshis;
+ *inner_val
+}
+/// The value in satoshis of the channel we're attempting to spend the anchor output of.
+#[no_mangle]
+pub extern "C" fn ChannelDerivationParameters_set_value_satoshis(this_ptr: &mut ChannelDerivationParameters, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.value_satoshis = val;
+}
+/// The unique identifier to re-derive the signer for the associated channel.
+#[no_mangle]
+pub extern "C" fn ChannelDerivationParameters_get_keys_id(this_ptr: &ChannelDerivationParameters) -> *const [u8; 32] {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().keys_id;
+ inner_val
+}
+/// The unique identifier to re-derive the signer for the associated channel.
+#[no_mangle]
+pub extern "C" fn ChannelDerivationParameters_set_keys_id(this_ptr: &mut ChannelDerivationParameters, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.keys_id = val.data;
+}
+/// The necessary channel parameters that need to be provided to the re-derived signer through
+/// [`ChannelSigner::provide_channel_parameters`].
+#[no_mangle]
+pub extern "C" fn ChannelDerivationParameters_get_transaction_parameters(this_ptr: &ChannelDerivationParameters) -> crate::lightning::ln::chan_utils::ChannelTransactionParameters {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().transaction_parameters;
+ crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }
+}
+/// The necessary channel parameters that need to be provided to the re-derived signer through
+/// [`ChannelSigner::provide_channel_parameters`].
+#[no_mangle]
+pub extern "C" fn ChannelDerivationParameters_set_transaction_parameters(this_ptr: &mut ChannelDerivationParameters, mut val: crate::lightning::ln::chan_utils::ChannelTransactionParameters) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.transaction_parameters = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// Constructs a new ChannelDerivationParameters given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelDerivationParameters_new(mut value_satoshis_arg: u64, mut keys_id_arg: crate::c_types::ThirtyTwoBytes, mut transaction_parameters_arg: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> ChannelDerivationParameters {
+ ChannelDerivationParameters { inner: ObjOps::heap_alloc(nativeChannelDerivationParameters {
+ value_satoshis: value_satoshis_arg,
+ keys_id: keys_id_arg.data,
+ transaction_parameters: *unsafe { Box::from_raw(transaction_parameters_arg.take_inner()) },
+ }), is_owned: true }
+}
+impl Clone for ChannelDerivationParameters {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeChannelDerivationParameters>::is_null(self.inner) { core::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 ChannelDerivationParameters_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelDerivationParameters)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the ChannelDerivationParameters
+pub extern "C" fn ChannelDerivationParameters_clone(orig: &ChannelDerivationParameters) -> ChannelDerivationParameters {
+ orig.clone()
+}
+/// Checks if two ChannelDerivationParameterss 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 ChannelDerivationParameters_eq(a: &ChannelDerivationParameters, b: &ChannelDerivationParameters) -> 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 }
+}
+#[no_mangle]
+/// Serialize the ChannelDerivationParameters object into a byte array which can be read by ChannelDerivationParameters_read
+pub extern "C" fn ChannelDerivationParameters_write(obj: &crate::lightning::sign::ChannelDerivationParameters) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+}
+#[allow(unused)]
+pub(crate) extern "C" fn ChannelDerivationParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelDerivationParameters) })
+}
+#[no_mangle]
+/// Read a ChannelDerivationParameters from a byte array, created by ChannelDerivationParameters_write
+pub extern "C" fn ChannelDerivationParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelDerivationParametersDecodeErrorZ {
+ let res: Result<lightning::sign::ChannelDerivationParameters, 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::sign::ChannelDerivationParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
+ local_res
+}
+
+use lightning::sign::HTLCDescriptor as nativeHTLCDescriptorImport;
+pub(crate) type nativeHTLCDescriptor = nativeHTLCDescriptorImport;
+
+/// A descriptor used to sign for a commitment transaction's HTLC output.
+#[must_use]
+#[repr(C)]
+pub struct HTLCDescriptor {
+ /// 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 nativeHTLCDescriptor,
+ /// 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 HTLCDescriptor {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeHTLCDescriptor>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the HTLCDescriptor, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_free(this_obj: HTLCDescriptor) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn HTLCDescriptor_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeHTLCDescriptor) };
+}
+#[allow(unused)]
+impl HTLCDescriptor {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeHTLCDescriptor {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeHTLCDescriptor {
+ 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 nativeHTLCDescriptor {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The parameters required to derive the signer for the HTLC input.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_get_channel_derivation_parameters(this_ptr: &HTLCDescriptor) -> crate::lightning::sign::ChannelDerivationParameters {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_derivation_parameters;
+ crate::lightning::sign::ChannelDerivationParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::sign::ChannelDerivationParameters<>) as *mut _) }, is_owned: false }
+}
+/// The parameters required to derive the signer for the HTLC input.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_set_channel_derivation_parameters(this_ptr: &mut HTLCDescriptor, mut val: crate::lightning::sign::ChannelDerivationParameters) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_derivation_parameters = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The number of the commitment transaction in which the HTLC output lives.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_get_per_commitment_number(this_ptr: &HTLCDescriptor) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().per_commitment_number;
+ *inner_val
+}
+/// The number of the commitment transaction in which the HTLC output lives.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_set_per_commitment_number(this_ptr: &mut HTLCDescriptor, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.per_commitment_number = val;
+}
+/// The key tweak corresponding to the number of the commitment transaction in which the HTLC
+/// output lives. This tweak is applied to all the basepoints for both parties in the channel to
+/// arrive at unique keys per commitment.
+///
+/// See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_get_per_commitment_point(this_ptr: &HTLCDescriptor) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().per_commitment_point;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// The key tweak corresponding to the number of the commitment transaction in which the HTLC
+/// output lives. This tweak is applied to all the basepoints for both parties in the channel to
+/// arrive at unique keys per commitment.
+///
+/// See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_set_per_commitment_point(this_ptr: &mut HTLCDescriptor, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.per_commitment_point = val.into_rust();
+}
+/// The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs
+/// originating from a channel supporting anchor outputs, otherwise it is the channel's
+/// negotiated feerate at the time the commitment transaction was built.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_get_feerate_per_kw(this_ptr: &HTLCDescriptor) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().feerate_per_kw;
+ *inner_val
+}
+/// The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs
+/// originating from a channel supporting anchor outputs, otherwise it is the channel's
+/// negotiated feerate at the time the commitment transaction was built.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_set_feerate_per_kw(this_ptr: &mut HTLCDescriptor, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.feerate_per_kw = val;
+}
+/// The details of the HTLC as it appears in the commitment transaction.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_get_htlc(this_ptr: &HTLCDescriptor) -> crate::lightning::ln::chan_utils::HTLCOutputInCommitment {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc;
+ crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) as *mut _) }, is_owned: false }
+}
+/// The details of the HTLC as it appears in the commitment transaction.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_set_htlc(this_ptr: &mut HTLCDescriptor, mut val: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
+/// taken.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_get_preimage(this_ptr: &HTLCDescriptor) -> crate::c_types::derived::COption_ThirtyTwoBytesZ {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().preimage;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option<Enum> is otherwise un-expressable. */ { crate::c_types::ThirtyTwoBytes { data: (*inner_val.as_ref().unwrap()).clone().0 } }) };
+ local_inner_val
+}
+/// The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
+/// taken.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_set_preimage(this_ptr: &mut HTLCDescriptor, mut val: crate::c_types::derived::COption_ThirtyTwoBytesZ) {
+ let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::lightning::ln::PaymentPreimage({ val_opt.take() }.data) }})} };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.preimage = local_val;
+}
+/// The counterparty's signature required to spend the HTLC output.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_get_counterparty_sig(this_ptr: &HTLCDescriptor) -> crate::c_types::ECDSASignature {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty_sig;
+ crate::c_types::ECDSASignature::from_rust(&inner_val)
+}
+/// The counterparty's signature required to spend the HTLC output.
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_set_counterparty_sig(this_ptr: &mut HTLCDescriptor, mut val: crate::c_types::ECDSASignature) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.counterparty_sig = val.into_rust();
+}
+impl Clone for HTLCDescriptor {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeHTLCDescriptor>::is_null(self.inner) { core::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 HTLCDescriptor_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHTLCDescriptor)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the HTLCDescriptor
+pub extern "C" fn HTLCDescriptor_clone(orig: &HTLCDescriptor) -> HTLCDescriptor {
+ orig.clone()
+}
+/// Checks if two HTLCDescriptors 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 HTLCDescriptor_eq(a: &HTLCDescriptor, b: &HTLCDescriptor) -> 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 }
+}
+#[no_mangle]
+/// Serialize the HTLCDescriptor object into a byte array which can be read by HTLCDescriptor_read
+pub extern "C" fn HTLCDescriptor_write(obj: &crate::lightning::sign::HTLCDescriptor) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
+}
+#[allow(unused)]
+pub(crate) extern "C" fn HTLCDescriptor_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeHTLCDescriptor) })
+}
+#[no_mangle]
+/// Read a HTLCDescriptor from a byte array, created by HTLCDescriptor_write
+pub extern "C" fn HTLCDescriptor_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_HTLCDescriptorDecodeErrorZ {
+ let res: Result<lightning::sign::HTLCDescriptor, 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::sign::HTLCDescriptor { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() };
+ local_res
+}
+/// Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint
+/// being spent by the HTLC input in the HTLC transaction.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_outpoint(this_arg: &crate::lightning::sign::HTLCDescriptor) -> crate::lightning::chain::transaction::OutPoint {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.outpoint();
+ crate::c_types::bitcoin_to_C_outpoint(&ret)
+}
+
+/// Returns the UTXO to be spent by the HTLC input, which can be obtained via
+/// [`Self::unsigned_tx_input`].
+#[must_use]
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_previous_utxo(this_arg: &crate::lightning::sign::HTLCDescriptor) -> crate::c_types::TxOut {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.previous_utxo(secp256k1::global::SECP256K1);
+ crate::c_types::TxOut::from_rust(&ret)
+}
+
+/// Returns the unsigned transaction input spending the HTLC output in the commitment
+/// transaction.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_unsigned_tx_input(this_arg: &crate::lightning::sign::HTLCDescriptor) -> crate::c_types::TxIn {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.unsigned_tx_input();
+ crate::c_types::TxIn::from_rust(&ret)
+}
+
+/// Returns the delayed output created as a result of spending the HTLC output in the commitment
+/// transaction.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_tx_output(this_arg: &crate::lightning::sign::HTLCDescriptor) -> crate::c_types::TxOut {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.tx_output(secp256k1::global::SECP256K1);
+ crate::c_types::TxOut::from_rust(&ret)
+}
+
+/// Returns the witness script of the HTLC output in the commitment transaction.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_witness_script(this_arg: &crate::lightning::sign::HTLCDescriptor) -> crate::c_types::derived::CVec_u8Z {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.witness_script(secp256k1::global::SECP256K1);
+ ret.into_bytes().into()
+}
+
+/// Returns the fully signed witness required to spend the HTLC output in the commitment
+/// transaction.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_tx_input_witness(this_arg: &crate::lightning::sign::HTLCDescriptor, mut signature: crate::c_types::ECDSASignature, mut witness_script: crate::c_types::u8slice) -> crate::c_types::Witness {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.tx_input_witness(&signature.into_rust(), &::bitcoin::blockdata::script::Script::from(Vec::from(witness_script.to_slice())));
+ crate::c_types::Witness::from_bitcoin(&ret)
+}
+
+/// Derives the channel signer required to sign the HTLC input.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn HTLCDescriptor_derive_channel_signer(this_arg: &crate::lightning::sign::HTLCDescriptor, signer_provider: &crate::lightning::sign::SignerProvider) -> crate::lightning::sign::WriteableEcdsaChannelSigner {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.derive_channel_signer(signer_provider);
+ Into::into(ret)
+}
+
/// A trait to handle Lightning channel key material without concretizing the channel type or
/// the signature mechanism.
#[repr(C)]
}
unsafe impl Send for ChannelSigner {}
unsafe impl Sync for ChannelSigner {}
+#[allow(unused)]
pub(crate) fn ChannelSigner_clone_fields(orig: &ChannelSigner) -> ChannelSigner {
ChannelSigner {
this_arg: orig.this_arg,
/// This is required in order for the signer to make sure that the state has moved
/// forward and it is safe to sign the next counterparty commitment.
pub validate_counterparty_revocation: extern "C" fn (this_arg: *const c_void, idx: u64, secret: *const [u8; 32]) -> crate::c_types::derived::CResult_NoneNoneZ,
- /// Creates a signature for a holder's commitment transaction and its claiming HTLC transactions.
+ /// Creates a signature for a holder's commitment transaction.
///
/// This will be called
/// - with a non-revoked `commitment_tx`.
/// - with the latest `commitment_tx` when we initiate a force-close.
- /// - with the previous `commitment_tx`, just to get claiming HTLC
- /// signatures, if we are reacting to a [`ChannelMonitor`]
- /// [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
- /// that decided to broadcast before it had been updated to the latest `commitment_tx`.
///
/// This may be called multiple times for the same transaction.
///
/// An external signer implementation should check that the commitment has not been revoked.
- ///
- /// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
- pub sign_holder_commitment_and_htlcs: extern "C" fn (this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ,
+ pub sign_holder_commitment: extern "C" fn (this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ,
/// Create a signature for the given input in a transaction spending an HTLC transaction output
/// or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
///
pub sign_justice_revoked_htlc: extern "C" fn (this_arg: *const c_void, justice_tx: crate::c_types::Transaction, input: usize, amount: u64, per_commitment_key: *const [u8; 32], htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ,
/// Computes the signature for a commitment transaction's HTLC output used as an input within
/// `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
- /// must be be computed using [`EcdsaSighashType::All`]. Note that this should only be used to
- /// sign HTLC transactions from channels supporting anchor outputs after all additional
- /// inputs/outputs have been added to the transaction.
+ /// must be be computed using [`EcdsaSighashType::All`].
+ ///
+ /// Note that this may be called for HTLCs in the penultimate commitment transaction if a
+ /// [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
+ /// broadcasts it before receiving the update for the latest commitment transaction.
///
/// [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All
- pub sign_holder_htlc_transaction: extern "C" fn (this_arg: *const c_void, htlc_tx: crate::c_types::Transaction, input: usize, htlc_descriptor: &crate::lightning::events::bump_transaction::HTLCDescriptor) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ,
+ /// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
+ pub sign_holder_htlc_transaction: extern "C" fn (this_arg: *const c_void, htlc_tx: crate::c_types::Transaction, input: usize, htlc_descriptor: &crate::lightning::sign::HTLCDescriptor) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ,
/// Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
/// transaction, either offered or received.
///
}
unsafe impl Send for EcdsaChannelSigner {}
unsafe impl Sync for EcdsaChannelSigner {}
+#[allow(unused)]
pub(crate) fn EcdsaChannelSigner_clone_fields(orig: &EcdsaChannelSigner) -> EcdsaChannelSigner {
EcdsaChannelSigner {
this_arg: orig.this_arg,
sign_counterparty_commitment: Clone::clone(&orig.sign_counterparty_commitment),
validate_counterparty_revocation: Clone::clone(&orig.validate_counterparty_revocation),
- sign_holder_commitment_and_htlcs: Clone::clone(&orig.sign_holder_commitment_and_htlcs),
+ sign_holder_commitment: Clone::clone(&orig.sign_holder_commitment),
sign_justice_revoked_output: Clone::clone(&orig.sign_justice_revoked_output),
sign_justice_revoked_htlc: Clone::clone(&orig.sign_justice_revoked_htlc),
sign_holder_htlc_transaction: Clone::clone(&orig.sign_holder_htlc_transaction),
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)) })*/ })};
local_ret
}
- fn sign_holder_commitment_and_htlcs(&self, mut commitment_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::ecdsa::Signature, Vec<bitcoin::secp256k1::ecdsa::Signature>), ()> {
- let mut ret = (self.sign_holder_commitment_and_htlcs)(self.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) as *mut _) }, is_owned: false });
- let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).to_rust(); let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.into_rust().drain(..) { local_orig_ret_0_1.push( { item.into_rust() }); }; let mut local_ret_0 = (orig_ret_0_0.into_rust(), local_orig_ret_0_1); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
+ fn sign_holder_commitment(&self, mut commitment_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
+ let mut ret = (self.sign_holder_commitment)(self.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) as *mut _) }, is_owned: false });
+ 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 sign_justice_revoked_output(&self, mut justice_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
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 sign_holder_htlc_transaction(&self, mut htlc_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut htlc_descriptor: &lightning::events::bump_transaction::HTLCDescriptor, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
- let mut ret = (self.sign_holder_htlc_transaction)(self.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, &crate::lightning::events::bump_transaction::HTLCDescriptor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc_descriptor as *const lightning::events::bump_transaction::HTLCDescriptor<>) as *mut _) }, is_owned: false });
+ fn sign_holder_htlc_transaction(&self, mut htlc_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut htlc_descriptor: &lightning::sign::HTLCDescriptor, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
+ let mut ret = (self.sign_holder_htlc_transaction)(self.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, &crate::lightning::sign::HTLCDescriptor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc_descriptor as *const lightning::sign::HTLCDescriptor<>) as *mut _) }, is_owned: false });
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
}
}
unsafe impl Send for WriteableEcdsaChannelSigner {}
unsafe impl Sync for WriteableEcdsaChannelSigner {}
+#[allow(unused)]
pub(crate) fn WriteableEcdsaChannelSigner_clone_fields(orig: &WriteableEcdsaChannelSigner) -> WriteableEcdsaChannelSigner {
WriteableEcdsaChannelSigner {
this_arg: orig.this_arg,
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)) })*/ })};
local_ret
}
- fn sign_holder_commitment_and_htlcs(&self, mut commitment_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<(bitcoin::secp256k1::ecdsa::Signature, Vec<bitcoin::secp256k1::ecdsa::Signature>), ()> {
- let mut ret = (self.EcdsaChannelSigner.sign_holder_commitment_and_htlcs)(self.EcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) as *mut _) }, is_owned: false });
- let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).to_rust(); let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.into_rust().drain(..) { local_orig_ret_0_1.push( { item.into_rust() }); }; let mut local_ret_0 = (orig_ret_0_0.into_rust(), local_orig_ret_0_1); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
+ fn sign_holder_commitment(&self, mut commitment_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
+ let mut ret = (self.EcdsaChannelSigner.sign_holder_commitment)(self.EcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) as *mut _) }, is_owned: false });
+ 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 sign_justice_revoked_output(&self, mut justice_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
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 sign_holder_htlc_transaction(&self, mut htlc_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut htlc_descriptor: &lightning::events::bump_transaction::HTLCDescriptor, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
- let mut ret = (self.EcdsaChannelSigner.sign_holder_htlc_transaction)(self.EcdsaChannelSigner.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, &crate::lightning::events::bump_transaction::HTLCDescriptor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc_descriptor as *const lightning::events::bump_transaction::HTLCDescriptor<>) as *mut _) }, is_owned: false });
+ fn sign_holder_htlc_transaction(&self, mut htlc_tx: &bitcoin::blockdata::transaction::Transaction, mut input: usize, mut htlc_descriptor: &lightning::sign::HTLCDescriptor, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::ecdsa::Signature, ()> {
+ let mut ret = (self.EcdsaChannelSigner.sign_holder_htlc_transaction)(self.EcdsaChannelSigner.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, &crate::lightning::sign::HTLCDescriptor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc_descriptor as *const lightning::sign::HTLCDescriptor<>) as *mut _) }, is_owned: false });
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
}
pub extern "C" fn Recipient_clone(orig: &Recipient) -> Recipient {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Recipient_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Recipient)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Recipient_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut Recipient) };
+}
#[no_mangle]
/// Utility method to constructs a new Node-variant Recipient
pub extern "C" fn Recipient_node() -> Recipient {
}
unsafe impl Send for EntropySource {}
unsafe impl Sync for EntropySource {}
+#[allow(unused)]
pub(crate) fn EntropySource_clone_fields(orig: &EntropySource) -> EntropySource {
EntropySource {
this_arg: orig.this_arg,
}
unsafe impl Send for NodeSigner {}
unsafe impl Sync for NodeSigner {}
+#[allow(unused)]
pub(crate) fn NodeSigner_clone_fields(orig: &NodeSigner) -> NodeSigner {
NodeSigner {
this_arg: orig.this_arg,
}
unsafe impl Send for SignerProvider {}
unsafe impl Sync for SignerProvider {}
+#[allow(unused)]
pub(crate) fn SignerProvider_clone_fields(orig: &SignerProvider) -> SignerProvider {
SignerProvider {
this_arg: orig.this_arg,
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn InMemorySigner_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInMemorySigner)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInMemorySigner)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the InMemorySigner
impl From<nativeInMemorySigner> for crate::lightning::sign::EntropySource {
fn from(obj: nativeInMemorySigner) -> Self {
- let mut rust_obj = InMemorySigner { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::sign::InMemorySigner { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = InMemorySigner_as_EntropySource(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(InMemorySigner_free_void);
ret
}
impl From<nativeInMemorySigner> for crate::lightning::sign::ChannelSigner {
fn from(obj: nativeInMemorySigner) -> Self {
- let mut rust_obj = InMemorySigner { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::sign::InMemorySigner { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = InMemorySigner_as_ChannelSigner(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(InMemorySigner_free_void);
ret
}
impl From<nativeInMemorySigner> for crate::lightning::sign::EcdsaChannelSigner {
fn from(obj: nativeInMemorySigner) -> Self {
- let mut rust_obj = InMemorySigner { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::sign::InMemorySigner { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = InMemorySigner_as_EcdsaChannelSigner(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(InMemorySigner_free_void);
ret
}
free: None,
sign_counterparty_commitment: InMemorySigner_EcdsaChannelSigner_sign_counterparty_commitment,
validate_counterparty_revocation: InMemorySigner_EcdsaChannelSigner_validate_counterparty_revocation,
- sign_holder_commitment_and_htlcs: InMemorySigner_EcdsaChannelSigner_sign_holder_commitment_and_htlcs,
+ sign_holder_commitment: InMemorySigner_EcdsaChannelSigner_sign_holder_commitment,
sign_justice_revoked_output: InMemorySigner_EcdsaChannelSigner_sign_justice_revoked_output,
sign_justice_revoked_htlc: InMemorySigner_EcdsaChannelSigner_sign_justice_revoked_htlc,
sign_holder_htlc_transaction: InMemorySigner_EcdsaChannelSigner_sign_holder_htlc_transaction,
local_ret
}
#[must_use]
-extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_holder_commitment_and_htlcs(this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
- let mut ret = <nativeInMemorySigner as lightning::sign::EcdsaChannelSigner<>>::sign_holder_commitment_and_htlcs(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, commitment_tx.get_native_ref(), secp256k1::global::SECP256K1);
- 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_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { crate::c_types::ECDSASignature::from_rust(&item) }); }; let mut local_ret_0 = (crate::c_types::ECDSASignature::from_rust(&orig_ret_0_0), local_orig_ret_0_1.into()).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_holder_commitment(this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ {
+ let mut ret = <nativeInMemorySigner as lightning::sign::EcdsaChannelSigner<>>::sign_holder_commitment(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, commitment_tx.get_native_ref(), secp256k1::global::SECP256K1);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ECDSASignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
}
#[must_use]
local_ret
}
#[must_use]
-extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_holder_htlc_transaction(this_arg: *const c_void, mut htlc_tx: crate::c_types::Transaction, mut input: usize, htlc_descriptor: &crate::lightning::events::bump_transaction::HTLCDescriptor) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ {
+extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_holder_htlc_transaction(this_arg: *const c_void, mut htlc_tx: crate::c_types::Transaction, mut input: usize, htlc_descriptor: &crate::lightning::sign::HTLCDescriptor) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ {
let mut ret = <nativeInMemorySigner as lightning::sign::EcdsaChannelSigner<>>::sign_holder_htlc_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &htlc_tx.into_bitcoin(), input, htlc_descriptor.get_native_ref(), secp256k1::global::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ECDSASignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
local_ret
impl From<nativeInMemorySigner> for crate::lightning::sign::WriteableEcdsaChannelSigner {
fn from(obj: nativeInMemorySigner) -> Self {
- let mut rust_obj = InMemorySigner { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::sign::InMemorySigner { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(InMemorySigner_free_void);
ret
}
free: None,
sign_counterparty_commitment: InMemorySigner_EcdsaChannelSigner_sign_counterparty_commitment,
validate_counterparty_revocation: InMemorySigner_EcdsaChannelSigner_validate_counterparty_revocation,
- sign_holder_commitment_and_htlcs: InMemorySigner_EcdsaChannelSigner_sign_holder_commitment_and_htlcs,
+ sign_holder_commitment: InMemorySigner_EcdsaChannelSigner_sign_holder_commitment,
sign_justice_revoked_output: InMemorySigner_EcdsaChannelSigner_sign_justice_revoked_output,
sign_justice_revoked_htlc: InMemorySigner_EcdsaChannelSigner_sign_justice_revoked_htlc,
sign_holder_htlc_transaction: InMemorySigner_EcdsaChannelSigner_sign_holder_htlc_transaction,
pub extern "C" fn InMemorySigner_write(obj: &crate::lightning::sign::InMemorySigner) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn InMemorySigner_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInMemorySigner) })
}
impl From<nativeKeysManager> for crate::lightning::sign::EntropySource {
fn from(obj: nativeKeysManager) -> Self {
- let mut rust_obj = KeysManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::sign::KeysManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = KeysManager_as_EntropySource(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(KeysManager_free_void);
ret
}
impl From<nativeKeysManager> for crate::lightning::sign::NodeSigner {
fn from(obj: nativeKeysManager) -> Self {
- let mut rust_obj = KeysManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::sign::KeysManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = KeysManager_as_NodeSigner(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(KeysManager_free_void);
ret
}
impl From<nativeKeysManager> for crate::lightning::sign::SignerProvider {
fn from(obj: nativeKeysManager) -> Self {
- let mut rust_obj = KeysManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::sign::KeysManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = KeysManager_as_SignerProvider(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(KeysManager_free_void);
ret
}
}
impl From<nativePhantomKeysManager> for crate::lightning::sign::EntropySource {
fn from(obj: nativePhantomKeysManager) -> Self {
- let mut rust_obj = PhantomKeysManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::sign::PhantomKeysManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = PhantomKeysManager_as_EntropySource(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(PhantomKeysManager_free_void);
ret
}
impl From<nativePhantomKeysManager> for crate::lightning::sign::NodeSigner {
fn from(obj: nativePhantomKeysManager) -> Self {
- let mut rust_obj = PhantomKeysManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::sign::PhantomKeysManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = PhantomKeysManager_as_NodeSigner(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(PhantomKeysManager_free_void);
ret
}
impl From<nativePhantomKeysManager> for crate::lightning::sign::SignerProvider {
fn from(obj: nativePhantomKeysManager) -> Self {
- let mut rust_obj = PhantomKeysManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::sign::PhantomKeysManager { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = PhantomKeysManager_as_SignerProvider(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(PhantomKeysManager_free_void);
ret
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelHandshakeConfig_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelHandshakeConfig)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelHandshakeConfig)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelHandshakeConfig
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelHandshakeLimits_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelHandshakeLimits)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelHandshakeLimits)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelHandshakeLimits
pub extern "C" fn MaxDustHTLCExposure_clone(orig: &MaxDustHTLCExposure) -> MaxDustHTLCExposure {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn MaxDustHTLCExposure_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const MaxDustHTLCExposure)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn MaxDustHTLCExposure_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut MaxDustHTLCExposure) };
+}
#[no_mangle]
/// Utility method to constructs a new FixedLimitMsat-variant MaxDustHTLCExposure
pub extern "C" fn MaxDustHTLCExposure_fixed_limit_msat(a: u64) -> MaxDustHTLCExposure {
pub extern "C" fn MaxDustHTLCExposure_write(obj: &crate::lightning::util::config::MaxDustHTLCExposure) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn MaxDustHTLCExposure_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ MaxDustHTLCExposure_write(unsafe { &*(obj as *const MaxDustHTLCExposure) })
+}
#[no_mangle]
/// Read a MaxDustHTLCExposure from a byte array, created by MaxDustHTLCExposure_write
pub extern "C" fn MaxDustHTLCExposure_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_MaxDustHTLCExposureDecodeErrorZ {
/// funder/initiator.
///
/// When we are the funder, because we have to pay the channel closing fee, we bound the
-/// acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
+/// acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by
/// this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
-/// [`Normal`] feerate during normal operation, this value represents the additional fee we're
+/// [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're
/// willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
/// funds.
///
/// When we are not the funder, we require the closing transaction fee pay at least our
-/// [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
+/// [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like.
/// Thus, this value is ignored when we are not the funder.
///
/// Default value: 1000 satoshis.
///
-/// [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
-/// [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
+/// [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
+/// [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum
#[no_mangle]
pub extern "C" fn ChannelConfig_get_force_close_avoidance_max_fee_satoshis(this_ptr: &ChannelConfig) -> u64 {
let mut inner_val = &mut this_ptr.get_native_mut_ref().force_close_avoidance_max_fee_satoshis;
/// funder/initiator.
///
/// When we are the funder, because we have to pay the channel closing fee, we bound the
-/// acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
+/// acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by
/// this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
-/// [`Normal`] feerate during normal operation, this value represents the additional fee we're
+/// [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're
/// willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
/// funds.
///
/// When we are not the funder, we require the closing transaction fee pay at least our
-/// [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
+/// [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like.
/// Thus, this value is ignored when we are not the funder.
///
/// Default value: 1000 satoshis.
///
-/// [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
-/// [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
+/// [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
+/// [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum
#[no_mangle]
pub extern "C" fn ChannelConfig_set_force_close_avoidance_max_fee_satoshis(this_ptr: &mut ChannelConfig, mut val: u64) {
unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.force_close_avoidance_max_fee_satoshis = val;
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ChannelConfig_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelConfig)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelConfig)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ChannelConfig
pub extern "C" fn ChannelConfig_write(obj: &crate::lightning::util::config::ChannelConfig) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn ChannelConfig_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelConfig) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn UserConfig_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUserConfig)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUserConfig)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the UserConfig
pub extern "C" fn APIError_clone(orig: &APIError) -> APIError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn APIError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const APIError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn APIError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut APIError) };
+}
#[no_mangle]
/// Utility method to constructs a new APIMisuseError-variant APIError
pub extern "C" fn APIError_apimisuse_error(err: crate::c_types::Str) -> APIError {
pub extern "C" fn APIError_write(obj: &crate::lightning::util::errors::APIError) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
}
+#[allow(unused)]
+pub(crate) extern "C" fn APIError_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+ APIError_write(unsafe { &*(obj as *const APIError) })
+}
#[no_mangle]
/// Read a APIError from a byte array, created by APIError_write
pub extern "C" fn APIError_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_APIErrorZDecodeErrorZ {
pub extern "C" fn Level_clone(orig: &Level) -> Level {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Level_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Level)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Level_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut Level) };
+}
#[no_mangle]
/// Utility method to constructs a new Gossip-variant Level
pub extern "C" fn Level_gossip() -> Level {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Record_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRecord)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRecord)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Record
}
unsafe impl Send for Logger {}
unsafe impl Sync for Logger {}
+#[allow(unused)]
pub(crate) fn Logger_clone_fields(orig: &Logger) -> Logger {
Logger {
this_arg: orig.this_arg,
}
unsafe impl Send for KVStore {}
unsafe impl Sync for KVStore {}
+#[allow(unused)]
pub(crate) fn KVStore_clone_fields(orig: &KVStore) -> KVStore {
KVStore {
this_arg: orig.this_arg,
}
unsafe impl Send for Persister {}
unsafe impl Sync for Persister {}
+#[allow(unused)]
pub(crate) fn Persister_clone_fields(orig: &Persister) -> Persister {
Persister {
this_arg: orig.this_arg,
impl From<nativeMonitorUpdatingPersister> for crate::lightning::chain::chainmonitor::Persist {
fn from(obj: nativeMonitorUpdatingPersister) -> Self {
- let mut rust_obj = MonitorUpdatingPersister { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning::util::persist::MonitorUpdatingPersister { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = MonitorUpdatingPersister_as_Persist(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(MonitorUpdatingPersister_free_void);
ret
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn BigSize_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBigSize)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBigSize)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the BigSize
pub extern "C" fn BigSize_write(obj: &crate::lightning::util::ser::BigSize) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn BigSize_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBigSize) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Hostname_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeHostname)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHostname)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Hostname
pub extern "C" fn Hostname_write(obj: &crate::lightning::util::ser::Hostname) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn Hostname_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeHostname) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn TransactionU16LenLimited_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeTransactionU16LenLimited)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTransactionU16LenLimited)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the TransactionU16LenLimited
pub extern "C" fn TransactionU16LenLimited_write(obj: &crate::lightning::util::ser::TransactionU16LenLimited) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn TransactionU16LenLimited_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeTransactionU16LenLimited) })
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn UntrustedString_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUntrustedString)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUntrustedString)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the UntrustedString
pub extern "C" fn UntrustedString_write(obj: &crate::lightning::util::string::UntrustedString) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
}
-#[no_mangle]
+#[allow(unused)]
pub(crate) extern "C" fn UntrustedString_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUntrustedString) })
}
}
unsafe impl Send for FutureCallback {}
unsafe impl Sync for FutureCallback {}
+#[allow(unused)]
pub(crate) fn FutureCallback_clone_fields(orig: &FutureCallback) -> FutureCallback {
FutureCallback {
this_arg: orig.this_arg,
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Future_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFuture)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeFuture)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Future
/// Frees any resources used by the GossipSync
#[no_mangle]
pub extern "C" fn GossipSync_free(this_ptr: GossipSync) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn GossipSync_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut GossipSync) };
+}
#[no_mangle]
/// Utility method to constructs a new P2P-variant GossipSync
pub extern "C" fn GossipSync_p2_p(a: &crate::lightning::routing::gossip::P2PGossipSync) -> GossipSync {
pub extern "C" fn Bolt11ParseError_clone(orig: &Bolt11ParseError) -> Bolt11ParseError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Bolt11ParseError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Bolt11ParseError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Bolt11ParseError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut Bolt11ParseError) };
+}
#[no_mangle]
/// Utility method to constructs a new Bech32Error-variant Bolt11ParseError
pub extern "C" fn Bolt11ParseError_bech32_error(a: crate::c_types::Bech32Error) -> Bolt11ParseError {
pub extern "C" fn ParseOrSemanticError_clone(orig: &ParseOrSemanticError) -> ParseOrSemanticError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ParseOrSemanticError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ParseOrSemanticError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ParseOrSemanticError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut ParseOrSemanticError) };
+}
#[no_mangle]
/// Utility method to constructs a new ParseError-variant ParseOrSemanticError
pub extern "C" fn ParseOrSemanticError_parse_error(a: crate::lightning_invoice::Bolt11ParseError) -> ParseOrSemanticError {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Bolt11Invoice_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBolt11Invoice)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt11Invoice)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Bolt11Invoice
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn SignedRawBolt11Invoice_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeSignedRawBolt11Invoice)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeSignedRawBolt11Invoice)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the SignedRawBolt11Invoice
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn RawBolt11Invoice_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRawBolt11Invoice)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRawBolt11Invoice)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the RawBolt11Invoice
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn RawDataPart_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRawDataPart)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRawDataPart)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the RawDataPart
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn PositiveTimestamp_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePositiveTimestamp)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePositiveTimestamp)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the PositiveTimestamp
pub extern "C" fn SiPrefix_clone(orig: &SiPrefix) -> SiPrefix {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SiPrefix_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const SiPrefix)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SiPrefix_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut SiPrefix) };
+}
#[no_mangle]
/// Utility method to constructs a new Milli-variant SiPrefix
pub extern "C" fn SiPrefix_milli() -> SiPrefix {
pub extern "C" fn Currency_clone(orig: &Currency) -> Currency {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Currency_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Currency)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Currency_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut Currency) };
+}
#[no_mangle]
/// Utility method to constructs a new Bitcoin-variant Currency
pub extern "C" fn Currency_bitcoin() -> Currency {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Sha256_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeSha256)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeSha256)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Sha256
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Description_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDescription)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeDescription)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Description
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn PayeePubKey_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePayeePubKey)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePayeePubKey)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the PayeePubKey
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn ExpiryTime_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeExpiryTime)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeExpiryTime)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the ExpiryTime
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn MinFinalCltvExpiryDelta_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeMinFinalCltvExpiryDelta)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeMinFinalCltvExpiryDelta)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the MinFinalCltvExpiryDelta
pub extern "C" fn Fallback_clone(orig: &Fallback) -> Fallback {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Fallback_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Fallback)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Fallback_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut Fallback) };
+}
#[no_mangle]
/// Utility method to constructs a new SegWitProgram-variant Fallback
pub extern "C" fn Fallback_seg_wit_program(version: crate::c_types::WitnessVersion, program: crate::c_types::derived::CVec_u8Z) -> Fallback {
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn Bolt11InvoiceSignature_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBolt11InvoiceSignature)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt11InvoiceSignature)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the Bolt11InvoiceSignature
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
pub(crate) extern "C" fn PrivateRoute_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePrivateRoute)).clone() })) as *mut c_void
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePrivateRoute)).clone() })) as *mut c_void
}
#[no_mangle]
/// Creates a copy of the PrivateRoute
pub extern "C" fn CreationError_clone(orig: &CreationError) -> CreationError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn CreationError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const CreationError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn CreationError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut CreationError) };
+}
#[no_mangle]
/// Utility method to constructs a new DescriptionTooLong-variant CreationError
pub extern "C" fn CreationError_description_too_long() -> CreationError {
pub extern "C" fn Bolt11SemanticError_clone(orig: &Bolt11SemanticError) -> Bolt11SemanticError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Bolt11SemanticError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Bolt11SemanticError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Bolt11SemanticError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut Bolt11SemanticError) };
+}
#[no_mangle]
/// Utility method to constructs a new NoPaymentHash-variant Bolt11SemanticError
pub extern "C" fn Bolt11SemanticError_no_payment_hash() -> Bolt11SemanticError {
pub extern "C" fn SignOrCreationError_clone(orig: &SignOrCreationError) -> SignOrCreationError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SignOrCreationError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const SignOrCreationError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SignOrCreationError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut SignOrCreationError) };
+}
#[no_mangle]
/// Utility method to constructs a new SignError-variant SignOrCreationError
pub extern "C" fn SignOrCreationError_sign_error() -> SignOrCreationError {
pub extern "C" fn PaymentError_clone(orig: &PaymentError) -> PaymentError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn PaymentError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const PaymentError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn PaymentError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut PaymentError) };
+}
#[no_mangle]
/// Utility method to constructs a new Invoice-variant PaymentError
pub extern "C" fn PaymentError_invoice(a: crate::c_types::Str) -> PaymentError {
pub extern "C" fn ProbingError_clone(orig: &ProbingError) -> ProbingError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ProbingError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ProbingError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ProbingError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut ProbingError) };
+}
#[no_mangle]
/// Utility method to constructs a new Invoice-variant ProbingError
pub extern "C" fn ProbingError_invoice(a: crate::c_types::Str) -> ProbingError {
impl From<nativeFilesystemStore> for crate::lightning::util::persist::KVStore {
fn from(obj: nativeFilesystemStore) -> Self {
- let mut rust_obj = FilesystemStore { inner: ObjOps::heap_alloc(obj), is_owned: true };
+ let rust_obj = crate::lightning_persister::fs_store::FilesystemStore { inner: ObjOps::heap_alloc(obj), is_owned: true };
let mut ret = FilesystemStore_as_KVStore(&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 = core::ptr::null_mut();
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn
+ core::mem::forget(rust_obj);
ret.free = Some(FilesystemStore_free_void);
ret
}
pub extern "C" fn GraphSyncError_clone(orig: &GraphSyncError) -> GraphSyncError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn GraphSyncError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const GraphSyncError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn GraphSyncError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut GraphSyncError) };
+}
#[no_mangle]
/// Utility method to constructs a new DecodeError-variant GraphSyncError
pub extern "C" fn GraphSyncError_decode_error(a: crate::lightning::ln::msgs::DecodeError) -> GraphSyncError {